How to convert spline into polyline without using the function of toPolyline in AcdbSpline member?
plz provide some sample code!!!
Solved! Go to Solution.
there is no simple way to do this. So, the way I'm doing this is:
1. choose a minimal distance A, for example 0.1 or 0.5
2. collect all of the spline's points at A, A*2, A*3, ...
3. use group of three points to find out if all of them are on the same LINE. If it's true, kill middle point
4. repeate 3 until the last collected point.
5. create polyline (2D or 3D) from the remaining points.
6. kill the spline.
Sorry, can't give you a source. But I think algorythm is enough for understanding.
use group of three points to find out if all of them are on the same LINE. If it's true, kill middle point---> how spline point in same line can u explain briefly.
first of all collect spline points through some step, for example 1/5000 of spline's length
put then into ptArray.
for(int i = 0; i<ptArray.length()-3; i++)
// first line - ptArray.at(i), ptArray.at(i+1)
// second line - ptArray.at(i+1), ptArray.at(i+2)
// if (lines have the same direction or less then permissible angle, for example 1degree in radians)
Thank for ur help
i found another way to convert spline to polyline but the output is wrongly come because of tolerance in spline.
AcDb3dPolyline(AcDb:oly3dType, AcGePoint3dArray& vertices, Adesk::Boolean closed = Adesk::kFalse);
AcDb3dPolyline *pPline = AcDb3dPolyline(k3dQuadSplinePoly,SplinePoints);
whether this method is correct to convert polyline
everything depends on accuracy of created polyline. if you want to have polyline's looks, like spline is shown on the screen, use my way or something similar. arx methods can't help you in this.
May be in 3-5 years somethin will change in autodesk structure, an they will try to fix great quantity of "expected behavior" of their functions. but now, look at the attached picture (autocad's native command for spline to polyline convertation). black - polyline3d, red - spline, blue marks - "expected behavior" (i call it BUGS).
Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register
Start with some of our most frequented solutions to get help installing your software.