DXF2GCODE TSP (path optimization question)

170 views
Skip to first unread message

Wagnerlip

unread,
Mar 21, 2021, 10:09:56 PM3/21/21
to dxf2gcode-users
Hi, I am new in this group, and minutes ago installed the DXF2GCODE software.

I am developing a path optimizer for the holes I produce in CorelDraw, exported as PLT and run through a software I made to a) convert to raw XY numbers to drill with G41 on a small router we have.  It is working nice, the optimization is the most simplest possible, just seek the closest hole to be the next, it works nice, but due the simplicity of it, make some mistakes.

I knew about the TSP (path optimization) of DXF2GCODE, so I wanted to see it working.
I used the same Corel image, now with a continues line going trough crazy cris-cross over the holes, exported the line as DXF and open on DXF2GCODE.

The image is there, nicely, if I export WITH optimize and shapes, it does not optimize, just export a gcode file exactly in the same sequence of the line sequence in Corel.

I even checkmarked the "By default enable the TSP..."  on Configuration/Output settings, Constrain_xxxx (both), tested all starting point options.

There are 31 holes (the Corel continuous line change angle in 29 points, plus two extremes), so I setup Max Population to 80 (just in case) and Max iterations: 5000.

It still doesn't work.

Can somebody help me to point what is my mistake on DXF2GCODE setup or operation, in order for the optimization to work?

I can post the DXF file, the images, whatever would be necessary.

Thank you,
Wagnerlip

Christian Kohlöffel

unread,
Mar 22, 2021, 8:57:47 AM3/22/21
to 'Timo Birnschein' via dxf2gcode-users
Can you attach the example file?

--
--
You received this message because you subscribed to the Google
Groups-group "dxf2gcode-users".
To post a message, send mail to dxf2gco...@googlegroups.com
To unsubscribe, send mail to dxf2gcode-use...@googlegroups.com
See http://groups.google.de/group/dxf2gcode-users?hl=en for more options
and the dxf2gcode project page at http://code.google.com/p/dxf2gcode/
---
You received this message because you are subscribed to the Google Groups "dxf2gcode-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dxf2gcode-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dxf2gcode-users/8de98f61-7caf-405f-aa4e-75a27cc56233n%40googlegroups.com.

Lip

unread,
Mar 23, 2021, 1:38:35 PM3/23/21
to dxf2gco...@googlegroups.com
Yes, A2.DXF attached, thank you.


A2.dxf

Wagnerlip

unread,
Apr 7, 2021, 3:26:46 PM4/7/21
to dxf2gcode-users
No updates at all?  
Just wonder if nobody use the path optimization option... 
Thanks
Wagner.

Christian Kohlöffel

unread,
Apr 9, 2021, 10:17:15 AM4/9/21
to dxf2gco...@googlegroups.com

Did you attach the example file, like i asked to? Or is this happening to any file?

Lip

unread,
Apr 9, 2021, 4:11:28 PM4/9/21
to dxf2gco...@googlegroups.com
Dear Christian, 
yes, I attached the A2.DXF file to my post of Mar/23.
Also, attached here again. 
Thanks.
A2.dxf

Christian Kohlöffel

unread,
Apr 11, 2021, 7:26:31 AM4/11/21
to dxf2gco...@googlegroups.com

I just tried it with one of my files.

Not Optimized

(* SHAPE Nr: 1 *)

G0 X -12.222 Y  -7.750

 

Optimized

(* SHAPE Nr: 1 *)

G0 X -12.222 Y   6.733

 

I can see same result as in picture. ….

I will check your file …

 

Regards

Christian

 

 

 

Von: dxf2gco...@googlegroups.com [mailto:dxf2gco...@googlegroups.com] Im Auftrag von Lip
Gesendet: Freitag, 9. April 2021 22:11
An: dxf2gco...@googlegroups.com
Betreff: Re: [dxf2gcode-users] DXF2GCODE TSP (path optimization question)

 

Dear Christian, 

--

--
You received this message because you subscribed to the Google
Groups-group "dxf2gcode-users".
To post a message, send mail to dxf2gco...@googlegroups.com
To unsubscribe, send mail to dxf2gcode-use...@googlegroups.com
See http://groups.google.de/group/dxf2gcode-users?hl=en for more options
and the dxf2gcode project page at http://code.google.com/p/dxf2gcode/
---
You received this message because you are subscribed to the Google Groups "dxf2gcode-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dxf2gcode-use...@googlegroups.com.

1997.ngc
1997_opt.ngc
2021-04-09 16_23_16-GIT_DXF2GCODE – dxf2gcode.py.png
2021-04-09 16_22_40-DXF2GCODE - [D__GIT_DXF2GCODE_sourcecode_dxf_1997.DXF]_opt.png

Christian Kohlöffel

unread,
Apr 11, 2021, 7:29:38 AM4/11/21
to dxf2gco...@googlegroups.com

This is not a shape / contour which can be optimized. You can create several circles as an example. But this seems to be several lines or a polyline. Order is already given by dxf I guess or by connectiong the lines. ….

 

Regards

Christian

 

 

Von: Christian Kohlöffel [mailto:christian....@googlemail.com]
Gesendet: Sonntag, 11. April 2021 13:26
An: 'dxf2gco...@googlegroups.com' <dxf2gco...@googlegroups.com>
Betreff: AW: [dxf2gcode-users] DXF2GCODE TSP (path optimization question)

 

I just tried it with one of my files.

Not Optimized

(* SHAPE Nr: 1 *)

G0 X -12.222 Y  -7.750

 

Optimized

(* SHAPE Nr: 1 *)

G0 X -12.222 Y   6.733

 

I can see same result as in picture. ….

I will check your file …

 

Regards

Christian

 

 

 

Von: dxf2gco...@googlegroups.com [mailto:dxf2gco...@googlegroups.com] Im Auftrag von Lip
Gesendet: Freitag, 9.

April 2021 22:11
An:
dxf2gco...@googlegroups.com


Betreff: Re: [dxf2gcode-users] DXF2GCODE TSP (path optimization question)

 

Dear Christian, 

--

--
You received this message because you subscribed to the Google
Groups-group "dxf2gcode-users".
To post a message, send mail to dxf2gco...@googlegroups.com
To unsubscribe, send mail to dxf2gcode-use...@googlegroups.com
See http://groups.google.de/group/dxf2gcode-users?hl=en for more options
and the dxf2gcode project page at http://code.google.com/p/dxf2gcode/
---
You received this message because you are subscribed to the Google Groups "dxf2gcode-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dxf2gcode-use...@googlegroups.com.

2021-04-11 13_27_34-Posteingang - christian.kohloeffel@gmail.com - Outlook.png

Lip

unread,
Apr 11, 2021, 1:16:23 PM4/11/21
to dxf2gco...@googlegroups.com
So you are saying the DXF2GCODE path optimization is not about finding the total shortest path for drilling.
The actual TSP (Travel Salesman Path) optimization algorithm find exactly that, what order the "cities" should be visited to reduce travel distances, in our case, the cities are holes in a drilling order.

Then I understand the DXF2GCODE optimization is not related to that, and yes for selecting which shape should be selected next.

If I consider each drilling hole a shape, it should do it, but DXF can't consider drilling holes as a "point", but circles.

This is why I needed to produce a polyline, just to position the drilling spots and trying to see how the "optimization" of DXF2Gcode works, obviously it doesn't for that.

To solve that, I use a "cross" 1mm x 1mm intersecting (combined) on each drill spot in Coreldraw, and my own software to convert that to "Xnnn Ynnn" gcode numbers, and during the process I really apply my own TSP algorithm.  Doing the Atom E3827 processor, 25x27mm chip, 1170 pins, it reduced the total CNC head drilling movement from 1020mm to 830mm, the gain is not very substantial, but more aligned drilling seems more logical and less prone to failures.  One of my work colleagues seeing me writing the code was saying "stop reinventing the wheel, since DXF2CGODE does that", finally I can say, it does not.

Below my software final optimized drilling path, 1170 holes, CNC time 147 minutes, drill bit 0.35mm diameter.
image.png

Thank you for your help, tests and participation.
Cheers,

Christian Kohlöffel

unread,
Apr 11, 2021, 2:32:17 PM4/11/21
to dxf2gco...@googlegroups.com

 

 

Von: dxf2gco...@googlegroups.com [mailto:dxf2gco...@googlegroups.com] Im Auftrag von Lip
Gesendet: Sonntag, 11. April 2021 19:16
An: dxf2gco...@googlegroups.com
Betreff: Re: [dxf2gcode-users] DXF2GCODE TSP (path optimization question)

 

So you are saying the DXF2GCODE path optimization is not about finding the total shortest path for drilling.

The actual TSP (Travel Salesman Path) optimization algorithm find exactly that, what order the "cities" should be visited to reduce travel distances, in our case, the cities are holes in a drilling order.

 

ð    I did use a TSP alogrith with is based on population and mutations of that. It’s able to find the local minium the abolut minimum is dependent on how many iterations you do ….

 

Then I understand the DXF2GCODE optimization is not related to that, and yes for selecting which shape should be selected next.

 

??

 

If I consider each drilling hole a shape, it should do it, but DXF can't consider drilling holes as a "point", but circles.

 

I am not sure about that, I am not a Autocad specialist. The CAD Tool I used was able to do it (a long time ago since I really did it).

 

This is why I needed to produce a polyline, just to position the drilling spots and trying to see how the "optimization" of DXF2Gcode works, obviously it doesn't for that.

 

A polyline cannot be optimzed ….

 

To solve that, I use a "cross" 1mm x 1mm intersecting (combined) on each drill spot in Coreldraw, and my own software to convert that to "Xnnn Ynnn" gcode numbers, and during the process I really apply my own TSP algorithm.  Doing the Atom E3827 processor, 25x27mm chip, 1170 pins, it reduced the total CNC head drilling movement from 1020mm to 830mm, the gain is not very substantial, but more aligned drilling seems more logical and less prone to failures.  One of my work colleagues seeing me writing the code was saying "stop reinventing the wheel, since DXF2CGODE does that", finally I can say, it does not.

 

Well i think it does J, but not for drills in the way you expect them. As this was never the intention of DXF2GCODE ….

 

Below my software final optimized drilling path, 1170 holes, CNC time 147 minutes, drill bit 0.35mm diameter.

image.png

 

Nice ….

I also did try 3 different TSP algorithm and I I think it’s fun to do it. So why not newly inventing the wheel. One of them can still be found here in the python examples. I think I did also code the ACS (Ant Colony System algorithm).:

dxf2gcode / SourceCode / [e6eddf] /python_examples/travelling_salesman_problem_2.py (sourceforge.net)

 

 

 

 

Thank you for your help, tests and participation.

Cheers,

--

--
You received this message because you subscribed to the Google
Groups-group "dxf2gcode-users".
To post a message, send mail to dxf2gco...@googlegroups.com
To unsubscribe, send mail to dxf2gcode-use...@googlegroups.com
See http://groups.google.de/group/dxf2gcode-users?hl=en for more options
and the dxf2gcode project page at http://code.google.com/p/dxf2gcode/
---
You received this message because you are subscribed to the Google Groups "dxf2gcode-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dxf2gcode-use...@googlegroups.com.

image001.png
Reply all
Reply to author
Forward
0 new messages