closes #5086: a preference to assign which classes display as wireframe upon opening the IFC file

This commit is contained in:
Ryan Schultz
2024-12-07 10:58:58 -06:00
parent 8bba25497b
commit 93ec1cbfc2
3 changed files with 13 additions and 0 deletions
+6
View File
@@ -203,6 +203,8 @@ class IfcImporter:
self.progress = 0
self.material_creator = MaterialCreator(ifc_import_settings, self)
classes_to_wireframe_str = bpy.context.scene.DocProperties.classes_to_wireframe
self.classes_to_wireframe_list = [word.strip() for word in classes_to_wireframe_str.split(",")]
def profile_code(self, message: str) -> None:
if not self.time:
@@ -815,6 +817,10 @@ class IfcImporter:
obj = bpy.data.objects.new(tool.Loader.get_name(element), mesh)
self.link_element(element, obj)
for ifcclass in self.classes_to_wireframe_list:
if element.is_a(ifcclass):
obj.display_type = 'WIRE'
if shape:
# We use numpy here because Blender mathutils.Matrix is not accurate enough
mat = np.array(shape.transformation.matrix).reshape((4, 4), order="F")
@@ -402,6 +402,11 @@ class DocProperties(PropertyGroup):
magic_font_scale: bpy.props.FloatProperty(default=0.004118616, name="Font Scale Factor")
imperial_precision: StringProperty(default="1/32", name="Imperial Precision")
tolerance: bpy.props.FloatProperty(default=0.00001, name="A tolerance used when selecting objects")
classes_to_wireframe: StringProperty(
default="IfcVirtualelement",
name="Classes to Wireframe",
description = "Upon import, these classes will display as wireframe.\nEx: IfcVirtualelement, IfcSpace"
)
class BIMCameraProperties(PropertyGroup):
+2
View File
@@ -383,6 +383,8 @@ class BIM_ADDON_preferences(bpy.types.AddonPreferences):
row.prop(context.scene.DocProperties, "imperial_precision")
row = self.layout.row()
row.prop(context.scene.DocProperties, "tolerance")
row = self.layout.row()
row.prop(context.scene.DocProperties, "classes_to_wireframe")
# Scene panel groups