Intersect solid and plane

Intersect solid and plane

sonicer
Collaborator Collaborator
3,444 Views
3 Replies
Message 1 of 4

Intersect solid and plane

sonicer
Collaborator
Collaborator

How can I get the curve that is result from intersect solid and plane?

 

I am using this:

   Plane plane =  new Plane(XYZ.BasisZ,point);                                                        
   Solid cast = BooleanOperationsUtils.CutWithHalfSpace(solid, plane); 

But don't know is the right way....?

 

thx..

 

0 Likes
3,445 Views
3 Replies
Replies (3)
Message 2 of 4

FAIR59
Advisor
Advisor

from the resulting solid (cast) find the face with normal (0,0,-1). The edges are the required curve(s)

 

                SketchPlane skPlane = SketchPlane.Create(document, plane);
                Solid cast = BooleanOperationsUtils.CutWithHalfSpace(solid, plane);
                PlanarFace CutFace = null;

                foreach (Face face in cast.Faces)
                {
                    PlanarFace planFace = face as PlanarFace;
                    if (planFace == null) continue;
                    if (planFace.FaceNormal.IsAlmostEqualTo(XYZ.BasisZ.Negate()) && planFace.Origin.Z == point.Z)
                    {
                        CutFace = planFace;
                    }
                }
                if (CutFace == null) return Result.Failed;
                CurveLoop _boundery = CutFace.GetEdgesAsCurveLoops().First();
                foreach (Curve c in _boundery)
                {
                    document.FamilyCreate.NewModelCurve(c, skPlane);
                }
Message 3 of 4

Revitalizer
Advisor
Advisor

Hi FAIR59,

 

I think that there may be more than a single Face in the result.

E.g. if cutting an "O" shaped solid into a half, making a "C", there will be two intersection faces on the "C"'s endings.

 

 

Revitalizer




Rudolf Honke
Software Developer
Mensch und Maschine





0 Likes
Message 4 of 4

FAIR59
Advisor
Advisor

Hi Revitalizer,

 

you're right. To find all the curves in the plane, you need to make a list of faces that pass the test, instead of the single CutFace.

And of course you'd need to process every Curveloop in the FoundFace.GetEdgesAsCurveLoops(), instead of only the first.  

0 Likes