mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 17:31:45 +00:00
Minor fix. See #2533.
This commit is contained in:
@@ -32,6 +32,7 @@ from blenderbim.bim.ifc import IfcStore
|
||||
from ifcopenshell.api.pset.data import Data
|
||||
from ifcopenshell.api.cost.data import Data as CostData
|
||||
from blenderbim.bim.module.pset.qto_calculator import QtoCalculator
|
||||
from blenderbim.bim.module.pset.calc_quantity_function_mapper import mapper
|
||||
|
||||
|
||||
class Operator:
|
||||
@@ -100,13 +101,13 @@ class EnablePsetEditing(bpy.types.Operator):
|
||||
if not prop_template.is_a("IfcSimplePropertyTemplate"):
|
||||
continue # Other types not yet supported
|
||||
if prop_template.TemplateType == "P_SINGLEVALUE":
|
||||
self.load_single_value(prop_template, data)
|
||||
self.load_single_value(pset_template, prop_template, data)
|
||||
elif prop_template.TemplateType.startswith("Q_"):
|
||||
self.load_single_value(prop_template, data)
|
||||
self.load_single_value(pset_template, prop_template, data)
|
||||
elif prop_template.TemplateType == "P_ENUMERATEDVALUE":
|
||||
self.load_enumerated_value(prop_template, data)
|
||||
|
||||
def load_single_value(self, prop_template, data):
|
||||
def load_single_value(self, pset_template, prop_template, data):
|
||||
prop = self.props.properties.add()
|
||||
prop.name = prop_template.Name
|
||||
prop.value_type = "IfcPropertySingleValue"
|
||||
@@ -115,6 +116,7 @@ class EnablePsetEditing(bpy.types.Operator):
|
||||
metadata.is_null = data.get(prop_template.Name, None) is None
|
||||
metadata.is_optional = True
|
||||
metadata.is_uri = prop_template.PrimaryMeasureType == "IfcURIReference"
|
||||
metadata.has_calculator = bool(mapper.get(pset_template.Name, {}).get(prop_template.Name, None))
|
||||
metadata.data_type = self.get_data_type(prop_template)
|
||||
|
||||
if metadata.data_type == "string":
|
||||
@@ -381,7 +383,6 @@ class CalculateQuantity(bpy.types.Operator):
|
||||
return unit_settings.length_unit[0 : -len("METERS")], "METRE"
|
||||
|
||||
|
||||
|
||||
class GuessQuantity(bpy.types.Operator):
|
||||
bl_idname = "bim.guess_quantity"
|
||||
bl_label = "Guess Quantity"
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
from bpy.types import Panel
|
||||
from blenderbim.bim.ifc import IfcStore
|
||||
from blenderbim.bim.helper import prop_with_search
|
||||
from blenderbim.bim.module.pset.calc_quantity_function_mapper import mapper
|
||||
from blenderbim.bim.module.pset.data import (
|
||||
ObjectPsetsData,
|
||||
ObjectQtosData,
|
||||
@@ -140,11 +139,10 @@ def draw_psetqto_ui(context, pset_id, pset, props, layout, obj_type):
|
||||
def draw_psetqto_editable_ui(box, props, prop):
|
||||
row = box.row(align=True)
|
||||
draw_property(prop, row, copy_operator="bim.copy_property_to_selection")
|
||||
qto_name = ObjectQtosData.data['qtos'][0]['Name']
|
||||
if qto_name in mapper.keys():
|
||||
if prop.name in mapper[qto_name]:
|
||||
op = row.operator("bim.calculate_quantity", icon="MOD_EDGESPLIT", text="")
|
||||
op.prop = prop.name
|
||||
if prop.metadata.has_calculator:
|
||||
op = row.operator("bim.calculate_quantity", icon="MOD_EDGESPLIT", text="")
|
||||
op.prop = prop.name
|
||||
# Old "guess quantity" feature to be removed once new calculator is comprehensive
|
||||
if (
|
||||
"length" in prop.name.lower()
|
||||
or "width" in prop.name.lower()
|
||||
|
||||
@@ -226,6 +226,7 @@ class Attribute(PropertyGroup):
|
||||
is_optional: BoolProperty(name="Is Optional")
|
||||
is_uri: BoolProperty(name="Is Uri", default=False)
|
||||
is_selected: BoolProperty(name="Is Selected", default=False)
|
||||
has_calculator: BoolProperty(name="Has Calculator", default=False)
|
||||
|
||||
def get_value(self):
|
||||
if self.is_null:
|
||||
|
||||
Reference in New Issue
Block a user