mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-19 14:41:25 +00:00
Clear IfcStore when you load a new file. See #1222.
This commit is contained in:
@@ -163,6 +163,7 @@ if bpy is not None:
|
|||||||
bpy.utils.register_class(cls)
|
bpy.utils.register_class(cls)
|
||||||
bpy.app.handlers.depsgraph_update_post.append(on_register)
|
bpy.app.handlers.depsgraph_update_post.append(on_register)
|
||||||
bpy.app.handlers.load_post.append(prop.setDefaultProperties)
|
bpy.app.handlers.load_post.append(prop.setDefaultProperties)
|
||||||
|
bpy.app.handlers.load_post.append(prop.clearIfcStore)
|
||||||
bpy.types.TOPBAR_MT_file_export.append(menu_func_export)
|
bpy.types.TOPBAR_MT_file_export.append(menu_func_export)
|
||||||
bpy.types.TOPBAR_MT_file_import.append(menu_func_import)
|
bpy.types.TOPBAR_MT_file_import.append(menu_func_import)
|
||||||
bpy.types.Scene.BIMProperties = bpy.props.PointerProperty(type=prop.BIMProperties)
|
bpy.types.Scene.BIMProperties = bpy.props.PointerProperty(type=prop.BIMProperties)
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
from bpy.types import Panel
|
from bpy.types import Panel
|
||||||
from blenderbim.bim.module.aggregate.data import Data
|
from blenderbim.bim.module.aggregate.data import Data
|
||||||
|
from blenderbim.bim.ifc import IfcStore
|
||||||
|
|
||||||
|
|
||||||
class BIM_PT_aggregate(Panel):
|
class BIM_PT_aggregate(Panel):
|
||||||
@@ -15,6 +16,8 @@ class BIM_PT_aggregate(Panel):
|
|||||||
props = context.active_object.BIMObjectProperties
|
props = context.active_object.BIMObjectProperties
|
||||||
if not props.ifc_definition_id:
|
if not props.ifc_definition_id:
|
||||||
return False
|
return False
|
||||||
|
if not IfcStore.get_file().by_id(props.ifc_definition_id).is_a("IfcObjectDefinition"):
|
||||||
|
return False
|
||||||
if props.ifc_definition_id not in Data.products:
|
if props.ifc_definition_id not in Data.products:
|
||||||
Data.load(props.ifc_definition_id)
|
Data.load(props.ifc_definition_id)
|
||||||
if not Data.products[props.ifc_definition_id]:
|
if not Data.products[props.ifc_definition_id]:
|
||||||
|
|||||||
@@ -27,7 +27,12 @@ class BIM_PT_object_material(Panel):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def poll(cls, context):
|
def poll(cls, context):
|
||||||
return bool(context.active_object.BIMObjectProperties.ifc_definition_id)
|
props = context.active_object.BIMObjectProperties
|
||||||
|
if not props.ifc_definition_id:
|
||||||
|
return False
|
||||||
|
if not hasattr(IfcStore.get_file().by_id(props.ifc_definition_id), "HasAssociations"):
|
||||||
|
return False
|
||||||
|
return True
|
||||||
|
|
||||||
def draw(self, context):
|
def draw(self, context):
|
||||||
self.file = IfcStore.get_file()
|
self.file = IfcStore.get_file()
|
||||||
|
|||||||
@@ -35,6 +35,11 @@ sheets_enum = []
|
|||||||
vector_styles_enum = []
|
vector_styles_enum = []
|
||||||
|
|
||||||
|
|
||||||
|
@persistent
|
||||||
|
def clearIfcStore(scene):
|
||||||
|
IfcStore.file = None
|
||||||
|
|
||||||
|
|
||||||
@persistent
|
@persistent
|
||||||
def setDefaultProperties(scene):
|
def setDefaultProperties(scene):
|
||||||
if len(bpy.context.scene.DocProperties.drawing_styles) == 0:
|
if len(bpy.context.scene.DocProperties.drawing_styles) == 0:
|
||||||
|
|||||||
Reference in New Issue
Block a user