[engraving] - Twice Gcode in the file

Here's the place for discussion related to CAM/CNC and the development of the Path module.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Russ4262
Posts: 941
Joined: Sat Jun 30, 2018 3:22 pm
Location: Oklahoma
Contact:

Re: [engraving] - Twice Gcode in the file

Post by Russ4262 »

Evening Gents,
I looked into the code. I found the issue for double path generation. I am waiting to consult with
sliptonic wrote:@Sliptonic
about which solution to employ. We'll get it rightly divided ... (by 2! -- LOL). Anyhow, the problem code has been found.
nemesis wrote:@Nemesis
Regardless, the sentence still has 25,000 lines of gcode, and just the "Inspect gcode" tool takes 5+ minutes to load completely. I have not attempted post-processing yet.
chrisb wrote:Can this be the source of the doubled gcodes?
I don't think so. There is a second IF statement in the opExecute() PathEngrave method that is re-processing model objects processed just a few lines above in another set of IF, ELIF statements. I have already run tests with a couple different solutions in the code. I just need to collaborate with someone who knows more about the possible test cases being considered with the second IF statement causing the duplication.

If I simply comment out the second IF statement, the duplication disappears; however, it looks like it is a fall-back of sorts if test cases in the first IF-ELIF set don't find anything. I need more information before employing one of the possible solutions I have tested.

Thanks,
Russell

OS: Windows 10 (10.0)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.16616 (Git)
Build type: Release
Branch: master
Hash: f94cdfd798d0c493efe9c7d45084ad2c5dd18caf
Python version: 3.6.8
Qt version: 5.12.1
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/United States (en_US)
User avatar
nemesis
Posts: 372
Joined: Tue Mar 25, 2014 11:24 pm
Location: France, Lyon

Re: [engraving] - Twice Gcode in the file

Post by nemesis »

Russ4262 wrote: Sat May 04, 2019 12:50 am Regardless, the sentence still has 25,000 lines of gcode, and just the "Inspect gcode" tool takes 5+ minutes to load completely. I have not attempted post-processing yet.

OS: Windows 10 (10.0)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.16616 (Git)
Build type: Release
Branch: master
Hash: f94cdfd798d0c493efe9c7d45084ad2c5dd18caf
Python version: 3.6.8
Qt version: 5.12.1
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/United States (en_US)

with the release bellow I don't have any double code, so it sounds the problem is already fixed no?
OS: Debian GNU/Linux buster/sid (KDE//usr/share/xsessions/plasma)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.16540 (Git) AppImage
Build type: Release
Branch: master
Hash: 554985dede771f9a6694baba2372cc60db86f17b
Python version: 3.7.1
Qt version: 5.6.2
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: French/France (fr_FR)
For the post processing time, it is about 5 to 10 minute with this version. but does not work with the debian package version.
I'll try with the appimage 0.18.1 (don't know if the debian version is 0.18 or 0.18.1)
kkremitzki wrote: ping
[EDIT]
so I tried with
OS: Debian GNU/Linux buster/sid
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.18.16110 (Git) AppImage
Build type: Release
Branch: (HEAD detached at 0.18.1)
Hash: f7dccfaa909e5b9da26bf50c4a22ccca9bb10c40
Python version: 3.6.7
Qt version: 5.6.2
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: French/France (fr_FR)
and it works without issue.(5min+ export)

tried again with my debian version and it run endlessly.
python version issue?
Russ4262
Posts: 941
Joined: Sat Jun 30, 2018 3:22 pm
Location: Oklahoma
Contact:

Re: [engraving] - Twice Gcode in the file

Post by Russ4262 »

Afternoon,
Today, [user_id=708]@Sliptonic[/quote] and I dove deeper into the PathEngrave.py scirpt.
nemesis wrote:ping
We found a part of the problem is that this particular use case was being processed twice.
chrisb wrote: Sun Apr 28, 2019 12:14 pmCan this be the source of the doubled gcodes?
And after redacting my previous "I don't think so, Chrisb" and apologize for my dismissal of your knowledgeable suggestion for a previous response, I will change that to a

"Yes, Chrisb, that is also a part of the problem."

Looking at the shapestring while zoomed in, one can visibly see multiple edge lines in the more acute curves. Images attached.

So, @Sliptonic and I are working on a solution for the duplicate processing; He is understands the larger coding picture much better than I. Likewise, @Chrisb's suggestion of selecting a font with only a single edge would also be beneficial. Perhaps that is what is occurring on some of the Linux machines that are processing the job much faster.

Russell
Attachments
High zoom
High zoom
TestEngrave_DblEdge-2.png (180.64 KiB) Viewed 1672 times
Mild zoom
Mild zoom
TestEngrave_DblEdge-1.png (176.73 KiB) Viewed 1672 times
User avatar
sliptonic
Veteran
Posts: 3457
Joined: Tue Oct 25, 2011 10:46 pm
Location: Columbia, Missouri
Contact:

Re: [engraving] - Twice Gcode in the file

Post by sliptonic »

Russ and I have been digging on this and I'm learning all kinds of interesting things today about those CamBam stick fonts.

Take a look here:http://www.mrrace.com/CamBam_Fonts/

Note the text

"Your cutter will go over each letter twice, once in each direction, and exactly on the same path no matter what size you engrave, even if they are 12 inches high!"
chrisb
Veteran
Posts: 53919
Joined: Tue Mar 17, 2015 9:14 am

Re: [engraving] - Twice Gcode in the file

Post by chrisb »

Russ4262 wrote: Sat May 04, 2019 8:50 pm
chrisb wrote: Sun Apr 28, 2019 12:14 pmCan this be the source of the doubled gcodes?
And after redacting my previous "I don't think so, Chrisb" and apologize for my dismissal of your knowledgeable suggestion for a previous response, I will change that to a

"Yes, Chrisb, that is also a part of the problem."
There is nothing to apologize, "I don't think so" does not sound like an insult to me :) . And I'm sure, that you were right, because you didn't thought so at that time :) .
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
User avatar
nemesis
Posts: 372
Joined: Tue Mar 25, 2014 11:24 pm
Location: France, Lyon

Re: [engraving] - Twice Gcode in the file

Post by nemesis »

sliptonic wrote: Sat May 04, 2019 10:03 pm Russ and I have been digging on this and I'm learning all kinds of interesting things today about those CamBam stick fonts.

Take a look here:http://www.mrrace.com/CamBam_Fonts/

Note the text

"Your cutter will go over each letter twice, once in each direction, and exactly on the same path no matter what size you engrave, even if they are 12 inches high!"
hi,
I was aware of the double travel in each direction, the issue is not here.
as stated in my first post there is a go/return on each letter and it is normal according the font. but this block of code is repeated again after the tjeoretical end of the gcode.
so it make the machine come back to 0,0,0 and start again the milling.
again it only appears on 0.18 debian package for me
it is ok with the 0.19 appimage
Russ4262
Posts: 941
Joined: Sat Jun 30, 2018 3:22 pm
Location: Oklahoma
Contact:

Re: [engraving] - Twice Gcode in the file

Post by Russ4262 »

Evening, Nemisis.
Good news. Recently @Sliptonic made a PR #2141 to address the duplicate path information.
nemesis wrote: Mon May 06, 2019 5:29 pm so it make the machine come back to 0,0,0 and start again the milling.
again it only appears on 0.18 debian package for me
it is ok with the 0.19 appimage
I verified the same duplication in the Windows x64 release of 0.19. It should be fixed for all OS's in current releases built after PR #2141 above.

Thanks for the feedback.
Russell
User avatar
nemesis
Posts: 372
Joined: Tue Mar 25, 2014 11:24 pm
Location: France, Lyon

Re: [engraving] - Twice Gcode in the file

Post by nemesis »

Russ4262 wrote: Tue May 07, 2019 1:01 am I verified the same duplication in the Windows x64 release of 0.19. It should be fixed for all OS's in current releases built after PR #2141 above.

Thanks for the feedback.
Russell
thanks a lot!
it works great and I finally get the engraving correct :D

EDIT :
And for the recods here is the result, and also my first 3D Milling thanks to freecad !!!
Awsome! I'm like a kid in front of box of lego !

20190519_114637.jpg
20190519_114637.jpg (176.29 KiB) Viewed 1495 times
clearly I need to adjust the speeds for the 3D milling, but it is quite a nice first shot! (need to make the finishing passes now)
20190519_114628.jpg
20190519_114628.jpg (166.72 KiB) Viewed 1495 times
Russ4262 wrote:
thanks again, again and again!
ScottP
Posts: 1
Joined: Thu Mar 04, 2021 11:45 am

Re: [engraving] - Twice Gcode in the file

Post by ScottP »

Hi,

FreeCAD Newbie here.

I too have seen repeated gcode generated by 0.19 Rev 24267 on Windows 10.

I have a small engraving maching run grbl.
I have created a small engraving job using a TrueType font.
There are four shapestrings.
I select all the edges of the text and add to the job list. (There are no duplicates here).
The repeated code appears when I click on the Gcode Inpector (P, I) button.
I don't think it's being generated by the grbl_post.py script but I'm not sure what generates the initial gcode before it is post processed.

The code as generated is perfectly usable other than the machine taking four times longer to complete the job.
I can remove the extraneaous gcode manually, but it is somewhat time consuming.

Cheers,
Scott
User avatar
onekk
Veteran
Posts: 6144
Joined: Sat Jan 17, 2015 7:48 am
Contact:

Re: [engraving] - Twice Gcode in the file

Post by onekk »

Some ttf font are not well suited for engraving, maybe it helps to use "single stroke fonts".

Not yet done in FreeCAD but in another CAM this problem is present and some special font are used, they are Free to use, search for "CamBam Stick fonts" and see if this helps.

Regards

Carlo D.
GitHub page: https://github.com/onekk/freecad-doc.
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.

Blog: https://okkmkblog.wordpress.com/
Post Reply