mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-28 19:27:10 +00:00
Fix #4321. The PurgeData recipe now also works on IFC2X3.
This commit is contained in:
@@ -96,17 +96,25 @@ class Patcher:
|
|||||||
element.Name = "Rabbit"
|
element.Name = "Rabbit"
|
||||||
element.Description = "Rabbit"
|
element.Description = "Rabbit"
|
||||||
|
|
||||||
for element in self.file.by_type("IfcContext"):
|
if self.file.schema == "IFC2X3":
|
||||||
|
elements = self.file.by_type("IfcProject")
|
||||||
|
else:
|
||||||
|
elements = self.file.by_type("IfcContext")
|
||||||
|
for element in elements:
|
||||||
element.ObjectType = None
|
element.ObjectType = None
|
||||||
element.LongName = None
|
element.LongName = None
|
||||||
element.Phase = None
|
element.Phase = None
|
||||||
|
|
||||||
for element in self.file.by_type("IfcSpatialElement"):
|
if self.file.schema == "IFC2X3":
|
||||||
|
elements = self.file.by_type("IfcSpatialStructureElement")
|
||||||
|
else:
|
||||||
|
elements = self.file.by_type("IfcSpatialElement")
|
||||||
|
for element in elements:
|
||||||
element.LongName = None
|
element.LongName = None
|
||||||
|
|
||||||
for element in self.file.by_type("IfcOwnerHistory"):
|
for element in self.file.by_type("IfcOwnerHistory"):
|
||||||
element.State = None
|
element.State = None
|
||||||
element.ChangeAction = None
|
element.ChangeAction = "NOCHANGE" if self.file.schema == "IFC2X3" else None
|
||||||
element.LastModifiedDate = None
|
element.LastModifiedDate = None
|
||||||
element.LastModifyingUser = None
|
element.LastModifyingUser = None
|
||||||
element.LastModifyingApplication = None
|
element.LastModifyingApplication = None
|
||||||
@@ -125,7 +133,11 @@ class Patcher:
|
|||||||
for element in self.file.by_type("IfcPropertyDefinition"):
|
for element in self.file.by_type("IfcPropertyDefinition"):
|
||||||
self.file.remove(element)
|
self.file.remove(element)
|
||||||
|
|
||||||
for element in self.file.by_type("IfcPropertyAbstraction"):
|
if self.file.schema == "IFC2X3":
|
||||||
|
elements = self.file.by_type("IfcProperty")
|
||||||
|
else:
|
||||||
|
elements = self.file.by_type("IfcPropertyAbstraction")
|
||||||
|
for element in elements:
|
||||||
self.file.remove(element)
|
self.file.remove(element)
|
||||||
|
|
||||||
for element in self.file.by_type("IfcPhysicalQuantity"):
|
for element in self.file.by_type("IfcPhysicalQuantity"):
|
||||||
@@ -134,13 +146,27 @@ class Patcher:
|
|||||||
for element in self.file.by_type("IfcRelAssociates"):
|
for element in self.file.by_type("IfcRelAssociates"):
|
||||||
self.file.remove(element)
|
self.file.remove(element)
|
||||||
|
|
||||||
for element in self.file.by_type("IfcMaterialDefinition"):
|
if self.file.schema == "IFC2X3":
|
||||||
|
elements = (
|
||||||
|
self.file.by_type("IfcMaterial")
|
||||||
|
+ self.file.by_type("IfcMaterialLayer")
|
||||||
|
+ self.file.by_type("IfcMaterialLayerSet")
|
||||||
|
+ self.file.by_type("IfcMaterialLayerSetUsage")
|
||||||
|
+ self.file.by_type("IfcMaterialList")
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
elements = self.file.by_type("IfcMaterialDefinition")
|
||||||
|
for element in elements:
|
||||||
self.file.remove(element)
|
self.file.remove(element)
|
||||||
|
|
||||||
for element in self.file.by_type("IfcMaterialDefinitionRepresentation"):
|
for element in self.file.by_type("IfcMaterialDefinitionRepresentation"):
|
||||||
self.file.remove(element)
|
self.file.remove(element)
|
||||||
|
|
||||||
for element in self.file.by_type("IfcMaterialUsageDefinition"):
|
if self.file.schema == "IFC2X3":
|
||||||
|
elements = []
|
||||||
|
else:
|
||||||
|
elements = self.file.by_type("IfcMaterialUsageDefinition")
|
||||||
|
for element in elements:
|
||||||
self.file.remove(element)
|
self.file.remove(element)
|
||||||
|
|
||||||
for element in self.file.by_type("IfcMaterialList"):
|
for element in self.file.by_type("IfcMaterialList"):
|
||||||
@@ -155,10 +181,40 @@ class Patcher:
|
|||||||
for element in self.file.by_type("IfcPresentationStyle"):
|
for element in self.file.by_type("IfcPresentationStyle"):
|
||||||
self.file.remove(element)
|
self.file.remove(element)
|
||||||
|
|
||||||
for element in self.file.by_type("IfcPresentationItem"):
|
if self.file.schema == "IFC2X3":
|
||||||
|
elements = (
|
||||||
|
self.file.by_type("IfcColourSpecification")
|
||||||
|
+ self.file.by_type("IfcCurveStyleFont")
|
||||||
|
+ self.file.by_type("IfcCurveStyleFontAndScaling")
|
||||||
|
+ self.file.by_type("IfcCurveStyleFontPattern")
|
||||||
|
+ self.file.by_type("IfcPreDefinedItem")
|
||||||
|
+ self.file.by_type("IfcSurfaceStyleLighting")
|
||||||
|
+ self.file.by_type("IfcSurfaceStyleRefraction")
|
||||||
|
+ self.file.by_type("IfcSurfaceStyleShading")
|
||||||
|
+ self.file.by_type("IfcSurfaceStyleWithTextures")
|
||||||
|
+ self.file.by_type("IfcSurfaceTexture")
|
||||||
|
+ self.file.by_type("IfcTextStyleForDefinedFont")
|
||||||
|
+ self.file.by_type("IfcTextStyleTextModel")
|
||||||
|
+ self.file.by_type("IfcTextStyleWithBoxCharacteristics")
|
||||||
|
+ self.file.by_type("IfcTextureCoordinate")
|
||||||
|
+ self.file.by_type("IfcTextureVertex")
|
||||||
|
+ self.file.by_type("IfcTextStyleForDefinedFont")
|
||||||
|
+ self.file.by_type("IfcTextStyleForDefinedFont")
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
elements = self.file.by_type("IfcPresentationItem")
|
||||||
|
for element in elements:
|
||||||
self.file.remove(element)
|
self.file.remove(element)
|
||||||
|
|
||||||
for element in self.file.by_type("IfcExternalInformation"):
|
if self.file.schema == "IFC2X3":
|
||||||
|
elements = (
|
||||||
|
self.file.by_type("IfcClassification")
|
||||||
|
+ self.file.by_type("IfcDocumentInformation")
|
||||||
|
+ self.file.by_type("IfcLibraryInformation")
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
elements = self.file.by_type("IfcExternalInformation")
|
||||||
|
for element in elements:
|
||||||
self.file.remove(element)
|
self.file.remove(element)
|
||||||
|
|
||||||
for element in self.file.by_type("IfcExternalReference"):
|
for element in self.file.by_type("IfcExternalReference"):
|
||||||
|
|||||||
Reference in New Issue
Block a user