WIP class dropdowns are now schema version specific and generated. See #1222.

This commit is contained in:
Dion Moult
2021-01-06 15:19:55 +11:00
parent cac635107e
commit d206dff9c0
6 changed files with 143 additions and 84 deletions
@@ -22,39 +22,30 @@ class CreateProject(bpy.types.Operator):
IfcStore.file = create_file.Usecase({"version": bpy.context.scene.BIMProperties.export_schema}).execute()
self.file = IfcStore.get_file()
project = bpy.data.collections.new("My Project")
site = bpy.data.collections.new("My Site")
building = bpy.data.collections.new("My Building")
building_storey = bpy.data.collections.new("Ground Floor")
project = bpy.data.objects.new("My Project", None)
site = bpy.data.objects.new("My Site", None)
building = bpy.data.objects.new("My Building", None)
building_storey = bpy.data.objects.new("Ground Floor", None)
project_obj = bpy.data.objects.new("My Project", None)
site_obj = bpy.data.objects.new("My Site", None)
building_obj = bpy.data.objects.new("My Building", None)
building_storey_obj = bpy.data.objects.new("Ground Floor", None)
bpy.context.scene.collection.children.link(project)
project.children.link(site)
site.children.link(building)
building.children.link(building_storey)
project.objects.link(project_obj)
site.objects.link(site_obj)
building.objects.link(building_obj)
building_storey.objects.link(building_storey_obj)
bpy.ops.bim.assign_class(obj=project_obj.name, ifc_class="IfcProject")
bpy.ops.bim.assign_class(obj=project.name, ifc_class="IfcProject")
bpy.ops.bim.assign_unit()
bpy.ops.bim.add_subcontext(context="Model")
bpy.ops.bim.add_subcontext(context="Model", subcontext="Body", target_view="MODEL_VIEW")
bpy.ops.bim.add_subcontext(context="Model", subcontext="Box", target_view="MODEL_VIEW")
bpy.ops.bim.add_subcontext(context="Plan")
bpy.ops.bim.add_subcontext(context="Plan", subcontext="Annotation", target_view="PLAN_VIEW")
bpy.ops.bim.assign_class(obj=site_obj.name, ifc_class="IfcSite")
bpy.ops.bim.assign_class(obj=building_obj.name, ifc_class="IfcBuilding")
bpy.ops.bim.assign_class(obj=building_storey_obj.name, ifc_class="IfcBuildingStorey")
bpy.ops.bim.assign_object(related_object=site_obj.name, relating_object=project_obj.name)
bpy.ops.bim.assign_object(related_object=building_obj.name, relating_object=site_obj.name)
bpy.ops.bim.assign_object(related_object=building_storey_obj.name, relating_object=building_obj.name)
for subcontext in self.file.by_type("IfcGeometricRepresentationSubContext"):
if subcontext.ContextIdentifier == "Body":
bpy.context.scene.BIMProperties.contexts = str(subcontext.id())
break
bpy.ops.bim.assign_class(obj=site.name, ifc_class="IfcSite")
bpy.ops.bim.assign_class(obj=building.name, ifc_class="IfcBuilding")
bpy.ops.bim.assign_class(obj=building_storey.name, ifc_class="IfcBuildingStorey")
bpy.ops.bim.assign_object(related_object=site.name, relating_object=project.name)
bpy.ops.bim.assign_object(related_object=building.name, relating_object=site.name)
bpy.ops.bim.assign_object(related_object=building_storey.name, relating_object=building.name)
# Data.load()
return {"FINISHED"}