mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 09:21:46 +00:00
You can now create IFC project libraries
This commit is contained in:
@@ -3,6 +3,7 @@ from . import ui, prop, operator
|
||||
|
||||
classes = (
|
||||
operator.CreateProject,
|
||||
operator.CreateProjectLibrary,
|
||||
operator.ValidateIfcFile,
|
||||
prop.BIMProjectProperties,
|
||||
ui.BIM_PT_project,
|
||||
|
||||
@@ -53,6 +53,30 @@ class CreateProject(bpy.types.Operator):
|
||||
return {"FINISHED"}
|
||||
|
||||
|
||||
class CreateProjectLibrary(bpy.types.Operator):
|
||||
bl_idname = "bim.create_project_library"
|
||||
bl_label = "Create Project Library"
|
||||
|
||||
def execute(self, context):
|
||||
self.file = IfcStore.get_file()
|
||||
if self.file:
|
||||
return {"FINISHED"}
|
||||
|
||||
IfcStore.file = ifcopenshell.api.run(
|
||||
"project.create_file", **{"version": bpy.context.scene.BIMProperties.export_schema}
|
||||
)
|
||||
self.file = IfcStore.get_file()
|
||||
|
||||
if self.file.schema == "IFC2X3":
|
||||
bpy.ops.bim.add_person()
|
||||
bpy.ops.bim.add_organisation()
|
||||
|
||||
project_library = bpy.data.objects.new("My Project Library", None)
|
||||
bpy.ops.bim.assign_class(obj=project_library.name, ifc_class="IfcProjectLibrary")
|
||||
bpy.ops.bim.assign_unit()
|
||||
return {"FINISHED"}
|
||||
|
||||
|
||||
class ValidateIfcFile(bpy.types.Operator):
|
||||
bl_idname = "bim.validate_ifc_file"
|
||||
bl_label = "Validate IFC File"
|
||||
|
||||
@@ -63,3 +63,6 @@ class BIM_PT_project(Panel):
|
||||
row.prop(props, "volume_unit", text="Volume Unit")
|
||||
row = self.layout.row()
|
||||
row.operator("bim.create_project")
|
||||
if props.export_schema != "IFC2X3":
|
||||
row = self.layout.row()
|
||||
row.operator("bim.create_project_library")
|
||||
|
||||
@@ -21,7 +21,12 @@ class Usecase:
|
||||
context = self.file.createIfcGeometricRepresentationContext(None, "Plan", 2, 1.0e-05, self.origin)
|
||||
else:
|
||||
context = self.file.createIfcGeometricRepresentationContext(None, "Model", 3, 1.0e-05, self.origin)
|
||||
project = self.file.by_type("IfcProject")[0]
|
||||
|
||||
if self.file.schema == "IFC2X3":
|
||||
project = self.file.by_type("IfcProject")[0]
|
||||
else:
|
||||
project = self.file.by_type("IfcContext")[0]
|
||||
|
||||
if project.RepresentationContexts:
|
||||
contexts = list(project.RepresentationContexts)
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user