mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 09:21:46 +00:00
Minor fix
This commit is contained in:
@@ -67,9 +67,9 @@ class IfcExporter:
|
||||
to_delete = []
|
||||
|
||||
for ifc_definition_id, obj in IfcStore.id_map.items():
|
||||
if isinstance(obj, bpy.types.Material):
|
||||
continue
|
||||
try:
|
||||
if isinstance(obj, bpy.types.Material):
|
||||
continue
|
||||
self.sync_object_placement(obj)
|
||||
self.sync_object_container(ifc_definition_id, obj)
|
||||
except ReferenceError:
|
||||
|
||||
@@ -594,7 +594,8 @@ class IfcImporter:
|
||||
)
|
||||
)
|
||||
checkpoint = time.time()
|
||||
self.update_progress(((total_created / approx_total_products) * progress_range) + start_progress)
|
||||
if approx_total_products:
|
||||
self.update_progress(((total_created / approx_total_products) * progress_range) + start_progress)
|
||||
shape = iterator.get()
|
||||
if shape:
|
||||
product = self.file.by_id(shape.guid)
|
||||
|
||||
@@ -12,10 +12,14 @@ class LibraryGenerator:
|
||||
ifcopenshell.api.run("unit.assign_unit", self.file, length={"is_metric": True, "raw": "METERS"})
|
||||
|
||||
self.material = ifcopenshell.api.run("material.add_material", self.file, name="Unknown")
|
||||
self.create_wall_type("DEMO50", 0.05)
|
||||
self.create_wall_type("DEMO100", 0.1)
|
||||
self.create_wall_type("DEMO200", 0.2)
|
||||
self.create_wall_type("DEMO300", 0.3)
|
||||
|
||||
self.create_layer_type("IfcWallType", "DEMO50", 0.05)
|
||||
self.create_layer_type("IfcWallType", "DEMO100", 0.1)
|
||||
self.create_layer_type("IfcWallType", "DEMO200", 0.2)
|
||||
self.create_layer_type("IfcWallType", "DEMO300", 0.3)
|
||||
|
||||
self.create_layer_type("IfcSlabType", "DEMO150", 0.2)
|
||||
self.create_layer_type("IfcSlabType", "DEMO250", 0.3)
|
||||
|
||||
profile = self.file.create_entity("IfcRectangleProfileDef", ProfileType="AREA", XDim=0.5, YDim=0.6)
|
||||
self.create_profile_type("IfcColumnType", "DEMO1", profile)
|
||||
@@ -60,13 +64,13 @@ class LibraryGenerator:
|
||||
|
||||
self.file.write("blenderbim-demo-library.ifc")
|
||||
|
||||
def create_wall_type(self, name, thickness):
|
||||
wall = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcWallType", name=name)
|
||||
ifcopenshell.api.run("material.assign_material", self.file, product=wall, type="IfcMaterialLayerSet")
|
||||
layer_set = ifcopenshell.util.element.get_material(wall)
|
||||
def create_layer_type(self, ifc_class, name, thickness):
|
||||
element = ifcopenshell.api.run("root.create_entity", self.file, ifc_class=ifc_class, name=name)
|
||||
ifcopenshell.api.run("material.assign_material", self.file, product=element, type="IfcMaterialLayerSet")
|
||||
layer_set = ifcopenshell.util.element.get_material(element)
|
||||
layer = ifcopenshell.api.run("material.add_layer", self.file, layer_set=layer_set, material=self.material)
|
||||
layer.LayerThickness = thickness
|
||||
ifcopenshell.api.run("project.assign_declaration", self.file, definition=wall, relating_context=self.project)
|
||||
ifcopenshell.api.run("project.assign_declaration", self.file, definition=element, relating_context=self.project)
|
||||
|
||||
def create_profile_type(self, ifc_class, name, profile):
|
||||
element = ifcopenshell.api.run("root.create_entity", self.file, ifc_class=ifc_class, name=name)
|
||||
|
||||
Reference in New Issue
Block a user