How to obtain a segment (part) of a curve

Everything DG Kernel: Technical discussions and issues
Post Reply
Carlos Gonzales
Posts: 2
Joined: Fri Nov 08, 2024 12:52 am

How to obtain a segment (part) of a curve

Post by Carlos Gonzales »

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.
Vince
Posts: 1
Joined: Mon Nov 11, 2024 2:59 am

Re: How to obtain a segment (part) of a curve

Post by Vince »

Try 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>();
Carlos Gonzales
Posts: 2
Joined: Fri Nov 08, 2024 12:52 am

Re: How to obtain a segment (part) of a curve

Post by Carlos Gonzales »

Thank you, Vince
It looks good. I will try this
Post Reply