mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-22 17:21:05 +00:00
Add support for importing area and volume units
This commit is contained in:
@@ -494,6 +494,7 @@ class IfcImporter():
|
|||||||
products.extend(self.get_products_from_shape_representation(inverse_element))
|
products.extend(self.get_products_from_shape_representation(inverse_element))
|
||||||
return products
|
return products
|
||||||
|
|
||||||
|
# TODO migrate to utility
|
||||||
def replace_attribute(self, element, old, new):
|
def replace_attribute(self, element, old, new):
|
||||||
for i, attribute in enumerate(element):
|
for i, attribute in enumerate(element):
|
||||||
if attribute == old:
|
if attribute == old:
|
||||||
@@ -1358,6 +1359,12 @@ class IfcImporter():
|
|||||||
bpy.context.scene.unit_settings.length_unit = 'INCHES'
|
bpy.context.scene.unit_settings.length_unit = 'INCHES'
|
||||||
elif unit.Name == 'foot':
|
elif unit.Name == 'foot':
|
||||||
bpy.context.scene.unit_settings.length_unit = 'FEET'
|
bpy.context.scene.unit_settings.length_unit = 'FEET'
|
||||||
|
elif unit.is_a('IfcNamedUnit') and unit.UnitType == 'AREAUNIT':
|
||||||
|
bpy.context.scene.BIMProperties.area_unit = '{}{}'.format(
|
||||||
|
unit.Prefix + '/' if hasattr(unit, 'Prefix') and unit.Prefix else '', unit.Name)
|
||||||
|
elif unit.is_a('IfcNamedUnit') and unit.UnitType == 'VOLUMEUNIT':
|
||||||
|
bpy.context.scene.BIMProperties.volume_unit = '{}{}'.format(
|
||||||
|
unit.Prefix + '/' if hasattr(unit, 'Prefix') and unit.Prefix else '', unit.Name)
|
||||||
|
|
||||||
def create_geometric_representation_contexts(self):
|
def create_geometric_representation_contexts(self):
|
||||||
bpy.context.scene.BIMProperties.has_model_context = False
|
bpy.context.scene.BIMProperties.has_model_context = False
|
||||||
|
|||||||
@@ -1088,6 +1088,8 @@ class BIMProperties(PropertyGroup):
|
|||||||
ifc_patch_output: StringProperty(default='', name='IFC Patch Output IFC')
|
ifc_patch_output: StringProperty(default='', name='IFC Patch Output IFC')
|
||||||
ifc_patch_args: StringProperty(default='', name='Arguments')
|
ifc_patch_args: StringProperty(default='', name='Arguments')
|
||||||
qto_result: StringProperty(default='', name='Qto Result')
|
qto_result: StringProperty(default='', name='Qto Result')
|
||||||
|
area_unit: StringProperty(default='', name='Area Unit')
|
||||||
|
volume_unit: StringProperty(default='', name='Volume Unit')
|
||||||
|
|
||||||
|
|
||||||
class BCFProperties(PropertyGroup):
|
class BCFProperties(PropertyGroup):
|
||||||
|
|||||||
@@ -487,15 +487,23 @@ class BIM_PT_psets(Panel):
|
|||||||
class BIM_PT_qto(Panel):
|
class BIM_PT_qto(Panel):
|
||||||
bl_label = 'IFC Quantity Take-off'
|
bl_label = 'IFC Quantity Take-off'
|
||||||
bl_idname = 'BIM_PT_qto'
|
bl_idname = 'BIM_PT_qto'
|
||||||
#bl_options = {'DEFAULT_CLOSED'}
|
bl_options = {'DEFAULT_CLOSED'}
|
||||||
bl_space_type = 'PROPERTIES'
|
bl_space_type = 'PROPERTIES'
|
||||||
bl_region_type = 'WINDOW'
|
bl_region_type = 'WINDOW'
|
||||||
bl_context = 'scene'
|
bl_context = 'scene'
|
||||||
|
|
||||||
def draw(self, context):
|
def draw(self, context):
|
||||||
layout = self.layout
|
layout = self.layout
|
||||||
|
layout.use_property_split = True
|
||||||
props = context.scene.BIMProperties
|
props = context.scene.BIMProperties
|
||||||
|
|
||||||
|
row = layout.row()
|
||||||
|
layout.label(text="Units:")
|
||||||
|
row = layout.row()
|
||||||
|
row.prop(props, 'area_unit')
|
||||||
|
row = layout.row()
|
||||||
|
row.prop(props, 'volume_unit')
|
||||||
|
|
||||||
row = layout.row()
|
row = layout.row()
|
||||||
layout.label(text="Results:")
|
layout.label(text="Results:")
|
||||||
row = layout.row()
|
row = layout.row()
|
||||||
|
|||||||
Reference in New Issue
Block a user