ObjectARX
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Get a spline,divide it and get the divided points?

2 REPLIES 2
Reply
Message 1 of 3
Anonymous
341 Views, 2 Replies

Get a spline,divide it and get the divided points?

By ARX, how to get a spline in a dwg file, and divide it into many (for
example, 50) parts? and after that how to get the points? Any advice and
codes will be appreciated!

yours

Cathy
2 REPLIES 2
Message 2 of 3
Anonymous
in reply to: Anonymous

cathy,

Take a look at AcDbCurve class which is the base class of AcDbPolyline and
AcDbSpline.
Those curves are parameterized so you can get the start and end parameters,
with getStartParam() and getEndParam(), calculate the result value divided
by your number of parts and then get the point placed on each part parameter
with function getPointAtParam().

I have not tested this but I guess command DIVIDE and MEASURE use something
like that...

Let me know if it works.
Regards,
Fernando.

"cathy" wrote in message
news:5FCF58CA2F661C71A73000B9E3AA094E@in.WebX.maYIadrTaRb...
> By ARX, how to get a spline in a dwg file, and divide it into many (for
> example, 50) parts? and after that how to get the points? Any advice and
> codes will be appreciated!
>
> yours
>
> Cathy
>
>
Message 3 of 3
Anonymous
in reply to: Anonymous

The key is the AcDbCurve class as has been pointed out however I think more
than Params are necessary. Examine the ARX help for AcDbCurve query
methods. Params are not equally spaced along the length of a curve.

I would use something like this:

double end_param = pCurve->getEndParam() ;
double curve_length = pCurve->getDistAtParam(end_param) ;
int n_pieces = 10 ; // number of subcurves...
double sub_length = curve_length / n_pieces ;
double param0 = pCurve->getStartParam() ;
double param1 = pCurve->getParamAtDist(sub_length) ;
double param2 = pCurve->getParamAtDist(2*sub_length) ;
...

Look carefully at AcDbCurve query methods and you will discover a "split
curve" method which uses param0,param1,... in an array as an input argument
and does the splitting for you.

Hope this is useful.

Bruce Sellers



"Fernando P. Malard" wrote in message
news:5DADB3B7A61543954A87D47BDA4E5A33@in.WebX.maYIadrTaRb...
> cathy,
>
> Take a look at AcDbCurve class which is the base class of AcDbPolyline and
> AcDbSpline.
> Those curves are parameterized so you can get the start and end
parameters,
> with getStartParam() and getEndParam(), calculate the result value divided
> by your number of parts and then get the point placed on each part
parameter
> with function getPointAtParam().
>
> I have not tested this but I guess command DIVIDE and MEASURE use
something
> like that...
>
> Let me know if it works.
> Regards,
> Fernando.
>
> "cathy" wrote in message
> news:5FCF58CA2F661C71A73000B9E3AA094E@in.WebX.maYIadrTaRb...
> > By ARX, how to get a spline in a dwg file, and divide it into many (for
> > example, 50) parts? and after that how to get the points? Any advice and
> > codes will be appreciated!
> >
> > yours
> >
> > Cathy
> >
> >
>
>

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost