mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 17:31:45 +00:00
New feature to calculate total length of selected edges
This commit is contained in:
@@ -169,6 +169,7 @@ if bpy is not None:
|
||||
operator.SelectIfcPatchInput,
|
||||
operator.SelectIfcPatchOutput,
|
||||
operator.ExecuteIfcPatch,
|
||||
operator.CalculateEdgeLengths,
|
||||
prop.StrProperty,
|
||||
prop.Variable,
|
||||
prop.Role,
|
||||
@@ -213,6 +214,7 @@ if bpy is not None:
|
||||
ui.BIM_PT_documentation,
|
||||
ui.BIM_PT_bim,
|
||||
ui.BIM_PT_psets,
|
||||
ui.BIM_PT_qto,
|
||||
ui.BIM_PT_classifications,
|
||||
ui.BIM_PT_document_information,
|
||||
ui.BIM_PT_constraints,
|
||||
|
||||
@@ -3314,3 +3314,20 @@ class SelectIfcPatchOutput(bpy.types.Operator):
|
||||
def invoke(self, context, event):
|
||||
context.window_manager.fileselect_add(self)
|
||||
return {'RUNNING_MODAL'}
|
||||
|
||||
|
||||
class CalculateEdgeLengths(bpy.types.Operator):
|
||||
bl_idname = 'bim.calculate_edge_lengths'
|
||||
bl_label = 'Calculate Edge Lengths'
|
||||
|
||||
def execute(self, context):
|
||||
result = 0
|
||||
for obj in bpy.context.selected_objects:
|
||||
if not obj.data or not obj.data.edges:
|
||||
continue
|
||||
for edge in obj.data.edges:
|
||||
if edge.select:
|
||||
result += (obj.data.vertices[edge.vertices[1]].co -
|
||||
obj.data.vertices[edge.vertices[0]].co).length
|
||||
bpy.context.scene.BIMProperties.qto_result = str(result)
|
||||
return {'FINISHED'}
|
||||
|
||||
@@ -1087,6 +1087,7 @@ class BIMProperties(PropertyGroup):
|
||||
ifc_patch_input: StringProperty(default='', name='IFC Patch Input IFC')
|
||||
ifc_patch_output: StringProperty(default='', name='IFC Patch Output IFC')
|
||||
ifc_patch_args: StringProperty(default='', name='Arguments')
|
||||
qto_result: StringProperty(default='', name='Qto Result')
|
||||
|
||||
|
||||
class BCFProperties(PropertyGroup):
|
||||
|
||||
@@ -69,6 +69,26 @@ class BIM_PT_object(Panel):
|
||||
row = layout.row()
|
||||
row.prop(props, 'relating_structure')
|
||||
|
||||
row = layout.row()
|
||||
row.prop(props, 'material_type')
|
||||
|
||||
layout.label(text='Structural Boundary Condition:')
|
||||
|
||||
row = layout.row()
|
||||
row.prop(props, 'has_boundary_condition')
|
||||
|
||||
if bpy.context.active_object.BIMObjectProperties.has_boundary_condition:
|
||||
row = layout.row()
|
||||
row.prop(props.boundary_condition, 'name')
|
||||
for index, attribute in enumerate(props.boundary_condition.attributes):
|
||||
row = layout.row(align=True)
|
||||
row.prop(attribute, 'name', text='')
|
||||
row.prop(attribute, 'string_value', text='')
|
||||
|
||||
row = layout.row()
|
||||
row.prop(props, 'structural_member_connection')
|
||||
|
||||
|
||||
class BIM_PT_object_psets(Panel):
|
||||
bl_label = 'IFC Object Property Sets'
|
||||
bl_idname = 'BIM_PT_object_psets'
|
||||
@@ -147,25 +167,6 @@ class BIM_PT_object_qto(Panel):
|
||||
op.qto_index = index
|
||||
op.prop_index = index2
|
||||
|
||||
row = layout.row()
|
||||
row.prop(props, 'material_type')
|
||||
|
||||
layout.label(text='Structural Boundary Condition:')
|
||||
|
||||
row = layout.row()
|
||||
row.prop(props, 'has_boundary_condition')
|
||||
|
||||
if bpy.context.active_object.BIMObjectProperties.has_boundary_condition:
|
||||
row = layout.row()
|
||||
row.prop(props.boundary_condition, 'name')
|
||||
for index, attribute in enumerate(props.boundary_condition.attributes):
|
||||
row = layout.row(align=True)
|
||||
row.prop(attribute, 'name', text='')
|
||||
row.prop(attribute, 'string_value', text='')
|
||||
|
||||
row = layout.row()
|
||||
row.prop(props, 'structural_member_connection')
|
||||
|
||||
|
||||
class BIM_PT_document_information(Panel):
|
||||
bl_label = 'IFC Documents'
|
||||
@@ -483,6 +484,27 @@ class BIM_PT_psets(Panel):
|
||||
row.operator('bim.remove_property_template', icon='X', text='').index = index
|
||||
|
||||
|
||||
class BIM_PT_qto(Panel):
|
||||
bl_label = 'IFC Quantity Take-off'
|
||||
bl_idname = 'BIM_PT_qto'
|
||||
#bl_options = {'DEFAULT_CLOSED'}
|
||||
bl_space_type = 'PROPERTIES'
|
||||
bl_region_type = 'WINDOW'
|
||||
bl_context = 'scene'
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
props = context.scene.BIMProperties
|
||||
|
||||
row = layout.row()
|
||||
layout.label(text="Results:")
|
||||
row = layout.row()
|
||||
row.prop(props, 'qto_result', text='')
|
||||
|
||||
row = layout.row(align=True)
|
||||
row.operator("bim.calculate_edge_lengths")
|
||||
|
||||
|
||||
class BIM_PT_classifications(Panel):
|
||||
bl_label = 'IFC Classifications References'
|
||||
bl_idname = 'BIM_PT_classifications'
|
||||
|
||||
Reference in New Issue
Block a user