Author Topic: Using Inkscape with MakerCam for G code CNC text engraving.  (Read 4353 times)

September 11, 2018, 05:30:31 PM
Read 4353 times

BretHankes

  • Jr. Member

  • Offline
  • ***

  • 11
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.
  • 0.92.3
  • Win 7 Pro

September 12, 2018, 09:21:53 AM
Reply #1

Moini

  • IC Mentor

  • Offline
  • ******

  • 1,567
    • VektorRascheln
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).

September 13, 2018, 12:47:23 AM
Reply #2

BretHankes

  • Jr. Member

  • Offline
  • ***

  • 11
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"
  • 0.92.3
  • Win 7 Pro

September 13, 2018, 02:29:06 AM
Reply #3

brynn

  • Administrator

  • Offline
  • ******

  • 3,939
  • Gender
    Female

    Female
    • Inkscape Community
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.
  • Inkscape version 0.92.3
  • Windows 7 Pro, 64-bit
Inkscape Tutorials (and manuals)                      Inkscape Community Gallery                        Inkscape for Cutting Design                     



"Be ashamed to die until you have won some victory for humanity" - Horace Mann                       

September 13, 2018, 04:59:04 PM
Reply #4

BretHankes

  • Jr. Member

  • Offline
  • ***

  • 11
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!
  • 0.92.3
  • Win 7 Pro

September 14, 2018, 05:57:07 AM
Reply #5

Moini

  • IC Mentor

  • Offline
  • ******

  • 1,567
    • VektorRascheln
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

September 14, 2018, 06:19:52 PM
Reply #6

BretHankes

  • Jr. Member

  • Offline
  • ***

  • 11
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
  • 0.92.3
  • Win 7 Pro

September 15, 2018, 02:48:52 AM
Reply #7

Moini

  • IC Mentor

  • Offline
  • ******

  • 1,567
    • VektorRascheln
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.

September 15, 2018, 09:22:49 PM
Reply #8

BretHankes

  • Jr. Member

  • Offline
  • ***

  • 11
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.
  • 0.92.3
  • Win 7 Pro

September 16, 2018, 01:43:50 PM
Reply #9

Moini

  • IC Mentor

  • Offline
  • ******

  • 1,567
    • VektorRascheln
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).


September 17, 2018, 02:48:39 PM
Reply #10

BretHankes

  • Jr. Member

  • Offline
  • ***

  • 11
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.
  • 0.92.3
  • Win 7 Pro

September 17, 2018, 05:12:33 PM
Reply #11

Moini

  • IC Mentor

  • Offline
  • ******

  • 1,567
    • VektorRascheln
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.

September 17, 2018, 05:30:51 PM
Reply #12

brynn

  • Administrator

  • Offline
  • ******

  • 3,939
  • Gender
    Female

    Female
    • Inkscape Community
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?
  • Inkscape version 0.92.3
  • Windows 7 Pro, 64-bit
Inkscape Tutorials (and manuals)                      Inkscape Community Gallery                        Inkscape for Cutting Design                     



"Be ashamed to die until you have won some victory for humanity" - Horace Mann                       

September 18, 2018, 12:19:16 PM
Reply #13

BretHankes

  • Jr. Member

  • Offline
  • ***

  • 11
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?
  • 0.92.3
  • Win 7 Pro

September 19, 2018, 06:26:16 AM
Reply #14

Moini

  • IC Mentor

  • Offline
  • ******

  • 1,567
    • VektorRascheln
Probably. I've listed the locations a couple of times now, you should be able to find them on your computer.

September 19, 2018, 07:50:19 AM
Reply #15

brynn

  • Administrator

  • Offline
  • ******

  • 3,939
  • Gender
    Female

    Female
    • Inkscape Community
  • Inkscape version 0.92.3
  • Windows 7 Pro, 64-bit
Inkscape Tutorials (and manuals)                      Inkscape Community Gallery                        Inkscape for Cutting Design                     



"Be ashamed to die until you have won some victory for humanity" - Horace Mann                       

September 19, 2018, 12:33:39 PM
Reply #16

BretHankes

  • Jr. Member

  • Offline
  • ***

  • 11
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?
  • 0.92.3
  • Win 7 Pro

September 20, 2018, 03:52:36 AM
Reply #17

Moini

  • IC Mentor

  • Offline
  • ******

  • 1,567
    • VektorRascheln
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.

September 21, 2018, 06:11:26 PM
Reply #18

BretHankes

  • Jr. Member

  • Offline
  • ***

  • 11
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

  • 0.92.3
  • Win 7 Pro

September 22, 2018, 02:02:00 PM
Reply #19

Moini

  • IC Mentor

  • Offline
  • ******

  • 1,567
    • VektorRascheln
Remove the duplicate parenthesis after batchcmd.

September 22, 2018, 02:11:40 PM
Reply #20

Moini

  • IC Mentor

  • Offline
  • ******

  • 1,567
    • VektorRascheln
(made a pull request for the original repository)

September 22, 2018, 05:12:07 PM
Reply #21

BretHankes

  • Jr. Member

  • Offline
  • ***

  • 11
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.
  • 0.92.3
  • Win 7 Pro

September 23, 2018, 11:03:52 AM
Reply #22

Moini

  • IC Mentor

  • Offline
  • ******

  • 1,567
    • VektorRascheln
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.

September 25, 2018, 04:34:52 PM
Reply #23

BretHankes

  • Jr. Member

  • Offline
  • ***

  • 11
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.
  • 0.92.3
  • Win 7 Pro

September 26, 2018, 02:21:04 PM
Reply #24

Moini

  • IC Mentor

  • Offline
  • ******

  • 1,567
    • VektorRascheln
It should be looking different in Inkscape already... Can you make a screenshot and share your file?