diff --git a/src/ifcopenshell-python/ifcopenshell/express/rules/IFC2X3.py b/src/ifcopenshell-python/ifcopenshell/express/rules/IFC2X3.py index 0c0d207db8..a3dda0c28d 100644 --- a/src/ifcopenshell-python/ifcopenshell/express/rules/IFC2X3.py +++ b/src/ifcopenshell-python/ifcopenshell/express/rules/IFC2X3.py @@ -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: @@ -8002,7 +8004,7 @@ class IfcArbitraryClosedProfileDef_WR2: def __call__(self): outercurve = self.OuterCurve - assert (not 'ifc2x3.ifcline' in typeof(outercurve)) is not False + assert (not ('ifc2x3.ifcline' in typeof(outercurve))) is not False @@ -8016,7 +8018,7 @@ class IfcArbitraryClosedProfileDef_WR3: def __call__(self): outercurve = self.OuterCurve - assert (not 'ifc2x3.ifcoffsetcurve2d' in typeof(outercurve)) is not False + assert (not ('ifc2x3.ifcoffsetcurve2d' in typeof(outercurve))) is not False @@ -8103,7 +8105,7 @@ class IfcAsset_WR1: def __call__(self): - assert ((sizeof([temp for temp in self.IsGroupedBy.RelatedObjects if not 'ifc2x3.ifcelement' in typeof(temp)])) == 0) is not False + assert ((sizeof([temp for temp in self.IsGroupedBy.RelatedObjects if not ('ifc2x3.ifcelement' in typeof(temp))])) == 0) is not False @@ -8251,7 +8253,7 @@ class IfcAxis2Placement3D_WR5: axis = self.Axis refdirection = self.RefDirection - assert (not exists(axis) ^ exists(refdirection)) is not False + assert (not (exists(axis) ^ exists(refdirection))) is not False @@ -8441,7 +8443,7 @@ class IfcBoxedHalfSpace_WR1: def __call__(self): - assert (not 'ifc2x3.ifccurveboundedplane' in typeof(self.BaseSurface)) is not False + assert (not ('ifc2x3.ifccurveboundedplane' in typeof(self.BaseSurface))) is not False @@ -9160,7 +9162,7 @@ class IfcConstructionMaterialResource_WR2: def __call__(self): - assert ((not exists(lambda: self.ResourceOf[1 - 1])) or ((self.ResourceOf[1 - 1].RelatedObjectsType) == IfcObjectTypeEnum.PRODUCT)) is not False + assert ((not (exists(lambda: self.ResourceOf[1 - 1]))) or ((self.ResourceOf[1 - 1].RelatedObjectsType) == IfcObjectTypeEnum.PRODUCT)) is not False @@ -9189,7 +9191,7 @@ class IfcConstructionProductResource_WR2: def __call__(self): - assert ((not exists(lambda: self.ResourceOf[1 - 1])) or ((self.ResourceOf[1 - 1].RelatedObjectsType) == IfcObjectTypeEnum.PRODUCT)) is not False + assert ((not (exists(lambda: self.ResourceOf[1 - 1]))) or ((self.ResourceOf[1 - 1].RelatedObjectsType) == IfcObjectTypeEnum.PRODUCT)) is not False @@ -9466,7 +9468,7 @@ class IfcDimensionCalloutRelationship_WR13: def __call__(self): - assert (not 'ifc2x3.ifcdimensioncurvedirectedcallout' in typeof(self.RelatedDraughtingCallout)) is not False + assert (not ('ifc2x3.ifcdimensioncurvedirectedcallout' in typeof(self.RelatedDraughtingCallout))) is not False @@ -9509,7 +9511,7 @@ class IfcDimensionCurve_WR53: def __call__(self): annotatedbysymbols = self.AnnotatedBySymbols - assert ((sizeof([dct for dct in annotatedbysymbols if not 'ifc2x3.ifcdimensioncurveterminator' in typeof(dct)])) == 0) is not False + assert ((sizeof([dct for dct in annotatedbysymbols if not ('ifc2x3.ifcdimensioncurveterminator' in typeof(dct))])) == 0) is not False @@ -9697,7 +9699,7 @@ class IfcDoorLiningProperties_WR31: liningdepth = self.LiningDepth liningthickness = self.LiningThickness - assert (not (not exists(liningdepth)) and exists(liningthickness)) is not False + assert (not ((not exists(liningdepth)) and exists(liningthickness))) is not False @@ -9712,7 +9714,7 @@ class IfcDoorLiningProperties_WR32: thresholddepth = self.ThresholdDepth thresholdthickness = self.ThresholdThickness - assert (not (not exists(thresholddepth)) and exists(thresholdthickness)) is not False + assert (not ((not exists(thresholddepth)) and exists(thresholdthickness))) is not False @@ -10238,7 +10240,7 @@ class IfcFillAreaStyleHatching_WR21: def __call__(self): startofnexthatchline = self.StartOfNextHatchLine - assert (not 'ifc2x3.ifctwodirectionrepeatfactor' in typeof(startofnexthatchline)) is not False + assert (not ('ifc2x3.ifctwodirectionrepeatfactor' in typeof(startofnexthatchline))) is not False @@ -10452,7 +10454,7 @@ class IfcGeometricRepresentationSubContext_WR31: def __call__(self): parentcontext = self.ParentContext - assert (not 'ifc2x3.ifcgeometricrepresentationsubcontext' in typeof(parentcontext)) is not False + assert (not ('ifc2x3.ifcgeometricrepresentationsubcontext' in typeof(parentcontext))) is not False @@ -10677,7 +10679,7 @@ class IfcInventory_WR41: def __call__(self): - assert ((sizeof([temp for temp in self.IsGroupedBy.RelatedObjects if not ('ifc2x3.ifcspace' in typeof(temp)) or ('ifc2x3.ifcasset' in typeof(temp)) or ('ifc2x3.ifcfurnishingelement' in typeof(temp))])) == 0) is not False + assert ((sizeof([temp for temp in self.IsGroupedBy.RelatedObjects if not (('ifc2x3.ifcspace' in typeof(temp)) or ('ifc2x3.ifcasset' in typeof(temp)) or ('ifc2x3.ifcfurnishingelement' in typeof(temp)))])) == 0) is not False @@ -10836,7 +10838,7 @@ class IfcMaterialDefinitionRepresentation_WR11: def __call__(self): representations = self.Representations - assert ((sizeof([temp for temp in representations if not 'ifc2x3.ifcstyledrepresentation' in typeof(temp)])) == 0) is not False + assert ((sizeof([temp for temp in representations if not ('ifc2x3.ifcstyledrepresentation' in typeof(temp))])) == 0) is not False @@ -11078,7 +11080,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 @@ -11144,7 +11146,7 @@ class IfcOrientedEdge_WR1: def __call__(self): edgeelement = self.EdgeElement - assert (not 'ifc2x3.ifcorientededge' in typeof(edgeelement)) is not False + assert (not ('ifc2x3.ifcorientededge' in typeof(edgeelement))) is not False @@ -11549,7 +11551,7 @@ class IfcProcedure_WR1: def __call__(self): - assert ((sizeof([temp for temp in self.Decomposes if not 'ifc2x3.ifcrelnests' in typeof(temp)])) == 0) is not False + assert ((sizeof([temp for temp in self.Decomposes if not ('ifc2x3.ifcrelnests' in typeof(temp))])) == 0) is not False @@ -11563,7 +11565,7 @@ class IfcProcedure_WR2: def __call__(self): - assert ((sizeof([temp for temp in self.IsDecomposedBy if not 'ifc2x3.ifcrelnests' in typeof(temp)])) == 0) is not False + assert ((sizeof([temp for temp in self.IsDecomposedBy if not ('ifc2x3.ifcrelnests' in typeof(temp))])) == 0) is not False @@ -11610,7 +11612,7 @@ class IfcProduct_WR1: objectplacement = self.ObjectPlacement representation = self.Representation - assert ((exists(representation) and exists(objectplacement)) or (exists(representation) and (not 'ifc2x3.ifcproductdefinitionshape' in typeof(representation))) or (not exists(representation))) is not False + assert ((exists(representation) and exists(objectplacement)) or (exists(representation) and (not ('ifc2x3.ifcproductdefinitionshape' in typeof(representation)))) or (not exists(representation))) is not False @@ -11625,7 +11627,7 @@ class IfcProductDefinitionShape_WR11: def __call__(self): representations = self.Representations - assert ((sizeof([temp for temp in representations if not 'ifc2x3.ifcshapemodel' in typeof(temp)])) == 0) is not False + assert ((sizeof([temp for temp in representations if not ('ifc2x3.ifcshapemodel' in typeof(temp))])) == 0) is not False @@ -11779,7 +11781,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 @@ -11794,7 +11796,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 @@ -12245,7 +12247,7 @@ class IfcRectangularTrimmedSurface_WR3: u2 = self.U2 usense = self.Usense - assert ((('ifc2x3.ifcelementarysurface' in typeof(basissurface)) and (not 'ifc2x3.ifcplane' in typeof(basissurface))) or ('ifc2x3.ifcsurfaceofrevolution' in typeof(basissurface)) or (usense == (u2 > u1))) is not False + assert ((('ifc2x3.ifcelementarysurface' in typeof(basissurface)) and (not ('ifc2x3.ifcplane' in typeof(basissurface)))) or ('ifc2x3.ifcsurfaceofrevolution' in typeof(basissurface)) or (usense == (u2 > u1))) is not False @@ -12471,7 +12473,7 @@ class IfcRelAssociates_WR21: def __call__(self): relatedobjects = self.RelatedObjects - assert ((sizeof([temp for temp in relatedobjects if not ('ifc2x3.ifcobjectdefinition' in typeof(temp)) or ('ifc2x3.ifcpropertydefinition' in typeof(temp))])) == 0) is not False + assert ((sizeof([temp for temp in relatedobjects if not (('ifc2x3.ifcobjectdefinition' in typeof(temp)) or ('ifc2x3.ifcpropertydefinition' in typeof(temp)))])) == 0) is not False @@ -12518,7 +12520,7 @@ class IfcRelAssociatesMaterial_WR22: def __call__(self): - assert ((sizeof([temp for temp in self.RelatedObjects if (not 'ifc2x3.ifcproduct' in typeof(temp)) and (not 'ifc2x3.ifctypeproduct' in typeof(temp))])) == 0) is not False + assert ((sizeof([temp for temp in self.RelatedObjects if (not ('ifc2x3.ifcproduct' in typeof(temp))) and (not ('ifc2x3.ifctypeproduct' in typeof(temp)))])) == 0) is not False @@ -12634,7 +12636,7 @@ class IfcRelNests_WR1: def __call__(self): - assert ((sizeof([temp for temp in self.RelatedObjects if not typeof(self.RelatingObject) == typeof(temp)])) == 0) is not False + assert ((sizeof([temp for temp in self.RelatedObjects if not (typeof(self.RelatingObject) == typeof(temp))])) == 0) is not False @@ -12685,7 +12687,7 @@ class IfcRelSchedulesCostItems_WR11: def __call__(self): - assert ((sizeof([temp for temp in self.RelatedObjects if not 'ifc2x3.ifccostitem' in typeof(temp)])) == 0) is not False + assert ((sizeof([temp for temp in self.RelatedObjects if not ('ifc2x3.ifccostitem' in typeof(temp))])) == 0) is not False @@ -12734,7 +12736,7 @@ class IfcRelSpaceBoundary_WR1: relatedbuildingelement = self.RelatedBuildingElement physicalorvirtualboundary = self.PhysicalOrVirtualBoundary - assert (((physicalorvirtualboundary == IfcPhysicalOrVirtualEnum.Physical) and (exists(relatedbuildingelement) and (not 'ifc2x3.ifcvirtualelement' in typeof(relatedbuildingelement)))) or ((physicalorvirtualboundary == IfcPhysicalOrVirtualEnum.Virtual) and ((not exists(relatedbuildingelement)) or ('ifc2x3.ifcvirtualelement' in typeof(relatedbuildingelement)))) or (physicalorvirtualboundary == IfcPhysicalOrVirtualEnum.NotDefined)) is not False + assert (((physicalorvirtualboundary == IfcPhysicalOrVirtualEnum.Physical) and (exists(relatedbuildingelement) and (not ('ifc2x3.ifcvirtualelement' in typeof(relatedbuildingelement))))) or ((physicalorvirtualboundary == IfcPhysicalOrVirtualEnum.Virtual) and ((not exists(relatedbuildingelement)) or ('ifc2x3.ifcvirtualelement' in typeof(relatedbuildingelement)))) or (physicalorvirtualboundary == IfcPhysicalOrVirtualEnum.NotDefined)) is not False @@ -12931,7 +12933,7 @@ class IfcServiceLifeFactor_WR31: def __call__(self): predefinedtype = self.PredefinedType - assert ((not predefinedtype == IfcServiceLifeFactorTypeEnum.USERDEFINED) or exists(self.ObjectType)) is not False + assert ((not (predefinedtype == IfcServiceLifeFactorTypeEnum.USERDEFINED)) or exists(self.ObjectType)) is not False @@ -12978,7 +12980,7 @@ class IfcShapeRepresentation_WR22: def __call__(self): items = self.Items - assert ((sizeof([temp for temp in items if ('ifc2x3.ifctopologicalrepresentationitem' in typeof(temp)) and (not (sizeof(['ifc2x3.ifcvertexpoint','ifc2x3.ifcedgecurve','ifc2x3.ifcfacesurface'] * typeof(temp))) == 1)])) == 0) is not False + assert ((sizeof([temp for temp in items if ('ifc2x3.ifctopologicalrepresentationitem' in typeof(temp)) and (not ((sizeof(['ifc2x3.ifcvertexpoint','ifc2x3.ifcedgecurve','ifc2x3.ifcfacesurface'] * typeof(temp))) == 1))])) == 0) is not False @@ -13365,7 +13367,7 @@ class IfcStructuralSurfaceMemberVarying_WR62: def __call__(self): - assert ((sizeof([temp for temp in self.VaryingThicknessLocation.ShapeRepresentations if not sizeof(temp.Items) == 1])) == 0) is not False + assert ((sizeof([temp for temp in self.VaryingThicknessLocation.ShapeRepresentations if not (sizeof(temp.Items) == 1)])) == 0) is not False @@ -13379,7 +13381,7 @@ class IfcStructuralSurfaceMemberVarying_WR63: def __call__(self): - assert ((sizeof([temp for temp in self.VaryingThicknessLocation.ShapeRepresentations if not ('ifc2x3.ifccartesianpoint' in (typeof(temp.Items[1 - 1]))) or ('ifc2x3.ifcpointonsurface' in (typeof(temp.Items[1 - 1])))])) == 0) is not False + assert ((sizeof([temp for temp in self.VaryingThicknessLocation.ShapeRepresentations if not (('ifc2x3.ifccartesianpoint' in (typeof(temp.Items[1 - 1]))) or ('ifc2x3.ifcpointonsurface' in (typeof(temp.Items[1 - 1]))))])) == 0) is not False @@ -13401,7 +13403,7 @@ class IfcStructuredDimensionCallout_WR31: def __call__(self): contents = self.Contents - assert ((sizeof([ato for ato in [con for con in self.contents if 'ifc2x3.ifcannotationtextoccurrence' in typeof(con)] if not ato.Name in ['dimensionvalue','tolerancevalue','unittext','prefixtext','suffixtext']])) == 0) is not False + assert ((sizeof([ato for ato in [con for con in self.contents if 'ifc2x3.ifcannotationtextoccurrence' in typeof(con)] if not (ato.Name in ['dimensionvalue','tolerancevalue','unittext','prefixtext','suffixtext'])])) == 0) is not False @@ -13433,7 +13435,7 @@ class IfcStyledItem_WR12: def __call__(self): item = self.Item - assert (not 'ifc2x3.ifcstyleditem' in typeof(item)) is not False + assert (not ('ifc2x3.ifcstyleditem' in typeof(item))) is not False @@ -13448,7 +13450,7 @@ class IfcStyledRepresentation_WR21: def __call__(self): - assert ((sizeof([temp for temp in self.Items if not 'ifc2x3.ifcstyleditem' in typeof(temp)])) == 0) is not False + assert ((sizeof([temp for temp in self.Items if not ('ifc2x3.ifcstyleditem' in typeof(temp))])) == 0) is not False @@ -13640,7 +13642,7 @@ class IfcSweptSurface_WR1: def __call__(self): sweptcurve = self.SweptCurve - assert (not 'ifc2x3.ifcderivedprofiledef' in typeof(sweptcurve)) is not False + assert (not ('ifc2x3.ifcderivedprofiledef' in typeof(sweptcurve))) is not False @@ -13801,7 +13803,7 @@ class IfcTask_WR1: def __call__(self): - assert ((sizeof([temp for temp in self.Decomposes if not 'ifc2x3.ifcrelnests' in typeof(temp)])) == 0) is not False + assert ((sizeof([temp for temp in self.Decomposes if not ('ifc2x3.ifcrelnests' in typeof(temp))])) == 0) is not False @@ -13815,7 +13817,7 @@ class IfcTask_WR2: def __call__(self): - assert ((sizeof([temp for temp in self.IsDecomposedBy if not 'ifc2x3.ifcrelnests' in typeof(temp)])) == 0) is not False + assert ((sizeof([temp for temp in self.IsDecomposedBy if not ('ifc2x3.ifcrelnests' in typeof(temp))])) == 0) is not False @@ -13887,7 +13889,7 @@ class IfcTextLiteralWithExtent_WR31: def __call__(self): extent = self.Extent - assert (not 'ifc2x3.ifcplanarbox' in typeof(extent)) is not False + assert (not ('ifc2x3.ifcplanarbox' in typeof(extent))) is not False @@ -13962,7 +13964,7 @@ class IfcTimeSeriesSchedule_WR41: def __call__(self): timeseriesscheduletype = self.TimeSeriesScheduleType - assert ((not timeseriesscheduletype == IfcTimeSeriesScheduleTypeEnum.USERDEFINED) or exists(self.ObjectType)) is not False + assert ((not (timeseriesscheduletype == IfcTimeSeriesScheduleTypeEnum.USERDEFINED)) or exists(self.ObjectType)) is not False @@ -13983,7 +13985,7 @@ class IfcTopologyRepresentation_WR21: def __call__(self): - assert ((sizeof([temp for temp in self.Items if not 'ifc2x3.ifctopologicalrepresentationitem' in typeof(temp)])) == 0) is not False + assert ((sizeof([temp for temp in self.Items if not ('ifc2x3.ifctopologicalrepresentationitem' in typeof(temp))])) == 0) is not False @@ -14066,7 +14068,7 @@ class IfcTrimmedCurve_WR43: def __call__(self): basiscurve = self.BasisCurve - assert (not 'ifc2x3.ifcboundedcurve' in typeof(basiscurve)) is not False + assert (not ('ifc2x3.ifcboundedcurve' in typeof(basiscurve))) is not False @@ -14114,7 +14116,7 @@ class IfcTypeProduct_WR41: def __call__(self): - assert ((not exists(lambda: self.ObjectTypeOf[1 - 1])) or ((sizeof([temp for temp in self.ObjectTypeOf[1 - 1].RelatedObjects if not 'ifc2x3.ifcproduct' in typeof(temp)])) == 0)) is not False + assert ((not (exists(lambda: self.ObjectTypeOf[1 - 1]))) or ((sizeof([temp for temp in self.ObjectTypeOf[1 - 1].RelatedObjects if not ('ifc2x3.ifcproduct' in typeof(temp))])) == 0)) is not False @@ -14303,7 +14305,7 @@ class IfcWindowLiningProperties_WR31: liningdepth = self.LiningDepth liningthickness = self.LiningThickness - assert (not (not exists(liningdepth)) and exists(liningthickness)) is not False + assert (not ((not exists(liningdepth)) and exists(liningthickness))) is not False @@ -14318,7 +14320,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 @@ -14333,7 +14335,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 @@ -14405,7 +14407,7 @@ class IfcZone_WR1: def __call__(self): - assert ((sizeof([temp for temp in self.IsGroupedBy.RelatedObjects if not ('ifc2x3.ifczone' in typeof(temp)) or ('ifc2x3.ifcspace' in typeof(temp))])) == 0) is not False + assert ((sizeof([temp for temp in self.IsGroupedBy.RelatedObjects if not (('ifc2x3.ifczone' in typeof(temp)) or ('ifc2x3.ifcspace' in typeof(temp)))])) == 0) is not False @@ -14421,7 +14423,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 @@ -14702,25 +14704,25 @@ def IfcCorrectObjectAssignment(constraint, objects): if constraint == IfcObjectTypeEnum.NOTDEFINED: return True elif constraint == IfcObjectTypeEnum.PRODUCT: - count = sizeof([temp for temp in objects if not 'ifc2x3.ifcproduct' in typeof(temp)]) + count = sizeof([temp for temp in objects if not ('ifc2x3.ifcproduct' in typeof(temp))]) return count == 0 elif constraint == IfcObjectTypeEnum.PROCESS: - count = sizeof([temp for temp in objects if not 'ifc2x3.ifcprocess' in typeof(temp)]) + count = sizeof([temp for temp in objects if not ('ifc2x3.ifcprocess' in typeof(temp))]) return count == 0 elif constraint == IfcObjectTypeEnum.CONTROL: - count = sizeof([temp for temp in objects if not 'ifc2x3.ifccontrol' in typeof(temp)]) + count = sizeof([temp for temp in objects if not ('ifc2x3.ifccontrol' in typeof(temp))]) return count == 0 elif constraint == IfcObjectTypeEnum.RESOURCE: - count = sizeof([temp for temp in objects if not 'ifc2x3.ifcresource' in typeof(temp)]) + count = sizeof([temp for temp in objects if not ('ifc2x3.ifcresource' in typeof(temp))]) return count == 0 elif constraint == IfcObjectTypeEnum.ACTOR: - count = sizeof([temp for temp in objects if not 'ifc2x3.ifcactor' in typeof(temp)]) + count = sizeof([temp for temp in objects if not ('ifc2x3.ifcactor' in typeof(temp))]) return count == 0 elif constraint == IfcObjectTypeEnum.GROUP: - count = sizeof([temp for temp in objects if not 'ifc2x3.ifcgroup' in typeof(temp)]) + count = sizeof([temp for temp in objects if not ('ifc2x3.ifcgroup' in typeof(temp))]) return count == 0 elif constraint == IfcObjectTypeEnum.PROJECT: - count = sizeof([temp for temp in objects if not 'ifc2x3.ifcproject' in typeof(temp)]) + count = sizeof([temp for temp in objects if not ('ifc2x3.ifcproject' in typeof(temp))]) return count == 0 else: return None @@ -14732,13 +14734,13 @@ def IfcCorrectUnitAssignment(units): monetaryunitnumber = 0 namedunitnames = express_set([]) derivedunitnames = express_set([]) - namedunitnumber = sizeof([temp for temp in units if ('ifc2x3.ifcnamedunit' in typeof(temp)) and (not temp.UnitType == IfcUnitEnum.USERDEFINED)]) - derivedunitnumber = sizeof([temp for temp in units if ('ifc2x3.ifcderivedunit' in typeof(temp)) and (not temp.UnitType == IfcDerivedUnitEnum.USERDEFINED)]) + namedunitnumber = sizeof([temp for temp in units if ('ifc2x3.ifcnamedunit' in typeof(temp)) and (not (temp.UnitType == IfcUnitEnum.USERDEFINED))]) + derivedunitnumber = sizeof([temp for temp in units if ('ifc2x3.ifcderivedunit' in typeof(temp)) and (not (temp.UnitType == IfcDerivedUnitEnum.USERDEFINED))]) monetaryunitnumber = sizeof([temp for temp in units if 'ifc2x3.ifcmonetaryunit' in typeof(temp)]) for i in range(1, sizeof(units) + 1): - if ('ifc2x3.ifcnamedunit' in (typeof(units[i - 1]))) and (not (units[i - 1].UnitType) == IfcUnitEnum.USERDEFINED): + if ('ifc2x3.ifcnamedunit' in (typeof(units[i - 1]))) and (not ((units[i - 1].UnitType) == IfcUnitEnum.USERDEFINED)): namedunitnames = namedunitnames + (units[i - 1].UnitType) - if ('ifc2x3.ifcderivedunit' in (typeof(units[i - 1]))) and (not (units[i - 1].UnitType) == IfcDerivedUnitEnum.USERDEFINED): + if ('ifc2x3.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) @@ -15174,7 +15176,7 @@ def IfcUniquePropertyName(properties): def IfcValidCalendarDate(date): - if not 1 <= date.DayComponent <= 31: + if not (1 <= date.DayComponent <= 31): return False if date.MonthComponent == 4: return 1 <= date.DayComponent <= 30 diff --git a/src/ifcopenshell-python/ifcopenshell/express/rules/IFC4.py b/src/ifcopenshell-python/ifcopenshell/express/rules/IFC4.py index 0a5cbdf988..7bb875cd52 100644 --- a/src/ifcopenshell-python/ifcopenshell/express/rules/IFC4.py +++ b/src/ifcopenshell-python/ifcopenshell/express/rules/IFC4.py @@ -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) diff --git a/src/ifcopenshell-python/ifcopenshell/express/rules/IFC4X1.py b/src/ifcopenshell-python/ifcopenshell/express/rules/IFC4X1.py index a672ae0437..59b1251b07 100644 --- a/src/ifcopenshell-python/ifcopenshell/express/rules/IFC4X1.py +++ b/src/ifcopenshell-python/ifcopenshell/express/rules/IFC4X1.py @@ -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: @@ -9634,7 +9636,7 @@ class IfcAdvancedBrep_HasAdvancedFaces: def __call__(self): - assert ((sizeof([afs for afs in self.Outer.CfsFaces if not 'ifc4x1.ifcadvancedface' in typeof(afs)])) == 0) is not False + assert ((sizeof([afs for afs in self.Outer.CfsFaces if not ('ifc4x1.ifcadvancedface' in typeof(afs))])) == 0) is not False @@ -9649,7 +9651,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 'ifc4x1.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 ('ifc4x1.ifcadvancedface' in typeof(afs))])) == 0])) == 0) is not False @@ -9678,7 +9680,7 @@ class IfcAdvancedFace_RequiresEdgeCurve: def __call__(self): - assert ((sizeof([elpfbnds for elpfbnds in [bnds for bnds in self.Bounds if 'ifc4x1.ifcedgeloop' in typeof(bnds.Bound)] if not (sizeof([oe for oe in elpfbnds.Bound.EdgeList if not 'ifc4x1.ifcedgecurve' in typeof(oe.EdgeElement)])) == 0])) == 0) is not False + assert ((sizeof([elpfbnds for elpfbnds in [bnds for bnds in self.Bounds if 'ifc4x1.ifcedgeloop' in typeof(bnds.Bound)] if not ((sizeof([oe for oe in elpfbnds.Bound.EdgeList if not ('ifc4x1.ifcedgecurve' in typeof(oe.EdgeElement))])) == 0)])) == 0) is not False @@ -9692,7 +9694,7 @@ class IfcAdvancedFace_ApplicableEdgeCurves: def __call__(self): - assert ((sizeof([elpfbnds for elpfbnds in [bnds for bnds in self.Bounds if 'ifc4x1.ifcedgeloop' in typeof(bnds.Bound)] if not (sizeof([oe for oe in elpfbnds.Bound.EdgeList if not (sizeof(['ifc4x1.ifcline','ifc4x1.ifcconic','ifc4x1.ifcpolyline','ifc4x1.ifcbsplinecurve'] * typeof(oe.EdgeElement.EdgeGeometry))) == 1])) == 0])) == 0) is not False + assert ((sizeof([elpfbnds for elpfbnds in [bnds for bnds in self.Bounds if 'ifc4x1.ifcedgeloop' in typeof(bnds.Bound)] if not ((sizeof([oe for oe in elpfbnds.Bound.EdgeList if not ((sizeof(['ifc4x1.ifcline','ifc4x1.ifcconic','ifc4x1.ifcpolyline','ifc4x1.ifcbsplinecurve'] * typeof(oe.EdgeElement.EdgeGeometry))) == 1)])) == 0)])) == 0) is not False @@ -9958,7 +9960,7 @@ class IfcArbitraryClosedProfileDef_WR2: def __call__(self): outercurve = self.OuterCurve - assert (not 'ifc4x1.ifcline' in typeof(outercurve)) is not False + assert (not ('ifc4x1.ifcline' in typeof(outercurve))) is not False @@ -9972,7 +9974,7 @@ class IfcArbitraryClosedProfileDef_WR3: def __call__(self): outercurve = self.OuterCurve - assert (not 'ifc4x1.ifcoffsetcurve2d' in typeof(outercurve)) is not False + assert (not ('ifc4x1.ifcoffsetcurve2d' in typeof(outercurve))) is not False @@ -10301,7 +10303,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 @@ -10689,7 +10691,7 @@ class IfcBooleanResult_FirstOperandClosed: def __call__(self): firstoperand = self.FirstOperand - assert ((not 'ifc4x1.ifctessellatedfaceset' in typeof(firstoperand)) or (exists(firstoperand.Closed) and firstoperand.Closed)) is not False + assert ((not ('ifc4x1.ifctessellatedfaceset' in typeof(firstoperand))) or (exists(firstoperand.Closed) and firstoperand.Closed)) is not False @@ -10703,7 +10705,7 @@ class IfcBooleanResult_SecondOperandClosed: def __call__(self): secondoperand = self.SecondOperand - assert ((not 'ifc4x1.ifctessellatedfaceset' in typeof(secondoperand)) or (exists(secondoperand.Closed) and secondoperand.Closed)) is not False + assert ((not ('ifc4x1.ifctessellatedfaceset' in typeof(secondoperand))) or (exists(secondoperand.Closed) and secondoperand.Closed)) is not False @@ -10769,7 +10771,7 @@ class IfcBoxedHalfSpace_UnboundedSurface: def __call__(self): - assert (not 'ifc4x1.ifccurveboundedplane' in typeof(self.BaseSurface)) is not False + assert (not ('ifc4x1.ifccurveboundedplane' in typeof(self.BaseSurface))) is not False @@ -12756,7 +12758,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 @@ -12771,7 +12773,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 @@ -14332,7 +14334,7 @@ class IfcGeometricRepresentationSubContext_ParentNoSub: def __call__(self): parentcontext = self.ParentContext - assert (not 'ifc4x1.ifcgeometricrepresentationsubcontext' in typeof(parentcontext)) is not False + assert (not ('ifc4x1.ifcgeometricrepresentationsubcontext' in typeof(parentcontext))) is not False @@ -15006,7 +15008,7 @@ class IfcMaterialDefinitionRepresentation_OnlyStyledRepresentations: def __call__(self): representations = self.Representations - assert ((sizeof([temp for temp in representations if not 'ifc4x1.ifcstyledrepresentation' in typeof(temp)])) == 0) is not False + assert ((sizeof([temp for temp in representations if not ('ifc4x1.ifcstyledrepresentation' in typeof(temp))])) == 0) is not False @@ -15348,7 +15350,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 @@ -15417,7 +15419,7 @@ class IfcOrientedEdge_EdgeElementNotOriented: def __call__(self): edgeelement = self.EdgeElement - assert (not 'ifc4x1.ifcorientededge' in typeof(edgeelement)) is not False + assert (not ('ifc4x1.ifcorientededge' in typeof(edgeelement))) is not False @@ -16145,7 +16147,7 @@ class IfcProductDefinitionShape_OnlyShapeModel: def __call__(self): representations = self.Representations - assert ((sizeof([temp for temp in representations if not 'ifc4x1.ifcshapemodel' in typeof(temp)])) == 0) is not False + assert ((sizeof([temp for temp in representations if not ('ifc4x1.ifcshapemodel' in typeof(temp))])) == 0) is not False @@ -16323,7 +16325,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 @@ -16338,7 +16340,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 @@ -17069,7 +17071,7 @@ class IfcRectangularTrimmedSurface_UsenseCompatible: u2 = self.U2 usense = self.Usense - assert ((('ifc4x1.ifcelementarysurface' in typeof(basissurface)) and (not 'ifc4x1.ifcplane' in typeof(basissurface))) or ('ifc4x1.ifcsurfaceofrevolution' in typeof(basissurface)) or (usense == (u2 > u1))) is not False + assert ((('ifc4x1.ifcelementarysurface' in typeof(basissurface)) and (not ('ifc4x1.ifcplane' in typeof(basissurface)))) or ('ifc4x1.ifcsurfaceofrevolution' in typeof(basissurface)) or (usense == (u2 > u1))) is not False @@ -17601,7 +17603,7 @@ class IfcRelReferencedInSpatialStructure_AllowedRelatedElements: def __call__(self): relatedelements = self.RelatedElements - assert ((sizeof([temp for temp in relatedelements if ('ifc4x1.ifcspatialstructureelement' in typeof(temp)) and (not 'ifc4x1.ifcspace' in typeof(temp))])) == 0) is not False + assert ((sizeof([temp for temp in relatedelements if ('ifc4x1.ifcspatialstructureelement' in typeof(temp)) and (not ('ifc4x1.ifcspace' in typeof(temp)))])) == 0) is not False @@ -17651,7 +17653,7 @@ class IfcRelSpaceBoundary_CorrectPhysOrVirt: relatedbuildingelement = self.RelatedBuildingElement physicalorvirtualboundary = self.PhysicalOrVirtualBoundary - assert (((physicalorvirtualboundary == IfcPhysicalOrVirtualEnum.Physical) and (not 'ifc4x1.ifcvirtualelement' in typeof(relatedbuildingelement))) or ((physicalorvirtualboundary == IfcPhysicalOrVirtualEnum.Virtual) and (('ifc4x1.ifcvirtualelement' in typeof(relatedbuildingelement)) or ('ifc4x1.ifcopeningelement' in typeof(relatedbuildingelement)))) or (physicalorvirtualboundary == IfcPhysicalOrVirtualEnum.NotDefined)) is not False + assert (((physicalorvirtualboundary == IfcPhysicalOrVirtualEnum.Physical) and (not ('ifc4x1.ifcvirtualelement' in typeof(relatedbuildingelement)))) or ((physicalorvirtualboundary == IfcPhysicalOrVirtualEnum.Virtual) and (('ifc4x1.ifcvirtualelement' in typeof(relatedbuildingelement)) or ('ifc4x1.ifcopeningelement' in typeof(relatedbuildingelement)))) or (physicalorvirtualboundary == IfcPhysicalOrVirtualEnum.NotDefined)) is not False @@ -18185,7 +18187,7 @@ class IfcShapeRepresentation_NoTopologicalItem: def __call__(self): items = self.Items - assert ((sizeof([temp for temp in items if ('ifc4x1.ifctopologicalrepresentationitem' in typeof(temp)) and (not (sizeof(['ifc4x1.ifcvertexpoint','ifc4x1.ifcedgecurve','ifc4x1.ifcfacesurface'] * typeof(temp))) == 1)])) == 0) is not False + assert ((sizeof([temp for temp in items if ('ifc4x1.ifctopologicalrepresentationitem' in typeof(temp)) and (not ((sizeof(['ifc4x1.ifcvertexpoint','ifc4x1.ifcedgecurve','ifc4x1.ifcfacesurface'] * typeof(temp))) == 1))])) == 0) is not False @@ -19063,7 +19065,7 @@ class IfcStyledItem_ApplicableItem: def __call__(self): item = self.Item - assert (not 'ifc4x1.ifcstyleditem' in typeof(item)) is not False + assert (not ('ifc4x1.ifcstyleditem' in typeof(item))) is not False @@ -19078,7 +19080,7 @@ class IfcStyledRepresentation_OnlyStyledItems: def __call__(self): - assert ((sizeof([temp for temp in self.Items if not 'ifc4x1.ifcstyleditem' in typeof(temp)])) == 0) is not False + assert ((sizeof([temp for temp in self.Items if not ('ifc4x1.ifcstyleditem' in typeof(temp))])) == 0) is not False @@ -19148,7 +19150,7 @@ class IfcSurfaceCurve_CurveIsNotPcurve: def __call__(self): curve3d = self.Curve3D - assert (not 'ifc4x1.ifcpcurve' in typeof(curve3d)) is not False + assert (not ('ifc4x1.ifcpcurve' in typeof(curve3d))) is not False @@ -19880,7 +19882,7 @@ class IfcTextLiteralWithExtent_WR31: def __call__(self): extent = self.Extent - assert (not 'ifc4x1.ifcplanarbox' in typeof(extent)) is not False + assert (not ('ifc4x1.ifcplanarbox' in typeof(extent))) is not False @@ -19946,7 +19948,7 @@ class IfcTopologyRepresentation_WR21: def __call__(self): - assert ((sizeof([temp for temp in self.Items if not 'ifc4x1.ifctopologicalrepresentationitem' in typeof(temp)])) == 0) is not False + assert ((sizeof([temp for temp in self.Items if not ('ifc4x1.ifctopologicalrepresentationitem' in typeof(temp))])) == 0) is not False @@ -20150,7 +20152,7 @@ class IfcTrimmedCurve_NoTrimOfBoundedCurves: def __call__(self): basiscurve = self.BasisCurve - assert (not 'ifc4x1.ifcboundedcurve' in typeof(basiscurve)) is not False + assert (not ('ifc4x1.ifcboundedcurve' in typeof(basiscurve))) is not False @@ -20241,7 +20243,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 'ifc4x1.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 ('ifc4x1.ifcproduct' in typeof(temp))])) == 0)) is not False @@ -20667,7 +20669,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 @@ -20682,7 +20684,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 @@ -20697,7 +20699,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 @@ -20829,7 +20831,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 ('ifc4x1.ifczone' in typeof(temp)) or ('ifc4x1.ifcspace' in typeof(temp)) or ('ifc4x1.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 (('ifc4x1.ifczone' in typeof(temp)) or ('ifc4x1.ifcspace' in typeof(temp)) or ('ifc4x1.ifcspatialzone' in typeof(temp)))])) == 0)) is not False @@ -20845,7 +20847,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 @@ -21165,25 +21167,25 @@ def IfcCorrectObjectAssignment(constraint, objects): if constraint == IfcObjectTypeEnum.NOTDEFINED: return True elif constraint == IfcObjectTypeEnum.PRODUCT: - count = sizeof([temp for temp in objects if not 'ifc4x1.ifcproduct' in typeof(temp)]) + count = sizeof([temp for temp in objects if not ('ifc4x1.ifcproduct' in typeof(temp))]) return count == 0 elif constraint == IfcObjectTypeEnum.PROCESS: - count = sizeof([temp for temp in objects if not 'ifc4x1.ifcprocess' in typeof(temp)]) + count = sizeof([temp for temp in objects if not ('ifc4x1.ifcprocess' in typeof(temp))]) return count == 0 elif constraint == IfcObjectTypeEnum.CONTROL: - count = sizeof([temp for temp in objects if not 'ifc4x1.ifccontrol' in typeof(temp)]) + count = sizeof([temp for temp in objects if not ('ifc4x1.ifccontrol' in typeof(temp))]) return count == 0 elif constraint == IfcObjectTypeEnum.RESOURCE: - count = sizeof([temp for temp in objects if not 'ifc4x1.ifcresource' in typeof(temp)]) + count = sizeof([temp for temp in objects if not ('ifc4x1.ifcresource' in typeof(temp))]) return count == 0 elif constraint == IfcObjectTypeEnum.ACTOR: - count = sizeof([temp for temp in objects if not 'ifc4x1.ifcactor' in typeof(temp)]) + count = sizeof([temp for temp in objects if not ('ifc4x1.ifcactor' in typeof(temp))]) return count == 0 elif constraint == IfcObjectTypeEnum.GROUP: - count = sizeof([temp for temp in objects if not 'ifc4x1.ifcgroup' in typeof(temp)]) + count = sizeof([temp for temp in objects if not ('ifc4x1.ifcgroup' in typeof(temp))]) return count == 0 elif constraint == IfcObjectTypeEnum.PROJECT: - count = sizeof([temp for temp in objects if not 'ifc4x1.ifcproject' in typeof(temp)]) + count = sizeof([temp for temp in objects if not ('ifc4x1.ifcproject' in typeof(temp))]) return count == 0 else: return None @@ -21195,13 +21197,13 @@ def IfcCorrectUnitAssignment(units): monetaryunitnumber = 0 namedunitnames = express_set([]) derivedunitnames = express_set([]) - namedunitnumber = sizeof([temp for temp in units if ('ifc4x1.ifcnamedunit' in typeof(temp)) and (not temp.UnitType == IfcUnitEnum.USERDEFINED)]) - derivedunitnumber = sizeof([temp for temp in units if ('ifc4x1.ifcderivedunit' in typeof(temp)) and (not temp.UnitType == IfcDerivedUnitEnum.USERDEFINED)]) + namedunitnumber = sizeof([temp for temp in units if ('ifc4x1.ifcnamedunit' in typeof(temp)) and (not (temp.UnitType == IfcUnitEnum.USERDEFINED))]) + derivedunitnumber = sizeof([temp for temp in units if ('ifc4x1.ifcderivedunit' in typeof(temp)) and (not (temp.UnitType == IfcDerivedUnitEnum.USERDEFINED))]) monetaryunitnumber = sizeof([temp for temp in units if 'ifc4x1.ifcmonetaryunit' in typeof(temp)]) for i in range(1, sizeof(units) + 1): - if ('ifc4x1.ifcnamedunit' in (typeof(units[i - 1]))) and (not (units[i - 1].UnitType) == IfcUnitEnum.USERDEFINED): + if ('ifc4x1.ifcnamedunit' in (typeof(units[i - 1]))) and (not ((units[i - 1].UnitType) == IfcUnitEnum.USERDEFINED)): namedunitnames = namedunitnames + (units[i - 1].UnitType) - if ('ifc4x1.ifcderivedunit' in (typeof(units[i - 1]))) and (not (units[i - 1].UnitType) == IfcDerivedUnitEnum.USERDEFINED): + if ('ifc4x1.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) diff --git a/src/ifcopenshell-python/ifcopenshell/express/rules/IFC4X2.py b/src/ifcopenshell-python/ifcopenshell/express/rules/IFC4X2.py index aedd15a4e4..89d70e1217 100644 --- a/src/ifcopenshell-python/ifcopenshell/express/rules/IFC4X2.py +++ b/src/ifcopenshell-python/ifcopenshell/express/rules/IFC4X2.py @@ -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: @@ -10018,7 +10020,7 @@ class IfcAdvancedBrep_HasAdvancedFaces: def __call__(self): - assert ((sizeof([afs for afs in self.Outer.CfsFaces if not 'ifc4x2.ifcadvancedface' in typeof(afs)])) == 0) is not False + assert ((sizeof([afs for afs in self.Outer.CfsFaces if not ('ifc4x2.ifcadvancedface' in typeof(afs))])) == 0) is not False @@ -10033,7 +10035,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 'ifc4x2.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 ('ifc4x2.ifcadvancedface' in typeof(afs))])) == 0])) == 0) is not False @@ -10062,7 +10064,7 @@ class IfcAdvancedFace_RequiresEdgeCurve: def __call__(self): - assert ((sizeof([elpfbnds for elpfbnds in [bnds for bnds in self.Bounds if 'ifc4x2.ifcedgeloop' in typeof(bnds.Bound)] if not (sizeof([oe for oe in elpfbnds.Bound.EdgeList if not 'ifc4x2.ifcedgecurve' in typeof(oe.EdgeElement)])) == 0])) == 0) is not False + assert ((sizeof([elpfbnds for elpfbnds in [bnds for bnds in self.Bounds if 'ifc4x2.ifcedgeloop' in typeof(bnds.Bound)] if not ((sizeof([oe for oe in elpfbnds.Bound.EdgeList if not ('ifc4x2.ifcedgecurve' in typeof(oe.EdgeElement))])) == 0)])) == 0) is not False @@ -10076,7 +10078,7 @@ class IfcAdvancedFace_ApplicableEdgeCurves: def __call__(self): - assert ((sizeof([elpfbnds for elpfbnds in [bnds for bnds in self.Bounds if 'ifc4x2.ifcedgeloop' in typeof(bnds.Bound)] if not (sizeof([oe for oe in elpfbnds.Bound.EdgeList if not (sizeof(['ifc4x2.ifcline','ifc4x2.ifcconic','ifc4x2.ifcpolyline','ifc4x2.ifcbsplinecurve'] * typeof(oe.EdgeElement.EdgeGeometry))) == 1])) == 0])) == 0) is not False + assert ((sizeof([elpfbnds for elpfbnds in [bnds for bnds in self.Bounds if 'ifc4x2.ifcedgeloop' in typeof(bnds.Bound)] if not ((sizeof([oe for oe in elpfbnds.Bound.EdgeList if not ((sizeof(['ifc4x2.ifcline','ifc4x2.ifcconic','ifc4x2.ifcpolyline','ifc4x2.ifcbsplinecurve'] * typeof(oe.EdgeElement.EdgeGeometry))) == 1)])) == 0)])) == 0) is not False @@ -10342,7 +10344,7 @@ class IfcArbitraryClosedProfileDef_WR2: def __call__(self): outercurve = self.OuterCurve - assert (not 'ifc4x2.ifcline' in typeof(outercurve)) is not False + assert (not ('ifc4x2.ifcline' in typeof(outercurve))) is not False @@ -10356,7 +10358,7 @@ class IfcArbitraryClosedProfileDef_WR3: def __call__(self): outercurve = self.OuterCurve - assert (not 'ifc4x2.ifcoffsetcurve2d' in typeof(outercurve)) is not False + assert (not ('ifc4x2.ifcoffsetcurve2d' in typeof(outercurve))) is not False @@ -10685,7 +10687,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 @@ -11117,7 +11119,7 @@ class IfcBooleanResult_FirstOperandClosed: def __call__(self): firstoperand = self.FirstOperand - assert ((not 'ifc4x2.ifctessellatedfaceset' in typeof(firstoperand)) or (exists(firstoperand.Closed) and firstoperand.Closed)) is not False + assert ((not ('ifc4x2.ifctessellatedfaceset' in typeof(firstoperand))) or (exists(firstoperand.Closed) and firstoperand.Closed)) is not False @@ -11131,7 +11133,7 @@ class IfcBooleanResult_SecondOperandClosed: def __call__(self): secondoperand = self.SecondOperand - assert ((not 'ifc4x2.ifctessellatedfaceset' in typeof(secondoperand)) or (exists(secondoperand.Closed) and secondoperand.Closed)) is not False + assert ((not ('ifc4x2.ifctessellatedfaceset' in typeof(secondoperand))) or (exists(secondoperand.Closed) and secondoperand.Closed)) is not False @@ -11197,7 +11199,7 @@ class IfcBoxedHalfSpace_UnboundedSurface: def __call__(self): - assert (not 'ifc4x2.ifccurveboundedplane' in typeof(self.BaseSurface)) is not False + assert (not ('ifc4x2.ifccurveboundedplane' in typeof(self.BaseSurface))) is not False @@ -13252,7 +13254,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 @@ -13267,7 +13269,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 @@ -14834,7 +14836,7 @@ class IfcGeometricRepresentationSubContext_ParentNoSub: def __call__(self): parentcontext = self.ParentContext - assert (not 'ifc4x2.ifcgeometricrepresentationsubcontext' in typeof(parentcontext)) is not False + assert (not ('ifc4x2.ifcgeometricrepresentationsubcontext' in typeof(parentcontext))) is not False @@ -15508,7 +15510,7 @@ class IfcMaterialDefinitionRepresentation_OnlyStyledRepresentations: def __call__(self): representations = self.Representations - assert ((sizeof([temp for temp in representations if not 'ifc4x2.ifcstyledrepresentation' in typeof(temp)])) == 0) is not False + assert ((sizeof([temp for temp in representations if not ('ifc4x2.ifcstyledrepresentation' in typeof(temp))])) == 0) is not False @@ -15850,7 +15852,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 @@ -15919,7 +15921,7 @@ class IfcOrientedEdge_EdgeElementNotOriented: def __call__(self): edgeelement = self.EdgeElement - assert (not 'ifc4x2.ifcorientededge' in typeof(edgeelement)) is not False + assert (not ('ifc4x2.ifcorientededge' in typeof(edgeelement))) is not False @@ -16647,7 +16649,7 @@ class IfcProductDefinitionShape_OnlyShapeModel: def __call__(self): representations = self.Representations - assert ((sizeof([temp for temp in representations if not 'ifc4x2.ifcshapemodel' in typeof(temp)])) == 0) is not False + assert ((sizeof([temp for temp in representations if not ('ifc4x2.ifcshapemodel' in typeof(temp))])) == 0) is not False @@ -16825,7 +16827,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 @@ -16840,7 +16842,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 @@ -17571,7 +17573,7 @@ class IfcRectangularTrimmedSurface_UsenseCompatible: u2 = self.U2 usense = self.Usense - assert ((('ifc4x2.ifcelementarysurface' in typeof(basissurface)) and (not 'ifc4x2.ifcplane' in typeof(basissurface))) or ('ifc4x2.ifcsurfaceofrevolution' in typeof(basissurface)) or (usense == (u2 > u1))) is not False + assert ((('ifc4x2.ifcelementarysurface' in typeof(basissurface)) and (not ('ifc4x2.ifcplane' in typeof(basissurface)))) or ('ifc4x2.ifcsurfaceofrevolution' in typeof(basissurface)) or (usense == (u2 > u1))) is not False @@ -18119,7 +18121,7 @@ class IfcRelReferencedInSpatialStructure_AllowedRelatedElements: def __call__(self): relatedelements = self.RelatedElements - assert ((sizeof([temp for temp in relatedelements if ('ifc4x2.ifcspatialstructureelement' in typeof(temp)) and (not 'ifc4x2.ifcspace' in typeof(temp))])) == 0) is not False + assert ((sizeof([temp for temp in relatedelements if ('ifc4x2.ifcspatialstructureelement' in typeof(temp)) and (not ('ifc4x2.ifcspace' in typeof(temp)))])) == 0) is not False @@ -18169,7 +18171,7 @@ class IfcRelSpaceBoundary_CorrectPhysOrVirt: relatedbuildingelement = self.RelatedBuildingElement physicalorvirtualboundary = self.PhysicalOrVirtualBoundary - assert (((physicalorvirtualboundary == IfcPhysicalOrVirtualEnum.Physical) and (not 'ifc4x2.ifcvirtualelement' in typeof(relatedbuildingelement))) or ((physicalorvirtualboundary == IfcPhysicalOrVirtualEnum.Virtual) and (('ifc4x2.ifcvirtualelement' in typeof(relatedbuildingelement)) or ('ifc4x2.ifcopeningelement' in typeof(relatedbuildingelement)))) or (physicalorvirtualboundary == IfcPhysicalOrVirtualEnum.NotDefined)) is not False + assert (((physicalorvirtualboundary == IfcPhysicalOrVirtualEnum.Physical) and (not ('ifc4x2.ifcvirtualelement' in typeof(relatedbuildingelement)))) or ((physicalorvirtualboundary == IfcPhysicalOrVirtualEnum.Virtual) and (('ifc4x2.ifcvirtualelement' in typeof(relatedbuildingelement)) or ('ifc4x2.ifcopeningelement' in typeof(relatedbuildingelement)))) or (physicalorvirtualboundary == IfcPhysicalOrVirtualEnum.NotDefined)) is not False @@ -18703,7 +18705,7 @@ class IfcShapeRepresentation_NoTopologicalItem: def __call__(self): items = self.Items - assert ((sizeof([temp for temp in items if ('ifc4x2.ifctopologicalrepresentationitem' in typeof(temp)) and (not (sizeof(['ifc4x2.ifcvertexpoint','ifc4x2.ifcedgecurve','ifc4x2.ifcfacesurface'] * typeof(temp))) == 1)])) == 0) is not False + assert ((sizeof([temp for temp in items if ('ifc4x2.ifctopologicalrepresentationitem' in typeof(temp)) and (not ((sizeof(['ifc4x2.ifcvertexpoint','ifc4x2.ifcedgecurve','ifc4x2.ifcfacesurface'] * typeof(temp))) == 1))])) == 0) is not False @@ -19581,7 +19583,7 @@ class IfcStyledItem_ApplicableItem: def __call__(self): item = self.Item - assert (not 'ifc4x2.ifcstyleditem' in typeof(item)) is not False + assert (not ('ifc4x2.ifcstyleditem' in typeof(item))) is not False @@ -19596,7 +19598,7 @@ class IfcStyledRepresentation_OnlyStyledItems: def __call__(self): - assert ((sizeof([temp for temp in self.Items if not 'ifc4x2.ifcstyleditem' in typeof(temp)])) == 0) is not False + assert ((sizeof([temp for temp in self.Items if not ('ifc4x2.ifcstyleditem' in typeof(temp))])) == 0) is not False @@ -19666,7 +19668,7 @@ class IfcSurfaceCurve_CurveIsNotPcurve: def __call__(self): curve3d = self.Curve3D - assert (not 'ifc4x2.ifcpcurve' in typeof(curve3d)) is not False + assert (not ('ifc4x2.ifcpcurve' in typeof(curve3d))) is not False @@ -20442,7 +20444,7 @@ class IfcTextLiteralWithExtent_WR31: def __call__(self): extent = self.Extent - assert (not 'ifc4x2.ifcplanarbox' in typeof(extent)) is not False + assert (not ('ifc4x2.ifcplanarbox' in typeof(extent))) is not False @@ -20508,7 +20510,7 @@ class IfcTopologyRepresentation_WR21: def __call__(self): - assert ((sizeof([temp for temp in self.Items if not 'ifc4x2.ifctopologicalrepresentationitem' in typeof(temp)])) == 0) is not False + assert ((sizeof([temp for temp in self.Items if not ('ifc4x2.ifctopologicalrepresentationitem' in typeof(temp))])) == 0) is not False @@ -20712,7 +20714,7 @@ class IfcTrimmedCurve_NoTrimOfBoundedCurves: def __call__(self): basiscurve = self.BasisCurve - assert (not 'ifc4x2.ifcboundedcurve' in typeof(basiscurve)) is not False + assert (not ('ifc4x2.ifcboundedcurve' in typeof(basiscurve))) is not False @@ -20803,7 +20805,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 'ifc4x2.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 ('ifc4x2.ifcproduct' in typeof(temp))])) == 0)) is not False @@ -21273,7 +21275,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 @@ -21288,7 +21290,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 @@ -21303,7 +21305,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 @@ -21435,7 +21437,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 ('ifc4x2.ifczone' in typeof(temp)) or ('ifc4x2.ifcspace' in typeof(temp)) or ('ifc4x2.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 (('ifc4x2.ifczone' in typeof(temp)) or ('ifc4x2.ifcspace' in typeof(temp)) or ('ifc4x2.ifcspatialzone' in typeof(temp)))])) == 0)) is not False @@ -21451,7 +21453,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 @@ -21771,25 +21773,25 @@ def IfcCorrectObjectAssignment(constraint, objects): if constraint == IfcObjectTypeEnum.NOTDEFINED: return True elif constraint == IfcObjectTypeEnum.PRODUCT: - count = sizeof([temp for temp in objects if not 'ifc4x2.ifcproduct' in typeof(temp)]) + count = sizeof([temp for temp in objects if not ('ifc4x2.ifcproduct' in typeof(temp))]) return count == 0 elif constraint == IfcObjectTypeEnum.PROCESS: - count = sizeof([temp for temp in objects if not 'ifc4x2.ifcprocess' in typeof(temp)]) + count = sizeof([temp for temp in objects if not ('ifc4x2.ifcprocess' in typeof(temp))]) return count == 0 elif constraint == IfcObjectTypeEnum.CONTROL: - count = sizeof([temp for temp in objects if not 'ifc4x2.ifccontrol' in typeof(temp)]) + count = sizeof([temp for temp in objects if not ('ifc4x2.ifccontrol' in typeof(temp))]) return count == 0 elif constraint == IfcObjectTypeEnum.RESOURCE: - count = sizeof([temp for temp in objects if not 'ifc4x2.ifcresource' in typeof(temp)]) + count = sizeof([temp for temp in objects if not ('ifc4x2.ifcresource' in typeof(temp))]) return count == 0 elif constraint == IfcObjectTypeEnum.ACTOR: - count = sizeof([temp for temp in objects if not 'ifc4x2.ifcactor' in typeof(temp)]) + count = sizeof([temp for temp in objects if not ('ifc4x2.ifcactor' in typeof(temp))]) return count == 0 elif constraint == IfcObjectTypeEnum.GROUP: - count = sizeof([temp for temp in objects if not 'ifc4x2.ifcgroup' in typeof(temp)]) + count = sizeof([temp for temp in objects if not ('ifc4x2.ifcgroup' in typeof(temp))]) return count == 0 elif constraint == IfcObjectTypeEnum.PROJECT: - count = sizeof([temp for temp in objects if not 'ifc4x2.ifcproject' in typeof(temp)]) + count = sizeof([temp for temp in objects if not ('ifc4x2.ifcproject' in typeof(temp))]) return count == 0 else: return None @@ -21801,13 +21803,13 @@ def IfcCorrectUnitAssignment(units): monetaryunitnumber = 0 namedunitnames = express_set([]) derivedunitnames = express_set([]) - namedunitnumber = sizeof([temp for temp in units if ('ifc4x2.ifcnamedunit' in typeof(temp)) and (not temp.UnitType == IfcUnitEnum.USERDEFINED)]) - derivedunitnumber = sizeof([temp for temp in units if ('ifc4x2.ifcderivedunit' in typeof(temp)) and (not temp.UnitType == IfcDerivedUnitEnum.USERDEFINED)]) + namedunitnumber = sizeof([temp for temp in units if ('ifc4x2.ifcnamedunit' in typeof(temp)) and (not (temp.UnitType == IfcUnitEnum.USERDEFINED))]) + derivedunitnumber = sizeof([temp for temp in units if ('ifc4x2.ifcderivedunit' in typeof(temp)) and (not (temp.UnitType == IfcDerivedUnitEnum.USERDEFINED))]) monetaryunitnumber = sizeof([temp for temp in units if 'ifc4x2.ifcmonetaryunit' in typeof(temp)]) for i in range(1, sizeof(units) + 1): - if ('ifc4x2.ifcnamedunit' in (typeof(units[i - 1]))) and (not (units[i - 1].UnitType) == IfcUnitEnum.USERDEFINED): + if ('ifc4x2.ifcnamedunit' in (typeof(units[i - 1]))) and (not ((units[i - 1].UnitType) == IfcUnitEnum.USERDEFINED)): namedunitnames = namedunitnames + (units[i - 1].UnitType) - if ('ifc4x2.ifcderivedunit' in (typeof(units[i - 1]))) and (not (units[i - 1].UnitType) == IfcDerivedUnitEnum.USERDEFINED): + if ('ifc4x2.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) diff --git a/src/ifcopenshell-python/ifcopenshell/express/rules/IFC4X3.py b/src/ifcopenshell-python/ifcopenshell/express/rules/IFC4X3.py index ab998e2e18..32abd3bcb1 100644 --- a/src/ifcopenshell-python/ifcopenshell/express/rules/IFC4X3.py +++ b/src/ifcopenshell-python/ifcopenshell/express/rules/IFC4X3.py @@ -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: @@ -11653,7 +11655,7 @@ class IfcAdvancedBrep_HasAdvancedFaces: def __call__(self): - assert ((sizeof([afs for afs in self.Outer.CfsFaces if not 'ifc4x3.ifcadvancedface' in typeof(afs)])) == 0) is not False + assert ((sizeof([afs for afs in self.Outer.CfsFaces if not ('ifc4x3.ifcadvancedface' in typeof(afs))])) == 0) is not False @@ -11668,7 +11670,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 'ifc4x3.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 ('ifc4x3.ifcadvancedface' in typeof(afs))])) == 0])) == 0) is not False @@ -11683,7 +11685,7 @@ class IfcAdvancedFace_ApplicableEdgeCurves: def __call__(self): - assert ((sizeof([elpfbnds for elpfbnds in [bnds for bnds in self.Bounds if 'ifc4x3.ifcedgeloop' in typeof(bnds.Bound)] if not (sizeof([oe for oe in elpfbnds.Bound.EdgeList if not (sizeof(['ifc4x3.ifcline','ifc4x3.ifcconic','ifc4x3.ifcpolyline','ifc4x3.ifcbsplinecurve'] * typeof(oe.EdgeElement.EdgeGeometry))) == 1])) == 0])) == 0) is not False + assert ((sizeof([elpfbnds for elpfbnds in [bnds for bnds in self.Bounds if 'ifc4x3.ifcedgeloop' in typeof(bnds.Bound)] if not ((sizeof([oe for oe in elpfbnds.Bound.EdgeList if not ((sizeof(['ifc4x3.ifcline','ifc4x3.ifcconic','ifc4x3.ifcpolyline','ifc4x3.ifcbsplinecurve'] * typeof(oe.EdgeElement.EdgeGeometry))) == 1)])) == 0)])) == 0) is not False @@ -11711,7 +11713,7 @@ class IfcAdvancedFace_RequiresEdgeCurve: def __call__(self): - assert ((sizeof([elpfbnds for elpfbnds in [bnds for bnds in self.Bounds if 'ifc4x3.ifcedgeloop' in typeof(bnds.Bound)] if not (sizeof([oe for oe in elpfbnds.Bound.EdgeList if not 'ifc4x3.ifcedgecurve' in typeof(oe.EdgeElement)])) == 0])) == 0) is not False + assert ((sizeof([elpfbnds for elpfbnds in [bnds for bnds in self.Bounds if 'ifc4x3.ifcedgeloop' in typeof(bnds.Bound)] if not ((sizeof([oe for oe in elpfbnds.Bound.EdgeList if not ('ifc4x3.ifcedgecurve' in typeof(oe.EdgeElement))])) == 0)])) == 0) is not False @@ -11974,7 +11976,7 @@ class IfcArbitraryClosedProfileDef_WR2: def __call__(self): outercurve = self.OuterCurve - assert (not 'ifc4x3.ifcline' in typeof(outercurve)) is not False + assert (not ('ifc4x3.ifcline' in typeof(outercurve))) is not False @@ -11988,7 +11990,7 @@ class IfcArbitraryClosedProfileDef_WR3: def __call__(self): outercurve = self.OuterCurve - assert (not 'ifc4x3.ifcoffsetcurve2d' in typeof(outercurve)) is not False + assert (not ('ifc4x3.ifcoffsetcurve2d' in typeof(outercurve))) is not False @@ -12288,7 +12290,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 @@ -12791,7 +12793,7 @@ class IfcBooleanResult_FirstOperandClosed: def __call__(self): firstoperand = self.FirstOperand - assert ((not 'ifc4x3.ifctessellatedfaceset' in typeof(firstoperand)) or (exists(firstoperand.Closed) and firstoperand.Closed)) is not False + assert ((not ('ifc4x3.ifctessellatedfaceset' in typeof(firstoperand))) or (exists(firstoperand.Closed) and firstoperand.Closed)) is not False @@ -12820,7 +12822,7 @@ class IfcBooleanResult_SecondOperandClosed: def __call__(self): secondoperand = self.SecondOperand - assert ((not 'ifc4x3.ifctessellatedfaceset' in typeof(secondoperand)) or (exists(secondoperand.Closed) and secondoperand.Closed)) is not False + assert ((not ('ifc4x3.ifctessellatedfaceset' in typeof(secondoperand))) or (exists(secondoperand.Closed) and secondoperand.Closed)) is not False @@ -12889,7 +12891,7 @@ class IfcBoxedHalfSpace_UnboundedSurface: def __call__(self): - assert (not 'ifc4x3.ifccurveboundedplane' in typeof(self.BaseSurface)) is not False + assert (not ('ifc4x3.ifccurveboundedplane' in typeof(self.BaseSurface))) is not False @@ -15163,7 +15165,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 @@ -15178,7 +15180,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 @@ -16843,7 +16845,7 @@ class IfcGeometricRepresentationSubContext_ParentNoSub: def __call__(self): parentcontext = self.ParentContext - assert (not 'ifc4x3.ifcgeometricrepresentationsubcontext' in typeof(parentcontext)) is not False + assert (not ('ifc4x3.ifcgeometricrepresentationsubcontext' in typeof(parentcontext))) is not False @@ -17665,7 +17667,7 @@ class IfcMaterialDefinitionRepresentation_OnlyStyledRepresentations: def __call__(self): representations = self.Representations - assert ((sizeof([temp for temp in representations if not 'ifc4x3.ifcstyledrepresentation' in typeof(temp)])) == 0) is not False + assert ((sizeof([temp for temp in representations if not ('ifc4x3.ifcstyledrepresentation' in typeof(temp))])) == 0) is not False @@ -18124,7 +18126,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 @@ -18244,7 +18246,7 @@ class IfcOrientedEdge_EdgeElementNotOriented: def __call__(self): edgeelement = self.EdgeElement - assert (not 'ifc4x3.ifcorientededge' in typeof(edgeelement)) is not False + assert (not ('ifc4x3.ifcorientededge' in typeof(edgeelement))) is not False @@ -19038,7 +19040,7 @@ class IfcProductDefinitionShape_OnlyShapeModel: def __call__(self): representations = self.Representations - assert ((sizeof([temp for temp in representations if not 'ifc4x3.ifcshapemodel' in typeof(temp)])) == 0) is not False + assert ((sizeof([temp for temp in representations if not ('ifc4x3.ifcshapemodel' in typeof(temp))])) == 0) is not False @@ -19228,7 +19230,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 @@ -19243,7 +19245,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 @@ -20035,7 +20037,7 @@ class IfcRectangularTrimmedSurface_UsenseCompatible: u2 = self.U2 usense = self.Usense - assert ((('ifc4x3.ifcelementarysurface' in typeof(basissurface)) and (not 'ifc4x3.ifcplane' in typeof(basissurface))) or ('ifc4x3.ifcsurfaceofrevolution' in typeof(basissurface)) or (usense == (u2 > u1))) is not False + assert ((('ifc4x3.ifcelementarysurface' in typeof(basissurface)) and (not ('ifc4x3.ifcplane' in typeof(basissurface)))) or ('ifc4x3.ifcsurfaceofrevolution' in typeof(basissurface)) or (usense == (u2 > u1))) is not False @@ -20619,7 +20621,7 @@ class IfcRelReferencedInSpatialStructure_AllowedRelatedElements: def __call__(self): relatedelements = self.RelatedElements - assert ((sizeof([temp for temp in relatedelements if ('ifc4x3.ifcspatialstructureelement' in typeof(temp)) and (not 'ifc4x3.ifcspace' in typeof(temp))])) == 0) is not False + assert ((sizeof([temp for temp in relatedelements if ('ifc4x3.ifcspatialstructureelement' in typeof(temp)) and (not ('ifc4x3.ifcspace' in typeof(temp)))])) == 0) is not False @@ -20669,7 +20671,7 @@ class IfcRelSpaceBoundary_CorrectPhysOrVirt: relatedbuildingelement = self.RelatedBuildingElement physicalorvirtualboundary = self.PhysicalOrVirtualBoundary - assert (((physicalorvirtualboundary == IfcPhysicalOrVirtualEnum.Physical) and (not 'ifc4x3.ifcvirtualelement' in typeof(relatedbuildingelement))) or ((physicalorvirtualboundary == IfcPhysicalOrVirtualEnum.Virtual) and (('ifc4x3.ifcvirtualelement' in typeof(relatedbuildingelement)) or ('ifc4x3.ifcopeningelement' in typeof(relatedbuildingelement)))) or (physicalorvirtualboundary == IfcPhysicalOrVirtualEnum.NotDefined)) is not False + assert (((physicalorvirtualboundary == IfcPhysicalOrVirtualEnum.Physical) and (not ('ifc4x3.ifcvirtualelement' in typeof(relatedbuildingelement)))) or ((physicalorvirtualboundary == IfcPhysicalOrVirtualEnum.Virtual) and (('ifc4x3.ifcvirtualelement' in typeof(relatedbuildingelement)) or ('ifc4x3.ifcopeningelement' in typeof(relatedbuildingelement)))) or (physicalorvirtualboundary == IfcPhysicalOrVirtualEnum.NotDefined)) is not False @@ -21373,7 +21375,7 @@ class IfcShapeRepresentation_NoTopologicalItem: def __call__(self): items = self.Items - assert ((sizeof([temp for temp in items if ('ifc4x3.ifctopologicalrepresentationitem' in typeof(temp)) and (not (sizeof(['ifc4x3.ifcvertexpoint','ifc4x3.ifcedgecurve','ifc4x3.ifcfacesurface'] * typeof(temp))) == 1)])) == 0) is not False + assert ((sizeof([temp for temp in items if ('ifc4x3.ifctopologicalrepresentationitem' in typeof(temp)) and (not ((sizeof(['ifc4x3.ifcvertexpoint','ifc4x3.ifcedgecurve','ifc4x3.ifcfacesurface'] * typeof(temp))) == 1))])) == 0) is not False @@ -22287,7 +22289,7 @@ class IfcStyledItem_ApplicableItem: def __call__(self): item = self.Item - assert (not 'ifc4x3.ifcstyleditem' in typeof(item)) is not False + assert (not ('ifc4x3.ifcstyleditem' in typeof(item))) is not False @@ -22302,7 +22304,7 @@ class IfcStyledRepresentation_OnlyStyledItems: def __call__(self): - assert ((sizeof([temp for temp in self.Items if not 'ifc4x3.ifcstyleditem' in typeof(temp)])) == 0) is not False + assert ((sizeof([temp for temp in self.Items if not ('ifc4x3.ifcstyleditem' in typeof(temp))])) == 0) is not False @@ -22372,7 +22374,7 @@ class IfcSurfaceCurve_CurveIsNotPcurve: def __call__(self): curve3d = self.Curve3D - assert (not 'ifc4x3.ifcpcurve' in typeof(curve3d)) is not False + assert (not ('ifc4x3.ifcpcurve' in typeof(curve3d))) is not False @@ -23148,7 +23150,7 @@ class IfcTextLiteralWithExtent_WR31: def __call__(self): extent = self.Extent - assert (not 'ifc4x3.ifcplanarbox' in typeof(extent)) is not False + assert (not ('ifc4x3.ifcplanarbox' in typeof(extent))) is not False @@ -23223,7 +23225,7 @@ class IfcTopologyRepresentation_WR21: def __call__(self): - assert ((sizeof([temp for temp in self.Items if not 'ifc4x3.ifctopologicalrepresentationitem' in typeof(temp)])) == 0) is not False + assert ((sizeof([temp for temp in self.Items if not ('ifc4x3.ifctopologicalrepresentationitem' in typeof(temp))])) == 0) is not False @@ -23446,7 +23448,7 @@ class IfcTrimmedCurve_NoTrimOfBoundedCurves: def __call__(self): basiscurve = self.BasisCurve - assert (not 'ifc4x3.ifcboundedcurve' in typeof(basiscurve)) is not False + assert (not ('ifc4x3.ifcboundedcurve' in typeof(basiscurve))) is not False @@ -23565,7 +23567,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 'ifc4x3.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 ('ifc4x3.ifcproduct' in typeof(temp))])) == 0)) is not False @@ -24104,7 +24106,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 @@ -24119,7 +24121,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 @@ -24134,7 +24136,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 @@ -24260,7 +24262,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 ('ifc4x3.ifczone' in typeof(temp)) or ('ifc4x3.ifcspace' in typeof(temp)) or ('ifc4x3.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 (('ifc4x3.ifczone' in typeof(temp)) or ('ifc4x3.ifcspace' in typeof(temp)) or ('ifc4x3.ifcspatialzone' in typeof(temp)))])) == 0)) is not False @@ -24276,7 +24278,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 @@ -24596,25 +24598,25 @@ def IfcCorrectObjectAssignment(constraint, objects): if constraint == IfcObjectTypeEnum.NOTDEFINED: return True elif constraint == IfcObjectTypeEnum.PRODUCT: - count = sizeof([temp for temp in objects if not 'ifc4x3.ifcproduct' in typeof(temp)]) + count = sizeof([temp for temp in objects if not ('ifc4x3.ifcproduct' in typeof(temp))]) return count == 0 elif constraint == IfcObjectTypeEnum.PROCESS: - count = sizeof([temp for temp in objects if not 'ifc4x3.ifcprocess' in typeof(temp)]) + count = sizeof([temp for temp in objects if not ('ifc4x3.ifcprocess' in typeof(temp))]) return count == 0 elif constraint == IfcObjectTypeEnum.CONTROL: - count = sizeof([temp for temp in objects if not 'ifc4x3.ifccontrol' in typeof(temp)]) + count = sizeof([temp for temp in objects if not ('ifc4x3.ifccontrol' in typeof(temp))]) return count == 0 elif constraint == IfcObjectTypeEnum.RESOURCE: - count = sizeof([temp for temp in objects if not 'ifc4x3.ifcresource' in typeof(temp)]) + count = sizeof([temp for temp in objects if not ('ifc4x3.ifcresource' in typeof(temp))]) return count == 0 elif constraint == IfcObjectTypeEnum.ACTOR: - count = sizeof([temp for temp in objects if not 'ifc4x3.ifcactor' in typeof(temp)]) + count = sizeof([temp for temp in objects if not ('ifc4x3.ifcactor' in typeof(temp))]) return count == 0 elif constraint == IfcObjectTypeEnum.GROUP: - count = sizeof([temp for temp in objects if not 'ifc4x3.ifcgroup' in typeof(temp)]) + count = sizeof([temp for temp in objects if not ('ifc4x3.ifcgroup' in typeof(temp))]) return count == 0 elif constraint == IfcObjectTypeEnum.PROJECT: - count = sizeof([temp for temp in objects if not 'ifc4x3.ifcproject' in typeof(temp)]) + count = sizeof([temp for temp in objects if not ('ifc4x3.ifcproject' in typeof(temp))]) return count == 0 else: return None @@ -24626,13 +24628,13 @@ def IfcCorrectUnitAssignment(units): monetaryunitnumber = 0 namedunitnames = express_set([]) derivedunitnames = express_set([]) - namedunitnumber = sizeof([temp for temp in units if ('ifc4x3.ifcnamedunit' in typeof(temp)) and (not temp.UnitType == IfcUnitEnum.USERDEFINED)]) - derivedunitnumber = sizeof([temp for temp in units if ('ifc4x3.ifcderivedunit' in typeof(temp)) and (not temp.UnitType == IfcDerivedUnitEnum.USERDEFINED)]) + namedunitnumber = sizeof([temp for temp in units if ('ifc4x3.ifcnamedunit' in typeof(temp)) and (not (temp.UnitType == IfcUnitEnum.USERDEFINED))]) + derivedunitnumber = sizeof([temp for temp in units if ('ifc4x3.ifcderivedunit' in typeof(temp)) and (not (temp.UnitType == IfcDerivedUnitEnum.USERDEFINED))]) monetaryunitnumber = sizeof([temp for temp in units if 'ifc4x3.ifcmonetaryunit' in typeof(temp)]) for i in range(1, sizeof(units) + 1): - if ('ifc4x3.ifcnamedunit' in (typeof(units[i - 1]))) and (not (units[i - 1].UnitType) == IfcUnitEnum.USERDEFINED): + if ('ifc4x3.ifcnamedunit' in (typeof(units[i - 1]))) and (not ((units[i - 1].UnitType) == IfcUnitEnum.USERDEFINED)): namedunitnames = namedunitnames + (units[i - 1].UnitType) - if ('ifc4x3.ifcderivedunit' in (typeof(units[i - 1]))) and (not (units[i - 1].UnitType) == IfcDerivedUnitEnum.USERDEFINED): + if ('ifc4x3.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) diff --git a/src/ifcopenshell-python/ifcopenshell/express/rules/IFC4X3_ADD1.py b/src/ifcopenshell-python/ifcopenshell/express/rules/IFC4X3_ADD1.py index 99e99daf2e..109f135f83 100644 --- a/src/ifcopenshell-python/ifcopenshell/express/rules/IFC4X3_ADD1.py +++ b/src/ifcopenshell-python/ifcopenshell/express/rules/IFC4X3_ADD1.py @@ -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: @@ -11470,7 +11472,7 @@ class IfcAdvancedBrep_HasAdvancedFaces: def __call__(self): - assert ((sizeof([afs for afs in self.Outer.CfsFaces if not 'ifc4x3_add1.ifcadvancedface' in typeof(afs)])) == 0) is not False + assert ((sizeof([afs for afs in self.Outer.CfsFaces if not ('ifc4x3_add1.ifcadvancedface' in typeof(afs))])) == 0) is not False @@ -11485,7 +11487,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 'ifc4x3_add1.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 ('ifc4x3_add1.ifcadvancedface' in typeof(afs))])) == 0])) == 0) is not False @@ -11500,7 +11502,7 @@ class IfcAdvancedFace_ApplicableEdgeCurves: def __call__(self): - assert ((sizeof([elpfbnds for elpfbnds in [bnds for bnds in self.Bounds if 'ifc4x3_add1.ifcedgeloop' in typeof(bnds.Bound)] if not (sizeof([oe for oe in elpfbnds.Bound.EdgeList if not (sizeof(['ifc4x3_add1.ifcline','ifc4x3_add1.ifcconic','ifc4x3_add1.ifcpolyline','ifc4x3_add1.ifcbsplinecurve'] * typeof(oe.EdgeElement.EdgeGeometry))) == 1])) == 0])) == 0) is not False + assert ((sizeof([elpfbnds for elpfbnds in [bnds for bnds in self.Bounds if 'ifc4x3_add1.ifcedgeloop' in typeof(bnds.Bound)] if not ((sizeof([oe for oe in elpfbnds.Bound.EdgeList if not ((sizeof(['ifc4x3_add1.ifcline','ifc4x3_add1.ifcconic','ifc4x3_add1.ifcpolyline','ifc4x3_add1.ifcbsplinecurve'] * typeof(oe.EdgeElement.EdgeGeometry))) == 1)])) == 0)])) == 0) is not False @@ -11528,7 +11530,7 @@ class IfcAdvancedFace_RequiresEdgeCurve: def __call__(self): - assert ((sizeof([elpfbnds for elpfbnds in [bnds for bnds in self.Bounds if 'ifc4x3_add1.ifcedgeloop' in typeof(bnds.Bound)] if not (sizeof([oe for oe in elpfbnds.Bound.EdgeList if not 'ifc4x3_add1.ifcedgecurve' in typeof(oe.EdgeElement)])) == 0])) == 0) is not False + assert ((sizeof([elpfbnds for elpfbnds in [bnds for bnds in self.Bounds if 'ifc4x3_add1.ifcedgeloop' in typeof(bnds.Bound)] if not ((sizeof([oe for oe in elpfbnds.Bound.EdgeList if not ('ifc4x3_add1.ifcedgecurve' in typeof(oe.EdgeElement))])) == 0)])) == 0) is not False @@ -11791,7 +11793,7 @@ class IfcArbitraryClosedProfileDef_WR2: def __call__(self): outercurve = self.OuterCurve - assert (not 'ifc4x3_add1.ifcline' in typeof(outercurve)) is not False + assert (not ('ifc4x3_add1.ifcline' in typeof(outercurve))) is not False @@ -11805,7 +11807,7 @@ class IfcArbitraryClosedProfileDef_WR3: def __call__(self): outercurve = self.OuterCurve - assert (not 'ifc4x3_add1.ifcoffsetcurve2d' in typeof(outercurve)) is not False + assert (not ('ifc4x3_add1.ifcoffsetcurve2d' in typeof(outercurve))) is not False @@ -12105,7 +12107,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 @@ -12608,7 +12610,7 @@ class IfcBooleanResult_FirstOperandClosed: def __call__(self): firstoperand = self.FirstOperand - assert ((not 'ifc4x3_add1.ifctessellatedfaceset' in typeof(firstoperand)) or (exists(firstoperand.Closed) and firstoperand.Closed)) is not False + assert ((not ('ifc4x3_add1.ifctessellatedfaceset' in typeof(firstoperand))) or (exists(firstoperand.Closed) and firstoperand.Closed)) is not False @@ -12637,7 +12639,7 @@ class IfcBooleanResult_SecondOperandClosed: def __call__(self): secondoperand = self.SecondOperand - assert ((not 'ifc4x3_add1.ifctessellatedfaceset' in typeof(secondoperand)) or (exists(secondoperand.Closed) and secondoperand.Closed)) is not False + assert ((not ('ifc4x3_add1.ifctessellatedfaceset' in typeof(secondoperand))) or (exists(secondoperand.Closed) and secondoperand.Closed)) is not False @@ -12706,7 +12708,7 @@ class IfcBoxedHalfSpace_UnboundedSurface: def __call__(self): - assert (not 'ifc4x3_add1.ifccurveboundedplane' in typeof(self.BaseSurface)) is not False + assert (not ('ifc4x3_add1.ifccurveboundedplane' in typeof(self.BaseSurface))) is not False @@ -14974,7 +14976,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 @@ -14989,7 +14991,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 @@ -16669,7 +16671,7 @@ class IfcGeometricRepresentationSubContext_ParentNoSub: def __call__(self): parentcontext = self.ParentContext - assert (not 'ifc4x3_add1.ifcgeometricrepresentationsubcontext' in typeof(parentcontext)) is not False + assert (not ('ifc4x3_add1.ifcgeometricrepresentationsubcontext' in typeof(parentcontext))) is not False @@ -17527,7 +17529,7 @@ class IfcMaterialDefinitionRepresentation_OnlyStyledRepresentations: def __call__(self): representations = self.Representations - assert ((sizeof([temp for temp in representations if not 'ifc4x3_add1.ifcstyledrepresentation' in typeof(temp)])) == 0) is not False + assert ((sizeof([temp for temp in representations if not ('ifc4x3_add1.ifcstyledrepresentation' in typeof(temp))])) == 0) is not False @@ -17986,7 +17988,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 @@ -18106,7 +18108,7 @@ class IfcOrientedEdge_EdgeElementNotOriented: def __call__(self): edgeelement = self.EdgeElement - assert (not 'ifc4x3_add1.ifcorientededge' in typeof(edgeelement)) is not False + assert (not ('ifc4x3_add1.ifcorientededge' in typeof(edgeelement))) is not False @@ -18890,7 +18892,7 @@ class IfcProductDefinitionShape_OnlyShapeModel: def __call__(self): representations = self.Representations - assert ((sizeof([temp for temp in representations if not 'ifc4x3_add1.ifcshapemodel' in typeof(temp)])) == 0) is not False + assert ((sizeof([temp for temp in representations if not ('ifc4x3_add1.ifcshapemodel' in typeof(temp))])) == 0) is not False @@ -19080,7 +19082,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 @@ -19095,7 +19097,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 @@ -19873,7 +19875,7 @@ class IfcRectangularTrimmedSurface_UsenseCompatible: u2 = self.U2 usense = self.Usense - assert ((('ifc4x3_add1.ifcelementarysurface' in typeof(basissurface)) and (not 'ifc4x3_add1.ifcplane' in typeof(basissurface))) or ('ifc4x3_add1.ifcsurfaceofrevolution' in typeof(basissurface)) or (usense == (u2 > u1))) is not False + assert ((('ifc4x3_add1.ifcelementarysurface' in typeof(basissurface)) and (not ('ifc4x3_add1.ifcplane' in typeof(basissurface)))) or ('ifc4x3_add1.ifcsurfaceofrevolution' in typeof(basissurface)) or (usense == (u2 > u1))) is not False @@ -20444,7 +20446,7 @@ class IfcRelReferencedInSpatialStructure_AllowedRelatedElements: def __call__(self): relatedelements = self.RelatedElements - assert ((sizeof([temp for temp in relatedelements if ('ifc4x3_add1.ifcspatialstructureelement' in typeof(temp)) and (not 'ifc4x3_add1.ifcspace' in typeof(temp))])) == 0) is not False + assert ((sizeof([temp for temp in relatedelements if ('ifc4x3_add1.ifcspatialstructureelement' in typeof(temp)) and (not ('ifc4x3_add1.ifcspace' in typeof(temp)))])) == 0) is not False @@ -20494,7 +20496,7 @@ class IfcRelSpaceBoundary_CorrectPhysOrVirt: relatedbuildingelement = self.RelatedBuildingElement physicalorvirtualboundary = self.PhysicalOrVirtualBoundary - assert (((physicalorvirtualboundary == IfcPhysicalOrVirtualEnum.Physical) and (not 'ifc4x3_add1.ifcvirtualelement' in typeof(relatedbuildingelement))) or ((physicalorvirtualboundary == IfcPhysicalOrVirtualEnum.Virtual) and (('ifc4x3_add1.ifcvirtualelement' in typeof(relatedbuildingelement)) or ('ifc4x3_add1.ifcopeningelement' in typeof(relatedbuildingelement)))) or (physicalorvirtualboundary == IfcPhysicalOrVirtualEnum.NotDefined)) is not False + assert (((physicalorvirtualboundary == IfcPhysicalOrVirtualEnum.Physical) and (not ('ifc4x3_add1.ifcvirtualelement' in typeof(relatedbuildingelement)))) or ((physicalorvirtualboundary == IfcPhysicalOrVirtualEnum.Virtual) and (('ifc4x3_add1.ifcvirtualelement' in typeof(relatedbuildingelement)) or ('ifc4x3_add1.ifcopeningelement' in typeof(relatedbuildingelement)))) or (physicalorvirtualboundary == IfcPhysicalOrVirtualEnum.NotDefined)) is not False @@ -21205,7 +21207,7 @@ class IfcShapeRepresentation_NoTopologicalItem: def __call__(self): items = self.Items - assert ((sizeof([temp for temp in items if ('ifc4x3_add1.ifctopologicalrepresentationitem' in typeof(temp)) and (not (sizeof(['ifc4x3_add1.ifcvertexpoint','ifc4x3_add1.ifcedgecurve','ifc4x3_add1.ifcfacesurface'] * typeof(temp))) == 1)])) == 0) is not False + assert ((sizeof([temp for temp in items if ('ifc4x3_add1.ifctopologicalrepresentationitem' in typeof(temp)) and (not ((sizeof(['ifc4x3_add1.ifcvertexpoint','ifc4x3_add1.ifcedgecurve','ifc4x3_add1.ifcfacesurface'] * typeof(temp))) == 1))])) == 0) is not False @@ -22105,7 +22107,7 @@ class IfcStyledItem_ApplicableItem: def __call__(self): item = self.Item - assert (not 'ifc4x3_add1.ifcstyleditem' in typeof(item)) is not False + assert (not ('ifc4x3_add1.ifcstyleditem' in typeof(item))) is not False @@ -22120,7 +22122,7 @@ class IfcStyledRepresentation_OnlyStyledItems: def __call__(self): - assert ((sizeof([temp for temp in self.Items if not 'ifc4x3_add1.ifcstyleditem' in typeof(temp)])) == 0) is not False + assert ((sizeof([temp for temp in self.Items if not ('ifc4x3_add1.ifcstyleditem' in typeof(temp))])) == 0) is not False @@ -22190,7 +22192,7 @@ class IfcSurfaceCurve_CurveIsNotPcurve: def __call__(self): curve3d = self.Curve3D - assert (not 'ifc4x3_add1.ifcpcurve' in typeof(curve3d)) is not False + assert (not ('ifc4x3_add1.ifcpcurve' in typeof(curve3d))) is not False @@ -22952,7 +22954,7 @@ class IfcTextLiteralWithExtent_WR31: def __call__(self): extent = self.Extent - assert (not 'ifc4x3_add1.ifcplanarbox' in typeof(extent)) is not False + assert (not ('ifc4x3_add1.ifcplanarbox' in typeof(extent))) is not False @@ -23027,7 +23029,7 @@ class IfcTopologyRepresentation_WR21: def __call__(self): - assert ((sizeof([temp for temp in self.Items if not 'ifc4x3_add1.ifctopologicalrepresentationitem' in typeof(temp)])) == 0) is not False + assert ((sizeof([temp for temp in self.Items if not ('ifc4x3_add1.ifctopologicalrepresentationitem' in typeof(temp))])) == 0) is not False @@ -23250,7 +23252,7 @@ class IfcTrimmedCurve_NoTrimOfBoundedCurves: def __call__(self): basiscurve = self.BasisCurve - assert (not 'ifc4x3_add1.ifcboundedcurve' in typeof(basiscurve)) is not False + assert (not ('ifc4x3_add1.ifcboundedcurve' in typeof(basiscurve))) is not False @@ -23369,7 +23371,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 'ifc4x3_add1.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 ('ifc4x3_add1.ifcproduct' in typeof(temp))])) == 0)) is not False @@ -23897,7 +23899,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 @@ -23912,7 +23914,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 @@ -23927,7 +23929,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 @@ -24053,7 +24055,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 ('ifc4x3_add1.ifczone' in typeof(temp)) or ('ifc4x3_add1.ifcspace' in typeof(temp)) or ('ifc4x3_add1.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 (('ifc4x3_add1.ifczone' in typeof(temp)) or ('ifc4x3_add1.ifcspace' in typeof(temp)) or ('ifc4x3_add1.ifcspatialzone' in typeof(temp)))])) == 0)) is not False @@ -24069,7 +24071,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 @@ -24388,13 +24390,13 @@ def IfcCorrectUnitAssignment(units): monetaryunitnumber = 0 namedunitnames = express_set([]) derivedunitnames = express_set([]) - namedunitnumber = sizeof([temp for temp in units if ('ifc4x3_add1.ifcnamedunit' in typeof(temp)) and (not temp.UnitType == IfcUnitEnum.USERDEFINED)]) - derivedunitnumber = sizeof([temp for temp in units if ('ifc4x3_add1.ifcderivedunit' in typeof(temp)) and (not temp.UnitType == IfcDerivedUnitEnum.USERDEFINED)]) + namedunitnumber = sizeof([temp for temp in units if ('ifc4x3_add1.ifcnamedunit' in typeof(temp)) and (not (temp.UnitType == IfcUnitEnum.USERDEFINED))]) + derivedunitnumber = sizeof([temp for temp in units if ('ifc4x3_add1.ifcderivedunit' in typeof(temp)) and (not (temp.UnitType == IfcDerivedUnitEnum.USERDEFINED))]) monetaryunitnumber = sizeof([temp for temp in units if 'ifc4x3_add1.ifcmonetaryunit' in typeof(temp)]) for i in range(1, sizeof(units) + 1): - if ('ifc4x3_add1.ifcnamedunit' in (typeof(units[i - 1]))) and (not (units[i - 1].UnitType) == IfcUnitEnum.USERDEFINED): + if ('ifc4x3_add1.ifcnamedunit' in (typeof(units[i - 1]))) and (not ((units[i - 1].UnitType) == IfcUnitEnum.USERDEFINED)): namedunitnames = namedunitnames + (units[i - 1].UnitType) - if ('ifc4x3_add1.ifcderivedunit' in (typeof(units[i - 1]))) and (not (units[i - 1].UnitType) == IfcDerivedUnitEnum.USERDEFINED): + if ('ifc4x3_add1.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) diff --git a/src/ifcopenshell-python/ifcopenshell/express/rules/IFC4X3_RC1.py b/src/ifcopenshell-python/ifcopenshell/express/rules/IFC4X3_RC1.py index d2b5f14c50..02c9f06fc3 100644 --- a/src/ifcopenshell-python/ifcopenshell/express/rules/IFC4X3_RC1.py +++ b/src/ifcopenshell-python/ifcopenshell/express/rules/IFC4X3_RC1.py @@ -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: @@ -11413,7 +11415,7 @@ class IfcAdvancedBrep_HasAdvancedFaces: def __call__(self): - assert ((sizeof([afs for afs in self.Outer.CfsFaces if not 'ifc4x3_rc1.ifcadvancedface' in typeof(afs)])) == 0) is not False + assert ((sizeof([afs for afs in self.Outer.CfsFaces if not ('ifc4x3_rc1.ifcadvancedface' in typeof(afs))])) == 0) is not False @@ -11428,7 +11430,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 'ifc4x3_rc1.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 ('ifc4x3_rc1.ifcadvancedface' in typeof(afs))])) == 0])) == 0) is not False @@ -11457,7 +11459,7 @@ class IfcAdvancedFace_RequiresEdgeCurve: def __call__(self): - assert ((sizeof([elpfbnds for elpfbnds in [bnds for bnds in self.Bounds if 'ifc4x3_rc1.ifcedgeloop' in typeof(bnds.Bound)] if not (sizeof([oe for oe in elpfbnds.Bound.EdgeList if not 'ifc4x3_rc1.ifcedgecurve' in typeof(oe.EdgeElement)])) == 0])) == 0) is not False + assert ((sizeof([elpfbnds for elpfbnds in [bnds for bnds in self.Bounds if 'ifc4x3_rc1.ifcedgeloop' in typeof(bnds.Bound)] if not ((sizeof([oe for oe in elpfbnds.Bound.EdgeList if not ('ifc4x3_rc1.ifcedgecurve' in typeof(oe.EdgeElement))])) == 0)])) == 0) is not False @@ -11471,7 +11473,7 @@ class IfcAdvancedFace_ApplicableEdgeCurves: def __call__(self): - assert ((sizeof([elpfbnds for elpfbnds in [bnds for bnds in self.Bounds if 'ifc4x3_rc1.ifcedgeloop' in typeof(bnds.Bound)] if not (sizeof([oe for oe in elpfbnds.Bound.EdgeList if not (sizeof(['ifc4x3_rc1.ifcline','ifc4x3_rc1.ifcconic','ifc4x3_rc1.ifcpolyline','ifc4x3_rc1.ifcbsplinecurve'] * typeof(oe.EdgeElement.EdgeGeometry))) == 1])) == 0])) == 0) is not False + assert ((sizeof([elpfbnds for elpfbnds in [bnds for bnds in self.Bounds if 'ifc4x3_rc1.ifcedgeloop' in typeof(bnds.Bound)] if not ((sizeof([oe for oe in elpfbnds.Bound.EdgeList if not ((sizeof(['ifc4x3_rc1.ifcline','ifc4x3_rc1.ifcconic','ifc4x3_rc1.ifcpolyline','ifc4x3_rc1.ifcbsplinecurve'] * typeof(oe.EdgeElement.EdgeGeometry))) == 1)])) == 0)])) == 0) is not False @@ -11752,7 +11754,7 @@ class IfcArbitraryClosedProfileDef_WR2: def __call__(self): outercurve = self.OuterCurve - assert (not 'ifc4x3_rc1.ifcline' in typeof(outercurve)) is not False + assert (not ('ifc4x3_rc1.ifcline' in typeof(outercurve))) is not False @@ -11766,7 +11768,7 @@ class IfcArbitraryClosedProfileDef_WR3: def __call__(self): outercurve = self.OuterCurve - assert (not 'ifc4x3_rc1.ifcoffsetcurve2d' in typeof(outercurve)) is not False + assert (not ('ifc4x3_rc1.ifcoffsetcurve2d' in typeof(outercurve))) is not False @@ -12095,7 +12097,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 @@ -12530,7 +12532,7 @@ class IfcBooleanResult_FirstOperandClosed: def __call__(self): firstoperand = self.FirstOperand - assert ((not 'ifc4x3_rc1.ifctessellatedfaceset' in typeof(firstoperand)) or (exists(firstoperand.Closed) and firstoperand.Closed)) is not False + assert ((not ('ifc4x3_rc1.ifctessellatedfaceset' in typeof(firstoperand))) or (exists(firstoperand.Closed) and firstoperand.Closed)) is not False @@ -12544,7 +12546,7 @@ class IfcBooleanResult_SecondOperandClosed: def __call__(self): secondoperand = self.SecondOperand - assert ((not 'ifc4x3_rc1.ifctessellatedfaceset' in typeof(secondoperand)) or (exists(secondoperand.Closed) and secondoperand.Closed)) is not False + assert ((not ('ifc4x3_rc1.ifctessellatedfaceset' in typeof(secondoperand))) or (exists(secondoperand.Closed) and secondoperand.Closed)) is not False @@ -12613,7 +12615,7 @@ class IfcBoxedHalfSpace_UnboundedSurface: def __call__(self): - assert (not 'ifc4x3_rc1.ifccurveboundedplane' in typeof(self.BaseSurface)) is not False + assert (not ('ifc4x3_rc1.ifccurveboundedplane' in typeof(self.BaseSurface))) is not False @@ -14835,7 +14837,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 @@ -14850,7 +14852,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 @@ -16480,7 +16482,7 @@ class IfcGeometricRepresentationSubContext_ParentNoSub: def __call__(self): parentcontext = self.ParentContext - assert (not 'ifc4x3_rc1.ifcgeometricrepresentationsubcontext' in typeof(parentcontext)) is not False + assert (not ('ifc4x3_rc1.ifcgeometricrepresentationsubcontext' in typeof(parentcontext))) is not False @@ -17290,7 +17292,7 @@ class IfcMaterialDefinitionRepresentation_OnlyStyledRepresentations: def __call__(self): representations = self.Representations - assert ((sizeof([temp for temp in representations if not 'ifc4x3_rc1.ifcstyledrepresentation' in typeof(temp)])) == 0) is not False + assert ((sizeof([temp for temp in representations if not ('ifc4x3_rc1.ifcstyledrepresentation' in typeof(temp))])) == 0) is not False @@ -17764,7 +17766,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 @@ -17878,7 +17880,7 @@ class IfcOrientedEdge_EdgeElementNotOriented: def __call__(self): edgeelement = self.EdgeElement - assert (not 'ifc4x3_rc1.ifcorientededge' in typeof(edgeelement)) is not False + assert (not ('ifc4x3_rc1.ifcorientededge' in typeof(edgeelement))) is not False @@ -18615,7 +18617,7 @@ class IfcProductDefinitionShape_OnlyShapeModel: def __call__(self): representations = self.Representations - assert ((sizeof([temp for temp in representations if not 'ifc4x3_rc1.ifcshapemodel' in typeof(temp)])) == 0) is not False + assert ((sizeof([temp for temp in representations if not ('ifc4x3_rc1.ifcshapemodel' in typeof(temp))])) == 0) is not False @@ -18793,7 +18795,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 @@ -18808,7 +18810,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 @@ -19586,7 +19588,7 @@ class IfcRectangularTrimmedSurface_UsenseCompatible: u2 = self.U2 usense = self.Usense - assert ((('ifc4x3_rc1.ifcelementarysurface' in typeof(basissurface)) and (not 'ifc4x3_rc1.ifcplane' in typeof(basissurface))) or ('ifc4x3_rc1.ifcsurfaceofrevolution' in typeof(basissurface)) or (usense == (u2 > u1))) is not False + assert ((('ifc4x3_rc1.ifcelementarysurface' in typeof(basissurface)) and (not ('ifc4x3_rc1.ifcplane' in typeof(basissurface)))) or ('ifc4x3_rc1.ifcsurfaceofrevolution' in typeof(basissurface)) or (usense == (u2 > u1))) is not False @@ -20152,7 +20154,7 @@ class IfcRelReferencedInSpatialStructure_AllowedRelatedElements: def __call__(self): relatedelements = self.RelatedElements - assert ((sizeof([temp for temp in relatedelements if ('ifc4x3_rc1.ifcspatialstructureelement' in typeof(temp)) and (not 'ifc4x3_rc1.ifcspace' in typeof(temp))])) == 0) is not False + assert ((sizeof([temp for temp in relatedelements if ('ifc4x3_rc1.ifcspatialstructureelement' in typeof(temp)) and (not ('ifc4x3_rc1.ifcspace' in typeof(temp)))])) == 0) is not False @@ -20202,7 +20204,7 @@ class IfcRelSpaceBoundary_CorrectPhysOrVirt: relatedbuildingelement = self.RelatedBuildingElement physicalorvirtualboundary = self.PhysicalOrVirtualBoundary - assert (((physicalorvirtualboundary == IfcPhysicalOrVirtualEnum.Physical) and (not 'ifc4x3_rc1.ifcvirtualelement' in typeof(relatedbuildingelement))) or ((physicalorvirtualboundary == IfcPhysicalOrVirtualEnum.Virtual) and (('ifc4x3_rc1.ifcvirtualelement' in typeof(relatedbuildingelement)) or ('ifc4x3_rc1.ifcopeningelement' in typeof(relatedbuildingelement)))) or (physicalorvirtualboundary == IfcPhysicalOrVirtualEnum.NotDefined)) is not False + assert (((physicalorvirtualboundary == IfcPhysicalOrVirtualEnum.Physical) and (not ('ifc4x3_rc1.ifcvirtualelement' in typeof(relatedbuildingelement)))) or ((physicalorvirtualboundary == IfcPhysicalOrVirtualEnum.Virtual) and (('ifc4x3_rc1.ifcvirtualelement' in typeof(relatedbuildingelement)) or ('ifc4x3_rc1.ifcopeningelement' in typeof(relatedbuildingelement)))) or (physicalorvirtualboundary == IfcPhysicalOrVirtualEnum.NotDefined)) is not False @@ -20742,7 +20744,7 @@ class IfcShapeRepresentation_NoTopologicalItem: def __call__(self): items = self.Items - assert ((sizeof([temp for temp in items if ('ifc4x3_rc1.ifctopologicalrepresentationitem' in typeof(temp)) and (not (sizeof(['ifc4x3_rc1.ifcvertexpoint','ifc4x3_rc1.ifcedgecurve','ifc4x3_rc1.ifcfacesurface'] * typeof(temp))) == 1)])) == 0) is not False + assert ((sizeof([temp for temp in items if ('ifc4x3_rc1.ifctopologicalrepresentationitem' in typeof(temp)) and (not ((sizeof(['ifc4x3_rc1.ifcvertexpoint','ifc4x3_rc1.ifcedgecurve','ifc4x3_rc1.ifcfacesurface'] * typeof(temp))) == 1))])) == 0) is not False @@ -21711,7 +21713,7 @@ class IfcStyledItem_ApplicableItem: def __call__(self): item = self.Item - assert (not 'ifc4x3_rc1.ifcstyleditem' in typeof(item)) is not False + assert (not ('ifc4x3_rc1.ifcstyleditem' in typeof(item))) is not False @@ -21726,7 +21728,7 @@ class IfcStyledRepresentation_OnlyStyledItems: def __call__(self): - assert ((sizeof([temp for temp in self.Items if not 'ifc4x3_rc1.ifcstyleditem' in typeof(temp)])) == 0) is not False + assert ((sizeof([temp for temp in self.Items if not ('ifc4x3_rc1.ifcstyleditem' in typeof(temp))])) == 0) is not False @@ -21796,7 +21798,7 @@ class IfcSurfaceCurve_CurveIsNotPcurve: def __call__(self): curve3d = self.Curve3D - assert (not 'ifc4x3_rc1.ifcpcurve' in typeof(curve3d)) is not False + assert (not ('ifc4x3_rc1.ifcpcurve' in typeof(curve3d))) is not False @@ -22558,7 +22560,7 @@ class IfcTextLiteralWithExtent_WR31: def __call__(self): extent = self.Extent - assert (not 'ifc4x3_rc1.ifcplanarbox' in typeof(extent)) is not False + assert (not ('ifc4x3_rc1.ifcplanarbox' in typeof(extent))) is not False @@ -22624,7 +22626,7 @@ class IfcTopologyRepresentation_WR21: def __call__(self): - assert ((sizeof([temp for temp in self.Items if not 'ifc4x3_rc1.ifctopologicalrepresentationitem' in typeof(temp)])) == 0) is not False + assert ((sizeof([temp for temp in self.Items if not ('ifc4x3_rc1.ifctopologicalrepresentationitem' in typeof(temp))])) == 0) is not False @@ -22872,7 +22874,7 @@ class IfcTrimmedCurve_NoTrimOfBoundedCurves: def __call__(self): basiscurve = self.BasisCurve - assert (not 'ifc4x3_rc1.ifcboundedcurve' in typeof(basiscurve)) is not False + assert (not ('ifc4x3_rc1.ifcboundedcurve' in typeof(basiscurve))) is not False @@ -22963,7 +22965,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 'ifc4x3_rc1.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 ('ifc4x3_rc1.ifcproduct' in typeof(temp))])) == 0)) is not False @@ -23439,7 +23441,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 @@ -23454,7 +23456,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 @@ -23469,7 +23471,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 @@ -23601,7 +23603,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 ('ifc4x3_rc1.ifczone' in typeof(temp)) or ('ifc4x3_rc1.ifcspace' in typeof(temp)) or ('ifc4x3_rc1.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 (('ifc4x3_rc1.ifczone' in typeof(temp)) or ('ifc4x3_rc1.ifcspace' in typeof(temp)) or ('ifc4x3_rc1.ifcspatialzone' in typeof(temp)))])) == 0)) is not False @@ -23617,7 +23619,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 @@ -23937,25 +23939,25 @@ def IfcCorrectObjectAssignment(constraint, objects): if constraint == IfcObjectTypeEnum.NOTDEFINED: return True elif constraint == IfcObjectTypeEnum.PRODUCT: - count = sizeof([temp for temp in objects if not 'ifc4x3_rc1.ifcproduct' in typeof(temp)]) + count = sizeof([temp for temp in objects if not ('ifc4x3_rc1.ifcproduct' in typeof(temp))]) return count == 0 elif constraint == IfcObjectTypeEnum.PROCESS: - count = sizeof([temp for temp in objects if not 'ifc4x3_rc1.ifcprocess' in typeof(temp)]) + count = sizeof([temp for temp in objects if not ('ifc4x3_rc1.ifcprocess' in typeof(temp))]) return count == 0 elif constraint == IfcObjectTypeEnum.CONTROL: - count = sizeof([temp for temp in objects if not 'ifc4x3_rc1.ifccontrol' in typeof(temp)]) + count = sizeof([temp for temp in objects if not ('ifc4x3_rc1.ifccontrol' in typeof(temp))]) return count == 0 elif constraint == IfcObjectTypeEnum.RESOURCE: - count = sizeof([temp for temp in objects if not 'ifc4x3_rc1.ifcresource' in typeof(temp)]) + count = sizeof([temp for temp in objects if not ('ifc4x3_rc1.ifcresource' in typeof(temp))]) return count == 0 elif constraint == IfcObjectTypeEnum.ACTOR: - count = sizeof([temp for temp in objects if not 'ifc4x3_rc1.ifcactor' in typeof(temp)]) + count = sizeof([temp for temp in objects if not ('ifc4x3_rc1.ifcactor' in typeof(temp))]) return count == 0 elif constraint == IfcObjectTypeEnum.GROUP: - count = sizeof([temp for temp in objects if not 'ifc4x3_rc1.ifcgroup' in typeof(temp)]) + count = sizeof([temp for temp in objects if not ('ifc4x3_rc1.ifcgroup' in typeof(temp))]) return count == 0 elif constraint == IfcObjectTypeEnum.PROJECT: - count = sizeof([temp for temp in objects if not 'ifc4x3_rc1.ifcproject' in typeof(temp)]) + count = sizeof([temp for temp in objects if not ('ifc4x3_rc1.ifcproject' in typeof(temp))]) return count == 0 else: return None @@ -23967,13 +23969,13 @@ def IfcCorrectUnitAssignment(units): monetaryunitnumber = 0 namedunitnames = express_set([]) derivedunitnames = express_set([]) - namedunitnumber = sizeof([temp for temp in units if ('ifc4x3_rc1.ifcnamedunit' in typeof(temp)) and (not temp.UnitType == IfcUnitEnum.USERDEFINED)]) - derivedunitnumber = sizeof([temp for temp in units if ('ifc4x3_rc1.ifcderivedunit' in typeof(temp)) and (not temp.UnitType == IfcDerivedUnitEnum.USERDEFINED)]) + namedunitnumber = sizeof([temp for temp in units if ('ifc4x3_rc1.ifcnamedunit' in typeof(temp)) and (not (temp.UnitType == IfcUnitEnum.USERDEFINED))]) + derivedunitnumber = sizeof([temp for temp in units if ('ifc4x3_rc1.ifcderivedunit' in typeof(temp)) and (not (temp.UnitType == IfcDerivedUnitEnum.USERDEFINED))]) monetaryunitnumber = sizeof([temp for temp in units if 'ifc4x3_rc1.ifcmonetaryunit' in typeof(temp)]) for i in range(1, sizeof(units) + 1): - if ('ifc4x3_rc1.ifcnamedunit' in (typeof(units[i - 1]))) and (not (units[i - 1].UnitType) == IfcUnitEnum.USERDEFINED): + if ('ifc4x3_rc1.ifcnamedunit' in (typeof(units[i - 1]))) and (not ((units[i - 1].UnitType) == IfcUnitEnum.USERDEFINED)): namedunitnames = namedunitnames + (units[i - 1].UnitType) - if ('ifc4x3_rc1.ifcderivedunit' in (typeof(units[i - 1]))) and (not (units[i - 1].UnitType) == IfcDerivedUnitEnum.USERDEFINED): + if ('ifc4x3_rc1.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) diff --git a/src/ifcopenshell-python/ifcopenshell/express/rules/IFC4X3_RC2.py b/src/ifcopenshell-python/ifcopenshell/express/rules/IFC4X3_RC2.py index ac490428bf..3b79b02353 100644 --- a/src/ifcopenshell-python/ifcopenshell/express/rules/IFC4X3_RC2.py +++ b/src/ifcopenshell-python/ifcopenshell/express/rules/IFC4X3_RC2.py @@ -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: @@ -11512,7 +11514,7 @@ class IfcAdvancedBrep_HasAdvancedFaces: def __call__(self): - assert ((sizeof([afs for afs in self.Outer.CfsFaces if not 'ifc4x3_rc2.ifcadvancedface' in typeof(afs)])) == 0) is not False + assert ((sizeof([afs for afs in self.Outer.CfsFaces if not ('ifc4x3_rc2.ifcadvancedface' in typeof(afs))])) == 0) is not False @@ -11527,7 +11529,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 'ifc4x3_rc2.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 ('ifc4x3_rc2.ifcadvancedface' in typeof(afs))])) == 0])) == 0) is not False @@ -11556,7 +11558,7 @@ class IfcAdvancedFace_RequiresEdgeCurve: def __call__(self): - assert ((sizeof([elpfbnds for elpfbnds in [bnds for bnds in self.Bounds if 'ifc4x3_rc2.ifcedgeloop' in typeof(bnds.Bound)] if not (sizeof([oe for oe in elpfbnds.Bound.EdgeList if not 'ifc4x3_rc2.ifcedgecurve' in typeof(oe.EdgeElement)])) == 0])) == 0) is not False + assert ((sizeof([elpfbnds for elpfbnds in [bnds for bnds in self.Bounds if 'ifc4x3_rc2.ifcedgeloop' in typeof(bnds.Bound)] if not ((sizeof([oe for oe in elpfbnds.Bound.EdgeList if not ('ifc4x3_rc2.ifcedgecurve' in typeof(oe.EdgeElement))])) == 0)])) == 0) is not False @@ -11570,7 +11572,7 @@ class IfcAdvancedFace_ApplicableEdgeCurves: def __call__(self): - assert ((sizeof([elpfbnds for elpfbnds in [bnds for bnds in self.Bounds if 'ifc4x3_rc2.ifcedgeloop' in typeof(bnds.Bound)] if not (sizeof([oe for oe in elpfbnds.Bound.EdgeList if not (sizeof(['ifc4x3_rc2.ifcline','ifc4x3_rc2.ifcconic','ifc4x3_rc2.ifcpolyline','ifc4x3_rc2.ifcbsplinecurve'] * typeof(oe.EdgeElement.EdgeGeometry))) == 1])) == 0])) == 0) is not False + assert ((sizeof([elpfbnds for elpfbnds in [bnds for bnds in self.Bounds if 'ifc4x3_rc2.ifcedgeloop' in typeof(bnds.Bound)] if not ((sizeof([oe for oe in elpfbnds.Bound.EdgeList if not ((sizeof(['ifc4x3_rc2.ifcline','ifc4x3_rc2.ifcconic','ifc4x3_rc2.ifcpolyline','ifc4x3_rc2.ifcbsplinecurve'] * typeof(oe.EdgeElement.EdgeGeometry))) == 1)])) == 0)])) == 0) is not False @@ -11845,7 +11847,7 @@ class IfcArbitraryClosedProfileDef_WR2: def __call__(self): outercurve = self.OuterCurve - assert (not 'ifc4x3_rc2.ifcline' in typeof(outercurve)) is not False + assert (not ('ifc4x3_rc2.ifcline' in typeof(outercurve))) is not False @@ -11859,7 +11861,7 @@ class IfcArbitraryClosedProfileDef_WR3: def __call__(self): outercurve = self.OuterCurve - assert (not 'ifc4x3_rc2.ifcoffsetcurve2d' in typeof(outercurve)) is not False + assert (not ('ifc4x3_rc2.ifcoffsetcurve2d' in typeof(outercurve))) is not False @@ -12216,7 +12218,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 @@ -12698,7 +12700,7 @@ class IfcBooleanResult_FirstOperandClosed: def __call__(self): firstoperand = self.FirstOperand - assert ((not 'ifc4x3_rc2.ifctessellatedfaceset' in typeof(firstoperand)) or (exists(firstoperand.Closed) and firstoperand.Closed)) is not False + assert ((not ('ifc4x3_rc2.ifctessellatedfaceset' in typeof(firstoperand))) or (exists(firstoperand.Closed) and firstoperand.Closed)) is not False @@ -12712,7 +12714,7 @@ class IfcBooleanResult_SecondOperandClosed: def __call__(self): secondoperand = self.SecondOperand - assert ((not 'ifc4x3_rc2.ifctessellatedfaceset' in typeof(secondoperand)) or (exists(secondoperand.Closed) and secondoperand.Closed)) is not False + assert ((not ('ifc4x3_rc2.ifctessellatedfaceset' in typeof(secondoperand))) or (exists(secondoperand.Closed) and secondoperand.Closed)) is not False @@ -12781,7 +12783,7 @@ class IfcBoxedHalfSpace_UnboundedSurface: def __call__(self): - assert (not 'ifc4x3_rc2.ifccurveboundedplane' in typeof(self.BaseSurface)) is not False + assert (not ('ifc4x3_rc2.ifccurveboundedplane' in typeof(self.BaseSurface))) is not False @@ -15006,7 +15008,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 @@ -15021,7 +15023,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 @@ -16651,7 +16653,7 @@ class IfcGeometricRepresentationSubContext_ParentNoSub: def __call__(self): parentcontext = self.ParentContext - assert (not 'ifc4x3_rc2.ifcgeometricrepresentationsubcontext' in typeof(parentcontext)) is not False + assert (not ('ifc4x3_rc2.ifcgeometricrepresentationsubcontext' in typeof(parentcontext))) is not False @@ -17472,7 +17474,7 @@ class IfcMaterialDefinitionRepresentation_OnlyStyledRepresentations: def __call__(self): representations = self.Representations - assert ((sizeof([temp for temp in representations if not 'ifc4x3_rc2.ifcstyledrepresentation' in typeof(temp)])) == 0) is not False + assert ((sizeof([temp for temp in representations if not ('ifc4x3_rc2.ifcstyledrepresentation' in typeof(temp))])) == 0) is not False @@ -17946,7 +17948,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 @@ -18057,7 +18059,7 @@ class IfcOrientedEdge_EdgeElementNotOriented: def __call__(self): edgeelement = self.EdgeElement - assert (not 'ifc4x3_rc2.ifcorientededge' in typeof(edgeelement)) is not False + assert (not ('ifc4x3_rc2.ifcorientededge' in typeof(edgeelement))) is not False @@ -18802,7 +18804,7 @@ class IfcProductDefinitionShape_OnlyShapeModel: def __call__(self): representations = self.Representations - assert ((sizeof([temp for temp in representations if not 'ifc4x3_rc2.ifcshapemodel' in typeof(temp)])) == 0) is not False + assert ((sizeof([temp for temp in representations if not ('ifc4x3_rc2.ifcshapemodel' in typeof(temp))])) == 0) is not False @@ -18980,7 +18982,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 @@ -18995,7 +18997,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 @@ -19773,7 +19775,7 @@ class IfcRectangularTrimmedSurface_UsenseCompatible: u2 = self.U2 usense = self.Usense - assert ((('ifc4x3_rc2.ifcelementarysurface' in typeof(basissurface)) and (not 'ifc4x3_rc2.ifcplane' in typeof(basissurface))) or ('ifc4x3_rc2.ifcsurfaceofrevolution' in typeof(basissurface)) or (usense == (u2 > u1))) is not False + assert ((('ifc4x3_rc2.ifcelementarysurface' in typeof(basissurface)) and (not ('ifc4x3_rc2.ifcplane' in typeof(basissurface)))) or ('ifc4x3_rc2.ifcsurfaceofrevolution' in typeof(basissurface)) or (usense == (u2 > u1))) is not False @@ -20339,7 +20341,7 @@ class IfcRelReferencedInSpatialStructure_AllowedRelatedElements: def __call__(self): relatedelements = self.RelatedElements - assert ((sizeof([temp for temp in relatedelements if ('ifc4x3_rc2.ifcspatialstructureelement' in typeof(temp)) and (not 'ifc4x3_rc2.ifcspace' in typeof(temp))])) == 0) is not False + assert ((sizeof([temp for temp in relatedelements if ('ifc4x3_rc2.ifcspatialstructureelement' in typeof(temp)) and (not ('ifc4x3_rc2.ifcspace' in typeof(temp)))])) == 0) is not False @@ -20389,7 +20391,7 @@ class IfcRelSpaceBoundary_CorrectPhysOrVirt: relatedbuildingelement = self.RelatedBuildingElement physicalorvirtualboundary = self.PhysicalOrVirtualBoundary - assert (((physicalorvirtualboundary == IfcPhysicalOrVirtualEnum.Physical) and (not 'ifc4x3_rc2.ifcvirtualelement' in typeof(relatedbuildingelement))) or ((physicalorvirtualboundary == IfcPhysicalOrVirtualEnum.Virtual) and (('ifc4x3_rc2.ifcvirtualelement' in typeof(relatedbuildingelement)) or ('ifc4x3_rc2.ifcopeningelement' in typeof(relatedbuildingelement)))) or (physicalorvirtualboundary == IfcPhysicalOrVirtualEnum.NotDefined)) is not False + assert (((physicalorvirtualboundary == IfcPhysicalOrVirtualEnum.Physical) and (not ('ifc4x3_rc2.ifcvirtualelement' in typeof(relatedbuildingelement)))) or ((physicalorvirtualboundary == IfcPhysicalOrVirtualEnum.Virtual) and (('ifc4x3_rc2.ifcvirtualelement' in typeof(relatedbuildingelement)) or ('ifc4x3_rc2.ifcopeningelement' in typeof(relatedbuildingelement)))) or (physicalorvirtualboundary == IfcPhysicalOrVirtualEnum.NotDefined)) is not False @@ -20938,7 +20940,7 @@ class IfcShapeRepresentation_NoTopologicalItem: def __call__(self): items = self.Items - assert ((sizeof([temp for temp in items if ('ifc4x3_rc2.ifctopologicalrepresentationitem' in typeof(temp)) and (not (sizeof(['ifc4x3_rc2.ifcvertexpoint','ifc4x3_rc2.ifcedgecurve','ifc4x3_rc2.ifcfacesurface'] * typeof(temp))) == 1)])) == 0) is not False + assert ((sizeof([temp for temp in items if ('ifc4x3_rc2.ifctopologicalrepresentationitem' in typeof(temp)) and (not ((sizeof(['ifc4x3_rc2.ifcvertexpoint','ifc4x3_rc2.ifcedgecurve','ifc4x3_rc2.ifcfacesurface'] * typeof(temp))) == 1))])) == 0) is not False @@ -21907,7 +21909,7 @@ class IfcStyledItem_ApplicableItem: def __call__(self): item = self.Item - assert (not 'ifc4x3_rc2.ifcstyleditem' in typeof(item)) is not False + assert (not ('ifc4x3_rc2.ifcstyleditem' in typeof(item))) is not False @@ -21922,7 +21924,7 @@ class IfcStyledRepresentation_OnlyStyledItems: def __call__(self): - assert ((sizeof([temp for temp in self.Items if not 'ifc4x3_rc2.ifcstyleditem' in typeof(temp)])) == 0) is not False + assert ((sizeof([temp for temp in self.Items if not ('ifc4x3_rc2.ifcstyleditem' in typeof(temp))])) == 0) is not False @@ -21992,7 +21994,7 @@ class IfcSurfaceCurve_CurveIsNotPcurve: def __call__(self): curve3d = self.Curve3D - assert (not 'ifc4x3_rc2.ifcpcurve' in typeof(curve3d)) is not False + assert (not ('ifc4x3_rc2.ifcpcurve' in typeof(curve3d))) is not False @@ -22754,7 +22756,7 @@ class IfcTextLiteralWithExtent_WR31: def __call__(self): extent = self.Extent - assert (not 'ifc4x3_rc2.ifcplanarbox' in typeof(extent)) is not False + assert (not ('ifc4x3_rc2.ifcplanarbox' in typeof(extent))) is not False @@ -22820,7 +22822,7 @@ class IfcTopologyRepresentation_WR21: def __call__(self): - assert ((sizeof([temp for temp in self.Items if not 'ifc4x3_rc2.ifctopologicalrepresentationitem' in typeof(temp)])) == 0) is not False + assert ((sizeof([temp for temp in self.Items if not ('ifc4x3_rc2.ifctopologicalrepresentationitem' in typeof(temp))])) == 0) is not False @@ -23068,7 +23070,7 @@ class IfcTrimmedCurve_NoTrimOfBoundedCurves: def __call__(self): basiscurve = self.BasisCurve - assert (not 'ifc4x3_rc2.ifcboundedcurve' in typeof(basiscurve)) is not False + assert (not ('ifc4x3_rc2.ifcboundedcurve' in typeof(basiscurve))) is not False @@ -23159,7 +23161,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 'ifc4x3_rc2.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 ('ifc4x3_rc2.ifcproduct' in typeof(temp))])) == 0)) is not False @@ -23635,7 +23637,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 @@ -23650,7 +23652,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 @@ -23665,7 +23667,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 @@ -23797,7 +23799,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 ('ifc4x3_rc2.ifczone' in typeof(temp)) or ('ifc4x3_rc2.ifcspace' in typeof(temp)) or ('ifc4x3_rc2.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 (('ifc4x3_rc2.ifczone' in typeof(temp)) or ('ifc4x3_rc2.ifcspace' in typeof(temp)) or ('ifc4x3_rc2.ifcspatialzone' in typeof(temp)))])) == 0)) is not False @@ -23813,7 +23815,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 @@ -24133,25 +24135,25 @@ def IfcCorrectObjectAssignment(constraint, objects): if constraint == IfcObjectTypeEnum.NOTDEFINED: return True elif constraint == IfcObjectTypeEnum.PRODUCT: - count = sizeof([temp for temp in objects if not 'ifc4x3_rc2.ifcproduct' in typeof(temp)]) + count = sizeof([temp for temp in objects if not ('ifc4x3_rc2.ifcproduct' in typeof(temp))]) return count == 0 elif constraint == IfcObjectTypeEnum.PROCESS: - count = sizeof([temp for temp in objects if not 'ifc4x3_rc2.ifcprocess' in typeof(temp)]) + count = sizeof([temp for temp in objects if not ('ifc4x3_rc2.ifcprocess' in typeof(temp))]) return count == 0 elif constraint == IfcObjectTypeEnum.CONTROL: - count = sizeof([temp for temp in objects if not 'ifc4x3_rc2.ifccontrol' in typeof(temp)]) + count = sizeof([temp for temp in objects if not ('ifc4x3_rc2.ifccontrol' in typeof(temp))]) return count == 0 elif constraint == IfcObjectTypeEnum.RESOURCE: - count = sizeof([temp for temp in objects if not 'ifc4x3_rc2.ifcresource' in typeof(temp)]) + count = sizeof([temp for temp in objects if not ('ifc4x3_rc2.ifcresource' in typeof(temp))]) return count == 0 elif constraint == IfcObjectTypeEnum.ACTOR: - count = sizeof([temp for temp in objects if not 'ifc4x3_rc2.ifcactor' in typeof(temp)]) + count = sizeof([temp for temp in objects if not ('ifc4x3_rc2.ifcactor' in typeof(temp))]) return count == 0 elif constraint == IfcObjectTypeEnum.GROUP: - count = sizeof([temp for temp in objects if not 'ifc4x3_rc2.ifcgroup' in typeof(temp)]) + count = sizeof([temp for temp in objects if not ('ifc4x3_rc2.ifcgroup' in typeof(temp))]) return count == 0 elif constraint == IfcObjectTypeEnum.PROJECT: - count = sizeof([temp for temp in objects if not 'ifc4x3_rc2.ifcproject' in typeof(temp)]) + count = sizeof([temp for temp in objects if not ('ifc4x3_rc2.ifcproject' in typeof(temp))]) return count == 0 else: return None @@ -24163,13 +24165,13 @@ def IfcCorrectUnitAssignment(units): monetaryunitnumber = 0 namedunitnames = express_set([]) derivedunitnames = express_set([]) - namedunitnumber = sizeof([temp for temp in units if ('ifc4x3_rc2.ifcnamedunit' in typeof(temp)) and (not temp.UnitType == IfcUnitEnum.USERDEFINED)]) - derivedunitnumber = sizeof([temp for temp in units if ('ifc4x3_rc2.ifcderivedunit' in typeof(temp)) and (not temp.UnitType == IfcDerivedUnitEnum.USERDEFINED)]) + namedunitnumber = sizeof([temp for temp in units if ('ifc4x3_rc2.ifcnamedunit' in typeof(temp)) and (not (temp.UnitType == IfcUnitEnum.USERDEFINED))]) + derivedunitnumber = sizeof([temp for temp in units if ('ifc4x3_rc2.ifcderivedunit' in typeof(temp)) and (not (temp.UnitType == IfcDerivedUnitEnum.USERDEFINED))]) monetaryunitnumber = sizeof([temp for temp in units if 'ifc4x3_rc2.ifcmonetaryunit' in typeof(temp)]) for i in range(1, sizeof(units) + 1): - if ('ifc4x3_rc2.ifcnamedunit' in (typeof(units[i - 1]))) and (not (units[i - 1].UnitType) == IfcUnitEnum.USERDEFINED): + if ('ifc4x3_rc2.ifcnamedunit' in (typeof(units[i - 1]))) and (not ((units[i - 1].UnitType) == IfcUnitEnum.USERDEFINED)): namedunitnames = namedunitnames + (units[i - 1].UnitType) - if ('ifc4x3_rc2.ifcderivedunit' in (typeof(units[i - 1]))) and (not (units[i - 1].UnitType) == IfcDerivedUnitEnum.USERDEFINED): + if ('ifc4x3_rc2.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) diff --git a/src/ifcopenshell-python/ifcopenshell/express/rules/IFC4X3_RC3.py b/src/ifcopenshell-python/ifcopenshell/express/rules/IFC4X3_RC3.py index 1f85e02bce..e3c1fe2077 100644 --- a/src/ifcopenshell-python/ifcopenshell/express/rules/IFC4X3_RC3.py +++ b/src/ifcopenshell-python/ifcopenshell/express/rules/IFC4X3_RC3.py @@ -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: @@ -11521,7 +11523,7 @@ class IfcAdvancedBrep_HasAdvancedFaces: def __call__(self): - assert ((sizeof([afs for afs in self.Outer.CfsFaces if not 'ifc4x3_rc3.ifcadvancedface' in typeof(afs)])) == 0) is not False + assert ((sizeof([afs for afs in self.Outer.CfsFaces if not ('ifc4x3_rc3.ifcadvancedface' in typeof(afs))])) == 0) is not False @@ -11536,7 +11538,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 'ifc4x3_rc3.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 ('ifc4x3_rc3.ifcadvancedface' in typeof(afs))])) == 0])) == 0) is not False @@ -11565,7 +11567,7 @@ class IfcAdvancedFace_RequiresEdgeCurve: def __call__(self): - assert ((sizeof([elpfbnds for elpfbnds in [bnds for bnds in self.Bounds if 'ifc4x3_rc3.ifcedgeloop' in typeof(bnds.Bound)] if not (sizeof([oe for oe in elpfbnds.Bound.EdgeList if not 'ifc4x3_rc3.ifcedgecurve' in typeof(oe.EdgeElement)])) == 0])) == 0) is not False + assert ((sizeof([elpfbnds for elpfbnds in [bnds for bnds in self.Bounds if 'ifc4x3_rc3.ifcedgeloop' in typeof(bnds.Bound)] if not ((sizeof([oe for oe in elpfbnds.Bound.EdgeList if not ('ifc4x3_rc3.ifcedgecurve' in typeof(oe.EdgeElement))])) == 0)])) == 0) is not False @@ -11579,7 +11581,7 @@ class IfcAdvancedFace_ApplicableEdgeCurves: def __call__(self): - assert ((sizeof([elpfbnds for elpfbnds in [bnds for bnds in self.Bounds if 'ifc4x3_rc3.ifcedgeloop' in typeof(bnds.Bound)] if not (sizeof([oe for oe in elpfbnds.Bound.EdgeList if not (sizeof(['ifc4x3_rc3.ifcline','ifc4x3_rc3.ifcconic','ifc4x3_rc3.ifcpolyline','ifc4x3_rc3.ifcbsplinecurve'] * typeof(oe.EdgeElement.EdgeGeometry))) == 1])) == 0])) == 0) is not False + assert ((sizeof([elpfbnds for elpfbnds in [bnds for bnds in self.Bounds if 'ifc4x3_rc3.ifcedgeloop' in typeof(bnds.Bound)] if not ((sizeof([oe for oe in elpfbnds.Bound.EdgeList if not ((sizeof(['ifc4x3_rc3.ifcline','ifc4x3_rc3.ifcconic','ifc4x3_rc3.ifcpolyline','ifc4x3_rc3.ifcbsplinecurve'] * typeof(oe.EdgeElement.EdgeGeometry))) == 1)])) == 0)])) == 0) is not False @@ -11842,7 +11844,7 @@ class IfcArbitraryClosedProfileDef_WR2: def __call__(self): outercurve = self.OuterCurve - assert (not 'ifc4x3_rc3.ifcline' in typeof(outercurve)) is not False + assert (not ('ifc4x3_rc3.ifcline' in typeof(outercurve))) is not False @@ -11856,7 +11858,7 @@ class IfcArbitraryClosedProfileDef_WR3: def __call__(self): outercurve = self.OuterCurve - assert (not 'ifc4x3_rc3.ifcoffsetcurve2d' in typeof(outercurve)) is not False + assert (not ('ifc4x3_rc3.ifcoffsetcurve2d' in typeof(outercurve))) is not False @@ -12213,7 +12215,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 @@ -12689,7 +12691,7 @@ class IfcBooleanResult_FirstOperandClosed: def __call__(self): firstoperand = self.FirstOperand - assert ((not 'ifc4x3_rc3.ifctessellatedfaceset' in typeof(firstoperand)) or (exists(firstoperand.Closed) and firstoperand.Closed)) is not False + assert ((not ('ifc4x3_rc3.ifctessellatedfaceset' in typeof(firstoperand))) or (exists(firstoperand.Closed) and firstoperand.Closed)) is not False @@ -12703,7 +12705,7 @@ class IfcBooleanResult_SecondOperandClosed: def __call__(self): secondoperand = self.SecondOperand - assert ((not 'ifc4x3_rc3.ifctessellatedfaceset' in typeof(secondoperand)) or (exists(secondoperand.Closed) and secondoperand.Closed)) is not False + assert ((not ('ifc4x3_rc3.ifctessellatedfaceset' in typeof(secondoperand))) or (exists(secondoperand.Closed) and secondoperand.Closed)) is not False @@ -12772,7 +12774,7 @@ class IfcBoxedHalfSpace_UnboundedSurface: def __call__(self): - assert (not 'ifc4x3_rc3.ifccurveboundedplane' in typeof(self.BaseSurface)) is not False + assert (not ('ifc4x3_rc3.ifccurveboundedplane' in typeof(self.BaseSurface))) is not False @@ -15051,7 +15053,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 @@ -15066,7 +15068,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 @@ -16720,7 +16722,7 @@ class IfcGeometricRepresentationSubContext_ParentNoSub: def __call__(self): parentcontext = self.ParentContext - assert (not 'ifc4x3_rc3.ifcgeometricrepresentationsubcontext' in typeof(parentcontext)) is not False + assert (not ('ifc4x3_rc3.ifcgeometricrepresentationsubcontext' in typeof(parentcontext))) is not False @@ -17529,7 +17531,7 @@ class IfcMaterialDefinitionRepresentation_OnlyStyledRepresentations: def __call__(self): representations = self.Representations - assert ((sizeof([temp for temp in representations if not 'ifc4x3_rc3.ifcstyledrepresentation' in typeof(temp)])) == 0) is not False + assert ((sizeof([temp for temp in representations if not ('ifc4x3_rc3.ifcstyledrepresentation' in typeof(temp))])) == 0) is not False @@ -18003,7 +18005,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 @@ -18126,7 +18128,7 @@ class IfcOrientedEdge_EdgeElementNotOriented: def __call__(self): edgeelement = self.EdgeElement - assert (not 'ifc4x3_rc3.ifcorientededge' in typeof(edgeelement)) is not False + assert (not ('ifc4x3_rc3.ifcorientededge' in typeof(edgeelement))) is not False @@ -18938,7 +18940,7 @@ class IfcProductDefinitionShape_OnlyShapeModel: def __call__(self): representations = self.Representations - assert ((sizeof([temp for temp in representations if not 'ifc4x3_rc3.ifcshapemodel' in typeof(temp)])) == 0) is not False + assert ((sizeof([temp for temp in representations if not ('ifc4x3_rc3.ifcshapemodel' in typeof(temp))])) == 0) is not False @@ -19128,7 +19130,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 @@ -19143,7 +19145,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 @@ -19933,7 +19935,7 @@ class IfcRectangularTrimmedSurface_UsenseCompatible: u2 = self.U2 usense = self.Usense - assert ((('ifc4x3_rc3.ifcelementarysurface' in typeof(basissurface)) and (not 'ifc4x3_rc3.ifcplane' in typeof(basissurface))) or ('ifc4x3_rc3.ifcsurfaceofrevolution' in typeof(basissurface)) or (usense == (u2 > u1))) is not False + assert ((('ifc4x3_rc3.ifcelementarysurface' in typeof(basissurface)) and (not ('ifc4x3_rc3.ifcplane' in typeof(basissurface)))) or ('ifc4x3_rc3.ifcsurfaceofrevolution' in typeof(basissurface)) or (usense == (u2 > u1))) is not False @@ -20499,7 +20501,7 @@ class IfcRelReferencedInSpatialStructure_AllowedRelatedElements: def __call__(self): relatedelements = self.RelatedElements - assert ((sizeof([temp for temp in relatedelements if ('ifc4x3_rc3.ifcspatialstructureelement' in typeof(temp)) and (not 'ifc4x3_rc3.ifcspace' in typeof(temp))])) == 0) is not False + assert ((sizeof([temp for temp in relatedelements if ('ifc4x3_rc3.ifcspatialstructureelement' in typeof(temp)) and (not ('ifc4x3_rc3.ifcspace' in typeof(temp)))])) == 0) is not False @@ -20549,7 +20551,7 @@ class IfcRelSpaceBoundary_CorrectPhysOrVirt: relatedbuildingelement = self.RelatedBuildingElement physicalorvirtualboundary = self.PhysicalOrVirtualBoundary - assert (((physicalorvirtualboundary == IfcPhysicalOrVirtualEnum.Physical) and (not 'ifc4x3_rc3.ifcvirtualelement' in typeof(relatedbuildingelement))) or ((physicalorvirtualboundary == IfcPhysicalOrVirtualEnum.Virtual) and (('ifc4x3_rc3.ifcvirtualelement' in typeof(relatedbuildingelement)) or ('ifc4x3_rc3.ifcopeningelement' in typeof(relatedbuildingelement)))) or (physicalorvirtualboundary == IfcPhysicalOrVirtualEnum.NotDefined)) is not False + assert (((physicalorvirtualboundary == IfcPhysicalOrVirtualEnum.Physical) and (not ('ifc4x3_rc3.ifcvirtualelement' in typeof(relatedbuildingelement)))) or ((physicalorvirtualboundary == IfcPhysicalOrVirtualEnum.Virtual) and (('ifc4x3_rc3.ifcvirtualelement' in typeof(relatedbuildingelement)) or ('ifc4x3_rc3.ifcopeningelement' in typeof(relatedbuildingelement)))) or (physicalorvirtualboundary == IfcPhysicalOrVirtualEnum.NotDefined)) is not False @@ -21110,7 +21112,7 @@ class IfcShapeRepresentation_NoTopologicalItem: def __call__(self): items = self.Items - assert ((sizeof([temp for temp in items if ('ifc4x3_rc3.ifctopologicalrepresentationitem' in typeof(temp)) and (not (sizeof(['ifc4x3_rc3.ifcvertexpoint','ifc4x3_rc3.ifcedgecurve','ifc4x3_rc3.ifcfacesurface'] * typeof(temp))) == 1)])) == 0) is not False + assert ((sizeof([temp for temp in items if ('ifc4x3_rc3.ifctopologicalrepresentationitem' in typeof(temp)) and (not ((sizeof(['ifc4x3_rc3.ifcvertexpoint','ifc4x3_rc3.ifcedgecurve','ifc4x3_rc3.ifcfacesurface'] * typeof(temp))) == 1))])) == 0) is not False @@ -22099,7 +22101,7 @@ class IfcStyledItem_ApplicableItem: def __call__(self): item = self.Item - assert (not 'ifc4x3_rc3.ifcstyleditem' in typeof(item)) is not False + assert (not ('ifc4x3_rc3.ifcstyleditem' in typeof(item))) is not False @@ -22114,7 +22116,7 @@ class IfcStyledRepresentation_OnlyStyledItems: def __call__(self): - assert ((sizeof([temp for temp in self.Items if not 'ifc4x3_rc3.ifcstyleditem' in typeof(temp)])) == 0) is not False + assert ((sizeof([temp for temp in self.Items if not ('ifc4x3_rc3.ifcstyleditem' in typeof(temp))])) == 0) is not False @@ -22184,7 +22186,7 @@ class IfcSurfaceCurve_CurveIsNotPcurve: def __call__(self): curve3d = self.Curve3D - assert (not 'ifc4x3_rc3.ifcpcurve' in typeof(curve3d)) is not False + assert (not ('ifc4x3_rc3.ifcpcurve' in typeof(curve3d))) is not False @@ -22946,7 +22948,7 @@ class IfcTextLiteralWithExtent_WR31: def __call__(self): extent = self.Extent - assert (not 'ifc4x3_rc3.ifcplanarbox' in typeof(extent)) is not False + assert (not ('ifc4x3_rc3.ifcplanarbox' in typeof(extent))) is not False @@ -23015,7 +23017,7 @@ class IfcTopologyRepresentation_WR21: def __call__(self): - assert ((sizeof([temp for temp in self.Items if not 'ifc4x3_rc3.ifctopologicalrepresentationitem' in typeof(temp)])) == 0) is not False + assert ((sizeof([temp for temp in self.Items if not ('ifc4x3_rc3.ifctopologicalrepresentationitem' in typeof(temp))])) == 0) is not False @@ -23260,7 +23262,7 @@ class IfcTrimmedCurve_NoTrimOfBoundedCurves: def __call__(self): basiscurve = self.BasisCurve - assert (not 'ifc4x3_rc3.ifcboundedcurve' in typeof(basiscurve)) is not False + assert (not ('ifc4x3_rc3.ifcboundedcurve' in typeof(basiscurve))) is not False @@ -23351,7 +23353,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 'ifc4x3_rc3.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 ('ifc4x3_rc3.ifcproduct' in typeof(temp))])) == 0)) is not False @@ -23858,7 +23860,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 @@ -23873,7 +23875,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 @@ -23888,7 +23890,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 @@ -24020,7 +24022,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 ('ifc4x3_rc3.ifczone' in typeof(temp)) or ('ifc4x3_rc3.ifcspace' in typeof(temp)) or ('ifc4x3_rc3.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 (('ifc4x3_rc3.ifczone' in typeof(temp)) or ('ifc4x3_rc3.ifcspace' in typeof(temp)) or ('ifc4x3_rc3.ifcspatialzone' in typeof(temp)))])) == 0)) is not False @@ -24036,7 +24038,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 @@ -24356,25 +24358,25 @@ def IfcCorrectObjectAssignment(constraint, objects): if constraint == IfcObjectTypeEnum.NOTDEFINED: return True elif constraint == IfcObjectTypeEnum.PRODUCT: - count = sizeof([temp for temp in objects if not 'ifc4x3_rc3.ifcproduct' in typeof(temp)]) + count = sizeof([temp for temp in objects if not ('ifc4x3_rc3.ifcproduct' in typeof(temp))]) return count == 0 elif constraint == IfcObjectTypeEnum.PROCESS: - count = sizeof([temp for temp in objects if not 'ifc4x3_rc3.ifcprocess' in typeof(temp)]) + count = sizeof([temp for temp in objects if not ('ifc4x3_rc3.ifcprocess' in typeof(temp))]) return count == 0 elif constraint == IfcObjectTypeEnum.CONTROL: - count = sizeof([temp for temp in objects if not 'ifc4x3_rc3.ifccontrol' in typeof(temp)]) + count = sizeof([temp for temp in objects if not ('ifc4x3_rc3.ifccontrol' in typeof(temp))]) return count == 0 elif constraint == IfcObjectTypeEnum.RESOURCE: - count = sizeof([temp for temp in objects if not 'ifc4x3_rc3.ifcresource' in typeof(temp)]) + count = sizeof([temp for temp in objects if not ('ifc4x3_rc3.ifcresource' in typeof(temp))]) return count == 0 elif constraint == IfcObjectTypeEnum.ACTOR: - count = sizeof([temp for temp in objects if not 'ifc4x3_rc3.ifcactor' in typeof(temp)]) + count = sizeof([temp for temp in objects if not ('ifc4x3_rc3.ifcactor' in typeof(temp))]) return count == 0 elif constraint == IfcObjectTypeEnum.GROUP: - count = sizeof([temp for temp in objects if not 'ifc4x3_rc3.ifcgroup' in typeof(temp)]) + count = sizeof([temp for temp in objects if not ('ifc4x3_rc3.ifcgroup' in typeof(temp))]) return count == 0 elif constraint == IfcObjectTypeEnum.PROJECT: - count = sizeof([temp for temp in objects if not 'ifc4x3_rc3.ifcproject' in typeof(temp)]) + count = sizeof([temp for temp in objects if not ('ifc4x3_rc3.ifcproject' in typeof(temp))]) return count == 0 else: return None @@ -24386,13 +24388,13 @@ def IfcCorrectUnitAssignment(units): monetaryunitnumber = 0 namedunitnames = express_set([]) derivedunitnames = express_set([]) - namedunitnumber = sizeof([temp for temp in units if ('ifc4x3_rc3.ifcnamedunit' in typeof(temp)) and (not temp.UnitType == IfcUnitEnum.USERDEFINED)]) - derivedunitnumber = sizeof([temp for temp in units if ('ifc4x3_rc3.ifcderivedunit' in typeof(temp)) and (not temp.UnitType == IfcDerivedUnitEnum.USERDEFINED)]) + namedunitnumber = sizeof([temp for temp in units if ('ifc4x3_rc3.ifcnamedunit' in typeof(temp)) and (not (temp.UnitType == IfcUnitEnum.USERDEFINED))]) + derivedunitnumber = sizeof([temp for temp in units if ('ifc4x3_rc3.ifcderivedunit' in typeof(temp)) and (not (temp.UnitType == IfcDerivedUnitEnum.USERDEFINED))]) monetaryunitnumber = sizeof([temp for temp in units if 'ifc4x3_rc3.ifcmonetaryunit' in typeof(temp)]) for i in range(1, sizeof(units) + 1): - if ('ifc4x3_rc3.ifcnamedunit' in (typeof(units[i - 1]))) and (not (units[i - 1].UnitType) == IfcUnitEnum.USERDEFINED): + if ('ifc4x3_rc3.ifcnamedunit' in (typeof(units[i - 1]))) and (not ((units[i - 1].UnitType) == IfcUnitEnum.USERDEFINED)): namedunitnames = namedunitnames + (units[i - 1].UnitType) - if ('ifc4x3_rc3.ifcderivedunit' in (typeof(units[i - 1]))) and (not (units[i - 1].UnitType) == IfcDerivedUnitEnum.USERDEFINED): + if ('ifc4x3_rc3.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) diff --git a/src/ifcopenshell-python/ifcopenshell/express/rules/IFC4X3_RC4.py b/src/ifcopenshell-python/ifcopenshell/express/rules/IFC4X3_RC4.py index 6e111ecf2d..0d17d613d1 100644 --- a/src/ifcopenshell-python/ifcopenshell/express/rules/IFC4X3_RC4.py +++ b/src/ifcopenshell-python/ifcopenshell/express/rules/IFC4X3_RC4.py @@ -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: @@ -11575,7 +11577,7 @@ class IfcAdvancedBrep_HasAdvancedFaces: def __call__(self): - assert ((sizeof([afs for afs in self.Outer.CfsFaces if not 'ifc4x3_rc4.ifcadvancedface' in typeof(afs)])) == 0) is not False + assert ((sizeof([afs for afs in self.Outer.CfsFaces if not ('ifc4x3_rc4.ifcadvancedface' in typeof(afs))])) == 0) is not False @@ -11590,7 +11592,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 'ifc4x3_rc4.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 ('ifc4x3_rc4.ifcadvancedface' in typeof(afs))])) == 0])) == 0) is not False @@ -11619,7 +11621,7 @@ class IfcAdvancedFace_RequiresEdgeCurve: def __call__(self): - assert ((sizeof([elpfbnds for elpfbnds in [bnds for bnds in self.Bounds if 'ifc4x3_rc4.ifcedgeloop' in typeof(bnds.Bound)] if not (sizeof([oe for oe in elpfbnds.Bound.EdgeList if not 'ifc4x3_rc4.ifcedgecurve' in typeof(oe.EdgeElement)])) == 0])) == 0) is not False + assert ((sizeof([elpfbnds for elpfbnds in [bnds for bnds in self.Bounds if 'ifc4x3_rc4.ifcedgeloop' in typeof(bnds.Bound)] if not ((sizeof([oe for oe in elpfbnds.Bound.EdgeList if not ('ifc4x3_rc4.ifcedgecurve' in typeof(oe.EdgeElement))])) == 0)])) == 0) is not False @@ -11633,7 +11635,7 @@ class IfcAdvancedFace_ApplicableEdgeCurves: def __call__(self): - assert ((sizeof([elpfbnds for elpfbnds in [bnds for bnds in self.Bounds if 'ifc4x3_rc4.ifcedgeloop' in typeof(bnds.Bound)] if not (sizeof([oe for oe in elpfbnds.Bound.EdgeList if not (sizeof(['ifc4x3_rc4.ifcline','ifc4x3_rc4.ifcconic','ifc4x3_rc4.ifcpolyline','ifc4x3_rc4.ifcbsplinecurve'] * typeof(oe.EdgeElement.EdgeGeometry))) == 1])) == 0])) == 0) is not False + assert ((sizeof([elpfbnds for elpfbnds in [bnds for bnds in self.Bounds if 'ifc4x3_rc4.ifcedgeloop' in typeof(bnds.Bound)] if not ((sizeof([oe for oe in elpfbnds.Bound.EdgeList if not ((sizeof(['ifc4x3_rc4.ifcline','ifc4x3_rc4.ifcconic','ifc4x3_rc4.ifcpolyline','ifc4x3_rc4.ifcbsplinecurve'] * typeof(oe.EdgeElement.EdgeGeometry))) == 1)])) == 0)])) == 0) is not False @@ -11896,7 +11898,7 @@ class IfcArbitraryClosedProfileDef_WR2: def __call__(self): outercurve = self.OuterCurve - assert (not 'ifc4x3_rc4.ifcline' in typeof(outercurve)) is not False + assert (not ('ifc4x3_rc4.ifcline' in typeof(outercurve))) is not False @@ -11910,7 +11912,7 @@ class IfcArbitraryClosedProfileDef_WR3: def __call__(self): outercurve = self.OuterCurve - assert (not 'ifc4x3_rc4.ifcoffsetcurve2d' in typeof(outercurve)) is not False + assert (not ('ifc4x3_rc4.ifcoffsetcurve2d' in typeof(outercurve))) is not False @@ -12267,7 +12269,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 @@ -12743,7 +12745,7 @@ class IfcBooleanResult_FirstOperandClosed: def __call__(self): firstoperand = self.FirstOperand - assert ((not 'ifc4x3_rc4.ifctessellatedfaceset' in typeof(firstoperand)) or (exists(firstoperand.Closed) and firstoperand.Closed)) is not False + assert ((not ('ifc4x3_rc4.ifctessellatedfaceset' in typeof(firstoperand))) or (exists(firstoperand.Closed) and firstoperand.Closed)) is not False @@ -12757,7 +12759,7 @@ class IfcBooleanResult_SecondOperandClosed: def __call__(self): secondoperand = self.SecondOperand - assert ((not 'ifc4x3_rc4.ifctessellatedfaceset' in typeof(secondoperand)) or (exists(secondoperand.Closed) and secondoperand.Closed)) is not False + assert ((not ('ifc4x3_rc4.ifctessellatedfaceset' in typeof(secondoperand))) or (exists(secondoperand.Closed) and secondoperand.Closed)) is not False @@ -12826,7 +12828,7 @@ class IfcBoxedHalfSpace_UnboundedSurface: def __call__(self): - assert (not 'ifc4x3_rc4.ifccurveboundedplane' in typeof(self.BaseSurface)) is not False + assert (not ('ifc4x3_rc4.ifccurveboundedplane' in typeof(self.BaseSurface))) is not False @@ -15102,7 +15104,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 @@ -15117,7 +15119,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 @@ -16771,7 +16773,7 @@ class IfcGeometricRepresentationSubContext_ParentNoSub: def __call__(self): parentcontext = self.ParentContext - assert (not 'ifc4x3_rc4.ifcgeometricrepresentationsubcontext' in typeof(parentcontext)) is not False + assert (not ('ifc4x3_rc4.ifcgeometricrepresentationsubcontext' in typeof(parentcontext))) is not False @@ -17577,7 +17579,7 @@ class IfcMaterialDefinitionRepresentation_OnlyStyledRepresentations: def __call__(self): representations = self.Representations - assert ((sizeof([temp for temp in representations if not 'ifc4x3_rc4.ifcstyledrepresentation' in typeof(temp)])) == 0) is not False + assert ((sizeof([temp for temp in representations if not ('ifc4x3_rc4.ifcstyledrepresentation' in typeof(temp))])) == 0) is not False @@ -18051,7 +18053,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 @@ -18174,7 +18176,7 @@ class IfcOrientedEdge_EdgeElementNotOriented: def __call__(self): edgeelement = self.EdgeElement - assert (not 'ifc4x3_rc4.ifcorientededge' in typeof(edgeelement)) is not False + assert (not ('ifc4x3_rc4.ifcorientededge' in typeof(edgeelement))) is not False @@ -18986,7 +18988,7 @@ class IfcProductDefinitionShape_OnlyShapeModel: def __call__(self): representations = self.Representations - assert ((sizeof([temp for temp in representations if not 'ifc4x3_rc4.ifcshapemodel' in typeof(temp)])) == 0) is not False + assert ((sizeof([temp for temp in representations if not ('ifc4x3_rc4.ifcshapemodel' in typeof(temp))])) == 0) is not False @@ -19176,7 +19178,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 @@ -19191,7 +19193,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 @@ -19981,7 +19983,7 @@ class IfcRectangularTrimmedSurface_UsenseCompatible: u2 = self.U2 usense = self.Usense - assert ((('ifc4x3_rc4.ifcelementarysurface' in typeof(basissurface)) and (not 'ifc4x3_rc4.ifcplane' in typeof(basissurface))) or ('ifc4x3_rc4.ifcsurfaceofrevolution' in typeof(basissurface)) or (usense == (u2 > u1))) is not False + assert ((('ifc4x3_rc4.ifcelementarysurface' in typeof(basissurface)) and (not ('ifc4x3_rc4.ifcplane' in typeof(basissurface)))) or ('ifc4x3_rc4.ifcsurfaceofrevolution' in typeof(basissurface)) or (usense == (u2 > u1))) is not False @@ -20550,7 +20552,7 @@ class IfcRelReferencedInSpatialStructure_AllowedRelatedElements: def __call__(self): relatedelements = self.RelatedElements - assert ((sizeof([temp for temp in relatedelements if ('ifc4x3_rc4.ifcspatialstructureelement' in typeof(temp)) and (not 'ifc4x3_rc4.ifcspace' in typeof(temp))])) == 0) is not False + assert ((sizeof([temp for temp in relatedelements if ('ifc4x3_rc4.ifcspatialstructureelement' in typeof(temp)) and (not ('ifc4x3_rc4.ifcspace' in typeof(temp)))])) == 0) is not False @@ -20600,7 +20602,7 @@ class IfcRelSpaceBoundary_CorrectPhysOrVirt: relatedbuildingelement = self.RelatedBuildingElement physicalorvirtualboundary = self.PhysicalOrVirtualBoundary - assert (((physicalorvirtualboundary == IfcPhysicalOrVirtualEnum.Physical) and (not 'ifc4x3_rc4.ifcvirtualelement' in typeof(relatedbuildingelement))) or ((physicalorvirtualboundary == IfcPhysicalOrVirtualEnum.Virtual) and (('ifc4x3_rc4.ifcvirtualelement' in typeof(relatedbuildingelement)) or ('ifc4x3_rc4.ifcopeningelement' in typeof(relatedbuildingelement)))) or (physicalorvirtualboundary == IfcPhysicalOrVirtualEnum.NotDefined)) is not False + assert (((physicalorvirtualboundary == IfcPhysicalOrVirtualEnum.Physical) and (not ('ifc4x3_rc4.ifcvirtualelement' in typeof(relatedbuildingelement)))) or ((physicalorvirtualboundary == IfcPhysicalOrVirtualEnum.Virtual) and (('ifc4x3_rc4.ifcvirtualelement' in typeof(relatedbuildingelement)) or ('ifc4x3_rc4.ifcopeningelement' in typeof(relatedbuildingelement)))) or (physicalorvirtualboundary == IfcPhysicalOrVirtualEnum.NotDefined)) is not False @@ -21164,7 +21166,7 @@ class IfcShapeRepresentation_NoTopologicalItem: def __call__(self): items = self.Items - assert ((sizeof([temp for temp in items if ('ifc4x3_rc4.ifctopologicalrepresentationitem' in typeof(temp)) and (not (sizeof(['ifc4x3_rc4.ifcvertexpoint','ifc4x3_rc4.ifcedgecurve','ifc4x3_rc4.ifcfacesurface'] * typeof(temp))) == 1)])) == 0) is not False + assert ((sizeof([temp for temp in items if ('ifc4x3_rc4.ifctopologicalrepresentationitem' in typeof(temp)) and (not ((sizeof(['ifc4x3_rc4.ifcvertexpoint','ifc4x3_rc4.ifcedgecurve','ifc4x3_rc4.ifcfacesurface'] * typeof(temp))) == 1))])) == 0) is not False @@ -22153,7 +22155,7 @@ class IfcStyledItem_ApplicableItem: def __call__(self): item = self.Item - assert (not 'ifc4x3_rc4.ifcstyleditem' in typeof(item)) is not False + assert (not ('ifc4x3_rc4.ifcstyleditem' in typeof(item))) is not False @@ -22168,7 +22170,7 @@ class IfcStyledRepresentation_OnlyStyledItems: def __call__(self): - assert ((sizeof([temp for temp in self.Items if not 'ifc4x3_rc4.ifcstyleditem' in typeof(temp)])) == 0) is not False + assert ((sizeof([temp for temp in self.Items if not ('ifc4x3_rc4.ifcstyleditem' in typeof(temp))])) == 0) is not False @@ -22238,7 +22240,7 @@ class IfcSurfaceCurve_CurveIsNotPcurve: def __call__(self): curve3d = self.Curve3D - assert (not 'ifc4x3_rc4.ifcpcurve' in typeof(curve3d)) is not False + assert (not ('ifc4x3_rc4.ifcpcurve' in typeof(curve3d))) is not False @@ -23000,7 +23002,7 @@ class IfcTextLiteralWithExtent_WR31: def __call__(self): extent = self.Extent - assert (not 'ifc4x3_rc4.ifcplanarbox' in typeof(extent)) is not False + assert (not ('ifc4x3_rc4.ifcplanarbox' in typeof(extent))) is not False @@ -23069,7 +23071,7 @@ class IfcTopologyRepresentation_WR21: def __call__(self): - assert ((sizeof([temp for temp in self.Items if not 'ifc4x3_rc4.ifctopologicalrepresentationitem' in typeof(temp)])) == 0) is not False + assert ((sizeof([temp for temp in self.Items if not ('ifc4x3_rc4.ifctopologicalrepresentationitem' in typeof(temp))])) == 0) is not False @@ -23314,7 +23316,7 @@ class IfcTrimmedCurve_NoTrimOfBoundedCurves: def __call__(self): basiscurve = self.BasisCurve - assert (not 'ifc4x3_rc4.ifcboundedcurve' in typeof(basiscurve)) is not False + assert (not ('ifc4x3_rc4.ifcboundedcurve' in typeof(basiscurve))) is not False @@ -23405,7 +23407,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 'ifc4x3_rc4.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 ('ifc4x3_rc4.ifcproduct' in typeof(temp))])) == 0)) is not False @@ -23909,7 +23911,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 @@ -23924,7 +23926,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 @@ -23939,7 +23941,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 @@ -24071,7 +24073,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 ('ifc4x3_rc4.ifczone' in typeof(temp)) or ('ifc4x3_rc4.ifcspace' in typeof(temp)) or ('ifc4x3_rc4.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 (('ifc4x3_rc4.ifczone' in typeof(temp)) or ('ifc4x3_rc4.ifcspace' in typeof(temp)) or ('ifc4x3_rc4.ifcspatialzone' in typeof(temp)))])) == 0)) is not False @@ -24087,7 +24089,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 @@ -24407,25 +24409,25 @@ def IfcCorrectObjectAssignment(constraint, objects): if constraint == IfcObjectTypeEnum.NOTDEFINED: return True elif constraint == IfcObjectTypeEnum.PRODUCT: - count = sizeof([temp for temp in objects if not 'ifc4x3_rc4.ifcproduct' in typeof(temp)]) + count = sizeof([temp for temp in objects if not ('ifc4x3_rc4.ifcproduct' in typeof(temp))]) return count == 0 elif constraint == IfcObjectTypeEnum.PROCESS: - count = sizeof([temp for temp in objects if not 'ifc4x3_rc4.ifcprocess' in typeof(temp)]) + count = sizeof([temp for temp in objects if not ('ifc4x3_rc4.ifcprocess' in typeof(temp))]) return count == 0 elif constraint == IfcObjectTypeEnum.CONTROL: - count = sizeof([temp for temp in objects if not 'ifc4x3_rc4.ifccontrol' in typeof(temp)]) + count = sizeof([temp for temp in objects if not ('ifc4x3_rc4.ifccontrol' in typeof(temp))]) return count == 0 elif constraint == IfcObjectTypeEnum.RESOURCE: - count = sizeof([temp for temp in objects if not 'ifc4x3_rc4.ifcresource' in typeof(temp)]) + count = sizeof([temp for temp in objects if not ('ifc4x3_rc4.ifcresource' in typeof(temp))]) return count == 0 elif constraint == IfcObjectTypeEnum.ACTOR: - count = sizeof([temp for temp in objects if not 'ifc4x3_rc4.ifcactor' in typeof(temp)]) + count = sizeof([temp for temp in objects if not ('ifc4x3_rc4.ifcactor' in typeof(temp))]) return count == 0 elif constraint == IfcObjectTypeEnum.GROUP: - count = sizeof([temp for temp in objects if not 'ifc4x3_rc4.ifcgroup' in typeof(temp)]) + count = sizeof([temp for temp in objects if not ('ifc4x3_rc4.ifcgroup' in typeof(temp))]) return count == 0 elif constraint == IfcObjectTypeEnum.PROJECT: - count = sizeof([temp for temp in objects if not 'ifc4x3_rc4.ifcproject' in typeof(temp)]) + count = sizeof([temp for temp in objects if not ('ifc4x3_rc4.ifcproject' in typeof(temp))]) return count == 0 else: return None @@ -24437,13 +24439,13 @@ def IfcCorrectUnitAssignment(units): monetaryunitnumber = 0 namedunitnames = express_set([]) derivedunitnames = express_set([]) - namedunitnumber = sizeof([temp for temp in units if ('ifc4x3_rc4.ifcnamedunit' in typeof(temp)) and (not temp.UnitType == IfcUnitEnum.USERDEFINED)]) - derivedunitnumber = sizeof([temp for temp in units if ('ifc4x3_rc4.ifcderivedunit' in typeof(temp)) and (not temp.UnitType == IfcDerivedUnitEnum.USERDEFINED)]) + namedunitnumber = sizeof([temp for temp in units if ('ifc4x3_rc4.ifcnamedunit' in typeof(temp)) and (not (temp.UnitType == IfcUnitEnum.USERDEFINED))]) + derivedunitnumber = sizeof([temp for temp in units if ('ifc4x3_rc4.ifcderivedunit' in typeof(temp)) and (not (temp.UnitType == IfcDerivedUnitEnum.USERDEFINED))]) monetaryunitnumber = sizeof([temp for temp in units if 'ifc4x3_rc4.ifcmonetaryunit' in typeof(temp)]) for i in range(1, sizeof(units) + 1): - if ('ifc4x3_rc4.ifcnamedunit' in (typeof(units[i - 1]))) and (not (units[i - 1].UnitType) == IfcUnitEnum.USERDEFINED): + if ('ifc4x3_rc4.ifcnamedunit' in (typeof(units[i - 1]))) and (not ((units[i - 1].UnitType) == IfcUnitEnum.USERDEFINED)): namedunitnames = namedunitnames + (units[i - 1].UnitType) - if ('ifc4x3_rc4.ifcderivedunit' in (typeof(units[i - 1]))) and (not (units[i - 1].UnitType) == IfcDerivedUnitEnum.USERDEFINED): + if ('ifc4x3_rc4.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) diff --git a/src/ifcopenshell-python/ifcopenshell/express/rules/IFC4X3_TC1.py b/src/ifcopenshell-python/ifcopenshell/express/rules/IFC4X3_TC1.py index 239d64fe39..bbb066f140 100644 --- a/src/ifcopenshell-python/ifcopenshell/express/rules/IFC4X3_TC1.py +++ b/src/ifcopenshell-python/ifcopenshell/express/rules/IFC4X3_TC1.py @@ -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: @@ -11455,7 +11457,7 @@ class IfcAdvancedBrep_HasAdvancedFaces: def __call__(self): - assert ((sizeof([afs for afs in self.Outer.CfsFaces if not 'ifc4x3_tc1.ifcadvancedface' in typeof(afs)])) == 0) is not False + assert ((sizeof([afs for afs in self.Outer.CfsFaces if not ('ifc4x3_tc1.ifcadvancedface' in typeof(afs))])) == 0) is not False @@ -11470,7 +11472,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 'ifc4x3_tc1.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 ('ifc4x3_tc1.ifcadvancedface' in typeof(afs))])) == 0])) == 0) is not False @@ -11485,7 +11487,7 @@ class IfcAdvancedFace_ApplicableEdgeCurves: def __call__(self): - assert ((sizeof([elpfbnds for elpfbnds in [bnds for bnds in self.Bounds if 'ifc4x3_tc1.ifcedgeloop' in typeof(bnds.Bound)] if not (sizeof([oe for oe in elpfbnds.Bound.EdgeList if not (sizeof(['ifc4x3_tc1.ifcline','ifc4x3_tc1.ifcconic','ifc4x3_tc1.ifcpolyline','ifc4x3_tc1.ifcbsplinecurve'] * typeof(oe.EdgeElement.EdgeGeometry))) == 1])) == 0])) == 0) is not False + assert ((sizeof([elpfbnds for elpfbnds in [bnds for bnds in self.Bounds if 'ifc4x3_tc1.ifcedgeloop' in typeof(bnds.Bound)] if not ((sizeof([oe for oe in elpfbnds.Bound.EdgeList if not ((sizeof(['ifc4x3_tc1.ifcline','ifc4x3_tc1.ifcconic','ifc4x3_tc1.ifcpolyline','ifc4x3_tc1.ifcbsplinecurve'] * typeof(oe.EdgeElement.EdgeGeometry))) == 1)])) == 0)])) == 0) is not False @@ -11513,7 +11515,7 @@ class IfcAdvancedFace_RequiresEdgeCurve: def __call__(self): - assert ((sizeof([elpfbnds for elpfbnds in [bnds for bnds in self.Bounds if 'ifc4x3_tc1.ifcedgeloop' in typeof(bnds.Bound)] if not (sizeof([oe for oe in elpfbnds.Bound.EdgeList if not 'ifc4x3_tc1.ifcedgecurve' in typeof(oe.EdgeElement)])) == 0])) == 0) is not False + assert ((sizeof([elpfbnds for elpfbnds in [bnds for bnds in self.Bounds if 'ifc4x3_tc1.ifcedgeloop' in typeof(bnds.Bound)] if not ((sizeof([oe for oe in elpfbnds.Bound.EdgeList if not ('ifc4x3_tc1.ifcedgecurve' in typeof(oe.EdgeElement))])) == 0)])) == 0) is not False @@ -11776,7 +11778,7 @@ class IfcArbitraryClosedProfileDef_WR2: def __call__(self): outercurve = self.OuterCurve - assert (not 'ifc4x3_tc1.ifcline' in typeof(outercurve)) is not False + assert (not ('ifc4x3_tc1.ifcline' in typeof(outercurve))) is not False @@ -11790,7 +11792,7 @@ class IfcArbitraryClosedProfileDef_WR3: def __call__(self): outercurve = self.OuterCurve - assert (not 'ifc4x3_tc1.ifcoffsetcurve2d' in typeof(outercurve)) is not False + assert (not ('ifc4x3_tc1.ifcoffsetcurve2d' in typeof(outercurve))) is not False @@ -12090,7 +12092,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 @@ -12593,7 +12595,7 @@ class IfcBooleanResult_FirstOperandClosed: def __call__(self): firstoperand = self.FirstOperand - assert ((not 'ifc4x3_tc1.ifctessellatedfaceset' in typeof(firstoperand)) or (exists(firstoperand.Closed) and firstoperand.Closed)) is not False + assert ((not ('ifc4x3_tc1.ifctessellatedfaceset' in typeof(firstoperand))) or (exists(firstoperand.Closed) and firstoperand.Closed)) is not False @@ -12622,7 +12624,7 @@ class IfcBooleanResult_SecondOperandClosed: def __call__(self): secondoperand = self.SecondOperand - assert ((not 'ifc4x3_tc1.ifctessellatedfaceset' in typeof(secondoperand)) or (exists(secondoperand.Closed) and secondoperand.Closed)) is not False + assert ((not ('ifc4x3_tc1.ifctessellatedfaceset' in typeof(secondoperand))) or (exists(secondoperand.Closed) and secondoperand.Closed)) is not False @@ -12691,7 +12693,7 @@ class IfcBoxedHalfSpace_UnboundedSurface: def __call__(self): - assert (not 'ifc4x3_tc1.ifccurveboundedplane' in typeof(self.BaseSurface)) is not False + assert (not ('ifc4x3_tc1.ifccurveboundedplane' in typeof(self.BaseSurface))) is not False @@ -14946,7 +14948,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 @@ -14961,7 +14963,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 @@ -16626,7 +16628,7 @@ class IfcGeometricRepresentationSubContext_ParentNoSub: def __call__(self): parentcontext = self.ParentContext - assert (not 'ifc4x3_tc1.ifcgeometricrepresentationsubcontext' in typeof(parentcontext)) is not False + assert (not ('ifc4x3_tc1.ifcgeometricrepresentationsubcontext' in typeof(parentcontext))) is not False @@ -17481,7 +17483,7 @@ class IfcMaterialDefinitionRepresentation_OnlyStyledRepresentations: def __call__(self): representations = self.Representations - assert ((sizeof([temp for temp in representations if not 'ifc4x3_tc1.ifcstyledrepresentation' in typeof(temp)])) == 0) is not False + assert ((sizeof([temp for temp in representations if not ('ifc4x3_tc1.ifcstyledrepresentation' in typeof(temp))])) == 0) is not False @@ -17940,7 +17942,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 @@ -18060,7 +18062,7 @@ class IfcOrientedEdge_EdgeElementNotOriented: def __call__(self): edgeelement = self.EdgeElement - assert (not 'ifc4x3_tc1.ifcorientededge' in typeof(edgeelement)) is not False + assert (not ('ifc4x3_tc1.ifcorientededge' in typeof(edgeelement))) is not False @@ -18844,7 +18846,7 @@ class IfcProductDefinitionShape_OnlyShapeModel: def __call__(self): representations = self.Representations - assert ((sizeof([temp for temp in representations if not 'ifc4x3_tc1.ifcshapemodel' in typeof(temp)])) == 0) is not False + assert ((sizeof([temp for temp in representations if not ('ifc4x3_tc1.ifcshapemodel' in typeof(temp))])) == 0) is not False @@ -19034,7 +19036,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 @@ -19049,7 +19051,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 @@ -19827,7 +19829,7 @@ class IfcRectangularTrimmedSurface_UsenseCompatible: u2 = self.U2 usense = self.Usense - assert ((('ifc4x3_tc1.ifcelementarysurface' in typeof(basissurface)) and (not 'ifc4x3_tc1.ifcplane' in typeof(basissurface))) or ('ifc4x3_tc1.ifcsurfaceofrevolution' in typeof(basissurface)) or (usense == (u2 > u1))) is not False + assert ((('ifc4x3_tc1.ifcelementarysurface' in typeof(basissurface)) and (not ('ifc4x3_tc1.ifcplane' in typeof(basissurface)))) or ('ifc4x3_tc1.ifcsurfaceofrevolution' in typeof(basissurface)) or (usense == (u2 > u1))) is not False @@ -20398,7 +20400,7 @@ class IfcRelReferencedInSpatialStructure_AllowedRelatedElements: def __call__(self): relatedelements = self.RelatedElements - assert ((sizeof([temp for temp in relatedelements if ('ifc4x3_tc1.ifcspatialstructureelement' in typeof(temp)) and (not 'ifc4x3_tc1.ifcspace' in typeof(temp))])) == 0) is not False + assert ((sizeof([temp for temp in relatedelements if ('ifc4x3_tc1.ifcspatialstructureelement' in typeof(temp)) and (not ('ifc4x3_tc1.ifcspace' in typeof(temp)))])) == 0) is not False @@ -20448,7 +20450,7 @@ class IfcRelSpaceBoundary_CorrectPhysOrVirt: relatedbuildingelement = self.RelatedBuildingElement physicalorvirtualboundary = self.PhysicalOrVirtualBoundary - assert (((physicalorvirtualboundary == IfcPhysicalOrVirtualEnum.Physical) and (not 'ifc4x3_tc1.ifcvirtualelement' in typeof(relatedbuildingelement))) or ((physicalorvirtualboundary == IfcPhysicalOrVirtualEnum.Virtual) and (('ifc4x3_tc1.ifcvirtualelement' in typeof(relatedbuildingelement)) or ('ifc4x3_tc1.ifcopeningelement' in typeof(relatedbuildingelement)))) or (physicalorvirtualboundary == IfcPhysicalOrVirtualEnum.NotDefined)) is not False + assert (((physicalorvirtualboundary == IfcPhysicalOrVirtualEnum.Physical) and (not ('ifc4x3_tc1.ifcvirtualelement' in typeof(relatedbuildingelement)))) or ((physicalorvirtualboundary == IfcPhysicalOrVirtualEnum.Virtual) and (('ifc4x3_tc1.ifcvirtualelement' in typeof(relatedbuildingelement)) or ('ifc4x3_tc1.ifcopeningelement' in typeof(relatedbuildingelement)))) or (physicalorvirtualboundary == IfcPhysicalOrVirtualEnum.NotDefined)) is not False @@ -21143,7 +21145,7 @@ class IfcShapeRepresentation_NoTopologicalItem: def __call__(self): items = self.Items - assert ((sizeof([temp for temp in items if ('ifc4x3_tc1.ifctopologicalrepresentationitem' in typeof(temp)) and (not (sizeof(['ifc4x3_tc1.ifcvertexpoint','ifc4x3_tc1.ifcedgecurve','ifc4x3_tc1.ifcfacesurface'] * typeof(temp))) == 1)])) == 0) is not False + assert ((sizeof([temp for temp in items if ('ifc4x3_tc1.ifctopologicalrepresentationitem' in typeof(temp)) and (not ((sizeof(['ifc4x3_tc1.ifcvertexpoint','ifc4x3_tc1.ifcedgecurve','ifc4x3_tc1.ifcfacesurface'] * typeof(temp))) == 1))])) == 0) is not False @@ -22043,7 +22045,7 @@ class IfcStyledItem_ApplicableItem: def __call__(self): item = self.Item - assert (not 'ifc4x3_tc1.ifcstyleditem' in typeof(item)) is not False + assert (not ('ifc4x3_tc1.ifcstyleditem' in typeof(item))) is not False @@ -22058,7 +22060,7 @@ class IfcStyledRepresentation_OnlyStyledItems: def __call__(self): - assert ((sizeof([temp for temp in self.Items if not 'ifc4x3_tc1.ifcstyleditem' in typeof(temp)])) == 0) is not False + assert ((sizeof([temp for temp in self.Items if not ('ifc4x3_tc1.ifcstyleditem' in typeof(temp))])) == 0) is not False @@ -22128,7 +22130,7 @@ class IfcSurfaceCurve_CurveIsNotPcurve: def __call__(self): curve3d = self.Curve3D - assert (not 'ifc4x3_tc1.ifcpcurve' in typeof(curve3d)) is not False + assert (not ('ifc4x3_tc1.ifcpcurve' in typeof(curve3d))) is not False @@ -22890,7 +22892,7 @@ class IfcTextLiteralWithExtent_WR31: def __call__(self): extent = self.Extent - assert (not 'ifc4x3_tc1.ifcplanarbox' in typeof(extent)) is not False + assert (not ('ifc4x3_tc1.ifcplanarbox' in typeof(extent))) is not False @@ -22965,7 +22967,7 @@ class IfcTopologyRepresentation_WR21: def __call__(self): - assert ((sizeof([temp for temp in self.Items if not 'ifc4x3_tc1.ifctopologicalrepresentationitem' in typeof(temp)])) == 0) is not False + assert ((sizeof([temp for temp in self.Items if not ('ifc4x3_tc1.ifctopologicalrepresentationitem' in typeof(temp))])) == 0) is not False @@ -23188,7 +23190,7 @@ class IfcTrimmedCurve_NoTrimOfBoundedCurves: def __call__(self): basiscurve = self.BasisCurve - assert (not 'ifc4x3_tc1.ifcboundedcurve' in typeof(basiscurve)) is not False + assert (not ('ifc4x3_tc1.ifcboundedcurve' in typeof(basiscurve))) is not False @@ -23307,7 +23309,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 'ifc4x3_tc1.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 ('ifc4x3_tc1.ifcproduct' in typeof(temp))])) == 0)) is not False @@ -23832,7 +23834,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 @@ -23847,7 +23849,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 @@ -23862,7 +23864,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 @@ -23988,7 +23990,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 ('ifc4x3_tc1.ifczone' in typeof(temp)) or ('ifc4x3_tc1.ifcspace' in typeof(temp)) or ('ifc4x3_tc1.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 (('ifc4x3_tc1.ifczone' in typeof(temp)) or ('ifc4x3_tc1.ifcspace' in typeof(temp)) or ('ifc4x3_tc1.ifcspatialzone' in typeof(temp)))])) == 0)) is not False @@ -24004,7 +24006,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 @@ -24323,13 +24325,13 @@ def IfcCorrectUnitAssignment(units): monetaryunitnumber = 0 namedunitnames = express_set([]) derivedunitnames = express_set([]) - namedunitnumber = sizeof([temp for temp in units if ('ifc4x3_tc1.ifcnamedunit' in typeof(temp)) and (not temp.UnitType == IfcUnitEnum.USERDEFINED)]) - derivedunitnumber = sizeof([temp for temp in units if ('ifc4x3_tc1.ifcderivedunit' in typeof(temp)) and (not temp.UnitType == IfcDerivedUnitEnum.USERDEFINED)]) + namedunitnumber = sizeof([temp for temp in units if ('ifc4x3_tc1.ifcnamedunit' in typeof(temp)) and (not (temp.UnitType == IfcUnitEnum.USERDEFINED))]) + derivedunitnumber = sizeof([temp for temp in units if ('ifc4x3_tc1.ifcderivedunit' in typeof(temp)) and (not (temp.UnitType == IfcDerivedUnitEnum.USERDEFINED))]) monetaryunitnumber = sizeof([temp for temp in units if 'ifc4x3_tc1.ifcmonetaryunit' in typeof(temp)]) for i in range(1, sizeof(units) + 1): - if ('ifc4x3_tc1.ifcnamedunit' in (typeof(units[i - 1]))) and (not (units[i - 1].UnitType) == IfcUnitEnum.USERDEFINED): + if ('ifc4x3_tc1.ifcnamedunit' in (typeof(units[i - 1]))) and (not ((units[i - 1].UnitType) == IfcUnitEnum.USERDEFINED)): namedunitnames = namedunitnames + (units[i - 1].UnitType) - if ('ifc4x3_tc1.ifcderivedunit' in (typeof(units[i - 1]))) and (not (units[i - 1].UnitType) == IfcDerivedUnitEnum.USERDEFINED): + if ('ifc4x3_tc1.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)