/// <summary> /// Tests the express where-clause specified in param 'clause' /// </summary> /// <param name="clause">The express clause to test</param> /// <returns>true if the clause is satisfied.</returns> public bool ValidateClause(IfcDimensionCurveClause clause) { var retVal = false; try { switch (clause) { case IfcDimensionCurveClause.WR51: retVal = Functions.SIZEOF(Functions.USEDIN(this, "IFC2X3.IFCDRAUGHTINGCALLOUT.CONTENTS")) >= 1; break; case IfcDimensionCurveClause.WR52: retVal = (Functions.SIZEOF(Functions.USEDIN(this, "IFC2X3." + "IFCTERMINATORSYMBOL.ANNOTATEDCURVE").Where(Dct1 => (Dct1.AsIfcDimensionCurveTerminator().Role == IfcDimensionExtentUsage.ORIGIN))) <= 1) && (Functions.SIZEOF(Functions.USEDIN(this, "IFC2X3." + "IFCTERMINATORSYMBOL.ANNOTATEDCURVE").Where(Dct2 => (Dct2.AsIfcDimensionCurveTerminator().Role == IfcDimensionExtentUsage.TARGET))) <= 1); break; case IfcDimensionCurveClause.WR53: retVal = Functions.SIZEOF(AnnotatedBySymbols.Where(Dct => !(Functions.TYPEOF(Dct).Contains("IFC2X3.IFCDIMENSIONCURVETERMINATOR")))) == 0; break; } } catch (Exception ex) { var log = Validation.ValidationLogging.CreateLogger <Xbim.Ifc2x3.PresentationDimensioningResource.IfcDimensionCurve>(); log?.LogError(string.Format("Exception thrown evaluating where-clause 'IfcDimensionCurve.{0}' for #{1}.", clause, EntityLabel), ex); } return(retVal); }
public override string WhereRule() { var result = base.WhereRule(); if (!ModelOf.Instances.Where <IfcDraughtingCallout>(dc => dc.Contents.Contains(this)).Any()) { result += "WR51: A dimension curve shall be used by at least one referencing dimension curve directed callout, i.e. it should not be used outside of the context of a dimension element group. \n"; } if (AnnotatedBySymbols.OfType <IfcDimensionCurveTerminator>().Count(t => t.Role == IfcDimensionExtentUsage.ORIGIN) > 1 || AnnotatedBySymbols.OfType <IfcDimensionCurveTerminator>().Count(t => t.Role == IfcDimensionExtentUsage.TARGET) > 1) { result += "WR52: The dimension curve should not be annotated with more than one terminator having the role \"Origin\", nor with more than one terminator having the role \"Target\". \n"; } if (AnnotatedBySymbols.Count(a => !(a is IfcDimensionCurveTerminator)) != 0) { result += "WR53: All terminators assigned to a dimension curve shall be dimension curve terminators. \n"; } return(result); }