HoldingTags Dressup start position

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!
Post Reply
Jakob Lundberg
Posts: 8
Joined: Sun Apr 09, 2017 6:26 am

HoldingTags Dressup start position

Post by Jakob Lundberg »

When I add a HoldingTags Dressup to a profile the operation starts with a move to origin.

Code: Select all

(begin operation: Right Side with tags)
(machine: LinuxCNC, mm/min)
G0 X0.0000 Y0.0000 Z5.0000
If you have many pieces to profile this will of course add to the job time. Is there a purpose for this move or is it just a bug and the gcode line can be removed by hand?

Code: Select all

OS: Ubuntu 16.04.2 LTS
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.11051 (Git)
Build type: None
Branch: master
Hash: 32176dba86db44775be51c5d8514a229fb27111f
Python version: 2.7.12
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 7.1.0
mlampert
Veteran
Posts: 1772
Joined: Fri Sep 16, 2016 9:28 pm

Re: HoldingTags Dressup start position

Post by mlampert »

Jakob Lundberg wrote:When I add a HoldingTags Dressup to a profile the operation starts with a move to origin.
....
If you have many pieces to profile this will of course add to the job time. Is there a purpose for this move or is it just a bug and the gcode line can be removed by hand?
There's no specific purpose/reason for it - it's really not necessary to the point where I would consider it a bug. If you can file an issue we'll not forget to look into it.
Jakob Lundberg
Posts: 8
Joined: Sun Apr 09, 2017 6:26 am

Re: HoldingTags Dressup start position

Post by Jakob Lundberg »

roivai
Posts: 117
Joined: Thu Feb 02, 2017 5:29 pm
Location: Oulu, Finland

Re: HoldingTags Dressup start position

Post by roivai »

I looked at this a bit. This is what I understood from the DressUpHoldingTags:
-The additional move to 0,0,0 comes because for creating the tags, the Path "G-code" commands are transformed to a wire object representing the Path. (by PathGeom.wireForPath() )
-Because the Path object does know anything about what happens before it, it has to assume some starting position of the first edge and it seems to assume 0,0,0.
-After the tags are done and the wire is transformed back to "G-codes", the initial wire from 0,0,0 to the actual starting position gets included.

An idea I got was to modify the PathGeom.wireForPath() so that it does not generate anything additional. Instead it should create edges only after it is 100% sure about the actual position. For example a path:

Code: Select all

G0 Z5
G0 X10Y10
G1 Z-1 F100
G1 X20Y10
...
With the current implementation, the first edge would be generated from (0,0,0) to (0,0,5) and then from (0,0,5) to (10,10,5). What I did was I changed the wireForPath() so that the first edge would be from (10,10,5) to (10,10,-1) because that is the first edge which can be said for sure where it actually is (G-Code modality sucks in that sense :D ) The function also returns the commands which are ignored from the beginning. Now the holding tags are generated normally. When generating commands from the wire, the initially ignored commands are returned back to the beginning of the path.

I got it to work with my very limited test case. But the solution smells lika a disgusting hack to me. :D Any better ideas?
mlampert
Veteran
Posts: 1772
Joined: Fri Sep 16, 2016 9:28 pm

Re: HoldingTags Dressup start position

Post by mlampert »

roivai wrote: Thu Jun 01, 2017 7:05 pm ... Instead it should create edges only after it is 100% sure about the actual position. ..... I got it to work with my very limited test case. But the solution smells lika a disgusting hack to me. :D Any better ideas?
Would it be possible to compare with the original starting/entry commands? Depending on where in the sequence of operations the holding tags are, you want or don't want those initial moves. If the original path included the setup from 0,0,0 then the holding tags should replicate that, OTOH if the original path didn't have that then the holding tags should not introduce it.
Post Reply