mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-26 18:21:59 +00:00
type dropdown now references ifc data types
This commit is contained in:
@@ -394,7 +394,7 @@ class BIM_OT_remove_property_to_edit(bpy.types.Operator):
|
|||||||
option: bpy.props.StringProperty()
|
option: bpy.props.StringProperty()
|
||||||
|
|
||||||
def execute(self, context):
|
def execute(self, context):
|
||||||
getattr(context.scene, self.option).remove()
|
getattr(context.scene, self.option).remove(self.index)
|
||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
|
|
||||||
|
|
||||||
@@ -469,6 +469,9 @@ class BIM_OT_add_edit_custom_property(bpy.types.Operator):
|
|||||||
|
|
||||||
for prop in props:
|
for prop in props:
|
||||||
value = getattr(prop, prop.get_value_name())
|
value = getattr(prop, prop.get_value_name())
|
||||||
|
primary_measure_type = prop.primary_measure_type
|
||||||
|
value_ifc_entity = getattr(self.file, f"create{primary_measure_type}")(value)
|
||||||
|
|
||||||
new_pset = ifcopenshell.api.run(
|
new_pset = ifcopenshell.api.run(
|
||||||
"pset.add_pset",
|
"pset.add_pset",
|
||||||
self.file,
|
self.file,
|
||||||
@@ -479,7 +482,7 @@ class BIM_OT_add_edit_custom_property(bpy.types.Operator):
|
|||||||
"pset.edit_pset",
|
"pset.edit_pset",
|
||||||
self.file,
|
self.file,
|
||||||
pset=new_pset,
|
pset=new_pset,
|
||||||
properties={prop.property_name:value}
|
properties={prop.property_name:value_ifc_entity}
|
||||||
)
|
)
|
||||||
|
|
||||||
self.report({'INFO'}, 'Finished applying changes')
|
self.report({'INFO'}, 'Finished applying changes')
|
||||||
|
|||||||
@@ -18,7 +18,8 @@
|
|||||||
|
|
||||||
import bpy
|
import bpy
|
||||||
import blenderbim.bim.schema
|
import blenderbim.bim.schema
|
||||||
from blenderbim.bim.prop import Attribute
|
from blenderbim.bim.prop import Attribute, PRIMARY_MEASURE_TYPE
|
||||||
|
import ifcopenshell
|
||||||
from ifcopenshell.api.pset.data import Data
|
from ifcopenshell.api.pset.data import Data
|
||||||
from blenderbim.bim.ifc import IfcStore
|
from blenderbim.bim.ifc import IfcStore
|
||||||
from bpy.types import PropertyGroup
|
from bpy.types import PropertyGroup
|
||||||
@@ -188,23 +189,25 @@ class AddEditProperties(PropertyGroup):
|
|||||||
bool_value: BoolProperty(name="Value")
|
bool_value: BoolProperty(name="Value")
|
||||||
int_value: IntProperty(name="Value")
|
int_value: IntProperty(name="Value")
|
||||||
float_value: FloatProperty(name="Value")
|
float_value: FloatProperty(name="Value")
|
||||||
data_type: EnumProperty(
|
primary_measure_type: EnumProperty(
|
||||||
items=[
|
items=[
|
||||||
("string", "String", "" ),
|
(x, x, "")
|
||||||
("boolean", "True/False", "" ),
|
for x in PRIMARY_MEASURE_TYPE
|
||||||
("integer", "Integer", "" ),
|
],
|
||||||
("float", "Number", "" )],
|
default="IfcLabel",
|
||||||
default="string"
|
name="Primary Measure Type"
|
||||||
)
|
)
|
||||||
|
|
||||||
def get_value_name(self):
|
def get_value_name(self):
|
||||||
if self.data_type == "string":
|
ifc_data_type = IfcStore.get_schema().declaration_by_name(self.primary_measure_type)
|
||||||
|
data_type = ifcopenshell.util.attribute.get_primitive_type(ifc_data_type)
|
||||||
|
if data_type == "string":
|
||||||
return "string_value"
|
return "string_value"
|
||||||
elif self.data_type == "boolean":
|
elif data_type == "boolean":
|
||||||
return "bool_value"
|
return "bool_value"
|
||||||
elif self.data_type == "integer":
|
elif data_type == "integer":
|
||||||
return "int_value"
|
return "int_value"
|
||||||
elif self.data_type == "float":
|
elif data_type == "float":
|
||||||
return "float_value"
|
return "float_value"
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -441,7 +441,7 @@ class BIM_PT_add_edit_custom_properties(Panel):
|
|||||||
row.prop(prop, "pset_name", text="")
|
row.prop(prop, "pset_name", text="")
|
||||||
row.prop(prop, "property_name", text="")
|
row.prop(prop, "property_name", text="")
|
||||||
row.prop(prop, prop.get_value_name(), text="")
|
row.prop(prop, prop.get_value_name(), text="")
|
||||||
row.prop(prop, "data_type", text="")
|
row.prop(prop, "primary_measure_type", text="")
|
||||||
op = row.operator("bim.remove_property_to_edit",icon="PANEL_CLOSE", text="")
|
op = row.operator("bim.remove_property_to_edit",icon="PANEL_CLOSE", text="")
|
||||||
op.index = index
|
op.index = index
|
||||||
op.option = "AddEditProperties"
|
op.option = "AddEditProperties"
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
import os
|
import os
|
||||||
import bpy
|
import bpy
|
||||||
import ifcopenshell
|
import ifcopenshell
|
||||||
from blenderbim.bim.prop import StrProperty, Attribute
|
from blenderbim.bim.prop import StrProperty, Attribute, PRIMARY_MEASURE_TYPE
|
||||||
from blenderbim.bim.ifc import IfcStore
|
from blenderbim.bim.ifc import IfcStore
|
||||||
from bpy.types import PropertyGroup
|
from bpy.types import PropertyGroup
|
||||||
from bpy.props import (
|
from bpy.props import (
|
||||||
@@ -146,116 +146,7 @@ class PropTemplate(PropertyGroup):
|
|||||||
primary_measure_type: EnumProperty(
|
primary_measure_type: EnumProperty(
|
||||||
items=[
|
items=[
|
||||||
(x, x, "")
|
(x, x, "")
|
||||||
for x in [
|
for x in PRIMARY_MEASURE_TYPE
|
||||||
"IfcInteger",
|
|
||||||
"IfcReal",
|
|
||||||
"IfcBoolean",
|
|
||||||
"IfcIdentifier",
|
|
||||||
"IfcText",
|
|
||||||
"IfcLabel",
|
|
||||||
"IfcLogical",
|
|
||||||
"IfcDateTime",
|
|
||||||
"IfcDate",
|
|
||||||
"IfcTime",
|
|
||||||
"IfcDuration",
|
|
||||||
"IfcTimeStamp",
|
|
||||||
"IfcPositiveInteger",
|
|
||||||
"IfcBinary",
|
|
||||||
"IfcVolumeMeasure",
|
|
||||||
"IfcTimeMeasure",
|
|
||||||
"IfcThermodynamicTemperatureMeasure",
|
|
||||||
"IfcSolidAngleMeasure",
|
|
||||||
"IfcPositiveRatioMeasure",
|
|
||||||
"IfcRatioMeasure",
|
|
||||||
"IfcPositivePlaneAngleMeasure",
|
|
||||||
"IfcPlaneAngleMeasure",
|
|
||||||
"IfcParameterValue",
|
|
||||||
"IfcNumericMeasure",
|
|
||||||
"IfcMassMeasure",
|
|
||||||
"IfcPositiveLengthMeasure",
|
|
||||||
"IfcLengthMeasure",
|
|
||||||
"IfcElectricCurrentMeasure",
|
|
||||||
"IfcDescriptiveMeasure",
|
|
||||||
"IfcCountMeasure",
|
|
||||||
"IfcContextDependentMeasure",
|
|
||||||
"IfcAreaMeasure",
|
|
||||||
"IfcAmountOfSubstanceMeasure",
|
|
||||||
"IfcLuminousIntensityMeasure",
|
|
||||||
"IfcNormalisedRatioMeasure",
|
|
||||||
"IfcComplexNumber",
|
|
||||||
"IfcNonNegativeLengthMeasure",
|
|
||||||
"IfcAbsorbedDoseMeasure",
|
|
||||||
"IfcAccelerationMeasure",
|
|
||||||
"IfcAngularVelocityMeasure",
|
|
||||||
"IfcAreaDensityMeasure",
|
|
||||||
"IfcCompoundPlaneAngleMeasure",
|
|
||||||
"IfcCurvatureMeasure",
|
|
||||||
"IfcDoseEquivalentMeasure",
|
|
||||||
"IfcDynamicViscosityMeasure",
|
|
||||||
"IfcElectricCapacitanceMeasure",
|
|
||||||
"IfcElectricChargeMeasure",
|
|
||||||
"IfcElectricConductanceMeasure",
|
|
||||||
"IfcElectricResistanceMeasure",
|
|
||||||
"IfcElectricVoltageMeasure",
|
|
||||||
"IfcEnergyMeasure",
|
|
||||||
"IfcForceMeasure",
|
|
||||||
"IfcFrequencyMeasure",
|
|
||||||
"IfcHeatFluxDensityMeasure",
|
|
||||||
"IfcHeatingValueMeasure",
|
|
||||||
"IfcIlluminanceMeasure",
|
|
||||||
"IfcInductanceMeasure",
|
|
||||||
"IfcIntegerCountRateMeasure",
|
|
||||||
"IfcIonConcentrationMeasure",
|
|
||||||
"IfcIsothermalMoistureCapacityMeasure",
|
|
||||||
"IfcKinematicViscosityMeasure",
|
|
||||||
"IfcLinearForceMeasure",
|
|
||||||
"IfcLinearMomentMeasure",
|
|
||||||
"IfcLinearStiffnessMeasure",
|
|
||||||
"IfcLinearVelocityMeasure",
|
|
||||||
"IfcLuminousFluxMeasure",
|
|
||||||
"IfcLuminousIntensityDistributionMeasure",
|
|
||||||
"IfcMagneticFluxDensityMeasure",
|
|
||||||
"IfcMagneticFluxMeasure",
|
|
||||||
"IfcMassDensityMeasure",
|
|
||||||
"IfcMassFlowRateMeasure",
|
|
||||||
"IfcMassPerLengthMeasure",
|
|
||||||
"IfcModulusOfElasticityMeasure",
|
|
||||||
"IfcModulusOfLinearSubgradeReactionMeasure",
|
|
||||||
"IfcModulusOfRotationalSubgradeReactionMeasure",
|
|
||||||
"IfcModulusOfSubgradeReactionMeasure",
|
|
||||||
"IfcMoistureDiffusivityMeasure",
|
|
||||||
"IfcMolecularWeightMeasure",
|
|
||||||
"IfcMomentOfInertiaMeasure",
|
|
||||||
"IfcMonetaryMeasure",
|
|
||||||
"IfcPHMeasure",
|
|
||||||
"IfcPlanarForceMeasure",
|
|
||||||
"IfcPowerMeasure",
|
|
||||||
"IfcPressureMeasure",
|
|
||||||
"IfcRadioActivityMeasure",
|
|
||||||
"IfcRotationalFrequencyMeasure",
|
|
||||||
"IfcRotationalMassMeasure",
|
|
||||||
"IfcRotationalStiffnessMeasure",
|
|
||||||
"IfcSectionModulusMeasure",
|
|
||||||
"IfcSectionalAreaIntegralMeasure",
|
|
||||||
"IfcShearModulusMeasure",
|
|
||||||
"IfcSoundPowerLevelMeasure",
|
|
||||||
"IfcSoundPowerMeasure",
|
|
||||||
"IfcSoundPressureLevelMeasure",
|
|
||||||
"IfcSoundPressureMeasure",
|
|
||||||
"IfcSpecificHeatCapacityMeasure",
|
|
||||||
"IfcTemperatureGradientMeasure",
|
|
||||||
"IfcTemperatureRateOfChangeMeasure",
|
|
||||||
"IfcThermalAdmittanceMeasure",
|
|
||||||
"IfcThermalConductivityMeasure",
|
|
||||||
"IfcThermalExpansionCoefficientMeasure",
|
|
||||||
"IfcThermalResistanceMeasure",
|
|
||||||
"IfcThermalTransmittanceMeasure",
|
|
||||||
"IfcTorqueMeasure",
|
|
||||||
"IfcVaporPermeabilityMeasure",
|
|
||||||
"IfcVolumetricFlowRateMeasure",
|
|
||||||
"IfcWarpingConstantMeasure",
|
|
||||||
"IfcWarpingMomentMeasure",
|
|
||||||
]
|
|
||||||
],
|
],
|
||||||
name="Primary Measure Type",
|
name="Primary Measure Type",
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -40,6 +40,117 @@ cwd = os.path.dirname(os.path.realpath(__file__))
|
|||||||
|
|
||||||
materialpsetnames_enum = []
|
materialpsetnames_enum = []
|
||||||
|
|
||||||
|
PRIMARY_MEASURE_TYPE = [
|
||||||
|
"IfcInteger",
|
||||||
|
"IfcReal",
|
||||||
|
"IfcBoolean",
|
||||||
|
"IfcIdentifier",
|
||||||
|
"IfcText",
|
||||||
|
"IfcLabel",
|
||||||
|
"IfcLogical",
|
||||||
|
"IfcDateTime",
|
||||||
|
"IfcDate",
|
||||||
|
"IfcTime",
|
||||||
|
"IfcDuration",
|
||||||
|
"IfcTimeStamp",
|
||||||
|
"IfcPositiveInteger",
|
||||||
|
"IfcBinary",
|
||||||
|
"IfcVolumeMeasure",
|
||||||
|
"IfcTimeMeasure",
|
||||||
|
"IfcThermodynamicTemperatureMeasure",
|
||||||
|
"IfcSolidAngleMeasure",
|
||||||
|
"IfcPositiveRatioMeasure",
|
||||||
|
"IfcRatioMeasure",
|
||||||
|
"IfcPositivePlaneAngleMeasure",
|
||||||
|
"IfcPlaneAngleMeasure",
|
||||||
|
"IfcParameterValue",
|
||||||
|
"IfcNumericMeasure",
|
||||||
|
"IfcMassMeasure",
|
||||||
|
"IfcPositiveLengthMeasure",
|
||||||
|
"IfcLengthMeasure",
|
||||||
|
"IfcElectricCurrentMeasure",
|
||||||
|
"IfcDescriptiveMeasure",
|
||||||
|
"IfcCountMeasure",
|
||||||
|
"IfcContextDependentMeasure",
|
||||||
|
"IfcAreaMeasure",
|
||||||
|
"IfcAmountOfSubstanceMeasure",
|
||||||
|
"IfcLuminousIntensityMeasure",
|
||||||
|
"IfcNormalisedRatioMeasure",
|
||||||
|
"IfcComplexNumber",
|
||||||
|
"IfcNonNegativeLengthMeasure",
|
||||||
|
"IfcAbsorbedDoseMeasure",
|
||||||
|
"IfcAccelerationMeasure",
|
||||||
|
"IfcAngularVelocityMeasure",
|
||||||
|
"IfcAreaDensityMeasure",
|
||||||
|
"IfcCompoundPlaneAngleMeasure",
|
||||||
|
"IfcCurvatureMeasure",
|
||||||
|
"IfcDoseEquivalentMeasure",
|
||||||
|
"IfcDynamicViscosityMeasure",
|
||||||
|
"IfcElectricCapacitanceMeasure",
|
||||||
|
"IfcElectricChargeMeasure",
|
||||||
|
"IfcElectricConductanceMeasure",
|
||||||
|
"IfcElectricResistanceMeasure",
|
||||||
|
"IfcElectricVoltageMeasure",
|
||||||
|
"IfcEnergyMeasure",
|
||||||
|
"IfcForceMeasure",
|
||||||
|
"IfcFrequencyMeasure",
|
||||||
|
"IfcHeatFluxDensityMeasure",
|
||||||
|
"IfcHeatingValueMeasure",
|
||||||
|
"IfcIlluminanceMeasure",
|
||||||
|
"IfcInductanceMeasure",
|
||||||
|
"IfcIntegerCountRateMeasure",
|
||||||
|
"IfcIonConcentrationMeasure",
|
||||||
|
"IfcIsothermalMoistureCapacityMeasure",
|
||||||
|
"IfcKinematicViscosityMeasure",
|
||||||
|
"IfcLinearForceMeasure",
|
||||||
|
"IfcLinearMomentMeasure",
|
||||||
|
"IfcLinearStiffnessMeasure",
|
||||||
|
"IfcLinearVelocityMeasure",
|
||||||
|
"IfcLuminousFluxMeasure",
|
||||||
|
"IfcLuminousIntensityDistributionMeasure",
|
||||||
|
"IfcMagneticFluxDensityMeasure",
|
||||||
|
"IfcMagneticFluxMeasure",
|
||||||
|
"IfcMassDensityMeasure",
|
||||||
|
"IfcMassFlowRateMeasure",
|
||||||
|
"IfcMassPerLengthMeasure",
|
||||||
|
"IfcModulusOfElasticityMeasure",
|
||||||
|
"IfcModulusOfLinearSubgradeReactionMeasure",
|
||||||
|
"IfcModulusOfRotationalSubgradeReactionMeasure",
|
||||||
|
"IfcModulusOfSubgradeReactionMeasure",
|
||||||
|
"IfcMoistureDiffusivityMeasure",
|
||||||
|
"IfcMolecularWeightMeasure",
|
||||||
|
"IfcMomentOfInertiaMeasure",
|
||||||
|
"IfcMonetaryMeasure",
|
||||||
|
"IfcPHMeasure",
|
||||||
|
"IfcPlanarForceMeasure",
|
||||||
|
"IfcPowerMeasure",
|
||||||
|
"IfcPressureMeasure",
|
||||||
|
"IfcRadioActivityMeasure",
|
||||||
|
"IfcRotationalFrequencyMeasure",
|
||||||
|
"IfcRotationalMassMeasure",
|
||||||
|
"IfcRotationalStiffnessMeasure",
|
||||||
|
"IfcSectionModulusMeasure",
|
||||||
|
"IfcSectionalAreaIntegralMeasure",
|
||||||
|
"IfcShearModulusMeasure",
|
||||||
|
"IfcSoundPowerLevelMeasure",
|
||||||
|
"IfcSoundPowerMeasure",
|
||||||
|
"IfcSoundPressureLevelMeasure",
|
||||||
|
"IfcSoundPressureMeasure",
|
||||||
|
"IfcSpecificHeatCapacityMeasure",
|
||||||
|
"IfcTemperatureGradientMeasure",
|
||||||
|
"IfcTemperatureRateOfChangeMeasure",
|
||||||
|
"IfcThermalAdmittanceMeasure",
|
||||||
|
"IfcThermalConductivityMeasure",
|
||||||
|
"IfcThermalExpansionCoefficientMeasure",
|
||||||
|
"IfcThermalResistanceMeasure",
|
||||||
|
"IfcThermalTransmittanceMeasure",
|
||||||
|
"IfcTorqueMeasure",
|
||||||
|
"IfcVaporPermeabilityMeasure",
|
||||||
|
"IfcVolumetricFlowRateMeasure",
|
||||||
|
"IfcWarpingConstantMeasure",
|
||||||
|
"IfcWarpingMomentMeasure",
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
def update_preset(self, context):
|
def update_preset(self, context):
|
||||||
from blenderbim.bim.data.ui.presets import presets
|
from blenderbim.bim.data.ui.presets import presets
|
||||||
|
|||||||
Reference in New Issue
Block a user