diff --git a/src/blenderbim/Makefile b/src/blenderbim/Makefile index 5a3f71428b..db77df524a 100644 --- a/src/blenderbim/Makefile +++ b/src/blenderbim/Makefile @@ -671,13 +671,6 @@ endif cp -r dist/working/IFC2JSON_python-master/file_converters/ifcjson dist/blenderbim/libs/site/packages/ rm -rf dist/working - # Provides OpenLCA functionality - mkdir dist/working - cd dist/working && wget https://files.pythonhosted.org/packages/85/33/f91b96e9e8608ff65a003b692e8a9cdd60f2178f60617e5b1d21334c009c/olca-ipc-0.0.10.tar.gz - cd dist/working && tar -xzvf olca-ipc* - cd dist/working/olca-ipc-0.0.10/ && cp -r olca ../../blenderbim/libs/site/packages/ - rm -rf dist/working - # Provides Brickschema functionality mkdir dist/working # For now lets bundle the latest nightly schema diff --git a/src/blenderbim/blenderbim/bim/__init__.py b/src/blenderbim/blenderbim/bim/__init__.py index 6dd8675e27..440c4ddf81 100644 --- a/src/blenderbim/blenderbim/bim/__init__.py +++ b/src/blenderbim/blenderbim/bim/__init__.py @@ -68,7 +68,6 @@ modules = { "document": None, "pset_template": None, "clash": None, - "lca": None, "csv": None, "tester": None, "bimtester": None, diff --git a/src/blenderbim/blenderbim/bim/module/lca/__init__.py b/src/blenderbim/blenderbim/bim/module/lca/__init__.py deleted file mode 100644 index 66194db120..0000000000 --- a/src/blenderbim/blenderbim/bim/module/lca/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -# BlenderBIM Add-on - OpenBIM Blender Add-on -# Copyright (C) 2021 Dion Moult -# -# This file is part of BlenderBIM Add-on. -# -# BlenderBIM Add-on is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# BlenderBIM Add-on is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with BlenderBIM Add-on. If not, see . - -import bpy -from . import ui, prop, operator - -classes = ( - operator.CalculateLCA, - operator.ConnectOpenLCA, - prop.BIMLCAProperties, - ui.BIM_PT_lca, -) - - -def register(): - bpy.types.Scene.BIMLCAProperties = bpy.props.PointerProperty(type=prop.BIMLCAProperties) - - -def unregister(): - del bpy.types.Scene.BIMLCAProperties diff --git a/src/blenderbim/blenderbim/bim/module/lca/data.py b/src/blenderbim/blenderbim/bim/module/lca/data.py deleted file mode 100644 index da5b5450e2..0000000000 --- a/src/blenderbim/blenderbim/bim/module/lca/data.py +++ /dev/null @@ -1,49 +0,0 @@ -# BlenderBIM Add-on - OpenBIM Blender Add-on -# Copyright (C) 2021 Dion Moult -# -# This file is part of BlenderBIM Add-on. -# -# BlenderBIM Add-on is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# BlenderBIM Add-on is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with BlenderBIM Add-on. If not, see . - -import bpy -import olca -import blenderbim.tool as tool - - -def refresh(): - LcaData.is_loaded = False - - -class LcaData: - data = {} - is_loaded = False - - @classmethod - def load(cls): - cls.data = { - "product_systems": cls.product_systems(), - } - cls.is_loaded = True - - @classmethod - def product_systems(cls): - if not bpy.context.scene.BIMLCAProperties.is_connected: - return [] - results = [] - client = olca.Client(context.preferences.addons["blenderbim"].preferences.openlca_port) - try: - results = [(ps.name, ps.name, "") for ps in client.get_all(olca.ProductSystem)] - except: - pass - return results diff --git a/src/blenderbim/blenderbim/bim/module/lca/operator.py b/src/blenderbim/blenderbim/bim/module/lca/operator.py deleted file mode 100644 index 91925d297f..0000000000 --- a/src/blenderbim/blenderbim/bim/module/lca/operator.py +++ /dev/null @@ -1,55 +0,0 @@ -# BlenderBIM Add-on - OpenBIM Blender Add-on -# Copyright (C) 2021 Dion Moult -# -# This file is part of BlenderBIM Add-on. -# -# BlenderBIM Add-on is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# BlenderBIM Add-on is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with BlenderBIM Add-on. If not, see . - -import bpy -import olca -import ifcopenshell - - -class CalculateLCA(bpy.types.Operator): - bl_idname = "bim.calculate_lca" - bl_label = "Calculate LCA" - bl_options = {"REGISTER", "UNDO"} - filepath: bpy.props.StringProperty(subtype="FILE_PATH") - filter_glob: bpy.props.StringProperty(default="*.xlsx", options={"HIDDEN"}) - - def execute(self, context): - props = context.scene.BIMLCAProperties - client = olca.Client(context.preferences.addons["blenderbim"].preferences.openlca_port) - setup = olca.CalculationSetup() - setup.calculation_type = olca.CalculationType.SIMPLE_CALCULATION - setup.impact_method = client.find(olca.ImpactMethod, "CML-IA baseline") - setup.product_system = client.find(olca.ProductSystem, props.product_systems) - setup.amount = props.amount - result = client.calculate(setup) - client.excel_export(result, self.filepath) - return {"FINISHED"} - - def invoke(self, context, event): - context.window_manager.fileselect_add(self) - return {"RUNNING_MODAL"} - - -class ConnectOpenLCA(bpy.types.Operator): - bl_idname = "bim.connect_openlca" - bl_label = "Connect OpenLCA" - bl_options = {"REGISTER", "UNDO"} - - def execute(self, context): - bpy.context.scene.BIMLCAProperties.is_connected = True - return {"FINISHED"} diff --git a/src/blenderbim/blenderbim/bim/module/lca/prop.py b/src/blenderbim/blenderbim/bim/module/lca/prop.py deleted file mode 100644 index 7d92c2e55b..0000000000 --- a/src/blenderbim/blenderbim/bim/module/lca/prop.py +++ /dev/null @@ -1,44 +0,0 @@ -# BlenderBIM Add-on - OpenBIM Blender Add-on -# Copyright (C) 2020, 2021 Dion Moult -# -# This file is part of BlenderBIM Add-on. -# -# BlenderBIM Add-on is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# BlenderBIM Add-on is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with BlenderBIM Add-on. If not, see . - -import bpy -from blenderbim.bim.module.lca.data import LcaData -from blenderbim.bim.prop import StrProperty, Attribute -from bpy.types import PropertyGroup -from bpy.props import ( - PointerProperty, - StringProperty, - EnumProperty, - BoolProperty, - IntProperty, - FloatProperty, - FloatVectorProperty, - CollectionProperty, -) - - -def get_product_systems(self, context): - if not LcaData.is_loaded: - LcaData.load() - return LcaData.data["product_systems"] - - -class BIMLCAProperties(PropertyGroup): - is_connected: BoolProperty(name="Is Connected") - amount: FloatProperty(name="Amount") - product_systems: EnumProperty(items=get_product_systems, name="Product Systems") diff --git a/src/blenderbim/blenderbim/bim/module/lca/ui.py b/src/blenderbim/blenderbim/bim/module/lca/ui.py deleted file mode 100644 index 9850bffe16..0000000000 --- a/src/blenderbim/blenderbim/bim/module/lca/ui.py +++ /dev/null @@ -1,43 +0,0 @@ -# BlenderBIM Add-on - OpenBIM Blender Add-on -# Copyright (C) 2020, 2021 Dion Moult -# -# This file is part of BlenderBIM Add-on. -# -# BlenderBIM Add-on is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# BlenderBIM Add-on is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with BlenderBIM Add-on. If not, see . - -import bpy -from bpy.types import Panel - - -class BIM_PT_lca(Panel): - bl_label = "BIM Life Cycle Assessment" - bl_idname = "BIM_PT_lca" - bl_options = {"DEFAULT_CLOSED"} - bl_space_type = "PROPERTIES" - bl_region_type = "WINDOW" - bl_context = "scene" - bl_parent_id = "BIM_PT_tab_sandbox" - - def draw(self, context): - props = context.scene.BIMLCAProperties - if props.is_connected: - row = self.layout.row() - row.prop(props, "product_systems", text="") - row = self.layout.row() - row.prop(props, "amount", text="") - row = self.layout.row() - row.operator("bim.calculate_lca") - else: - row = self.layout.row() - row.operator("bim.connect_openlca")