mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 09:21:46 +00:00
generate_furniture_library - remove unused methods
We have them in demo library either way
This commit is contained in:
@@ -1859,72 +1859,6 @@ class LibraryGenerator:
|
||||
ifcopenshell.api.project.assign_declaration(self.file, definitions=[element], relating_context=self.library)
|
||||
return element
|
||||
|
||||
def create_layer_set_type(self, name, data):
|
||||
element = ifcopenshell.api.root.create_entity(self.file, ifc_class=data["type"], name=name)
|
||||
element.Description = data["Description"]
|
||||
rel = ifcopenshell.api.material.assign_material(self.file, products=[element], type="IfcMaterialLayerSet")
|
||||
layer_set = rel.RelatingMaterial
|
||||
for layer_data in data["Layers"]:
|
||||
layer = ifcopenshell.api.material.add_layer(
|
||||
self.file, layer_set=layer_set, material=self.materials[layer_data[1]]["ifc"]
|
||||
)
|
||||
layer.Name = layer_data[0]
|
||||
layer.LayerThickness = layer_data[2]
|
||||
ifcopenshell.api.project.assign_declaration(self.file, definitions=[element], relating_context=self.library)
|
||||
return element
|
||||
|
||||
def create_layer_type(self, ifc_class, name, thickness):
|
||||
element = ifcopenshell.api.root.create_entity(self.file, ifc_class=ifc_class, name=name)
|
||||
rel = ifcopenshell.api.material.assign_material(self.file, products=[element], type="IfcMaterialLayerSet")
|
||||
layer_set = rel.RelatingMaterial
|
||||
layer = ifcopenshell.api.material.add_layer(
|
||||
self.file, layer_set=layer_set, material=self.materials["TBD"]["ifc"]
|
||||
)
|
||||
layer.LayerThickness = thickness
|
||||
ifcopenshell.api.project.assign_declaration(self.file, definitions=[element], relating_context=self.library)
|
||||
return element
|
||||
|
||||
def create_profile_type(self, ifc_class, name, profile):
|
||||
element = ifcopenshell.api.root.create_entity(self.file, ifc_class=ifc_class, name=name)
|
||||
rel = ifcopenshell.api.material.assign_material(self.file, products=[element], type="IfcMaterialProfileSet")
|
||||
profile_set = rel.RelatingMaterial
|
||||
material_profile = ifcopenshell.api.material.add_profile(
|
||||
self.file,
|
||||
profile_set=profile_set,
|
||||
material=self.material,
|
||||
# material=self.materials["TBD"]["ifc"]
|
||||
)
|
||||
ifcopenshell.api.material.assign_profile(self.file, material_profile=material_profile, profile=profile)
|
||||
ifcopenshell.api.project.assign_declaration(self.file, definitions=[element], relating_context=self.library)
|
||||
|
||||
def create_type(self, ifc_class, name, representations):
|
||||
element = ifcopenshell.api.root.create_entity(self.file, ifc_class=ifc_class, name=name)
|
||||
for rep_name, obj_name in representations.items():
|
||||
obj = bpy.data.objects.get(obj_name)
|
||||
representation = ifcopenshell.api.geometry.add_representation(
|
||||
self.file,
|
||||
context=self.representations[rep_name],
|
||||
blender_object=obj,
|
||||
geometry=obj.data,
|
||||
total_items=max(1, len(obj.material_slots)),
|
||||
)
|
||||
styles = []
|
||||
for slot in obj.material_slots:
|
||||
style = ifcopenshell.api.style.add_style(self.file, name=slot.material.name)
|
||||
ifcopenshell.api.style.add_surface_style(
|
||||
self.file,
|
||||
style=style,
|
||||
ifc_class="IfcSurfaceStyleRendering",
|
||||
attributes=tool.Style.get_surface_rendering_attributes(slot.material),
|
||||
)
|
||||
styles.append(style)
|
||||
if styles:
|
||||
ifcopenshell.api.style.assign_representation_styles(
|
||||
self.file, shape_representation=representation, styles=styles
|
||||
)
|
||||
ifcopenshell.api.geometry.assign_representation(self.file, product=element, representation=representation)
|
||||
ifcopenshell.api.project.assign_declaration(self.file, definitions=[element], relating_context=self.library)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
path = Path(__file__).parents[1] / "bonsai/bim/data/libraries"
|
||||
|
||||
Reference in New Issue
Block a user