Reply
Solved! Go to solution

Why are additional reference planes are created

[ Edited ]

Hi. I used AddNormalToCurve for creating new refplane, which normal to the line. But I see additional two refplance in result. Where do they come?

 

Result:

 

Code:

 

ProfileSet profileSet = objDoc.ProfileSets.Add();
RefPlane plane = objDoc.RefPlanes.Item(1);
Profile profile = profileSet.Profiles.Add(plane);
Line2d line = profile.Lines2d.AddBy2Points(0, 0, -0.05, 0);
            
profile.End(ValidationCriteria: ProfileValidationType.igProfileClosed);

RefPlane newPlane = objDoc.RefPlanes.AddNormalToCurve(
    Curve: line,
    PlanePoint: ReferenceElementConstants.igCurveEnd,
    OrientationPlaneOrPivot: plane,
    PivotOrigin: ReferenceElementConstants.igPivotEnd,
    Local: false,
    ParentCurve: profile)

 

2 REPLIES
Solution
Solution
Accepted by topic author kavit
‎09-06-2015 04:36 AM

Re: Why are additional reference planes are created

I am not sure if this is a bug in SE, but you are not following some main concepts in your code:

  • A profile set should be used for local profiles which are integrated in a feature like the extruded protrusion
  • If you need a profile in a subsequent feature, create a Sketch
  • The AddNormalToCurve method requires a Curve object and not the graphic members added to a profile

The following code creates a plane normal to a line without creating the additional 2 planes:

PartDocument objDoc = (PartDocument)pSEApp.ActiveDocument;
// Create a sketch with a single line
Sketch sketch = objDoc.Sketches.Add();
RefPlane plane = objDoc.RefPlanes.Item(1);
Profile profile = sketch.Profiles.Add(plane);
Line2d line = profile.Lines2d.AddBy2Points(0, 0, -0.05, 0);
profile.End(SolidEdgePart.ProfileValidationType.igProfileClosed);
// Get the curve geometry of the line
SolidEdgeGeometry.Curve curve = profile.CurveBody.Curves.Item(1);
// Create the plane
RefPlane newPlane = objDoc.RefPlanes.AddNormalToCurve(
		curve,
		SolidEdgePart.ReferenceElementConstants.igCurveEnd,
		plane,
		SolidEdgePart.ReferenceElementConstants.igPivotEnd,
		false,
		null);

Re: Why are additional reference planes are created

Thank you. The main mistake was to use a graphic object instead of a Curve object