mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 01:11:40 +00:00
New debug panel to create shapes from STEP IDs. See #977.
This commit is contained in:
@@ -199,6 +199,7 @@ if bpy is not None:
|
||||
operator.AddDrawingStyleAttribute,
|
||||
operator.RemoveDrawingStyleAttribute,
|
||||
operator.CopyPropertyToSelection,
|
||||
operator.CreateShapeFromStepId,
|
||||
prop.StrProperty,
|
||||
prop.Variable,
|
||||
prop.Role,
|
||||
@@ -227,6 +228,7 @@ if bpy is not None:
|
||||
prop.BcfTopicRelatedTopic,
|
||||
prop.Subcontext,
|
||||
prop.BIMProperties,
|
||||
prop.BIMDebugProperties,
|
||||
prop.BCFProperties,
|
||||
prop.DocProperties,
|
||||
prop.BIMLibrary,
|
||||
@@ -267,6 +269,7 @@ if bpy is not None:
|
||||
ui.BIM_PT_cobie,
|
||||
ui.BIM_PT_patch,
|
||||
ui.BIM_PT_mvd,
|
||||
ui.BIM_PT_debug,
|
||||
ui.BIM_PT_material,
|
||||
ui.BIM_PT_mesh,
|
||||
ui.BIM_PT_object,
|
||||
@@ -329,6 +332,7 @@ if bpy is not None:
|
||||
bpy.types.TOPBAR_MT_file_export.append(menu_func_export)
|
||||
bpy.types.TOPBAR_MT_file_import.append(menu_func_import)
|
||||
bpy.types.Scene.BIMProperties = bpy.props.PointerProperty(type=prop.BIMProperties)
|
||||
bpy.types.Scene.BIMDebugProperties = bpy.props.PointerProperty(type=prop.BIMDebugProperties)
|
||||
bpy.types.Scene.BCFProperties = bpy.props.PointerProperty(type=prop.BCFProperties)
|
||||
bpy.types.Scene.DocProperties = bpy.props.PointerProperty(type=prop.DocProperties)
|
||||
bpy.types.Scene.BIMLibrary = bpy.props.PointerProperty(type=prop.BIMLibrary)
|
||||
@@ -358,6 +362,7 @@ if bpy is not None:
|
||||
bpy.types.TOPBAR_MT_file_export.remove(menu_func_export)
|
||||
bpy.types.TOPBAR_MT_file_import.remove(menu_func_import)
|
||||
del(bpy.types.Scene.BIMProperties)
|
||||
del(bpy.types.Scene.BIMDebugProperties)
|
||||
del(bpy.types.Scene.BCFProperties)
|
||||
del(bpy.types.Scene.DocProperties)
|
||||
del(bpy.types.Scene.MapConversion)
|
||||
|
||||
@@ -3940,3 +3940,23 @@ class RemoveDrawingStyleAttribute(bpy.types.Operator):
|
||||
props = bpy.context.scene.camera.data.BIMCameraProperties
|
||||
context.scene.DocProperties.drawing_styles[props.active_drawing_style_index].attributes.remove(self.index)
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
class CreateShapeFromStepId(bpy.types.Operator):
|
||||
bl_idname = 'bim.create_shape_from_step_id'
|
||||
bl_label = 'Create Shape From STEP ID'
|
||||
|
||||
def execute(self, context):
|
||||
logger = logging.getLogger('ImportIFC')
|
||||
self.ifc_import_settings = import_ifc.IfcImportSettings.factory(bpy.context, ifc.IfcStore.path, logger)
|
||||
self.file = ifc.IfcStore.get_file()
|
||||
element = self.file.by_id(int(bpy.context.scene.BIMDebugProperties.step_id))
|
||||
settings = ifcopenshell.geom.settings()
|
||||
#settings.set(settings.INCLUDE_CURVES, True)
|
||||
shape = ifcopenshell.geom.create_shape(settings, element)
|
||||
ifc_importer = import_ifc.IfcImporter(self.ifc_import_settings)
|
||||
ifc_importer.file = self.file
|
||||
mesh = ifc_importer.create_mesh(element, shape)
|
||||
obj = bpy.data.objects.new('Debug', mesh)
|
||||
bpy.context.scene.collection.objects.link(obj)
|
||||
return {'FINISHED'}
|
||||
|
||||
@@ -1351,6 +1351,10 @@ class BIMObjectProperties(PropertyGroup):
|
||||
representation_contexts: CollectionProperty(name="Representation Contexts", type=Subcontext)
|
||||
|
||||
|
||||
class BIMDebugProperties(PropertyGroup):
|
||||
step_id: IntProperty(name="STEP ID")
|
||||
|
||||
|
||||
class BIMMaterialProperties(PropertyGroup):
|
||||
is_external: BoolProperty(name="Has External Definition")
|
||||
location: StringProperty(name="Location")
|
||||
|
||||
@@ -2006,6 +2006,27 @@ class BIM_PT_misc_utilities(Panel):
|
||||
row.operator("bim.set_viewport_shadow_from_sun")
|
||||
|
||||
|
||||
class BIM_PT_debug(Panel):
|
||||
bl_label = "IFC Debug"
|
||||
bl_idname = "BIM_PT_debug"
|
||||
bl_options = {'DEFAULT_CLOSED'}
|
||||
bl_space_type = 'PROPERTIES'
|
||||
bl_region_type = 'WINDOW'
|
||||
bl_context = "scene"
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
scene = context.scene
|
||||
bim_props = scene.BIMProperties
|
||||
debug_props = scene.BIMDebugProperties
|
||||
|
||||
row = layout.row()
|
||||
row.prop(debug_props, 'step_id', text='')
|
||||
row = layout.row()
|
||||
row.operator('bim.create_shape_from_step_id')
|
||||
|
||||
|
||||
def ifc_units(self, context):
|
||||
scene = context.scene
|
||||
props = context.scene.BIMProperties
|
||||
|
||||
Reference in New Issue
Block a user