Fix bug where project libraries were not legal.

This commit is contained in:
Dion Moult
2021-09-01 08:58:13 +10:00
parent 41db0f4705
commit a1b462a83b
4 changed files with 1211 additions and 1197 deletions
+7 -1
View File
@@ -28,8 +28,14 @@ class LibraryGenerator:
self.file = ifcopenshell.api.run("project.create_file")
self.project = ifcopenshell.api.run(
"root.create_entity", self.file, ifc_class="IfcProject", name="BlenderBIM Demo"
)
self.library = ifcopenshell.api.run(
"root.create_entity", self.file, ifc_class="IfcProjectLibrary", name="BlenderBIM Demo Library"
)
ifcopenshell.api.run(
"project.assign_declaration", self.file, definition=self.library, relating_context=self.library
)
ifcopenshell.api.run("unit.assign_unit", self.file, length={"is_metric": True, "raw": "METERS"})
ifcopenshell.api.run("context.add_context", self.file, context="Model")
self.representations = {
@@ -81,7 +87,7 @@ class LibraryGenerator:
ifcopenshell.api.run(
"geometry.assign_representation", self.file, product=element, representation=representation
)
ifcopenshell.api.run("project.assign_declaration", self.file, definition=element, relating_context=self.project)
ifcopenshell.api.run("project.assign_declaration", self.file, definition=element, relating_context=self.library)
def get_style_settings(self, material):
transparency = material.diffuse_color[3]