mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-18 22:33:33 +00:00
Spatial manager elevation in projects units and some bug fixed
1) Elevation prop now is taking into account project units (previously it was hardcoded to meters) 2) Fixed a bug that occured when you started changing spatial element name/elevation right after you loaded spatial manager. https://i.imgur.com/1keMGus.png
This commit is contained in:
@@ -32,6 +32,7 @@ from bpy.props import (
|
|||||||
)
|
)
|
||||||
import blenderbim.tool as tool
|
import blenderbim.tool as tool
|
||||||
import blenderbim.core.geometry
|
import blenderbim.core.geometry
|
||||||
|
import ifcopenshell
|
||||||
|
|
||||||
|
|
||||||
def update_elevation(self, context):
|
def update_elevation(self, context):
|
||||||
@@ -43,9 +44,10 @@ def update_elevation(self, context):
|
|||||||
|
|
||||||
|
|
||||||
def update_active_container_index(self, context):
|
def update_active_container_index(self, context):
|
||||||
|
si_conversion = ifcopenshell.util.unit.calculate_unit_scale(tool.Ifc.get())
|
||||||
self.active_container_id = self.containers[self.active_container_index].ifc_definition_id
|
self.active_container_id = self.containers[self.active_container_index].ifc_definition_id
|
||||||
self.container_name = self.containers[self.active_container_index].name
|
self.container_name = self.containers[self.active_container_index].name
|
||||||
self.elevation = self.containers[self.active_container_index].elevation
|
self.elevation = self.containers[self.active_container_index].elevation * si_conversion
|
||||||
|
|
||||||
|
|
||||||
def updateContainerName(self, context):
|
def updateContainerName(self, context):
|
||||||
@@ -90,5 +92,5 @@ class BIMSpatialManagerProperties(PropertyGroup):
|
|||||||
active_container_index: IntProperty(name="Active Container Index", update=update_active_container_index)
|
active_container_index: IntProperty(name="Active Container Index", update=update_active_container_index)
|
||||||
active_container_id: IntProperty(name="Active Container Id")
|
active_container_id: IntProperty(name="Active Container Id")
|
||||||
container_name: StringProperty(name="Container Name")
|
container_name: StringProperty(name="Container Name")
|
||||||
elevation: FloatProperty(name="Elevation", update=update_elevation)
|
elevation: FloatProperty(name="Elevation", update=update_elevation, subtype="DISTANCE")
|
||||||
is_container_update_enabled: BoolProperty(name="Is Container Update Enabled", default=True) # TODO:review
|
is_container_update_enabled: BoolProperty(name="Is Container Update Enabled", default=True) # TODO:review
|
||||||
|
|||||||
@@ -207,6 +207,8 @@ class Spatial(blenderbim.core.tool.Spatial):
|
|||||||
if object.is_a("IfcSpatialElement") or object.is_a("IfcSpatialStructureElement"):
|
if object.is_a("IfcSpatialElement") or object.is_a("IfcSpatialStructureElement"):
|
||||||
cls.create_new_storey_li(object, 0)
|
cls.create_new_storey_li(object, 0)
|
||||||
cls.props.is_container_update_enabled = True
|
cls.props.is_container_update_enabled = True
|
||||||
|
# triggers spatial manager props setup
|
||||||
|
cls.props.active_container_index = 0
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def create_new_storey_li(cls, element, level_index):
|
def create_new_storey_li(cls, element, level_index):
|
||||||
|
|||||||
Reference in New Issue
Block a user