Recompile rules

This commit is contained in:
Thomas Krijnen
2023-02-03 22:22:40 +01:00
parent 66d0627035
commit c4b77c2a07
11 changed files with 540 additions and 518 deletions
@@ -44,7 +44,9 @@ class express_set(set):
__radd__ = __add__
def __repr__(self):
return repr(set(self))
def __getitem__(self, k):
# @todo this is obviously not stable, but should be good enough?
return list(self)[k]
def typeof(inst):
if not inst:
@@ -9502,7 +9504,7 @@ class IfcAdvancedBrep_HasAdvancedFaces:
def __call__(self):
assert ((sizeof([afs for afs in self.Outer.CfsFaces if not 'ifc4.ifcadvancedface' in typeof(afs)])) == 0) is not False
assert ((sizeof([afs for afs in self.Outer.CfsFaces if not ('ifc4.ifcadvancedface' in typeof(afs))])) == 0) is not False
@@ -9517,7 +9519,7 @@ class IfcAdvancedBrepWithVoids_VoidsHaveAdvancedFaces:
def __call__(self):
voids = self.Voids
assert ((sizeof([vsh for vsh in voids if (sizeof([afs for afs in vsh.CfsFaces if not 'ifc4.ifcadvancedface' in typeof(afs)])) == 0])) == 0) is not False
assert ((sizeof([vsh for vsh in voids if (sizeof([afs for afs in vsh.CfsFaces if not ('ifc4.ifcadvancedface' in typeof(afs))])) == 0])) == 0) is not False
@@ -9546,7 +9548,7 @@ class IfcAdvancedFace_RequiresEdgeCurve:
def __call__(self):
assert ((sizeof([elpfbnds for elpfbnds in [bnds for bnds in self.Bounds if 'ifc4.ifcedgeloop' in typeof(bnds.Bound)] if not (sizeof([oe for oe in elpfbnds.Bound.EdgeList if not 'ifc4.ifcedgecurve' in typeof(oe.EdgeElement)])) == 0])) == 0) is not False
assert ((sizeof([elpfbnds for elpfbnds in [bnds for bnds in self.Bounds if 'ifc4.ifcedgeloop' in typeof(bnds.Bound)] if not ((sizeof([oe for oe in elpfbnds.Bound.EdgeList if not ('ifc4.ifcedgecurve' in typeof(oe.EdgeElement))])) == 0)])) == 0) is not False
@@ -9560,7 +9562,7 @@ class IfcAdvancedFace_ApplicableEdgeCurves:
def __call__(self):
assert ((sizeof([elpfbnds for elpfbnds in [bnds for bnds in self.Bounds if 'ifc4.ifcedgeloop' in typeof(bnds.Bound)] if not (sizeof([oe for oe in elpfbnds.Bound.EdgeList if not (sizeof(['ifc4.ifcline','ifc4.ifcconic','ifc4.ifcpolyline','ifc4.ifcbsplinecurve'] * typeof(oe.EdgeElement.EdgeGeometry))) == 1])) == 0])) == 0) is not False
assert ((sizeof([elpfbnds for elpfbnds in [bnds for bnds in self.Bounds if 'ifc4.ifcedgeloop' in typeof(bnds.Bound)] if not ((sizeof([oe for oe in elpfbnds.Bound.EdgeList if not ((sizeof(['ifc4.ifcline','ifc4.ifcconic','ifc4.ifcpolyline','ifc4.ifcbsplinecurve'] * typeof(oe.EdgeElement.EdgeGeometry))) == 1)])) == 0)])) == 0) is not False
@@ -9796,7 +9798,7 @@ class IfcArbitraryClosedProfileDef_WR2:
def __call__(self):
outercurve = self.OuterCurve
assert (not 'ifc4.ifcline' in typeof(outercurve)) is not False
assert (not ('ifc4.ifcline' in typeof(outercurve))) is not False
@@ -9810,7 +9812,7 @@ class IfcArbitraryClosedProfileDef_WR3:
def __call__(self):
outercurve = self.OuterCurve
assert (not 'ifc4.ifcoffsetcurve2d' in typeof(outercurve)) is not False
assert (not ('ifc4.ifcoffsetcurve2d' in typeof(outercurve))) is not False
@@ -10139,7 +10141,7 @@ class IfcAxis2Placement3D_AxisAndRefDirProvision:
axis = self.Axis
refdirection = self.RefDirection
assert (not exists(axis) ^ exists(refdirection)) is not False
assert (not (exists(axis) ^ exists(refdirection))) is not False
@@ -10527,7 +10529,7 @@ class IfcBooleanResult_FirstOperandClosed:
def __call__(self):
firstoperand = self.FirstOperand
assert ((not 'ifc4.ifctessellatedfaceset' in typeof(firstoperand)) or (exists(firstoperand.Closed) and firstoperand.Closed)) is not False
assert ((not ('ifc4.ifctessellatedfaceset' in typeof(firstoperand))) or (exists(firstoperand.Closed) and firstoperand.Closed)) is not False
@@ -10541,7 +10543,7 @@ class IfcBooleanResult_SecondOperandClosed:
def __call__(self):
secondoperand = self.SecondOperand
assert ((not 'ifc4.ifctessellatedfaceset' in typeof(secondoperand)) or (exists(secondoperand.Closed) and secondoperand.Closed)) is not False
assert ((not ('ifc4.ifctessellatedfaceset' in typeof(secondoperand))) or (exists(secondoperand.Closed) and secondoperand.Closed)) is not False
@@ -10607,7 +10609,7 @@ class IfcBoxedHalfSpace_UnboundedSurface:
def __call__(self):
assert (not 'ifc4.ifccurveboundedplane' in typeof(self.BaseSurface)) is not False
assert (not ('ifc4.ifccurveboundedplane' in typeof(self.BaseSurface))) is not False
@@ -12585,7 +12587,7 @@ class IfcDoorLiningProperties_WR31:
liningdepth = self.LiningDepth
liningthickness = self.LiningThickness
assert (not exists(liningdepth) and (not exists(liningthickness))) is not False
assert (not (exists(liningdepth) and (not exists(liningthickness)))) is not False
@@ -12600,7 +12602,7 @@ class IfcDoorLiningProperties_WR32:
thresholddepth = self.ThresholdDepth
thresholdthickness = self.ThresholdThickness
assert (not exists(thresholddepth) and (not exists(thresholdthickness))) is not False
assert (not (exists(thresholddepth) and (not exists(thresholdthickness)))) is not False
@@ -14161,7 +14163,7 @@ class IfcGeometricRepresentationSubContext_ParentNoSub:
def __call__(self):
parentcontext = self.ParentContext
assert (not 'ifc4.ifcgeometricrepresentationsubcontext' in typeof(parentcontext)) is not False
assert (not ('ifc4.ifcgeometricrepresentationsubcontext' in typeof(parentcontext))) is not False
@@ -14838,7 +14840,7 @@ class IfcMaterialDefinitionRepresentation_OnlyStyledRepresentations:
def __call__(self):
representations = self.Representations
assert ((sizeof([temp for temp in representations if not 'ifc4.ifcstyledrepresentation' in typeof(temp)])) == 0) is not False
assert ((sizeof([temp for temp in representations if not ('ifc4.ifcstyledrepresentation' in typeof(temp))])) == 0) is not False
@@ -15180,7 +15182,7 @@ class IfcOccupant_WR31:
def __call__(self):
predefinedtype = self.PredefinedType
assert ((not predefinedtype == IfcOccupantTypeEnum.USERDEFINED) or exists(self.ObjectType)) is not False
assert ((not (predefinedtype == IfcOccupantTypeEnum.USERDEFINED)) or exists(self.ObjectType)) is not False
@@ -15240,7 +15242,7 @@ class IfcOrientedEdge_EdgeElementNotOriented:
def __call__(self):
edgeelement = self.EdgeElement
assert (not 'ifc4.ifcorientededge' in typeof(edgeelement)) is not False
assert (not ('ifc4.ifcorientededge' in typeof(edgeelement))) is not False
@@ -15953,7 +15955,7 @@ class IfcProductDefinitionShape_OnlyShapeModel:
def __call__(self):
representations = self.Representations
assert ((sizeof([temp for temp in representations if not 'ifc4.ifcshapemodel' in typeof(temp)])) == 0) is not False
assert ((sizeof([temp for temp in representations if not ('ifc4.ifcshapemodel' in typeof(temp))])) == 0) is not False
@@ -16131,7 +16133,7 @@ class IfcPropertyEnumeration_WR01:
def __call__(self):
assert ((sizeof([temp for temp in self.EnumerationValues if not (typeof(self.EnumerationValues[1 - 1])) == typeof(temp)])) == 0) is not False
assert ((sizeof([temp for temp in self.EnumerationValues if not ((typeof(self.EnumerationValues[1 - 1])) == typeof(temp))])) == 0) is not False
@@ -16146,7 +16148,7 @@ class IfcPropertyListValue_WR31:
def __call__(self):
assert ((sizeof([temp for temp in self.ListValues if not (typeof(self.ListValues[1 - 1])) == typeof(temp)])) == 0) is not False
assert ((sizeof([temp for temp in self.ListValues if not ((typeof(self.ListValues[1 - 1])) == typeof(temp))])) == 0) is not False
@@ -16877,7 +16879,7 @@ class IfcRectangularTrimmedSurface_UsenseCompatible:
u2 = self.U2
usense = self.Usense
assert ((('ifc4.ifcelementarysurface' in typeof(basissurface)) and (not 'ifc4.ifcplane' in typeof(basissurface))) or ('ifc4.ifcsurfaceofrevolution' in typeof(basissurface)) or (usense == (u2 > u1))) is not False
assert ((('ifc4.ifcelementarysurface' in typeof(basissurface)) and (not ('ifc4.ifcplane' in typeof(basissurface)))) or ('ifc4.ifcsurfaceofrevolution' in typeof(basissurface)) or (usense == (u2 > u1))) is not False
@@ -17406,7 +17408,7 @@ class IfcRelReferencedInSpatialStructure_AllowedRelatedElements:
def __call__(self):
relatedelements = self.RelatedElements
assert ((sizeof([temp for temp in relatedelements if ('ifc4.ifcspatialstructureelement' in typeof(temp)) and (not 'ifc4.ifcspace' in typeof(temp))])) == 0) is not False
assert ((sizeof([temp for temp in relatedelements if ('ifc4.ifcspatialstructureelement' in typeof(temp)) and (not ('ifc4.ifcspace' in typeof(temp)))])) == 0) is not False
@@ -17456,7 +17458,7 @@ class IfcRelSpaceBoundary_CorrectPhysOrVirt:
relatedbuildingelement = self.RelatedBuildingElement
physicalorvirtualboundary = self.PhysicalOrVirtualBoundary
assert (((physicalorvirtualboundary == IfcPhysicalOrVirtualEnum.Physical) and (not 'ifc4.ifcvirtualelement' in typeof(relatedbuildingelement))) or ((physicalorvirtualboundary == IfcPhysicalOrVirtualEnum.Virtual) and (('ifc4.ifcvirtualelement' in typeof(relatedbuildingelement)) or ('ifc4.ifcopeningelement' in typeof(relatedbuildingelement)))) or (physicalorvirtualboundary == IfcPhysicalOrVirtualEnum.NotDefined)) is not False
assert (((physicalorvirtualboundary == IfcPhysicalOrVirtualEnum.Physical) and (not ('ifc4.ifcvirtualelement' in typeof(relatedbuildingelement)))) or ((physicalorvirtualboundary == IfcPhysicalOrVirtualEnum.Virtual) and (('ifc4.ifcvirtualelement' in typeof(relatedbuildingelement)) or ('ifc4.ifcopeningelement' in typeof(relatedbuildingelement)))) or (physicalorvirtualboundary == IfcPhysicalOrVirtualEnum.NotDefined)) is not False
@@ -17917,7 +17919,7 @@ class IfcShapeRepresentation_NoTopologicalItem:
def __call__(self):
items = self.Items
assert ((sizeof([temp for temp in items if ('ifc4.ifctopologicalrepresentationitem' in typeof(temp)) and (not (sizeof(['ifc4.ifcvertexpoint','ifc4.ifcedgecurve','ifc4.ifcfacesurface'] * typeof(temp))) == 1)])) == 0) is not False
assert ((sizeof([temp for temp in items if ('ifc4.ifctopologicalrepresentationitem' in typeof(temp)) and (not ((sizeof(['ifc4.ifcvertexpoint','ifc4.ifcedgecurve','ifc4.ifcfacesurface'] * typeof(temp))) == 1))])) == 0) is not False
@@ -18795,7 +18797,7 @@ class IfcStyledItem_ApplicableItem:
def __call__(self):
item = self.Item
assert (not 'ifc4.ifcstyleditem' in typeof(item)) is not False
assert (not ('ifc4.ifcstyleditem' in typeof(item))) is not False
@@ -18810,7 +18812,7 @@ class IfcStyledRepresentation_OnlyStyledItems:
def __call__(self):
assert ((sizeof([temp for temp in self.Items if not 'ifc4.ifcstyleditem' in typeof(temp)])) == 0) is not False
assert ((sizeof([temp for temp in self.Items if not ('ifc4.ifcstyleditem' in typeof(temp))])) == 0) is not False
@@ -18880,7 +18882,7 @@ class IfcSurfaceCurve_CurveIsNotPcurve:
def __call__(self):
curve3d = self.Curve3D
assert (not 'ifc4.ifcpcurve' in typeof(curve3d)) is not False
assert (not ('ifc4.ifcpcurve' in typeof(curve3d))) is not False
@@ -19612,7 +19614,7 @@ class IfcTextLiteralWithExtent_WR31:
def __call__(self):
extent = self.Extent
assert (not 'ifc4.ifcplanarbox' in typeof(extent)) is not False
assert (not ('ifc4.ifcplanarbox' in typeof(extent))) is not False
@@ -19678,7 +19680,7 @@ class IfcTopologyRepresentation_WR21:
def __call__(self):
assert ((sizeof([temp for temp in self.Items if not 'ifc4.ifctopologicalrepresentationitem' in typeof(temp)])) == 0) is not False
assert ((sizeof([temp for temp in self.Items if not ('ifc4.ifctopologicalrepresentationitem' in typeof(temp))])) == 0) is not False
@@ -19864,7 +19866,7 @@ class IfcTrimmedCurve_NoTrimOfBoundedCurves:
def __call__(self):
basiscurve = self.BasisCurve
assert (not 'ifc4.ifcboundedcurve' in typeof(basiscurve)) is not False
assert (not ('ifc4.ifcboundedcurve' in typeof(basiscurve))) is not False
@@ -19955,7 +19957,7 @@ class IfcTypeProduct_ApplicableOccurrence:
def __call__(self):
assert ((not exists(lambda: self.Types[1 - 1])) or ((sizeof([temp for temp in self.Types[1 - 1].RelatedObjects if not 'ifc4.ifcproduct' in typeof(temp)])) == 0)) is not False
assert ((not (exists(lambda: self.Types[1 - 1]))) or ((sizeof([temp for temp in self.Types[1 - 1].RelatedObjects if not ('ifc4.ifcproduct' in typeof(temp))])) == 0)) is not False
@@ -20381,7 +20383,7 @@ class IfcWindowLiningProperties_WR31:
liningdepth = self.LiningDepth
liningthickness = self.LiningThickness
assert (not exists(liningdepth) and (not exists(liningthickness))) is not False
assert (not (exists(liningdepth) and (not exists(liningthickness)))) is not False
@@ -20396,7 +20398,7 @@ class IfcWindowLiningProperties_WR32:
firsttransomoffset = self.FirstTransomOffset
secondtransomoffset = self.SecondTransomOffset
assert (not (not exists(firsttransomoffset)) and exists(secondtransomoffset)) is not False
assert (not ((not exists(firsttransomoffset)) and exists(secondtransomoffset))) is not False
@@ -20411,7 +20413,7 @@ class IfcWindowLiningProperties_WR33:
firstmullionoffset = self.FirstMullionOffset
secondmullionoffset = self.SecondMullionOffset
assert (not (not exists(firstmullionoffset)) and exists(secondmullionoffset)) is not False
assert (not ((not exists(firstmullionoffset)) and exists(secondmullionoffset))) is not False
@@ -20543,7 +20545,7 @@ class IfcZone_WR1:
def __call__(self):
assert ((sizeof(self.IsGroupedBy) == 0) or ((sizeof([temp for temp in self.IsGroupedBy[1 - 1].RelatedObjects if not ('ifc4.ifczone' in typeof(temp)) or ('ifc4.ifcspace' in typeof(temp)) or ('ifc4.ifcspatialzone' in typeof(temp))])) == 0)) is not False
assert ((sizeof(self.IsGroupedBy) == 0) or ((sizeof([temp for temp in self.IsGroupedBy[1 - 1].RelatedObjects if not (('ifc4.ifczone' in typeof(temp)) or ('ifc4.ifcspace' in typeof(temp)) or ('ifc4.ifcspatialzone' in typeof(temp)))])) == 0)) is not False
@@ -20559,7 +20561,7 @@ class IfcRepresentationContextSameWCS:
if sizeof(IfcGeometricRepresentationContext) > 1:
for i in range(2, hiindex(IfcGeometricRepresentationContext) + 1):
if (IfcGeometricRepresentationContext[1 - 1].WorldCoordinateSystem) != (IfcGeometricRepresentationContext[i - 1].WorldCoordinateSystem):
isdifferent = (not IfcSameValidPrecision(IfcGeometricRepresentationContext[1 - 1].Precision,IfcGeometricRepresentationContext[i - 1].Precision)) or (not IfcSameAxis2Placement(IfcGeometricRepresentationContext[1 - 1].WorldCoordinateSystem,IfcGeometricRepresentationContext[i - 1].WorldCoordinateSystem,IfcGeometricRepresentationContext[1 - 1].Precision))
isdifferent = (not (IfcSameValidPrecision(IfcGeometricRepresentationContext[1 - 1].Precision,IfcGeometricRepresentationContext[i - 1].Precision))) or (not (IfcSameAxis2Placement(IfcGeometricRepresentationContext[1 - 1].WorldCoordinateSystem,IfcGeometricRepresentationContext[i - 1].WorldCoordinateSystem,IfcGeometricRepresentationContext[1 - 1].Precision)))
if isdifferent == True:
break
@@ -20879,25 +20881,25 @@ def IfcCorrectObjectAssignment(constraint, objects):
if constraint == IfcObjectTypeEnum.NOTDEFINED:
return True
elif constraint == IfcObjectTypeEnum.PRODUCT:
count = sizeof([temp for temp in objects if not 'ifc4.ifcproduct' in typeof(temp)])
count = sizeof([temp for temp in objects if not ('ifc4.ifcproduct' in typeof(temp))])
return count == 0
elif constraint == IfcObjectTypeEnum.PROCESS:
count = sizeof([temp for temp in objects if not 'ifc4.ifcprocess' in typeof(temp)])
count = sizeof([temp for temp in objects if not ('ifc4.ifcprocess' in typeof(temp))])
return count == 0
elif constraint == IfcObjectTypeEnum.CONTROL:
count = sizeof([temp for temp in objects if not 'ifc4.ifccontrol' in typeof(temp)])
count = sizeof([temp for temp in objects if not ('ifc4.ifccontrol' in typeof(temp))])
return count == 0
elif constraint == IfcObjectTypeEnum.RESOURCE:
count = sizeof([temp for temp in objects if not 'ifc4.ifcresource' in typeof(temp)])
count = sizeof([temp for temp in objects if not ('ifc4.ifcresource' in typeof(temp))])
return count == 0
elif constraint == IfcObjectTypeEnum.ACTOR:
count = sizeof([temp for temp in objects if not 'ifc4.ifcactor' in typeof(temp)])
count = sizeof([temp for temp in objects if not ('ifc4.ifcactor' in typeof(temp))])
return count == 0
elif constraint == IfcObjectTypeEnum.GROUP:
count = sizeof([temp for temp in objects if not 'ifc4.ifcgroup' in typeof(temp)])
count = sizeof([temp for temp in objects if not ('ifc4.ifcgroup' in typeof(temp))])
return count == 0
elif constraint == IfcObjectTypeEnum.PROJECT:
count = sizeof([temp for temp in objects if not 'ifc4.ifcproject' in typeof(temp)])
count = sizeof([temp for temp in objects if not ('ifc4.ifcproject' in typeof(temp))])
return count == 0
else:
return None
@@ -20909,13 +20911,13 @@ def IfcCorrectUnitAssignment(units):
monetaryunitnumber = 0
namedunitnames = express_set([])
derivedunitnames = express_set([])
namedunitnumber = sizeof([temp for temp in units if ('ifc4.ifcnamedunit' in typeof(temp)) and (not temp.UnitType == IfcUnitEnum.USERDEFINED)])
derivedunitnumber = sizeof([temp for temp in units if ('ifc4.ifcderivedunit' in typeof(temp)) and (not temp.UnitType == IfcDerivedUnitEnum.USERDEFINED)])
namedunitnumber = sizeof([temp for temp in units if ('ifc4.ifcnamedunit' in typeof(temp)) and (not (temp.UnitType == IfcUnitEnum.USERDEFINED))])
derivedunitnumber = sizeof([temp for temp in units if ('ifc4.ifcderivedunit' in typeof(temp)) and (not (temp.UnitType == IfcDerivedUnitEnum.USERDEFINED))])
monetaryunitnumber = sizeof([temp for temp in units if 'ifc4.ifcmonetaryunit' in typeof(temp)])
for i in range(1, sizeof(units) + 1):
if ('ifc4.ifcnamedunit' in (typeof(units[i - 1]))) and (not (units[i - 1].UnitType) == IfcUnitEnum.USERDEFINED):
if ('ifc4.ifcnamedunit' in (typeof(units[i - 1]))) and (not ((units[i - 1].UnitType) == IfcUnitEnum.USERDEFINED)):
namedunitnames = namedunitnames + (units[i - 1].UnitType)
if ('ifc4.ifcderivedunit' in (typeof(units[i - 1]))) and (not (units[i - 1].UnitType) == IfcDerivedUnitEnum.USERDEFINED):
if ('ifc4.ifcderivedunit' in (typeof(units[i - 1]))) and (not ((units[i - 1].UnitType) == IfcDerivedUnitEnum.USERDEFINED)):
derivedunitnames = derivedunitnames + (units[i - 1].UnitType)
return (sizeof(namedunitnames) == namedunitnumber) and (sizeof(derivedunitnames) == derivedunitnumber) and (monetaryunitnumber <= 1)