mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-18 06:21:40 +00:00
Small type manager refactor and more descriptions
This commit is contained in:
@@ -137,16 +137,17 @@ class BIMModelProperties(PropertyGroup):
|
|||||||
type_page: bpy.props.IntProperty(name="Type Page", default=1, update=update_type_page)
|
type_page: bpy.props.IntProperty(name="Type Page", default=1, update=update_type_page)
|
||||||
type_template: bpy.props.EnumProperty(
|
type_template: bpy.props.EnumProperty(
|
||||||
items=(
|
items=(
|
||||||
("MESH", "Custom Mesh", ""),
|
("MESH", "Custom Mesh", "Use as a representation currently active object mesh or default cube if no object selected"),
|
||||||
("LAYERSET_AXIS2", "Vertical Layers", "For objects similar to walls"),
|
("LAYERSET_AXIS2", "Vertical Layers", "For objects similar to walls, will automatically add IfcMaterialLayerSet"),
|
||||||
("LAYERSET_AXIS3", "Horizontal Layers", "For objects similar to slabs"),
|
("LAYERSET_AXIS3", "Horizontal Layers", "For objects similar to slabs, will automatically add IfcMaterialLayerSet"),
|
||||||
("PROFILESET", "Extruded Profile", ""),
|
("PROFILESET", "Extruded Profile", "Create profile type object, automatically defines IfcMaterialProfileSet with the first profile from library"),
|
||||||
("EMPTY", "Non-Geometric Type", ""),
|
("EMPTY", "Non-Geometric Type", "Start with an empty object"),
|
||||||
("WINDOW", "Window", ""),
|
("WINDOW", "Window", "Parametric window"),
|
||||||
("DOOR", "Door", ""),
|
("DOOR", "Door", "Parametric door"),
|
||||||
("STAIR", "Stair", ""),
|
("STAIR", "Stair", "Parametric stair"),
|
||||||
("RAILING", "Railing", ""),
|
("RAILING", "Railing", "Parametric railing"),
|
||||||
("ROOF", "Roof", ""),
|
("ROOF", "Roof", "Parametric roof"),
|
||||||
|
|
||||||
),
|
),
|
||||||
name="Type Template",
|
name="Type Template",
|
||||||
default="MESH",
|
default="MESH",
|
||||||
|
|||||||
@@ -212,6 +212,7 @@ class AddType(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
body = ifcopenshell.util.representation.get_context(ifc_file, "Model", "Body", "MODEL_VIEW")
|
body = ifcopenshell.util.representation.get_context(ifc_file, "Model", "Body", "MODEL_VIEW")
|
||||||
if not body:
|
if not body:
|
||||||
props.type_class = props.type_class
|
props.type_class = props.type_class
|
||||||
|
self.report({"ERROR"}, "No Model/Body/MODEL_VIEW context found.")
|
||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
|
|
||||||
if template == "MESH":
|
if template == "MESH":
|
||||||
@@ -314,6 +315,7 @@ class AddType(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
ifcopenshell.api.run(
|
ifcopenshell.api.run(
|
||||||
"material.assign_profile", ifc_file, material_profile=material_profile, profile=profile
|
"material.assign_profile", ifc_file, material_profile=material_profile, profile=profile
|
||||||
)
|
)
|
||||||
|
|
||||||
elif template == "EMPTY":
|
elif template == "EMPTY":
|
||||||
obj = bpy.data.objects.new(name, None)
|
obj = bpy.data.objects.new(name, None)
|
||||||
blenderbim.core.root.assign_class(
|
blenderbim.core.root.assign_class(
|
||||||
@@ -329,7 +331,7 @@ class AddType(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
)
|
)
|
||||||
|
|
||||||
elif template == "WINDOW":
|
elif template == "WINDOW":
|
||||||
mesh = bpy.data.meshes.new("IfcWindow")
|
mesh = bpy.data.meshes.new(name)
|
||||||
obj = bpy.data.objects.new(name, mesh)
|
obj = bpy.data.objects.new(name, mesh)
|
||||||
element = blenderbim.core.root.assign_class(
|
element = blenderbim.core.root.assign_class(
|
||||||
tool.Ifc,
|
tool.Ifc,
|
||||||
@@ -340,14 +342,11 @@ class AddType(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
ifc_class="IfcWindowType" if tool.Ifc.get_schema() != "IFC2X3" else "IfcWindowStyle",
|
ifc_class="IfcWindowType" if tool.Ifc.get_schema() != "IFC2X3" else "IfcWindowStyle",
|
||||||
should_add_representation=False,
|
should_add_representation=False,
|
||||||
)
|
)
|
||||||
bpy.ops.object.select_all(action="DESELECT")
|
tool.Blender.select_and_activate_single_object(context, obj)
|
||||||
bpy.context.view_layer.objects.active = None
|
|
||||||
bpy.context.view_layer.objects.active = obj
|
|
||||||
obj.select_set(True)
|
|
||||||
bpy.ops.bim.add_window()
|
bpy.ops.bim.add_window()
|
||||||
|
|
||||||
elif template == "DOOR":
|
elif template == "DOOR":
|
||||||
mesh = bpy.data.meshes.new("IfcDoor")
|
mesh = bpy.data.meshes.new(name)
|
||||||
obj = bpy.data.objects.new(name, mesh)
|
obj = bpy.data.objects.new(name, mesh)
|
||||||
element = blenderbim.core.root.assign_class(
|
element = blenderbim.core.root.assign_class(
|
||||||
tool.Ifc,
|
tool.Ifc,
|
||||||
@@ -358,14 +357,11 @@ class AddType(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
ifc_class="IfcDoorType" if tool.Ifc.get_schema() != "IFC2X3" else "IfcDoorStyle",
|
ifc_class="IfcDoorType" if tool.Ifc.get_schema() != "IFC2X3" else "IfcDoorStyle",
|
||||||
should_add_representation=False,
|
should_add_representation=False,
|
||||||
)
|
)
|
||||||
bpy.ops.object.select_all(action="DESELECT")
|
tool.Blender.select_and_activate_single_object(context, obj)
|
||||||
bpy.context.view_layer.objects.active = None
|
|
||||||
bpy.context.view_layer.objects.active = obj
|
|
||||||
obj.select_set(True)
|
|
||||||
bpy.ops.bim.add_door()
|
bpy.ops.bim.add_door()
|
||||||
|
|
||||||
elif template == "STAIR":
|
elif template == "STAIR":
|
||||||
mesh = bpy.data.meshes.new("IfcStairFlight")
|
mesh = bpy.data.meshes.new(name)
|
||||||
obj = bpy.data.objects.new(name, mesh)
|
obj = bpy.data.objects.new(name, mesh)
|
||||||
element = blenderbim.core.root.assign_class(
|
element = blenderbim.core.root.assign_class(
|
||||||
tool.Ifc,
|
tool.Ifc,
|
||||||
@@ -377,14 +373,11 @@ class AddType(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
should_add_representation=True,
|
should_add_representation=True,
|
||||||
context=body,
|
context=body,
|
||||||
)
|
)
|
||||||
bpy.ops.object.select_all(action="DESELECT")
|
tool.Blender.select_and_activate_single_object(context, obj)
|
||||||
bpy.context.view_layer.objects.active = None
|
|
||||||
bpy.context.view_layer.objects.active = obj
|
|
||||||
obj.select_set(True)
|
|
||||||
bpy.ops.bim.add_stair()
|
bpy.ops.bim.add_stair()
|
||||||
|
|
||||||
elif template == "RAILING":
|
elif template == "RAILING":
|
||||||
mesh = bpy.data.meshes.new("IfcRailing")
|
mesh = bpy.data.meshes.new(name)
|
||||||
obj = bpy.data.objects.new(name, mesh)
|
obj = bpy.data.objects.new(name, mesh)
|
||||||
element = blenderbim.core.root.assign_class(
|
element = blenderbim.core.root.assign_class(
|
||||||
tool.Ifc,
|
tool.Ifc,
|
||||||
@@ -396,14 +389,11 @@ class AddType(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
should_add_representation=True,
|
should_add_representation=True,
|
||||||
context=body,
|
context=body,
|
||||||
)
|
)
|
||||||
bpy.ops.object.select_all(action="DESELECT")
|
tool.Blender.select_and_activate_single_object(context, obj)
|
||||||
bpy.context.view_layer.objects.active = None
|
|
||||||
bpy.context.view_layer.objects.active = obj
|
|
||||||
obj.select_set(True)
|
|
||||||
bpy.ops.bim.add_railing()
|
bpy.ops.bim.add_railing()
|
||||||
|
|
||||||
elif template == "ROOF":
|
elif template == "ROOF":
|
||||||
mesh = bpy.data.meshes.new("IfcRoof")
|
mesh = bpy.data.meshes.new(name)
|
||||||
obj = bpy.data.objects.new(name, mesh)
|
obj = bpy.data.objects.new(name, mesh)
|
||||||
element = blenderbim.core.root.assign_class(
|
element = blenderbim.core.root.assign_class(
|
||||||
tool.Ifc,
|
tool.Ifc,
|
||||||
@@ -415,10 +405,7 @@ class AddType(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
should_add_representation=True,
|
should_add_representation=True,
|
||||||
context=body,
|
context=body,
|
||||||
)
|
)
|
||||||
bpy.ops.object.select_all(action="DESELECT")
|
tool.Blender.select_and_activate_single_object(obj)
|
||||||
bpy.context.view_layer.objects.active = None
|
|
||||||
bpy.context.view_layer.objects.active = obj
|
|
||||||
obj.select_set(True)
|
|
||||||
bpy.ops.bim.add_roof()
|
bpy.ops.bim.add_roof()
|
||||||
|
|
||||||
bpy.ops.bim.load_type_thumbnails(ifc_class=ifc_class)
|
bpy.ops.bim.load_type_thumbnails(ifc_class=ifc_class)
|
||||||
|
|||||||
Reference in New Issue
Block a user