gramp wrote:
Your latest offering works famously. I even wrote (as in "copied liberally from websites") enough Perl to get a working G-code program! Still have to do all the stuff about orientation and scaling and registration, but "it's all in there."
Actually, I have a couple of critical errors in that version that could make the results off by as much as a pixel radius (e.g., it can take the sample from a different pixel than the path crosses). I will get a fix out (hopefully before Sunday) but
until then I would recommend not using the data in production.
gramp wrote:
I thought I could get away with creating a new path from a copy of the over-sized one cropped to the layer, and then merely increasing the canvas size by 2 pixels (and centering) in order to get a 1-pixel zone around the outside. However as you said, I did have to "Layer-to-Image-Size" the layer-of-interest to the new canvas size to avoid the error.
I will make it so that all path segments outside of the layer boundaries are ignored. Actually, I've already done this but because of the aforementioned errors in my script, this doesn't behave well.
gramp wrote:
Q. I need to be able to distinguish the paths because of the necessity of raising the cutter during traverses from the end of one to the beginning of another. (Failure to do so, in CNC parlance, leads to "crashing" the cutter into the workpiece.) One way would be to add a pathID comment ahead of each path? (implemented as a toggle for people who don't desire it?) Another way might be to have your script toggle between processing all or only visible paths? (The script appends a "-1" to the filename I provided, but with two paths, I still only got one the one output file.)
A single path can have different segments that are not connected. These segments are called "strokes". When creating a path, you can start a new stroke by holding down the SHIFT key when you click on a location, in which case the new point will not be connected to the previous one. I am not sure whether this feature will be useful; your idea of hiding paths might be more applicable (you also have the option to chainlink paths).
gramp wrote:
Unexpected piece: I duplicated the single path in my example, and renamed it, expecting I'd get an output file of twice the size, but it came out identical--as confirmed by diff. I suspect your script recognized the duplicity, and that if I shifted the path, it would in fact result in a doubling of the size.
The script currently only processes the active path and ignores all others. If you duplicated the path than the duplicate becomes active and the original inactive. This can be changed to process all paths, or all visible, once I have a better idea of the work flow.