mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-18 14:31:39 +00:00
Minor fix
This commit is contained in:
@@ -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