Re: How to 'crop' a g-code
Quote:
Originally Posted by
paulus.v
Generating a separate toolpath for each shape is time consuming
It shouldn't be, that is a really quick job in any competent CAM system, just use a tool path which supports a boundary or border to limit the cut area then add a boundary of the shape you need and POST the code for each shape,
- Nick
Re: How to 'crop' a g-code
if you remember, here is why it is so time consuming... Now I have to generate separate toolpath for each triangle separately. I already have the toolpath for a surface big enough to include every shape I need, but now I need to eliminate the unnecessary movement.
Re: How to 'crop' a g-code
Yes, I guessed that it was related but generating the toolpath for a full surface then chopping up that toolpath simply isn't done, you chop up the surface then generate toolpaths for the parts or you cut the full surface then chop out the parts.
If your CAD/CAM isn't capable of the above you might need to cut two or more copies of your full surface to be able to machine out your parts
I don't think you realise just how complex a mathematical problem what you're asking for constitutes, it would need to
1 Recognise which paths needed to be truncated and where
and
2 Calculate which truncated paths then need linking
and
3 Would need access to the surface data in order to know how to link them without gouging your part
and
4 Generate the paths to link paths
and
5 Insert the links into the modified truncated code
The reason no one writes software to edit complex 3D toolpaths generated in another package within a boundary like this is because if they can do that they can write a CAM package that does the job properly in the first case and sell that to a mass market.
Simply buy a CAM package that can do what you need, or provide enough information about what you're trying to achieve so the guys can analyse the full problem, not just the problem as you see it after reaching your own dead end.
Re: How to 'crop' a g-code
Quote:
Originally Posted by
magicniner
I don't think you realise just how complex a mathematical problem what you're asking for constitutes, it would need to
I do not see where it is the complexity. My g-code is a list of points defined by XYZ. I need to look at the the XY coord. of every line and compare with my shape. If the point is inside the shape keep the line, if it is outside delete it. That simple.
To get an idea of what I'm doing, I have the shapes already cutout and I'm applying a surface texture on them. I need to eliminate the extra movement, cutting out air, around the shape.
Re: How to 'crop' a g-code
Quote:
Originally Posted by
paulus.v
I do not see where it is the complexity. My g-code is a list of points defined by XYZ. I need to look at the the XY coord. of every line and compare with my shape. If the point is inside the shape keep the line, if it is outside delete it. That simple.
To get an idea of what I'm doing, I have the shapes already cutout and I'm applying a surface texture on them. I need to eliminate the extra movement, cutting out air, around the shape.
Which leaves you with a set of moves which don't join up and aren't linked ;-)
Re: How to 'crop' a g-code
Quote:
Originally Posted by
magicniner
Which leaves you with a set of moves which don't join up and aren't linked ;-)
Doesn't matter. The moves are the dotted lines in my sketch. There will be a G1 move from the last point of one texture line to the first point of the next line. It will cut through air anyway.
Re: How to 'crop' a g-code
Quote:
Originally Posted by
paulus.v
Doesn't matter. The moves are the dotted lines in my sketch. There will be a G1 move from the last point of one texture line to the first point of the next line. It will cut through air anyway.
Sorry, I didn't realise it was so simple, I await your elegant software solution with bated breath, meanwhile the rest of the world does this in CAD/CAM :wink:
Re: How to 'crop' a g-code
In geometry, the term for what you want to do is 'clipping'
Try a search for 'polygon clipping'
It seems like a simple task but is made difficult by lots of tricky edge cases.
If you can code in c++ or c# or Delphi i can recommend Angus Johnsons excellent freeware 'Clipper' http://www.angusj.com/delphi/clipper.php
Cheers
Re: How to 'crop' a g-code
Quote:
Originally Posted by
Greeny
That looks like a really useful bit of software written by someone with an understanding of the problems involved in truncating lines with a shape, but surely the problem with G Code is "Simple" ? :D
- Nick
Re: How to 'crop' a g-code
A late response on this problem...
Quote:
Originally Posted by
Greeny
In geometry, the term for what you want to do is 'clipping'
Try a search for 'polygon clipping'
It seems like a simple task but is made difficult by lots of tricky edge cases.
If you can code in c++ or c# or Delphi i can recommend Angus Johnsons excellent freeware 'Clipper'
http://www.angusj.com/delphi/clipper.php
Cheers
First of all thanks a lot Greeny for pointing me in the right direction!
For a programmer it was a 5 minutes job. The solution was simpler than the clipper library (certainly included in the library as well), it is called ray casting algorithm.
Here are code examples.
Quote:
Originally Posted by
magicniner
I don't think you realise just how complex a mathematical problem what you're asking for constitutes
Nick, I'm sorry to tell you that this complex mathematical problem is done by a computer in less than a second, by comparing 50k points against a 12 points defined polygon.
Re: How to 'crop' a g-code
Quote:
Originally Posted by
paulus.v
Nick, I'm sorry to tell you that this complex mathematical problem is done by a computer in less than a second, by comparing 50k points against a 12 points defined polygon.
Paulus,
I'm sorry to have to tell you that how quickly a computer runs a chink of code has no relationship to the complexity of the maths used by the programmer to address the problem or how smart the programmer had to be to write the code :D
Or could any dummy have done the job? ;-)