mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-18 22:33:33 +00:00
Fix #1848. Purge remaining references to API data classes.
This commit is contained in:
@@ -27,8 +27,6 @@ from bpy.app.handlers import persistent
|
|||||||
from blenderbim.bim.ifc import IfcStore
|
from blenderbim.bim.ifc import IfcStore
|
||||||
from blenderbim.bim.module.owner.prop import get_user_person, get_user_organisation
|
from blenderbim.bim.module.owner.prop import get_user_person, get_user_organisation
|
||||||
from blenderbim.bim.module.model.data import AuthoringData
|
from blenderbim.bim.module.model.data import AuthoringData
|
||||||
from ifcopenshell.api.material.data import Data as MaterialData
|
|
||||||
from ifcopenshell.api.type.data import Data as TypeData
|
|
||||||
|
|
||||||
|
|
||||||
global_subscription_owner = object()
|
global_subscription_owner = object()
|
||||||
@@ -67,7 +65,6 @@ def name_callback(obj, data):
|
|||||||
if isinstance(obj, bpy.types.Material):
|
if isinstance(obj, bpy.types.Material):
|
||||||
if obj.BIMObjectProperties.ifc_definition_id:
|
if obj.BIMObjectProperties.ifc_definition_id:
|
||||||
IfcStore.get_file().by_id(obj.BIMObjectProperties.ifc_definition_id).Name = obj.name
|
IfcStore.get_file().by_id(obj.BIMObjectProperties.ifc_definition_id).Name = obj.name
|
||||||
MaterialData.load_materials()
|
|
||||||
if obj.BIMMaterialProperties.ifc_style_id:
|
if obj.BIMMaterialProperties.ifc_style_id:
|
||||||
IfcStore.get_file().by_id(obj.BIMMaterialProperties.ifc_style_id).Name = obj.name
|
IfcStore.get_file().by_id(obj.BIMMaterialProperties.ifc_style_id).Name = obj.name
|
||||||
refresh_ui_data()
|
refresh_ui_data()
|
||||||
@@ -91,8 +88,6 @@ def name_callback(obj, data):
|
|||||||
break
|
break
|
||||||
if grid_collection:
|
if grid_collection:
|
||||||
grid_collection.name = obj.name
|
grid_collection.name = obj.name
|
||||||
if element.is_a("IfcTypeProduct"):
|
|
||||||
TypeData.purge()
|
|
||||||
element.Name = "/".join(obj.name.split("/")[1:])
|
element.Name = "/".join(obj.name.split("/")[1:])
|
||||||
refresh_ui_data()
|
refresh_ui_data()
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,6 @@ import blenderbim.bim.handler
|
|||||||
import blenderbim.tool as tool
|
import blenderbim.tool as tool
|
||||||
import blenderbim.core.attribute as core
|
import blenderbim.core.attribute as core
|
||||||
from blenderbim.bim.ifc import IfcStore
|
from blenderbim.bim.ifc import IfcStore
|
||||||
from ifcopenshell.api.attribute.data import Data
|
|
||||||
|
|
||||||
|
|
||||||
class Operator:
|
class Operator:
|
||||||
@@ -51,8 +50,6 @@ class EnableEditingAttributes(bpy.types.Operator):
|
|||||||
oprops = obj.BIMObjectProperties
|
oprops = obj.BIMObjectProperties
|
||||||
props = obj.BIMAttributeProperties
|
props = obj.BIMAttributeProperties
|
||||||
props.attributes.clear()
|
props.attributes.clear()
|
||||||
if oprops.ifc_definition_id not in Data.products:
|
|
||||||
Data.load(IfcStore.get_file(), oprops.ifc_definition_id)
|
|
||||||
blenderbim.bim.helper.import_attributes2(tool.Ifc.get().by_id(oprops.ifc_definition_id), props.attributes)
|
blenderbim.bim.helper.import_attributes2(tool.Ifc.get().by_id(oprops.ifc_definition_id), props.attributes)
|
||||||
props.is_editing_attributes = True
|
props.is_editing_attributes = True
|
||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
@@ -88,33 +85,10 @@ class EditAttributes(bpy.types.Operator, Operator):
|
|||||||
obj = bpy.data.objects.get(self.obj)
|
obj = bpy.data.objects.get(self.obj)
|
||||||
elif self.obj_type == "Material":
|
elif self.obj_type == "Material":
|
||||||
obj = bpy.data.materials.get(self.obj)
|
obj = bpy.data.materials.get(self.obj)
|
||||||
oprops = obj.BIMObjectProperties
|
|
||||||
props = obj.BIMAttributeProperties
|
props = obj.BIMAttributeProperties
|
||||||
attributes = {}
|
product = tool.Ifc.get_entity(obj)
|
||||||
for attribute in Data.products[oprops.ifc_definition_id]:
|
attributes = blenderbim.bim.helper.export_attributes(props.attributes)
|
||||||
blender_attribute = props.attributes.get(attribute["name"])
|
ifcopenshell.api.run("attribute.edit_attributes", self.file, product=product, attributes=attributes)
|
||||||
if not blender_attribute:
|
|
||||||
continue
|
|
||||||
if attribute["is_optional"] and blender_attribute.is_null:
|
|
||||||
attributes[attribute["name"]] = None
|
|
||||||
elif attribute["type"] == "string":
|
|
||||||
attributes[attribute["name"]] = blender_attribute.string_value
|
|
||||||
elif attribute["type"] == "list":
|
|
||||||
values = blender_attribute.string_value[1:-1].split(", ")
|
|
||||||
if attribute["list_type"] == "float":
|
|
||||||
values = [float(v) for v in values]
|
|
||||||
elif attribute["list_type"] == "integer":
|
|
||||||
values = [int(v) for v in values]
|
|
||||||
attributes[attribute["name"]] = values
|
|
||||||
elif attribute["type"] == "integer":
|
|
||||||
attributes[attribute["name"]] = blender_attribute.int_value
|
|
||||||
elif attribute["type"] == "float":
|
|
||||||
attributes[attribute["name"]] = blender_attribute.float_value
|
|
||||||
elif attribute["type"] == "enum":
|
|
||||||
attributes[attribute["name"]] = blender_attribute.enum_value
|
|
||||||
product = self.file.by_id(oprops.ifc_definition_id)
|
|
||||||
ifcopenshell.api.run("attribute.edit_attributes", self.file, **{"product": product, "attributes": attributes})
|
|
||||||
Data.load(IfcStore.get_file(), oprops.ifc_definition_id)
|
|
||||||
bpy.ops.bim.disable_editing_attributes(obj=obj.name, obj_type=self.obj_type)
|
bpy.ops.bim.disable_editing_attributes(obj=obj.name, obj_type=self.obj_type)
|
||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ import blenderbim.core.context as core
|
|||||||
import blenderbim.bim.module.context.data
|
import blenderbim.bim.module.context.data
|
||||||
import blenderbim.bim.handler
|
import blenderbim.bim.handler
|
||||||
from blenderbim.bim.ifc import IfcStore
|
from blenderbim.bim.ifc import IfcStore
|
||||||
from ifcopenshell.api.context.data import Data
|
|
||||||
|
|
||||||
|
|
||||||
class Operator:
|
class Operator:
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ import ifcopenshell.util.attribute
|
|||||||
import blenderbim.tool as tool
|
import blenderbim.tool as tool
|
||||||
import blenderbim.core.document as core
|
import blenderbim.core.document as core
|
||||||
from blenderbim.bim.ifc import IfcStore
|
from blenderbim.bim.ifc import IfcStore
|
||||||
from ifcopenshell.api.document.data import Data
|
|
||||||
|
|
||||||
|
|
||||||
class LoadProjectDocuments(bpy.types.Operator, tool.Ifc.Operator):
|
class LoadProjectDocuments(bpy.types.Operator, tool.Ifc.Operator):
|
||||||
|
|||||||
@@ -44,8 +44,6 @@ from mathutils import Vector
|
|||||||
from timeit import default_timer as timer
|
from timeit import default_timer as timer
|
||||||
from blenderbim.bim.module.drawing.prop import RasterStyleProperty
|
from blenderbim.bim.module.drawing.prop import RasterStyleProperty
|
||||||
from blenderbim.bim.ifc import IfcStore
|
from blenderbim.bim.ifc import IfcStore
|
||||||
from ifcopenshell.api.group.data import Data as GroupData
|
|
||||||
from ifcopenshell.api.pset.data import Data as PsetData
|
|
||||||
|
|
||||||
cwd = os.path.dirname(os.path.realpath(__file__))
|
cwd = os.path.dirname(os.path.realpath(__file__))
|
||||||
|
|
||||||
@@ -1346,4 +1344,4 @@ class SelectAssignedProduct(bpy.types.Operator, Operator):
|
|||||||
bl_options = {"REGISTER", "UNDO"}
|
bl_options = {"REGISTER", "UNDO"}
|
||||||
|
|
||||||
def _execute(self, context):
|
def _execute(self, context):
|
||||||
core.select_assigned_product(tool.Drawing)
|
core.select_assigned_product(tool.Drawing)
|
||||||
|
|||||||
@@ -31,9 +31,6 @@ import blenderbim.core.root
|
|||||||
import blenderbim.tool as tool
|
import blenderbim.tool as tool
|
||||||
import blenderbim.bim.handler
|
import blenderbim.bim.handler
|
||||||
from mathutils import Vector
|
from mathutils import Vector
|
||||||
from ifcopenshell.api.geometry.data import Data
|
|
||||||
from ifcopenshell.api.context.data import Data as ContextData
|
|
||||||
from ifcopenshell.api.void.data import Data as VoidData
|
|
||||||
from blenderbim.bim import import_ifc
|
from blenderbim.bim import import_ifc
|
||||||
from blenderbim.bim.ifc import IfcStore
|
from blenderbim.bim.ifc import IfcStore
|
||||||
from blenderbim.bim.module.root.prop import get_contexts
|
from blenderbim.bim.module.root.prop import get_contexts
|
||||||
@@ -168,9 +165,6 @@ class UpdateRepresentation(bpy.types.Operator):
|
|||||||
return IfcStore.execute_ifc_operator(self, context)
|
return IfcStore.execute_ifc_operator(self, context)
|
||||||
|
|
||||||
def _execute(self, context):
|
def _execute(self, context):
|
||||||
if not ContextData.is_loaded:
|
|
||||||
ContextData.load(IfcStore.get_file())
|
|
||||||
|
|
||||||
if context.active_object and context.active_object.mode != "OBJECT":
|
if context.active_object and context.active_object.mode != "OBJECT":
|
||||||
# Ensure mode is object to prevent invalid mesh data causing CTD
|
# Ensure mode is object to prevent invalid mesh data causing CTD
|
||||||
bpy.ops.object.mode_set(mode="OBJECT", toggle=False)
|
bpy.ops.object.mode_set(mode="OBJECT", toggle=False)
|
||||||
@@ -266,7 +260,6 @@ class UpdateRepresentation(bpy.types.Operator):
|
|||||||
obj.data.BIMMeshProperties.ifc_definition_id = int(new_representation.id())
|
obj.data.BIMMeshProperties.ifc_definition_id = int(new_representation.id())
|
||||||
obj.data.name = f"{old_representation.ContextOfItems.id()}/{new_representation.id()}"
|
obj.data.name = f"{old_representation.ContextOfItems.id()}/{new_representation.id()}"
|
||||||
core.remove_representation(tool.Ifc, tool.Geometry, obj=obj, representation=old_representation)
|
core.remove_representation(tool.Ifc, tool.Geometry, obj=obj, representation=old_representation)
|
||||||
Data.load(self.file, obj.BIMObjectProperties.ifc_definition_id)
|
|
||||||
if obj.data.BIMMeshProperties.ifc_parameters:
|
if obj.data.BIMMeshProperties.ifc_parameters:
|
||||||
core.get_representation_ifc_parameters(tool.Geometry, obj=obj)
|
core.get_representation_ifc_parameters(tool.Geometry, obj=obj)
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,6 @@
|
|||||||
|
|
||||||
import blenderbim.bim.helper
|
import blenderbim.bim.helper
|
||||||
from bpy.types import Panel, UIList
|
from bpy.types import Panel, UIList
|
||||||
from ifcopenshell.api.material.data import Data
|
|
||||||
from blenderbim.bim.ifc import IfcStore
|
from blenderbim.bim.ifc import IfcStore
|
||||||
from blenderbim.bim.helper import draw_attributes
|
from blenderbim.bim.helper import draw_attributes
|
||||||
from blenderbim.bim.helper import prop_with_search
|
from blenderbim.bim.helper import prop_with_search
|
||||||
|
|||||||
@@ -33,7 +33,6 @@ from blenderbim.bim.ifc import IfcStore
|
|||||||
from blenderbim.bim.module.model.data import AuthoringData
|
from blenderbim.bim.module.model.data import AuthoringData
|
||||||
from blenderbim.bim.module.model.prop import store_cursor_position
|
from blenderbim.bim.module.model.prop import store_cursor_position
|
||||||
from blenderbim.bim.helper import draw_image_for_ifc_profile
|
from blenderbim.bim.helper import draw_image_for_ifc_profile
|
||||||
from ifcopenshell.api.pset.data import Data as PsetData
|
|
||||||
from mathutils import Vector, Matrix
|
from mathutils import Vector, Matrix
|
||||||
from bpy_extras.object_utils import AddObjectHelper
|
from bpy_extras.object_utils import AddObjectHelper
|
||||||
from . import prop
|
from . import prop
|
||||||
|
|||||||
@@ -32,8 +32,6 @@ import blenderbim.core.geometry
|
|||||||
from blenderbim.bim.ifc import IfcStore
|
from blenderbim.bim.ifc import IfcStore
|
||||||
from math import pi, degrees, inf
|
from math import pi, degrees, inf
|
||||||
from mathutils import Vector, Matrix
|
from mathutils import Vector, Matrix
|
||||||
from ifcopenshell.api.pset.data import Data as PsetData
|
|
||||||
from ifcopenshell.api.material.data import Data as MaterialData
|
|
||||||
from blenderbim.bim.module.geometry.helper import Helper
|
from blenderbim.bim.module.geometry.helper import Helper
|
||||||
|
|
||||||
|
|
||||||
@@ -191,7 +189,6 @@ class DumbProfileGenerator:
|
|||||||
|
|
||||||
pset = ifcopenshell.api.run("pset.add_pset", self.file, product=element, name="EPset_Parametric")
|
pset = ifcopenshell.api.run("pset.add_pset", self.file, product=element, name="EPset_Parametric")
|
||||||
ifcopenshell.api.run("pset.edit_pset", self.file, pset=pset, properties={"Engine": "BlenderBIM.DumbProfile"})
|
ifcopenshell.api.run("pset.edit_pset", self.file, pset=pset, properties={"Engine": "BlenderBIM.DumbProfile"})
|
||||||
MaterialData.load(self.file)
|
|
||||||
|
|
||||||
if link_to_scene:
|
if link_to_scene:
|
||||||
obj.select_set(True)
|
obj.select_set(True)
|
||||||
|
|||||||
@@ -37,8 +37,6 @@ from bpy.types import SpaceView3D
|
|||||||
from blenderbim.bim.ifc import IfcStore
|
from blenderbim.bim.ifc import IfcStore
|
||||||
from math import pi, degrees, sin, cos, radians
|
from math import pi, degrees, sin, cos, radians
|
||||||
from mathutils import Vector, Matrix
|
from mathutils import Vector, Matrix
|
||||||
from ifcopenshell.api.pset.data import Data as PsetData
|
|
||||||
from ifcopenshell.api.material.data import Data as MaterialData
|
|
||||||
from blenderbim.bim.module.geometry.helper import Helper
|
from blenderbim.bim.module.geometry.helper import Helper
|
||||||
from gpu.types import GPUShader, GPUBatch, GPUIndexBuf, GPUVertBuf, GPUVertFormat
|
from gpu.types import GPUShader, GPUBatch, GPUIndexBuf, GPUVertBuf, GPUVertFormat
|
||||||
from gpu_extras.batch import batch_for_shader
|
from gpu_extras.batch import batch_for_shader
|
||||||
@@ -118,7 +116,6 @@ def calculate_quantities(usecase_path, ifc_file, settings):
|
|||||||
)
|
)
|
||||||
|
|
||||||
ifcopenshell.api.run("pset.edit_qto", ifc_file, should_run_listeners=False, qto=qto, properties=properties)
|
ifcopenshell.api.run("pset.edit_qto", ifc_file, should_run_listeners=False, qto=qto, properties=properties)
|
||||||
PsetData.load(ifc_file, obj.BIMObjectProperties.ifc_definition_id)
|
|
||||||
|
|
||||||
|
|
||||||
class DumbSlabGenerator:
|
class DumbSlabGenerator:
|
||||||
@@ -228,7 +225,6 @@ class DumbSlabGenerator:
|
|||||||
|
|
||||||
pset = ifcopenshell.api.run("pset.add_pset", self.file, product=element, name="EPset_Parametric")
|
pset = ifcopenshell.api.run("pset.add_pset", self.file, product=element, name="EPset_Parametric")
|
||||||
ifcopenshell.api.run("pset.edit_pset", self.file, pset=pset, properties={"Engine": "BlenderBIM.DumbLayer3"})
|
ifcopenshell.api.run("pset.edit_pset", self.file, pset=pset, properties={"Engine": "BlenderBIM.DumbLayer3"})
|
||||||
MaterialData.load(self.file)
|
|
||||||
obj.select_set(True)
|
obj.select_set(True)
|
||||||
return obj
|
return obj
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,6 @@
|
|||||||
import ifcopenshell
|
import ifcopenshell
|
||||||
import ifcopenshell.api
|
import ifcopenshell.api
|
||||||
import ifcopenshell.util.date
|
import ifcopenshell.util.date
|
||||||
from ifcopenshell.api.pset.data import Data as PsetData
|
|
||||||
|
|
||||||
|
|
||||||
def calculate_quantities(usecase_path, ifc_file, settings):
|
def calculate_quantities(usecase_path, ifc_file, settings):
|
||||||
@@ -43,4 +42,3 @@ def calculate_quantities(usecase_path, ifc_file, settings):
|
|||||||
"StandardWork": ifcopenshell.util.date.ifc2datetime(element.ScheduleDuration).days,
|
"StandardWork": ifcopenshell.util.date.ifc2datetime(element.ScheduleDuration).days,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
PsetData.load(ifc_file, task.id())
|
|
||||||
|
|||||||
@@ -32,8 +32,6 @@ import blenderbim.core.root
|
|||||||
import blenderbim.core.geometry
|
import blenderbim.core.geometry
|
||||||
import blenderbim.tool as tool
|
import blenderbim.tool as tool
|
||||||
from blenderbim.bim.ifc import IfcStore
|
from blenderbim.bim.ifc import IfcStore
|
||||||
from ifcopenshell.api.pset.data import Data as PsetData
|
|
||||||
from ifcopenshell.api.material.data import Data as MaterialData
|
|
||||||
from math import pi, sin, cos, degrees, radians
|
from math import pi, sin, cos, degrees, radians
|
||||||
from mathutils import Vector, Matrix
|
from mathutils import Vector, Matrix
|
||||||
|
|
||||||
@@ -660,7 +658,6 @@ class DumbWallGenerator:
|
|||||||
)
|
)
|
||||||
pset = ifcopenshell.api.run("pset.add_pset", self.file, product=element, name="EPset_Parametric")
|
pset = ifcopenshell.api.run("pset.add_pset", self.file, product=element, name="EPset_Parametric")
|
||||||
ifcopenshell.api.run("pset.edit_pset", self.file, pset=pset, properties={"Engine": "BlenderBIM.DumbLayer2"})
|
ifcopenshell.api.run("pset.edit_pset", self.file, pset=pset, properties={"Engine": "BlenderBIM.DumbLayer2"})
|
||||||
MaterialData.load(self.file)
|
|
||||||
obj.select_set(True)
|
obj.select_set(True)
|
||||||
return obj
|
return obj
|
||||||
|
|
||||||
@@ -719,7 +716,6 @@ def calculate_quantities(usecase_path, ifc_file, settings):
|
|||||||
"NetVolume": round(net_volume, 2),
|
"NetVolume": round(net_volume, 2),
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
PsetData.load(ifc_file, obj.BIMObjectProperties.ifc_definition_id)
|
|
||||||
|
|
||||||
|
|
||||||
class DumbWallPlaner:
|
class DumbWallPlaner:
|
||||||
@@ -789,7 +785,6 @@ class DumbWallJoiner:
|
|||||||
connection = "ATEND" if connection > 0.5 else "ATSTART"
|
connection = "ATEND" if connection > 0.5 else "ATSTART"
|
||||||
|
|
||||||
wall2 = self.duplicate_wall(wall1)
|
wall2 = self.duplicate_wall(wall1)
|
||||||
MaterialData.load(tool.Ifc.get())
|
|
||||||
element2 = tool.Ifc.get_entity(wall2)
|
element2 = tool.Ifc.get_entity(wall2)
|
||||||
|
|
||||||
ifcopenshell.api.run("geometry.disconnect_path", tool.Ifc.get(), element=element1, connection_type="ATEND")
|
ifcopenshell.api.run("geometry.disconnect_path", tool.Ifc.get(), element=element1, connection_type="ATEND")
|
||||||
|
|||||||
@@ -34,7 +34,6 @@ from blenderbim.bim.ifc import IfcStore
|
|||||||
from blenderbim.bim.ui import IFCFileSelector
|
from blenderbim.bim.ui import IFCFileSelector
|
||||||
from blenderbim.bim import import_ifc
|
from blenderbim.bim import import_ifc
|
||||||
from blenderbim.bim import export_ifc
|
from blenderbim.bim import export_ifc
|
||||||
from ifcopenshell.api.context.data import Data as ContextData
|
|
||||||
|
|
||||||
|
|
||||||
class CreateProject(bpy.types.Operator):
|
class CreateProject(bpy.types.Operator):
|
||||||
|
|||||||
@@ -30,8 +30,6 @@ import blenderbim.core.pset as core
|
|||||||
import blenderbim.core.qto as QtoCore
|
import blenderbim.core.qto as QtoCore
|
||||||
import blenderbim.bim.module.pset.data
|
import blenderbim.bim.module.pset.data
|
||||||
from blenderbim.bim.ifc import IfcStore
|
from blenderbim.bim.ifc import IfcStore
|
||||||
from ifcopenshell.api.pset.data import Data
|
|
||||||
from ifcopenshell.api.cost.data import Data as CostData
|
|
||||||
from blenderbim.bim.module.pset.qto_calculator import QtoCalculator
|
from blenderbim.bim.module.pset.qto_calculator import QtoCalculator
|
||||||
from blenderbim.bim.module.pset.calc_quantity_function_mapper import mapper
|
from blenderbim.bim.module.pset.calc_quantity_function_mapper import mapper
|
||||||
|
|
||||||
@@ -85,23 +83,22 @@ class EnablePsetEditing(bpy.types.Operator):
|
|||||||
self.props = get_pset_props(context, self.obj, self.obj_type)
|
self.props = get_pset_props(context, self.obj, self.obj_type)
|
||||||
self.props.properties.clear()
|
self.props.properties.clear()
|
||||||
ifc_definition_id = blenderbim.bim.helper.get_obj_ifc_definition_id(context, self.obj, self.obj_type)
|
ifc_definition_id = blenderbim.bim.helper.get_obj_ifc_definition_id(context, self.obj, self.obj_type)
|
||||||
Data.load(IfcStore.get_file(), ifc_definition_id)
|
pset = tool.Ifc.get().by_id(self.pset_id)
|
||||||
data = Data.psets if self.pset_id in Data.psets else Data.qtos
|
self.props.active_pset_name = pset.Name
|
||||||
pset_data = data[self.pset_id]
|
|
||||||
self.props.active_pset_name = pset_data["Name"]
|
|
||||||
|
|
||||||
pset_template = blenderbim.bim.schema.ifc.psetqto.get_by_name(pset_data["Name"])
|
pset_template = blenderbim.bim.schema.ifc.psetqto.get_by_name(pset.Name)
|
||||||
|
|
||||||
if pset_template:
|
if pset_template:
|
||||||
self.load_from_pset_template(pset_template, pset_data)
|
self.load_from_pset_template(pset_template, pset)
|
||||||
else:
|
else:
|
||||||
self.load_from_pset_data(pset_data)
|
self.load_from_pset_data(pset)
|
||||||
|
|
||||||
self.props.active_pset_id = self.pset_id
|
self.props.active_pset_id = self.pset_id
|
||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
|
|
||||||
def load_from_pset_template(self, pset_template, pset_data):
|
def load_from_pset_template(self, pset_template, pset):
|
||||||
data = {Data.properties[p]["Name"]: Data.properties[p]["NominalValue"] for p in pset_data["Properties"]}
|
data = ifcopenshell.util.element.get_property_definition(pset)
|
||||||
|
del data["id"]
|
||||||
for prop_template in pset_template.HasPropertyTemplates:
|
for prop_template in pset_template.HasPropertyTemplates:
|
||||||
if not prop_template.is_a("IfcSimplePropertyTemplate"):
|
if not prop_template.is_a("IfcSimplePropertyTemplate"):
|
||||||
continue # Other types not yet supported
|
continue # Other types not yet supported
|
||||||
@@ -173,21 +170,26 @@ class EnablePsetEditing(bpy.types.Operator):
|
|||||||
setattr(new, data_type, enum)
|
setattr(new, data_type, enum)
|
||||||
new.is_selected = enum in selected_enum_items
|
new.is_selected = enum in selected_enum_items
|
||||||
|
|
||||||
def load_from_pset_data(self, pset_data):
|
def load_from_pset_data(self, pset):
|
||||||
for prop_id in pset_data["Properties"]:
|
if pset.is_a("IfcElementQuantity"):
|
||||||
prop = Data.properties[prop_id]
|
props = pset.Quantities
|
||||||
|
elif pset.is_a("IfcPropertySet"):
|
||||||
|
props = pset.HasProperties
|
||||||
|
elif pset.is_a("IfcMaterialProperties") or pset.is_a("IfcProfileProperties"):
|
||||||
|
props = pset.Properties
|
||||||
|
|
||||||
if prop["type"] == "IfcPropertyEnumeratedValue":
|
for prop in props:
|
||||||
|
if prop.is_a("IfcPropertyEnumeratedValue"):
|
||||||
simple_prop = self.props.properties.add()
|
simple_prop = self.props.properties.add()
|
||||||
simple_prop.value_type = "IfcPropertyEnumeratedValue"
|
simple_prop.value_type = "IfcPropertyEnumeratedValue"
|
||||||
metadata = simple_prop.metadata
|
metadata = simple_prop.metadata
|
||||||
metadata.name = prop["Name"]
|
metadata.name = prop.Name
|
||||||
metadata.is_null = len(simple_prop.enumerated_value.enumerated_values) == 0
|
metadata.is_null = len(simple_prop.enumerated_value.enumerated_values) == 0
|
||||||
metadata.is_optional = True
|
metadata.is_optional = True
|
||||||
metadata.set_value(prop["EnumerationReference"].EnumerationValues[0].wrappedValue)
|
metadata.set_value(prop.EnumerationReference.EnumerationValues[0].wrappedValue)
|
||||||
|
|
||||||
enum_items = [v.wrappedValue for v in prop["EnumerationReference"].EnumerationValues]
|
enum_items = [v.wrappedValue for v in prop.EnumerationReference.EnumerationValues]
|
||||||
selected_enum_items = [v.wrappedValue for v in prop["EnumerationValues"]]
|
selected_enum_items = [v.wrappedValue for v in prop.EnumerationValues]
|
||||||
data_type = metadata.get_value_name()
|
data_type = metadata.get_value_name()
|
||||||
|
|
||||||
for enum in enum_items:
|
for enum in enum_items:
|
||||||
@@ -195,11 +197,14 @@ class EnablePsetEditing(bpy.types.Operator):
|
|||||||
setattr(new, data_type, enum)
|
setattr(new, data_type, enum)
|
||||||
new.is_selected = enum in selected_enum_items
|
new.is_selected = enum in selected_enum_items
|
||||||
else:
|
else:
|
||||||
value = prop["NominalValue"]
|
if prop.is_a("IfcSimplePropertyTemplate"):
|
||||||
|
value = prop.NominalValue.wrappedValue
|
||||||
|
elif prop.is_a("IfcPhysicalSimpleQuantity"):
|
||||||
|
value = prop[3]
|
||||||
new_prop = self.props.properties.add()
|
new_prop = self.props.properties.add()
|
||||||
metadata = new_prop.metadata
|
metadata = new_prop.metadata
|
||||||
metadata.set_value(value)
|
metadata.set_value(value)
|
||||||
metadata.name = prop["Name"]
|
metadata.name = prop.Name
|
||||||
metadata.is_null = value is None
|
metadata.is_null = value is None
|
||||||
metadata.is_optional = True
|
metadata.is_optional = True
|
||||||
metadata.set_value(metadata.get_value_default() if metadata.is_null else value)
|
metadata.set_value(metadata.get_value_default() if metadata.is_null else value)
|
||||||
@@ -236,7 +241,6 @@ class EditPset(bpy.types.Operator, Operator):
|
|||||||
if self.properties:
|
if self.properties:
|
||||||
properties = json.loads(self.properties)
|
properties = json.loads(self.properties)
|
||||||
else:
|
else:
|
||||||
data = Data.psets if pset_id in Data.psets else Data.qtos
|
|
||||||
for prop in props.properties:
|
for prop in props.properties:
|
||||||
if prop.value_type == "IfcPropertySingleValue":
|
if prop.value_type == "IfcPropertySingleValue":
|
||||||
properties[prop.metadata.name] = prop.metadata.get_value()
|
properties[prop.metadata.name] = prop.metadata.get_value()
|
||||||
@@ -246,7 +250,7 @@ class EditPset(bpy.types.Operator, Operator):
|
|||||||
e[value_name] for e in prop.enumerated_value.enumerated_values if e.is_selected
|
e[value_name] for e in prop.enumerated_value.enumerated_values if e.is_selected
|
||||||
]
|
]
|
||||||
|
|
||||||
if pset_id in Data.psets:
|
if tool.Ifc.get().by_id(pset_id).is_a("IfcPropertySet"):
|
||||||
ifcopenshell.api.run(
|
ifcopenshell.api.run(
|
||||||
"pset.edit_pset",
|
"pset.edit_pset",
|
||||||
self.file,
|
self.file,
|
||||||
@@ -270,9 +274,7 @@ class EditPset(bpy.types.Operator, Operator):
|
|||||||
"properties": properties,
|
"properties": properties,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
CostData.purge()
|
|
||||||
bpy.ops.bim.load_cost_item_quantities()
|
bpy.ops.bim.load_cost_item_quantities()
|
||||||
Data.load(IfcStore.get_file(), ifc_definition_id)
|
|
||||||
bpy.ops.bim.disable_pset_editing(obj=self.obj, obj_type=self.obj_type)
|
bpy.ops.bim.disable_pset_editing(obj=self.obj, obj_type=self.obj_type)
|
||||||
|
|
||||||
|
|
||||||
@@ -302,7 +304,6 @@ class RemovePset(bpy.types.Operator, Operator):
|
|||||||
ifcopenshell.api.run(
|
ifcopenshell.api.run(
|
||||||
"pset.remove_pset", tool.Ifc.get(), product=element, pset=tool.Ifc.get().by_id(pset["id"])
|
"pset.remove_pset", tool.Ifc.get(), product=element, pset=tool.Ifc.get().by_id(pset["id"])
|
||||||
)
|
)
|
||||||
Data.load(IfcStore.get_file(), ifc_definition_id)
|
|
||||||
|
|
||||||
|
|
||||||
class AddPset(bpy.types.Operator, Operator):
|
class AddPset(bpy.types.Operator, Operator):
|
||||||
@@ -329,7 +330,6 @@ class AddPset(bpy.types.Operator, Operator):
|
|||||||
element = tool.Ifc.get().by_id(ifc_definition_id)
|
element = tool.Ifc.get().by_id(ifc_definition_id)
|
||||||
if pset_name in blenderbim.bim.schema.ifc.psetqto.get_applicable_names(element.is_a(), pset_only=True):
|
if pset_name in blenderbim.bim.schema.ifc.psetqto.get_applicable_names(element.is_a(), pset_only=True):
|
||||||
ifcopenshell.api.run("pset.add_pset", self.file, product=element, name=pset_name)
|
ifcopenshell.api.run("pset.add_pset", self.file, product=element, name=pset_name)
|
||||||
Data.load(IfcStore.get_file(), ifc_definition_id)
|
|
||||||
|
|
||||||
|
|
||||||
class AddQto(bpy.types.Operator, Operator):
|
class AddQto(bpy.types.Operator, Operator):
|
||||||
@@ -352,7 +352,6 @@ class AddQto(bpy.types.Operator, Operator):
|
|||||||
"name": props.qto_name,
|
"name": props.qto_name,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
Data.load(IfcStore.get_file(), ifc_definition_id)
|
|
||||||
|
|
||||||
|
|
||||||
class CalculateQuantity(bpy.types.Operator):
|
class CalculateQuantity(bpy.types.Operator):
|
||||||
@@ -536,7 +535,6 @@ class BIM_OT_rename_parameters(bpy.types.Operator):
|
|||||||
continue
|
continue
|
||||||
if prop2map.existing_property_name == obj_prop.Name:
|
if prop2map.existing_property_name == obj_prop.Name:
|
||||||
obj_prop.Name = prop2map.new_property_name
|
obj_prop.Name = prop2map.new_property_name
|
||||||
Data.load(IfcStore.get_file(), ifc_element.id())
|
|
||||||
|
|
||||||
|
|
||||||
class BIM_OT_add_edit_custom_property(bpy.types.Operator):
|
class BIM_OT_add_edit_custom_property(bpy.types.Operator):
|
||||||
@@ -572,7 +570,6 @@ class BIM_OT_add_edit_custom_property(bpy.types.Operator):
|
|||||||
ifcopenshell.api.run(
|
ifcopenshell.api.run(
|
||||||
"pset.edit_pset", self.file, pset=new_pset, properties={prop.property_name: value_ifc_entity}
|
"pset.edit_pset", self.file, pset=new_pset, properties={prop.property_name: value_ifc_entity}
|
||||||
)
|
)
|
||||||
Data.load(IfcStore.get_file(), ifc_definition_id)
|
|
||||||
self.report({"INFO"}, "Finished applying changes")
|
self.report({"INFO"}, "Finished applying changes")
|
||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
|
|
||||||
@@ -634,7 +631,6 @@ class BIM_OT_bulk_remove_psets(bpy.types.Operator):
|
|||||||
)
|
)
|
||||||
except KeyError:
|
except KeyError:
|
||||||
pass # Sometimes the pset id is not found, I'm not sure why this happens though. - vulevukusej
|
pass # Sometimes the pset id is not found, I'm not sure why this happens though. - vulevukusej
|
||||||
Data.load(IfcStore.get_file(), ifc_definition_id)
|
|
||||||
|
|
||||||
self.report({"INFO"}, "Finished applying changes")
|
self.report({"INFO"}, "Finished applying changes")
|
||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
|
|||||||
@@ -18,10 +18,10 @@
|
|||||||
|
|
||||||
import bpy
|
import bpy
|
||||||
import blenderbim.bim.schema
|
import blenderbim.bim.schema
|
||||||
from blenderbim.bim.prop import Attribute, StrProperty
|
|
||||||
import ifcopenshell
|
import ifcopenshell
|
||||||
from ifcopenshell.api.pset.data import Data
|
import ifcopenshell.util.element
|
||||||
import blenderbim.tool as tool
|
import blenderbim.tool as tool
|
||||||
|
from blenderbim.bim.prop import Attribute, StrProperty
|
||||||
from blenderbim.bim.module.pset.data import AddEditCustomPropertiesData
|
from blenderbim.bim.module.pset.data import AddEditCustomPropertiesData
|
||||||
from blenderbim.bim.ifc import IfcStore
|
from blenderbim.bim.ifc import IfcStore
|
||||||
from bpy.types import PropertyGroup
|
from bpy.types import PropertyGroup
|
||||||
@@ -62,14 +62,12 @@ def get_pset_names(self, context):
|
|||||||
obj = context.active_object
|
obj = context.active_object
|
||||||
if not obj.BIMObjectProperties.ifc_definition_id:
|
if not obj.BIMObjectProperties.ifc_definition_id:
|
||||||
return []
|
return []
|
||||||
if obj.BIMObjectProperties.ifc_definition_id not in Data.products:
|
|
||||||
Data.load(IfcStore.get_file(), obj.BIMObjectProperties.ifc_definition_id)
|
|
||||||
element = IfcStore.get_file().by_id(obj.BIMObjectProperties.ifc_definition_id)
|
element = IfcStore.get_file().by_id(obj.BIMObjectProperties.ifc_definition_id)
|
||||||
ifc_class = element.is_a()
|
ifc_class = element.is_a()
|
||||||
if ifc_class not in psetnames:
|
if ifc_class not in psetnames:
|
||||||
psets = blenderbim.bim.schema.ifc.psetqto.get_applicable(ifc_class, pset_only=True)
|
psets = blenderbim.bim.schema.ifc.psetqto.get_applicable(ifc_class, pset_only=True)
|
||||||
psetnames[ifc_class] = blender_formatted_enum_from_psets(psets)
|
psetnames[ifc_class] = blender_formatted_enum_from_psets(psets)
|
||||||
assigned_names = [Data.psets[p]["Name"] for p in Data.products[obj.BIMObjectProperties.ifc_definition_id]["psets"]]
|
assigned_names = ifcopenshell.util.element.get_psets(element, psets_only=True).keys()
|
||||||
return [p for p in psetnames[ifc_class] if p[0] not in assigned_names]
|
return [p for p in psetnames[ifc_class] if p[0] not in assigned_names]
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ import blenderbim.tool as tool
|
|||||||
import blenderbim.core.qto as core
|
import blenderbim.core.qto as core
|
||||||
from blenderbim.bim.ifc import IfcStore
|
from blenderbim.bim.ifc import IfcStore
|
||||||
from blenderbim.bim.module.qto import helper
|
from blenderbim.bim.module.qto import helper
|
||||||
from ifcopenshell.api.pset.data import Data as PsetData
|
|
||||||
from blenderbim.bim.module.pset.qto_calculator import QtoCalculator
|
from blenderbim.bim.module.pset.qto_calculator import QtoCalculator
|
||||||
|
|
||||||
|
|
||||||
@@ -169,7 +168,6 @@ class QuantifyObjects(bpy.types.Operator):
|
|||||||
name=props.qto_name,
|
name=props.qto_name,
|
||||||
)
|
)
|
||||||
ifcopenshell.api.run("pset.edit_qto", self.file, qto=qto, properties={props.prop_name: result})
|
ifcopenshell.api.run("pset.edit_qto", self.file, qto=qto, properties={props.prop_name: result})
|
||||||
PsetData.load(self.file, obj.BIMObjectProperties.ifc_definition_id)
|
|
||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
|
|
||||||
class AssignBaseQto(bpy.types.Operator, tool.Ifc.Operator):
|
class AssignBaseQto(bpy.types.Operator, tool.Ifc.Operator):
|
||||||
@@ -198,4 +196,4 @@ class CalculateAllQuantities(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
|
|
||||||
def _execute(self, context):
|
def _execute(self, context):
|
||||||
core.calculate_objects_base_quantities(tool.Ifc, tool.Qto, QtoCalculator(), selected_objects = context.selected_objects)
|
core.calculate_objects_base_quantities(tool.Ifc, tool.Qto, QtoCalculator(), selected_objects = context.selected_objects)
|
||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
|
|||||||
@@ -29,7 +29,6 @@ import blenderbim.core.style
|
|||||||
import blenderbim.core.type
|
import blenderbim.core.type
|
||||||
import blenderbim.core.root as core
|
import blenderbim.core.root as core
|
||||||
import blenderbim.tool as tool
|
import blenderbim.tool as tool
|
||||||
from ifcopenshell.api.void.data import Data as VoidData
|
|
||||||
from blenderbim.bim.ifc import IfcStore
|
from blenderbim.bim.ifc import IfcStore
|
||||||
from blenderbim.bim.helper import get_enum_items
|
from blenderbim.bim.helper import get_enum_items
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ import re
|
|||||||
import bpy
|
import bpy
|
||||||
import ifcopenshell
|
import ifcopenshell
|
||||||
import ifcopenshell.util.element
|
import ifcopenshell.util.element
|
||||||
from ifcopenshell.api.group.data import Data
|
|
||||||
from ifcopenshell.util.selector import Selector
|
from ifcopenshell.util.selector import Selector
|
||||||
import blenderbim.tool as tool
|
import blenderbim.tool as tool
|
||||||
from blenderbim.bim.ifc import IfcStore
|
from blenderbim.bim.ifc import IfcStore
|
||||||
|
|||||||
@@ -26,9 +26,6 @@ import blenderbim.core.geometry
|
|||||||
import blenderbim.core.type as core
|
import blenderbim.core.type as core
|
||||||
import blenderbim.core.root
|
import blenderbim.core.root
|
||||||
from blenderbim.bim.ifc import IfcStore
|
from blenderbim.bim.ifc import IfcStore
|
||||||
from ifcopenshell.api.type.data import Data
|
|
||||||
from ifcopenshell.api.geometry.data import Data as GeometryData
|
|
||||||
from ifcopenshell.api.material.data import Data as MaterialData
|
|
||||||
|
|
||||||
|
|
||||||
class Operator:
|
class Operator:
|
||||||
@@ -55,10 +52,6 @@ class AssignType(bpy.types.Operator, Operator):
|
|||||||
for obj in related_objects:
|
for obj in related_objects:
|
||||||
core.assign_type(tool.Ifc, tool.Type, element=tool.Ifc.get_entity(obj), type=type)
|
core.assign_type(tool.Ifc, tool.Type, element=tool.Ifc.get_entity(obj), type=type)
|
||||||
oprops = obj.BIMObjectProperties
|
oprops = obj.BIMObjectProperties
|
||||||
Data.load(IfcStore.get_file(), oprops.ifc_definition_id)
|
|
||||||
GeometryData.load(IfcStore.get_file(), oprops.ifc_definition_id)
|
|
||||||
MaterialData.load(IfcStore.get_file(), oprops.ifc_definition_id)
|
|
||||||
MaterialData.load(IfcStore.get_file())
|
|
||||||
|
|
||||||
|
|
||||||
class UnassignType(bpy.types.Operator):
|
class UnassignType(bpy.types.Operator):
|
||||||
@@ -84,7 +77,6 @@ class UnassignType(bpy.types.Operator):
|
|||||||
"related_object": self.file.by_id(oprops.ifc_definition_id),
|
"related_object": self.file.by_id(oprops.ifc_definition_id),
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
Data.load(IfcStore.get_file(), oprops.ifc_definition_id)
|
|
||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,6 @@ import blenderbim.bim.handler
|
|||||||
import blenderbim.tool as tool
|
import blenderbim.tool as tool
|
||||||
import blenderbim.core.unit as core
|
import blenderbim.core.unit as core
|
||||||
from blenderbim.bim.ifc import IfcStore
|
from blenderbim.bim.ifc import IfcStore
|
||||||
from ifcopenshell.api.unit.data import Data
|
|
||||||
|
|
||||||
|
|
||||||
class Operator:
|
class Operator:
|
||||||
|
|||||||
Reference in New Issue
Block a user