access to start point and end point of segments

access to start point and end point of segments

Vasago
Advocate Advocate
1,715 Views
8 Replies
Message 1 of 9

access to start point and end point of segments

Vasago
Advocate
Advocate

I need to rescue the start point and end point data from all the segments of a toolpath.

 

Sin título.jpg

0 Likes
Accepted solutions (1)
1,716 Views
8 Replies
Replies (8)
Message 2 of 9

5axes
Advisor
Advisor
to rescue ?
0 Likes
Message 3 of 9

Vasago
Advocate
Advocate

.... Get value....

0 Likes
Message 4 of 9

5axes
Advisor
Advisor

You can get the values of the start and endpoint of a toolpath via the variables :

    REAL ARRAY $Start_Point[3] = $entity('toolpath','').startpoint.position
    REAL ARRAY $End_Point[3] = $entity('toolpath','').endpoint.position

 

But to get the start point and end point of every segment , you need to split the toolpath into individual toolpaths via the command :

EDIT TOOLPATH DIVIDE TYPE RETRACT
PROCESS TPDIVIDE YES

 

And get the datas for every new created toolpaths. Then delete these useless toolpaths.

 

More informations on the Old Delcam Forum :

https://manufacturing.autodesk.com/forums/forum.delcam.com/viewtopic260a.html?p=57948#p57948

 

And also the original code of @craig.chester

https://manufacturing.autodesk.com/forums/forum.delcam.com/viewtopic0720.html?p=48786#p48786

 

Message 5 of 9

Vasago
Advocate
Advocate

My problem is that the toolpath I'm going to work with has 3304 segments, imagine creating 3304 toolpaths ... do you know some easier way to get the start and end points without dividing the toolpaths?

0 Likes
Message 6 of 9

5axes
Advisor
Advisor

You don't have to create 3304 Toolpaths, The code EDIT TOOLPATH DIVIDE TYPE RETRACT will create for you based on your original toolpath. After that your macro will get the start and and point for every segments and then delete the useless toolpath. But Yes if you have a lot of segment this type of macro could be Time consuming.

Regards,

0 Likes
Message 7 of 9

Vasago
Advocate
Advocate
Accepted solution

In the end I have used the Autodesk automation libraries, I have inserted the path in a pattern, and I have exported the pattern to PIC file, then I have opened it as List <Polyline> and thus I have obtained all the objects contained within the path. Thank you for spending your time in finding a solution.

Message 8 of 9

5axes
Advisor
Advisor

Great idea ! But take care, the curves via the Pic format are exported in the global plane.  And it could be different from your toolpath Axis system.

 

Pic.jpg

 

So on my point of view you need to transform the pattern into the global plane before to export the pattern.

 

MODE GEOMETRY_TRANSFORM TOWORLD

 

 

0 Likes
Message 9 of 9

a_bako
Enthusiast
Enthusiast

object segment_get_point( entity toolpath, int n, int i)
Provides information on the i'th point of the n'th segment of the specified toolpath. It returns a map containing the following fields:

 

array Position
The position of the point in x,y and z, relative to the toolpath's workplane.
array ToolAxis
The tool axis at this position.
array OrientationVector
The orientation vector at this position. (A zero vector is output when the orientation vector has not been specified.)