I have built a IBSplineCurve_DG by 8 points using IBSplineCurve_DG.Interpolate. But I want to get a segment of this curve between two points. The points are intersections with other surfaces. I need the segment as another IBSplineCurve_DG.
I know only X,Y and Z for those points. I do not have the parameter values. But I know they are on the curve.
Thanks for help.
How to obtain a segment (part) of a curve
-
- Posts: 2
- Joined: Fri Nov 08, 2024 12:52 am
Re: How to obtain a segment (part) of a curve
Try this:
Query ICurve_DG from your IBSplineCurve_DG:
Parameters for your intersection points can be obtained with ICurve_DG.GetNearestPoint(PointDg point, out PointDg pointNearest). It returns the parameter. So, you will get paramMin, paramMax.
Do this:
Query ICurve_DG from your IBSplineCurve_DG:
Code: Select all
ICurve_DG curve = theBsplineCurve.As<ICurve_DG>();
Parameters for your intersection points can be obtained with ICurve_DG.GetNearestPoint(PointDg point, out PointDg pointNearest). It returns the parameter. So, you will get paramMin, paramMax.
Do this:
Code: Select all
//Clone the theBsplineCurve:
IGeometricObject_DG geomObject = theBsplineCurve.As<IGeometricObject_DG>();
IGeometricObject_DG geomObjectClone = geomObject.Clone();
ICurve_DG curveClone = geomObjectClone.As<ICurve_DG>();
// Reduce its range:
curveClone.ParameterRange = new RangeDg(paramMin, paramMax);
// The result:
IBSplineCurve_DG segment = geomObjectClone.As<IBSplineCurve_DG>();
-
- Posts: 2
- Joined: Fri Nov 08, 2024 12:52 am
Re: How to obtain a segment (part) of a curve
Thank you, Vince
It looks good. I will try this
It looks good. I will try this