mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 01:41:57 +00:00
purge cost schedules
This commit is contained in:
@@ -16,6 +16,8 @@
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import ifcopenshell.api
|
||||
|
||||
|
||||
class Usecase:
|
||||
def __init__(self, file, cost_schedule=None):
|
||||
@@ -42,4 +44,13 @@ class Usecase:
|
||||
|
||||
def execute(self):
|
||||
# TODO: do a deep purge
|
||||
for inverse in self.file.get_inverse(self.settings["cost_schedule"]):
|
||||
if inverse.is_a("IfcRelAssignsToControl"):
|
||||
[
|
||||
ifcopenshell.api.run(
|
||||
"sequence.remove_cost_item", self.file, task=related_object
|
||||
)
|
||||
for related_object in inverse.RelatedObjects
|
||||
if related_object.is_a("IfcCostItem")
|
||||
]
|
||||
self.file.remove(self.settings["cost_schedule"])
|
||||
|
||||
Reference in New Issue
Block a user