Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jwg12 IfcGetBasisSurface #6

Open
aothms opened this issue Sep 5, 2022 · 3 comments
Open

jwg12 IfcGetBasisSurface #6

aothms opened this issue Sep 5, 2022 · 3 comments

Comments

@aothms
Copy link
Member

aothms commented Sep 5, 2022

Changes where required to accomodate IfcSegment changes (affecting IfcCompositiveCurveOnSurface)

@aothms
Copy link
Member Author

aothms commented Sep 5, 2022

--- tmp/a/IFC.exp	2022-08-26 22:32:18.631600600 +0200
+++ tmp/b/IFC.exp	2022-09-05 20:18:03.017322700 +0200
@@ -13065,24 +13065,36 @@
       REPEAT i := 1 TO N;
       Surfs := Surfs + IfcAssociatedSurface(C\IfcSurfaceCurve.AssociatedGeometry[i]);
       END_REPEAT;
     END_IF;
   END_IF;
   IF 'IFC4X3_DEV.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);
-    Surfs := IfcGetBasisSurface(C\IfcCompositeCurve.Segments[1].ParentCurve);
+    
+    IF ('IFC4X3_DEV.IFCCURVESEGMENT' IN TYPEOF(Segment)) THEN
+      Surfs := IfcGetBasisSurface(C\IfcCompositeCurve.Segments[1]\IfcCurveSegment.ParentCurve);
+    END_IF;
+    IF ('IFC4X3_DEV.IFCCOMPOSITECURVESEGMENT' IN TYPEOF(Segment)) THEN
+      Surfs := IfcGetBasisSurface(C\IfcCompositeCurve.Segments[1]\IfcCompositeCurveSegment.ParentCurve);
+    END_IF;
+    
     IF N > 1 THEN
       REPEAT i := 2 TO N;
-        Surfs := Surfs * IfcGetBasisSurface(C\IfcCompositeCurve.Segments[1].ParentCurve);
+        IF ('IFC4X3_DEV.IFCCURVESEGMENT' IN TYPEOF(Segment)) THEN
+          Surfs := Surfs * IfcGetBasisSurface(C\IfcCompositeCurve.Segments[i]\IfcCurveSegment.ParentCurve);
+        END_IF;
+        IF ('IFC4X3_DEV.IFCCOMPOSITECURVESEGMENT' IN TYPEOF(Segment)) THEN
+          Surfs := Surfs * IfcGetBasisSurface(C\IfcCompositeCurve.Segments[i]\IfcCompositeCurveSegment.ParentCurve);
+        END_IF;
       END_REPEAT;
     END_IF;
   END_IF;
   RETURN(Surfs);
 
 END_FUNCTION;
 
 FUNCTION IfcListToArray
 (Lis : LIST [0:?] OF GENERIC : T;
        Low,U : INTEGER) : ARRAY OF GENERIC : T;

@SergejMuhic
Copy link

This is not going to work. Segment is undefined.

@aothms
Copy link
Member Author

aothms commented Sep 12, 2022

Correct. Substituting one copy-pasta error for the other. How about:

(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 ('IFC4X3.IFCCURVESEGMENT' IN TYPEOF(C\IfcCompositeCurve.Segments[1])) THEN
      Surfs := IfcGetBasisSurface(C\IfcCompositeCurve.Segments[1]\IfcCurveSegment.ParentCurve);
    END_IF;
    IF ('IFC4X3.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 ('IFC4X3.IFCCURVESEGMENT' IN TYPEOF(C\IfcCompositeCurve.Segments[i])) THEN
          Surfs := Surfs * IfcGetBasisSurface(C\IfcCompositeCurve.Segments[i]\IfcCurveSegment.ParentCurve);
        END_IF;
        IF ('IFC4X3.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

Edit: don't mind the IFCGEOMETRYRESOURCE, it's stored like that, but not written out to exp.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants