Get Basis Surface |
NOTE Definition according to ISO/CD 10303-42:1992
This function returns the basis surface for a curve as a a set of surfaces. For a curve which is not a curve on surface an empty set is returned.
NOTE Function adapted from get_basis_surface defined in ISO 10303-42.
HISTORY New function in IFC1.5
FUNCTION IfcGetBasisSurface
(C : IfcCurveOnSurface) : SET[0:2] OF IfcSurface;
LOCAL
Surfs : SET[0:2] OF IfcSurface;
N : INTEGER;
END_LOCAL;
Surfs := [];
IF 'IFCGEOMETRYRESOURCE.IfcPcurve' IN TYPEOF (C) THEN
Surfs := [C\IfcPcurve.BasisSurface];
ELSE
IF 'IFCGEOMETRYRESOURCE.IfcSurfaceCurve' IN TYPEOF (C) THEN
N := SIZEOF(C\IfcSurfaceCurve.AssociatedGeometry);
REPEAT i := 1 TO N;
Surfs := Surfs + IfcAssociatedSurface(C\IfcSurfaceCurve.AssociatedGeometry[i]);
END_REPEAT;
END_IF;
END_IF;
IF 'IFCGEOMETRYRESOURCE.IfcCompositeCurveOnSurface' IN TYPEOF (C) THEN
(* For an IfcCompositeCurveOnSurface the BasisSurface is the intersection of the BasisSurface of all the segments. *)
N := SIZEOF(C\IfcCompositeCurve.Segments);
IF ('IFCGEOMETRYRESOURCE.IfcCurveSegment' IN TYPEOF(C\IfcCompositeCurve.Segments[1])) THEN
Surfs := IfcGetBasisSurface(C\IfcCompositeCurve.Segments[1]\IfcCurveSegment.ParentCurve);
END_IF;
IF ('IFCGEOMETRYRESOURCE.IfcCompositeCurveSegment' IN TYPEOF(C\IfcCompositeCurve.Segments[1])) THEN
Surfs := IfcGetBasisSurface(C\IfcCompositeCurve.Segments[1]\IfcCompositeCurveSegment.ParentCurve);
END_IF;
IF N > 1 THEN
REPEAT i := 2 TO N;
IF ('IFCGEOMETRYRESOURCE.IfcCurveSegment' IN TYPEOF(C\IfcCompositeCurve.Segments[i])) THEN
Surfs := Surfs * IfcGetBasisSurface(C\IfcCompositeCurve.Segments[i]\IfcCurveSegment.ParentCurve);
END_IF;
IF ('IFCGEOMETRYRESOURCE.IfcCompositeCurveSegment' IN TYPEOF(C\IfcCompositeCurve.Segments[i])) THEN
Surfs := Surfs * IfcGetBasisSurface(C\IfcCompositeCurve.Segments[i]\IfcCompositeCurveSegment.ParentCurve);
END_IF;
END_REPEAT;
END_IF;
END_IF;
RETURN(Surfs);
END_FUNCTION;