Updating model quantities now auto refreshes parametric quantities in cost schedules

This commit is contained in:
Dion Moult
2021-08-10 12:01:29 +10:00
parent f393c5f1d2
commit ebd84a662e
3 changed files with 8 additions and 7 deletions
+4 -7
View File
@@ -5,12 +5,11 @@ import numpy as np
import datetime import datetime
import zipfile import zipfile
import tempfile import tempfile
import ifcopenshell
import ifcopenshell.util.placement
import ifcopenshell.api
from ifcopenshell.api.spatial.data import Data as SpatialData
from blenderbim.bim.ifc import IfcStore
import addon_utils import addon_utils
import ifcopenshell
import ifcopenshell.api
import ifcopenshell.util.placement
from blenderbim.bim.ifc import IfcStore
class IfcExporter: class IfcExporter:
@@ -77,8 +76,6 @@ class IfcExporter:
if self.should_delete(obj): if self.should_delete(obj):
to_delete.append(ifc_definition_id) to_delete.append(ifc_definition_id)
SpatialData.purge()
for ifc_definition_id in to_delete: for ifc_definition_id in to_delete:
product = self.file.by_id(ifc_definition_id) product = self.file.by_id(ifc_definition_id)
IfcStore.unlink_element(product) IfcStore.unlink_element(product)
@@ -7,6 +7,7 @@ import ifcopenshell.util.attribute
import blenderbim.bim.schema import blenderbim.bim.schema
from blenderbim.bim.ifc import IfcStore from blenderbim.bim.ifc import IfcStore
from ifcopenshell.api.pset.data import Data 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.qto_calculator import QtoCalculator
@@ -211,6 +212,7 @@ class EditPset(bpy.types.Operator):
"properties": properties, "properties": properties,
}, },
) )
CostData.purge()
Data.load(IfcStore.get_file(), oprops.ifc_definition_id) Data.load(IfcStore.get_file(), oprops.ifc_definition_id)
bpy.ops.bim.disable_pset_editing(obj=self.obj, obj_type=self.obj_type) bpy.ops.bim.disable_pset_editing(obj=self.obj, obj_type=self.obj_type)
return {"FINISHED"} return {"FINISHED"}
@@ -6,6 +6,7 @@ import tempfile
import logging import logging
import webbrowser import webbrowser
import ifcopenshell import ifcopenshell
import blenderbim.bim.handler
from . import export_ifc from . import export_ifc
from . import import_ifc from . import import_ifc
from . import schema from . import schema
@@ -77,6 +78,7 @@ class ExportIFC(bpy.types.Operator):
scene.BIMProperties.ifc_file = output_file scene.BIMProperties.ifc_file = output_file
if bpy.data.is_saved and bpy.data.is_dirty and bpy.data.filepath: if bpy.data.is_saved and bpy.data.is_dirty and bpy.data.filepath:
bpy.ops.wm.save_mainfile(filepath=bpy.data.filepath) bpy.ops.wm.save_mainfile(filepath=bpy.data.filepath)
blenderbim.bim.handler.purge_module_data()
return {"FINISHED"} return {"FINISHED"}