tcnc icon indicating copy to clipboard operation
tcnc copied to clipboard

command line tcnc usage huge size NGC file generated

Open giantstonex7 opened this issue 7 years ago • 5 comments

hi, thanks for your instructions on the command line tcnc usage, andi tried the following script:

#!/bin/sh This would be the path to where tcnc.py is installed

TCNC_PATH=/home/sam/tcnc-master/tcnc Your python executable (Python 2.7 is currently required)

PYTHON_BIN=/usr/bin/python

PYTHONPATH="$PYTHONPATH:$TCNC_PATH" Some example tcnc settings. More can be passed via the command line...

TCNC_OPTIONS="--gcode-units=mm --path-smooth-fillet=True --a-feed=1000 --xy-feed=2000 --z-feed=400 --z-safe=0 --z-depth=8 --z-step=8 /home/sam/catkin_ws/src/fur_processing/scripts/collar_cutting/1s.svg --output-path=~/NGC_files/tcnc_gcode.ngc" Suppress the path preview SVG output by redirecting stdout to /dev/null

$PYTHON_BIN $TCNC_PATH/tcnc.py $TCNC_OPTIONS $@ >/dev/null

and the program kept running, until i press ctrl+c, it generated 600+mb ngc file.

this is the command line output: ./tcnc_commandline_usage.sh

^CTraceback (most recent call last): File "/home/sam/tcnc-master/tcnc/tcnc.py", line 417, in debug_layer_name='tcnc debug') File "/home/sam/tcnc-master/tcnc/inkscape/inkext.py", line 201, in main self.run() File "/home/sam/tcnc-master/tcnc/tcnc.py", line 235, in run cam.generate_gcode(path_list) File "/home/sam/tcnc-master/tcnc/cam/simplecam.py", line 177, in generate_gcode self.generate_segment_gcode(segment, tool_depth) File "/home/sam/tcnc-master/tcnc/cam/simplecam.py", line 494, in generate_segment_gcode self.feed_distance += segment.length() File "/home/sam/tcnc-master/tcnc/geom/arc.py", line 199, in length return abs(self.radius * self.angle) File "/home/sam/tcnc-master/tcnc/geom/arc.py", line 172, in radius @Property KeyboardInterrupt

giantstonex7 avatar Sep 13 '18 03:09 giantstonex7

Hmmm, it's probably because you specified a depth of 8 which is above the work plane and Z axis safe height, so it was in an endless loop trying to get to that depth. I'm assuming you meant -8. The Z axis safe height should probably also be a reasonable height above the workplane to avoid destroying tools, say 1cm or so. But I don't know your particular set up so YMMV. Tcnc assumes that the Z axis is positive as it moves above the Z axis origin and negative as it descends and cuts into the material. But maybe this isn't how your machine works. Let me know.

The fact that it didn't print an error and quit instead of going into an endless loop is a bug. Thanks for spotting it. I'll check in a fix when I have some time (hopefully soon). In the mean time maybe try using --z-depth=-8.

Also, just a note, tcnc assumes settings are in document units. The --gcode-units is the machine unit (the G code units). So, for example, if your document uses cm then -8 would be -8cm and the G code output would be scaled to 80 (mm). I hope I'm not making this too confusing...

I'm glad to hear that you are using tcnc, since I've been using it just for my own particular process and I'd like for it to be more generally useful!

utlco avatar Sep 13 '18 05:09 utlco

Hi, I've been trying to connect svgpathtools(https://github.com/mathandy/svgpathtools) with tcnc, but i sometimes receive the error: raise Exception('viewBox aspect ratio does not match viewport.') Exception: viewBox aspect ratio does not match viewport.

i use svgpathtools to generate svg file and then use tcnc to convert it to gcode, in this way everything can be done in auto-mode.

please see the attached document, (generated from svgpathtools sample-tutorial)

if I try to set viewbox, viewport etc using svgpathtools, i will receive many more errors when connecting to tcnc. could you take a look at this case?

btw, after setting z_depth = -8mm, tcnc correctly generates the g-code,

giantstonex7 avatar Sep 17 '18 07:09 giantstonex7

decorated_ellipse_svg.txt

can only upload .txt extension files

giantstonex7 avatar Sep 17 '18 07:09 giantstonex7

on the other hand, if tcnc can handle dxf files, i can connect dxfwrite with tcnc, and it will work well.

giantstonex7 avatar Sep 17 '18 07:09 giantstonex7

Your SVG file has the following attribute values for the svg element: viewBox="-220.35 -345.35 840.7 540.7" height="386px" width="600px"

height/width ratio 386/600 = 0.643333333333333 viewBox height/width ratio 540.7/840.7 = 0.643154514095397

The error is due to a mismatch between the viewBox aspect ratio and the aspect ratio specified by the width and height attributes. The difference is within the default tolerance (epsilon) of .0001. If you set the tolerance/epsilon to a larger value (ie --tolerance=.001) it should work. This tolerance value affects all floating point number comparisons in tcnc.

Tcnc can't deal with actual aspect ratio mismatches since that would require scaling one of the axes which distorts the drawing and that's is something the user should do before using a CAM program.

I don't have any current plans to directly support DXF input, but maybe in the future if I have a need for it (or if somebody pays me ;) )

utlco avatar Sep 17 '18 15:09 utlco