Code Monkey home page Code Monkey logo

gcodeplot's People

Contributors

arpruss avatar jrouquie avatar jsphpl avatar mattstedman avatar quinnjn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gcodeplot's Issues

Adding default config file

Hi again!

Is there any way to put somewhere some default config file instead of using switches?

Regards!

Upload new zip to Inkscape site

Looks like the changes have been made it code, but the zip available on the inkscape site still downloads an older codebase.

"No points" error with simple grid to be cut

I wanted to draw a rectangular grid of cut lines in Inkscape and have it saved as GCode, but I got the error

Drawing out of range: [14.1846332, 30.78257099999999] [162.9988482, 90.782574]
No points.

The grid is straightforward:
grafik

The gcodeplot settings look sensible to me:
grafik

What am I doing wrong?

Here is the zipped SVG file for reference:
Velostatpads.zip

minFeatureThickness < 1 issues in new release

testing the new changes and I re exported a SVG I knew worked and I found an issue that has started happening since the new changes,

my setitngs are minFeatureThickness = 0.86;

It ignores that and makes it much much thicker now!

IMG_20190323_141704

Untitled

SyntaxWarning: "is not" with a literal. Did you mean "!="?

The issue is found in parser.py and gcodeplot.py. using the find & replace tool to replace all occurrences of "is not" with "!=" seems to have resolved the problem, but I have not been able to thoroughly test that this is a good solution and that it does not introduce any more bugs. attached are my modified parser.py and gcodeplot.py files.
gcodeplot_fix.zip

The called script passed additional data to Inkscape...

"The called script passed additional data to Inkscape. No error message was returned from the script, but the result may be unusable."

If I try to save s.th. to gcode I get the above error message. Even if it says that there are no erros, if I click "ok" the next message says that it was not able to save the file.

Traceback (most recent call last):
File "C:\Program Files\Inkscape\share\inkscape\extensions\gcodeplot\gcodeplot.py", line 9, in
import svgpath.parser as parser
File "C:\Program Files\Inkscape\share\inkscape\extensions\gcodeplot\svgpath_init_.py", line 1, in
from .path import Path, Line, Arc, CubicBezier, QuadraticBezier
File "C:\Program Files\Inkscape\share\inkscape\extensions\gcodeplot\svgpath\path.py", line 3, in
from collections import MutableSequence
ImportError: cannot import name 'MutableSequence' from 'collections' (C:\Program Files\Inkscape\lib\python3.10\collections_init_.py)

svg2cookiecutter.py broken after pull request changes

I'm unable to run svg2cookiecutter.py after the latest pull request, I get this error

Traceback (most recent call last):
File "svg2cookiecutter.py", line 223, in
print(svgToCookieCutter(sys.argv[1]))
File "svg2cookiecutter.py", line 171, in svgToCookieCutter
line = Connector('connector'+pathName, points, fill)
File "svg2cookiecutter.py", line 140, in init
super().init(pathName, points, fill, False, None) # no stroke for connectors, thus no use of self.height and self.width
TypeError: super() takes at least 1 argument (0 given)

Setting align causes error

python gcodeplot.py -c sggw.conf heart.svg > heart-test.gcode 
Traceback (most recent call last):
  File "gcodeplot.py", line 1129, in <module>
    plotter=plotter, gcodePause=gcodePause, pens=pens, pauseAtStart=pauseAtStart, simulation=svgSimulation)
  File "gcodeplot.py", line 363, in emitGcode
    scale.align(plotter, xyMin, xyMax, align)
  File "gcodeplot.py", line 144, in align
    o[i] = 0.5 * (self.xyMin[i] - self.scale[i]*xyMin[i] + self.xyMax[i] - self.scale[i]*xyMax[i])
AttributeError: 'Scale' object has no attribute 'xyMin'

when using config:

init-code=;
area=105,35,205,135
no-allow-repeats
gcode-pause=@Pause
scale=down-only
align-x=none
align-y=center
tolerance=1.0
no-send
send-speed=115200
input-dpi=1016,1016
safe-delta-z=5
lift-delta-z=2
work-z=-10
pen-down-speed=35
pen-up-speed=40
z-speed=5
no-hpgl-out
shading-threshold=1
shading-lightest=3
shading-darkest=0.5
shading-angle=45
no-shading-crosshatch
no-stroke-all
optimization-time=0
sort
no-pause-at-start
extract-color=all
tool-offset=0.000
overcut=0.000
no-simulation
direction=none
lift-command=none
down-command=none
comment-delimiters=;

ModuleNotFoundError: No module named 'svgpath'

I am new to Inkscape, and I installed the extension per the instructions, but I get this error, so the file cannot be saved as .scad:
Traceback (most recent call last):
File "svg2cookiecutter.py", line 2, in
import svgpath.parser as parser
ModuleNotFoundError: No module named 'svgpath'

Any ideas?

Pen Width

Nice tool but what parameter is defining the width of the pen?

"Drawing out of range" - floating-point issues

$ python gcodeplot/gcodeplot.py --work-z=0.9 --lift-delta=0.6 --safe-delta-z=3 --z-speed=45 --pens=pens.txt mandala.svg
Optimizing...[0%][5%][10%][15%][20%][25%][30%][35%][40%][45%][50%][55%][60%][65%][70%][75%][80%][85%][90%][95%]
Transport time improvement: 89.1% (took 1.64 seconds).
Drawing out of range: [0.0, 5.291666695939057e-06] [176.38888447916665, 176.38888977083334]
No points.

Files needed to reproduce the issue: gcodeplot-fpbug.zip

I commented out the "Drawing out of range" section to make the print work, and it turned out awesome. I think it would be better to add a tolerance here though (or just allow negative values, since they're not necessarily invalid).

Avoid turning loops?

Hi,

first let me thank you for this convenient way to use my 3D printer as a cutter as well! ๐Ÿ‘๐Ÿป

I have a question on using it, though. Due to the nature of the blade's point running behind the turning axis, there are loops cut at sharp corners. Is there a way to avoid these? Something one could do in Inkscape to have the blade lifted, moved and lowered again at these corners?
grafik

Demoulding plate

The generated demoulding plate can be improved in two ways:
1. Take into consideration the insideWallFlareWidth. Right now, if the insideWallFlareWidth is larger than the minInsideWallThickness the demoulding plate will not go through the hole.
2. With multiple walls, the generated demoulding plate will consist of multiple pieces that will have to be used as a puzzle. This pieces could be connected together to ease the usage of the demoulding plate.

I've already implemented a solution for these problems, but I'm not experienced in GitHub and, of course, have no permission to commit my changes. Also, I've never done a pull request and don't know if that's the right option. So, if it helps, I attach here my modified svg2cookiecutter.py (renamed to .txt so I can attach it), and an example of the generated demoulding plate.

Screenshot 2019-11-07 at 23 00 39

svg2cookiecutter.py.txt

[Bug] KeyError: 'd'

 File "svg2cookiecutter.py", line 232, in svgToCookieCutter
    for superpath in parser.getPathsFromSVGFile(filename)[0]:
  File "C:\Users\Axel\AppData\Roaming\inkscape\extensions\svgpath\parser.py", line 699, in getPathsFromSVGFile
    return getPathsFromSVG(ET.parse(filename).getroot())
  File "C:\Users\Axel\AppData\Roaming\inkscape\extensions\svgpath\parser.py", line 693, in getPathsFromSVG
    getPaths(paths, matrix, svg, path.SVGState(), {})
  File "C:\Users\Axel\AppData\Roaming\inkscape\extensions\svgpath\parser.py", line 587, in getPaths
    getPaths(paths, matrix, child, state, savedElements)
  File "C:\Users\Axel\AppData\Roaming\inkscape\extensions\svgpath\parser.py", line 587, in getPaths
    getPaths(paths, matrix, child, state, savedElements)
  File "C:\Users\Axel\AppData\Roaming\inkscape\extensions\svgpath\parser.py", line 549, in getPaths
    path = parse_path(tree.attrib['d'], matrix=matrix, svgState=state)
KeyError: 'd'

I Attach file to reproduce error
camion.zip

"Drawing out of range" with negative coordinates

My plotter has (0, 0) at the center, so I want to be able to use negative X and Y values. So I set Left and Buttom to negative values. Unfortunately this gives my a "Drawing out of range" showing coordinates that are NOT.
I had a look at the code, but I couldn't find a obvious reason.

Drawing gcode looks okay, but cutting gcode is bad

Inkscape version 1.2.2
GCodePlot version 0.12
Viewing in CAMotics version 1.2.0

Same file, text is set to path in both scenarios, only change is between drawing/cutting in selection before saving. Is it bug, or am I doing something wrong? It is not problem of CAMotics, if I send it to cut on Klipper managed Ender 3 Pro, I get the same result.

Drawing GCode:
image

Cutting GCode:
obrรกzek_2023-01-16_013535228

Cookie Cutter Extension

Hi friend. Thank you, for sharing this work.

Tell me, how to use your Cookie Cutter extension?
Reverse engineering of Python and OpenSCAD is too slow by me.

Best regards, alex.

Update command-line help

The --safe-delta-z option is missing from the command-line help.

I haven't looked but there are probably other options that need to be updated too.

Python can generate command-line help automatically if you use a more full-featured library like argparse.

Lift/Down Commands

Hello. Thank you for a great project. I think the "Lift Command" and "Down Command" under the cutting settings tab for GCode creation is still under development? It seems as though after every small movement, the down command is written in the gcode again. Example below. I have to include a statement such as "M3 S25 G4P0.3" to add a delay after the down command due to using a servo for the up/down movement. Same thing for the lift command "G4P0.3 M5". You can see the output will cause major delays when ran. I am just trying to figure out a way to utilize the tool, but it may be beneficial to be able to add a delay before and after the actual cut path is started. It is hard to find a tool that has the overcut and offset feature such as your tool, so thank you for your work!

G4P0.3 M5
G00 F2400.0 X5.716 Y16.641; move !!Xleft+5.716 Ybottom+16.641
M3 S25 G4P0.3
G01 F2100.0 X5.932 Y16.696; draw !!Xleft+5.932 Ybottom+16.696
M3 S25 G4P0.3
G01 F2100.0 X6.095 Y16.848; draw !!Xleft+6.095 Ybottom+16.848
M3 S25 G4P0.3
G01 F2100.0 X6.165 Y17.060; draw !!Xleft+6.165 Ybottom+17.060
M3 S25 G4P0.3
G01 F2100.0 X9.014 Y17.063; draw !!Xleft+9.014 Ybottom+17.063
M3 S25 G4P0.3
G01 F2100.0 X9.010 Y17.004; draw !!Xleft+9.010 Ybottom+17.004
M3 S25 G4P0.3
G01 F2100.0 X9.535 Y16.930; draw !!Xleft+9.535 Ybottom+16.930
M3 S25 G4P0.3
G01 F2100.0 X9.521 Y16.865; draw !!Xleft+9.521 Ybottom+16.865
M3 S25 G4P0.3

can we get laser control added?

I have played with some other "laser" options for inkscape.
but this plugin is just so simple to use with my 3d printer

would it be possible to add Gcode for laser option?
i suggest adding a tab, and a couple of fields to where we can input the
desidered gcodes for for on/off (i use a fan code for instance)
then simply integrate instead of the pen retract?

Custom start/end gcodes.

Any way to add a field for custom start/end gcodes for those of us converting 3D printers with auto leveling?

Thanks!

Hidden paths

there is any way to not generate gcode for hidden paths? right now is generated for all paths even if is not visible

thanks

SVG viewBox

Sometimes there is space in the end of viewBox property in SVG file.
So I suggest modify line 520 of parser.py to
viewBox = list(map(float, re.split(r'[\s,]+', svg.attrib['viewBox'].rstrip())))

Gcode Curve Support?

I was searching for a gcode exporter for Inkscape so I can print smooth lettering/etc. and came across your project. I don't code well enough to be able to parse your code, but does it support the G02/G03/G06.X commands that generate curves for the hardware to interpret? That would both make the resulting gcode MUCH smaller while making the fabricated part match the original artwork MUCH better.

Here is the video that introduced me to the commands: https://youtu.be/18uYYXecH5g

No Points error when set to cutting mode, works fine in drawing mode.

I've followed your Instructables hoping to set up a vinyl cutter on my 3D printer, but ran into issue when trying to export/saving gcode. I've tried every setting combination and it it seems like this error only shows up when set to cutting mode, drawing mode exports a gcode file just fine.

Please advise.
Thanks

update needed for Inkscape version 1.0

Hello,
Thank you for providing this extension for Inkscape users!

This is just to let you know that most 3rd party Inkscape extensions, like this one, probably will not work with the upcoming new Inkscape version, the long-awaited version 1.0.

Here is the info you need to update this extension, so that it will work with 1.0 and future versions.
https://wiki.inkscape.org/wiki/index.php?title=Updating_your_Extension_for_1.0

If you have further questions, you can contact Inkscape developers via mailing lists, forum, or the chatroom.

If you have already updated it, please disregard this message.

All best,
brynn

Are you still developing this?

Would be nice to specify our own pre and post commands for gcode. To make this more generic, I think perhaps the code out of the box should just zero out XYZ axis so all the user has to do is move the pen to the bed and hit print. Could you provide some input on what files would need to be changes to allow me to add pre and post gcode command instead of the ones currently in use?

Error when using greek characters

When I use Greek characters i get the following error when I try to generate the gcode, if I remove the Greek characters it saves normally.

Traceback (most recent call last): File "C:\Users\LT\AppData\Roaming\inkscape\extensions\mobi.omegacentauri.cookiecutter\gcodeplot.py", line 1073, in <module> data = f.read() File "C:\Program Files\Inkscape\lib\python3.9\encodings\cp1252.py", line 23, in decode return codecs.charmap_decode(input,self.errors,decoding_table)[0] UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 1640: character maps to <undefined>

ProcessOffset problem

Hi, i am trying to convert your python code to javascript, and result in weird path data.

I enlarge the sample path and offset is 4
paths = [[[0,0],[20,0],[20,20],[0,20],[0,0]]]

image

I try copy the python data result also the result is like that.

Here's my code
Gist code

I am planning to make a GCODE CNC generator from SVG, with tool offseting.

Thx

Multiple pens in Inkscape

Hello Alexander,

First of all, thanks for sharing your wonderful tool. I've been playing with it for a long time now, converted it to work on my DIY pen plotter with custom gcode injection for header and footer and more.

Now, there's only one thing that I haven't been able to get to work, and that's pen changes. How do I set up my inkscape file for that? I have a custom gcode snippet I want to insert in the gcode output file whenever a pen change is needed, the most important thing is getting the script to actually recognize when a new pen needs to be selected.

Does it simply work by using multiple colors? (this didn't work for me, maybe I need to work in RGB instead of CMYK or is it some other issue?)
Does it work by naming layers? And what names should the layers have?

I hope you have a solution for me, my project is 95% done and the only thing missing is this pen change script.

See my prototype plotter here:
https://www.youtube.com/watch?v=uIy4tRCPbHU

Thanks for your time,
Marinus

[question] 3D printers compatibility

Hi! May I ask you for which printer does this program export the GCODE? I have an Ender3 which runs on Marlin firmware, will the GCODE be compatible? Thank you ๐Ÿ˜„

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.