Moves to safety height on each pass?
peteruithoven opened this issue · 9 comments
Currently the drill seems to move to the safety height after finishing a pass before it continues with the next pass (on the same operation). Since the Z axis usually moves very slow this costs a lot of time. Why move to the safety height between passes of the same operation?
If the cutter can move to the starting position from the ending position in a straight line without crossing outside the cutting area then it doesn't go up to the safety height. I made this calculation conservative for safety. I limited it to a straight line because path-finding algorithms are pretty expensive.
I'm afraid there is an issue. Maybe something goes wrong when it's exactly the same position?
I can replicate it with the following rectangle.
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="744.09448819"
height="1052.3622047"
id="svg3035"
version="1.1"
inkscape:version="0.48.2 r9819"
sodipodi:docname="square.svg">
<defs
id="defs3037" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="1.1399139"
inkscape:cx="375"
inkscape:cy="520"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="false"
inkscape:window-width="1244"
inkscape:window-height="620"
inkscape:window-x="20"
inkscape:window-y="20"
inkscape:window-maximized="0" />
<metadata
id="metadata3040">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title />
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1">
<rect
style="color:#000000;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
id="rect3043"
width="344.72888"
height="163.32452"
x="200.88481"
y="496.91034" />
</g>
</svg>
Settings I used:
{"svg":{"pxPerInch":"90"},"material":{"units":"mm","thickness":25.4,"zOrigin":"Top","clearance":2.54},"curveToLineConversion":{"minNumSegments":"1","minSegmentLength":2.54},"tool":{"units":"mm","diameter":3.175,"angle":180,"passDepth":"5","stepover":0.4,"rapidRate":2540,"plungeRate":127,"cutRate":1016},"operations":{"operations":[{"rawPaths":[{"path":[["M",200.88481,496.91034],["L",545.61369,496.91034],["L",545.61369,660.23486],["L",200.88481000000002,660.23486],["L",200.88481000000002,496.91034]],"nonzero":true}],"name":"","units":"mm","enabled":true,"combineOp":"Union","camOp":"Engrave","direction":"Conventional","cutDepth":"20","ramp":false}]},"tabs":{"units":"mm","maxCutDepth":0,"tabs":[]},"gcodeConversion":{"units":"mm","gcodeFilename":"gcode.gcode","offsetX":0,"offsetY":0}}
If you point me to the peice of code that does this safety height I'd love to help out.
It's probably the safeToClose
boolean or the tabGeometry.length on the following line:
https://github.com/tbfleming/jscut/blob/gh-pages/js/Cam.js#L411
Please use the gist save option in the future; it makes reproduction a lot easier.
Odd. safeToClose == true and tabGeometry.length == 0. It's not entering that condition, which means something else is retracting.
Found it. It should ignore tabZ at https://github.com/tbfleming/jscut/blob/gh-pages/js/Cam.js#L419 when tabGeometry.length == 0.
Nice! I was just going to mention that it's not the retractGcode part, but the Rapid to initial position part.
Good news! It means someone else can read my code :)
Works! That's gonna save lot's of milling time.