mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-17 14:02:27 +00:00
IFC4 Landscape Library
Created IFC library with simple trees, shrubs and hedges - with both 2d and 3d representations. Example - https://i.imgur.com/pOjh1si.png Now it's available along with the furniture library when creating new project - https://i.imgur.com/Ho0B5Gn.png
This commit is contained in:
@@ -25,18 +25,16 @@ from ifcopenshell.util.shape_builder import ShapeBuilder, V
|
||||
|
||||
|
||||
class LibraryGenerator:
|
||||
def generate(self, output_filename="IFC4 EU Steel.ifc"):
|
||||
def generate(self, library_name, output_filename="IFC4 EU Steel.ifc"):
|
||||
ifcopenshell.api.pre_listeners = {}
|
||||
ifcopenshell.api.post_listeners = {}
|
||||
|
||||
self.materials = {}
|
||||
|
||||
self.file = ifcopenshell.api.run("project.create_file")
|
||||
self.project = ifcopenshell.api.run(
|
||||
"root.create_entity", self.file, ifc_class="IfcProject", name=f"Non-structural assets library"
|
||||
)
|
||||
self.project = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcProject", name=library_name)
|
||||
self.library = ifcopenshell.api.run(
|
||||
"root.create_entity", self.file, ifc_class="IfcProjectLibrary", name=f"Non-structural assets library"
|
||||
"root.create_entity", self.file, ifc_class="IfcProjectLibrary", name=library_name
|
||||
)
|
||||
ifcopenshell.api.run(
|
||||
"project.assign_declaration", self.file, definition=self.library, relating_context=self.project
|
||||
@@ -1876,4 +1874,6 @@ class LibraryGenerator:
|
||||
|
||||
if __name__ == "__main__":
|
||||
path = Path(__file__).parents[1] / "blenderbim/bim/data/libraries"
|
||||
LibraryGenerator().generate(output_filename=str(path / "IFC4 Furniture Library.ifc"))
|
||||
LibraryGenerator().generate(
|
||||
"Non-structural assets library", output_filename=str(path / "IFC4 Furniture Library.ifc")
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user