Inkscape Community

Help Using Inkscape => Using Inkscape with Other Apps => Topic started by: BretHankes on September 11, 2018, 05:30:31 PM

Title: Using Inkscape with MakerCam for G code CNC text engraving.
Post by: BretHankes on September 11, 2018, 05:30:31 PM
I have been trying to to use Inkscape to create the SVG file to use with MakerCam to generate G code for simple text engraving using Mach 3 on my CNC mill.
With images this works fine, but with every way that I have tried to do the text it generates an image that goes around each letter rather than simply going
down the center.
This would not work well for engraving the small text that I want to do and the run time would be at least twice what it needs to be.
Title: Re: Using Inkscape with MakerCam for G code CNC text engraving.
Post by: Moini on September 12, 2018, 09:21:53 AM
That's how normal text works, it has an outline all around the letter shape. What you seem to want is Hershey text. There's an extension for that:
Extensions > Render > Hershey text

And then there's also https://github.com/fablabnbg/inkscape-text2hershey which turns existing text blocks to Hershey text (didn't test).
Title: Re: Using Inkscape with MakerCam for G code CNC text engraving.
Post by: BretHankes on September 13, 2018, 12:47:23 AM
That's how normal text works, it has an outline all around the letter shape. What you seem to want is Hershey text. There's an extension for that:
Extensions > Render > Hershey text

And then there's also https://github.com/fablabnbg/inkscape-text2hershey which turns existing text blocks to Hershey text (didn't test).

That sounds like exactly what I am looking for and I am trying to do that, but I keep getting this error;
 "File "text2hershey.py", line 26
    inkex.errormsg("ERROR: hersheydata.py not found. Is the "Hershey-Text" extension missing?")
                                                                   ^
SyntaxError: invalid syntax"
Title: Re: Using Inkscape with MakerCam for G code CNC text engraving.
Post by: brynn on September 13, 2018, 02:29:06 AM
It looks like you might be trying to use the external extension, the one that's not already in the Extensions menu.  Is that correct?  If so, did you install that extension?  (I'm not sure because occassionally, 2 different extensions can have files of the same name.)

In case there aren't any installation instructions at the link Moini provided, here are instructions (if you need them):  https://inkscape.org/en/learn/faq/#how-install-new-extensions-palettes-document-templates-symbol-sets-icon-sets-etc

If it wasn't properly installed, that could be one reason why Inkscape can't find that file.  So it's probably a good idea to double-check that it's installed correctly.

If you were trying to use the one which is packed with Inkscape (already in the menu), did you get a Traceback error?  If so, please share the entire error message.
Title: Re: Using Inkscape with MakerCam for G code CNC text engraving.
Post by: BretHankes on September 13, 2018, 04:59:04 PM
It looks like you might be trying to use the external extension, the one that's not already in the Extensions menu.  Is that correct?  If so, did you install that extension?  (I'm not sure because occassionally, 2 different extensions can have files of the same name.)

In case there aren't any installation instructions at the link Moini provided, here are instructions (if you need them):  https://inkscape.org/en/learn/faq/#how-install-new-extensions-palettes-document-templates-symbol-sets-icon-sets-etc

If it wasn't properly installed, that could be one reason why Inkscape can't find that file.  So it's probably a good idea to double-check that it's installed correctly.

If you were trying to use the one which is packed with Inkscape (already in the menu), did you get a Traceback error?  If so, please share the entire error message.
Those are pretty much the same as the instructions that I used, but I keep getting the error that is listed in the post above.

I have tried using just the render function for the few Hershey texts that are included and I have ran into an issue even with that!
It will only let me render one line of text at a time and when I merge them it ends up being goofy when I load it into Maker Cam.
The first line of text looks as it should, but the second line is spaced out at a 45 degree angle?

Thanks for your help!
Title: Re: Using Inkscape with MakerCam for G code CNC text engraving.
Post by: Moini on September 14, 2018, 05:57:07 AM
Please let us know your Inkscape version and check in the Inkscape extensions directories (the one in your user share/extensions directory and the one in your Inkscape installation share/extensions directory) if there are the following files:

hershey.py , hershey.inx and hersheydata.py
Title: Re: Using Inkscape with MakerCam for G code CNC text engraving.
Post by: BretHankes on September 14, 2018, 06:19:52 PM
Please let us know your Inkscape version and check in the Inkscape extensions directories (the one in your user share/extensions directory and the one in your Inkscape installation share/extensions directory) if there are the following files:

hershey.py , hershey.inx and hersheydata.py
I am running Inkscape version 0.92 and yes, all of those extensions are there.
The error that comes up is with the Convert Text to Hershey extension, not with the Hershey text render function.

I am having two separate issues.
The render Hershey text function will only properly render one line of text in Makercam and the text to Hershey comes up with an error.

When I sent two merged lines of text to Makercam it looks something like this;

  Two line text
            S
                e
                    c
                        o
                            n
                                d
Title: Re: Using Inkscape with MakerCam for G code CNC text engraving.
Post by: Moini on September 15, 2018, 02:48:52 AM
Still, your Inkscape doesn't appear to be able to find all the required files. Where exactly have you put them for the text2hershey extension?

What is the complete version name for your Inkscape version and your operating system?

Render Hershey text can only do a single line, as far as I know. I would need to see the file and have more info about how you created it and how it is being used to see what's going wrong.
Title: Re: Using Inkscape with MakerCam for G code CNC text engraving.
Post by: BretHankes on September 15, 2018, 09:22:49 PM
Still, your Inkscape doesn't appear to be able to find all the required files. Where exactly have you put them for the text2hershey extension?

What is the complete version name for your Inkscape version and your operating system?

Render Hershey text can only do a single line, as far as I know. I would need to see the file and have more info about how you created it and how it is being used to see what's going wrong.

The two text2hershey extensions are in this directory;
C:\Program Files (x86)\Inkscape\share\extensions

Inkscape 0.92.3 (2405546, 2018-03-11) running on a 64 bit windows 7 pro operating system.

The two rendered lines were rended seperately and then merged in Inkscape using the group function under Object.
Title: Re: Using Inkscape with MakerCam for G code CNC text engraving.
Post by: Moini on September 16, 2018, 01:43:50 PM
Please move the two text2hershey files
(https://raw.githubusercontent.com/fablabnbg/inkscape-text2hershey/master/text2hershey.py and
https://raw.githubusercontent.com/fablabnbg/inkscape-text2hershey/master/text2hershey.inx)

into the directory that is listed at

Edit > Preferences > System: User extensions

Make sure that there is no copy of them remaining in C:\Program Files (x86)\Inkscape\share\extensions .

Also, make sure that the files
hershey.py , hershey.inx and hersheydata.py
are in
C:\Program Files (x86)\Inkscape\share\extensions

Then try again (select a text, apply extension).

Title: Re: Using Inkscape with MakerCam for G code CNC text engraving.
Post by: BretHankes on September 17, 2018, 02:48:39 PM
Please move the two text2hershey files
(https://raw.githubusercontent.com/fablabnbg/inkscape-text2hershey/master/text2hershey.py and
https://raw.githubusercontent.com/fablabnbg/inkscape-text2hershey/master/text2hershey.inx)

into the directory that is listed at

Edit > Preferences > System: User extensions

Make sure that there is no copy of them remaining in C:\Program Files (x86)\Inkscape\share\extensions .

Also, make sure that the files
hershey.py , hershey.inx and hersheydata.py
are in
C:\Program Files (x86)\Inkscape\share\extensions

Then try again (select a text, apply extension).

I did all of that and I still get this error;
 File "text2hershey.py", line 33
    inkex.errormsg("ERROR: hersheydata.py not found. Is the "Hershey-Text" extension missing?")
                                                                   ^
SyntaxError: invalid syntax

Also, the Convert to Hershey is now listed twice under the text extension.
Title: Re: Using Inkscape with MakerCam for G code CNC text engraving.
Post by: Moini on September 17, 2018, 05:12:33 PM
Sorry, I haven't read well... Try this:

Open text2hershey.py with a text editor.
Replace the line

inkex.errormsg("ERROR: hersheydata.py not found. Is the "Hershey-Text" extension missing?")

with the line

inkex.errormsg("ERROR: hersheydata.py not found. Is the 'Hershey-Text' extension missing?")

Let me know if that helps.
Title: Re: Using Inkscape with MakerCam for G code CNC text engraving.
Post by: brynn on September 17, 2018, 05:30:51 PM
Replace the line

inkex.errormsg("ERROR: hersheydata.py not found. Is the "Hershey-Text" extension missing?")

with the line

inkex.errormsg("ERROR: hersheydata.py not found. Is the 'Hershey-Text' extension missing?")


Could there be a typo?
Title: Re: Using Inkscape with MakerCam for G code CNC text engraving.
Post by: BretHankes on September 18, 2018, 12:19:16 PM
Sorry, I haven't read well... Try this:

Open text2hershey.py with a text editor.
Replace the line

inkex.errormsg("ERROR: hersheydata.py not found. Is the "Hershey-Text" extension missing?")

with the line

inkex.errormsg("ERROR: hersheydata.py not found. Is the 'Hershey-Text' extension missing?")

Let me know if that helps.

Strange, even after I changed that line of text it still comes up with the same error and it is still in quote marks rather than apostrophes!
Is this same line listed in multiple locations?
Title: Re: Using Inkscape with MakerCam for G code CNC text engraving.
Post by: Moini on September 19, 2018, 06:26:16 AM
Probably. I've listed the locations a couple of times now, you should be able to find them on your computer.
Title: Re: Using Inkscape with MakerCam for G code CNC text engraving.
Post by: brynn on September 19, 2018, 07:50:19 AM
Could there be a typo?

Ooohh, I see it now!   :b1:
Title: Re: Using Inkscape with MakerCam for G code CNC text engraving.
Post by: BretHankes on September 19, 2018, 12:33:39 PM
Probably. I've listed the locations a couple of times now, you should be able to find them on your computer.

Well, I changed the files in both locations and now I get this error;

  File "text2hershey.py", line 34
    sys.exit(1)
    ^
IndentationError: unexpected indent

Is this just another typo error?
Title: Re: Using Inkscape with MakerCam for G code CNC text engraving.
Post by: Moini on September 20, 2018, 03:52:36 AM
1.) You should delete one of the versions of text2hershey - i.e. the one in C:\Program Files (x86)\Inkscape\share\extensions. Keep the one in the directory listed in the Inkscape preferences as 'User extensions'.

2.) It looks like your editing of the file changed the indentation. Make sure that it looks exactly as it does here:
https://github.com/fablabnbg/inkscape-text2hershey/blob/8c052d8142374d8fdb3ed370b0bb91344e053c3f/text2hershey.py#L34

3.) I've proposed a fix for the quotes to the extension author on github.
Title: Re: Using Inkscape with MakerCam for G code CNC text engraving.
Post by: BretHankes on September 21, 2018, 06:11:26 PM
1.) You should delete one of the versions of text2hershey - i.e. the one in C:\Program Files (x86)\Inkscape\share\extensions. Keep the one in the directory listed in the Inkscape preferences as 'User extensions'.

2.) It looks like your editing of the file changed the indentation. Make sure that it looks exactly as it does here:
https://github.com/fablabnbg/inkscape-text2hershey/blob/8c052d8142374d8fdb3ed370b0bb91344e053c3f/text2hershey.py#L34

3.) I've proposed a fix for the quotes to the extension author on github.

From one error on to the next!

  File "text2hershey.py", line 82
    ps = subprocess.Popen(r' '.join(batchcmd)), shell=True, stdout=subprocess.PIPE)
                                                                                  ^
SyntaxError: invalid syntax

Title: Re: Using Inkscape with MakerCam for G code CNC text engraving.
Post by: Moini on September 22, 2018, 02:02:00 PM
Remove the duplicate parenthesis after batchcmd.
Title: Re: Using Inkscape with MakerCam for G code CNC text engraving.
Post by: Moini on September 22, 2018, 02:11:40 PM
(made a pull request for the original repository)
Title: Re: Using Inkscape with MakerCam for G code CNC text engraving.
Post by: BretHankes on September 22, 2018, 05:12:07 PM
Remove the duplicate parenthesis after batchcmd.

Does anyone have actual working copies of these files?
I am talking about actual downloadable files, not ones where you have to copy, paste and save in the proper format.
Title: Re: Using Inkscape with MakerCam for G code CNC text engraving.
Post by: Moini on September 23, 2018, 11:03:52 AM
I'm currently fixing it with your help, and updating my pull request as we go.
https://github.com/fablabnbg/inkscape-text2hershey/pull/2

When we have fixed things, there will be a fixed version available.
Title: Re: Using Inkscape with MakerCam for G code CNC text engraving.
Post by: BretHankes on September 25, 2018, 04:34:52 PM
I'm currently fixing it with your help, and updating my pull request as we go.
https://github.com/fablabnbg/inkscape-text2hershey/pull/2

When we have fixed things, there will be a fixed version available.

It no longer comes up with any errors when I use the Convert to Hershey 0.1 function, but the text still looks the same in Inkscape.
I don't know if it is my poor internet connection right now, but www.makercam.com won't load, so I can't test to see if it actually is converting to Hershey text.
I will see if i can find a version of MakerCam that can be downloaded and used off line.
Title: Re: Using Inkscape with MakerCam for G code CNC text engraving.
Post by: Moini on September 26, 2018, 02:21:04 PM
It should be looking different in Inkscape already... Can you make a screenshot and share your file?