-
-
Notifications
You must be signed in to change notification settings - Fork 500
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Experimental SVG support #451
Comments
Hi. I left the settings at the default ones, loaded the .svg file in which was made in Inkscape. I also noticed in the code there is no return to home position code generated. Generated code (Beginning and End) with a large section removed, it's actually 234 lines of code:
This is the finished test burn after 1 pass. |
Hi @StuartB4 I have used a third-party code (heavly modified) for SVG conversion, so I was expected some issues but the desire to publish a new version was stronger than to strong test it!
M3 instead of M4 and missing of Go-Home at end are known. I'll fix ASAP.
I think the offset was not added by the code, but already existing in your original svg drawing. Check it!
It is an issue or it is ok? I think that the code is generated as found inside xms-svg code, with few control on it by my side. |
Hi Arkypita.
Certainly not an issue for me, just an observation. |
question removed? |
Sorry. My mistake. I had PWM mode switched off in settings. |
Здравствуйте. Все хорошо, открывает. Возможно сделать маштабирование векторов. Спасибо |
translated: Hello. All is well, opens. It is possible to do vector scaling. Thank you Yes, as future option I will add scaling. |
Hi, GOOD Job !
i do test opening .SVG file exported from Corel DRAW X7 64b= works well thanks |
I can't exclude. Maybe in the future but not for now. |
Can you submit your svg? |
SVG is not supported here. :( |
Zip and upload |
I found the error. Tks, |
I was sure that the problem was in the file, but if you can share it (the one with issues) i can try to make the import procedure more strong and error tollerant |
Of course. Another feature that would be great is can import dxf file. Here it is. Thanks and congratulations for the good job. |
After a little search i found that xml specification define that only some character ranges are allowed in xml (svg is a form of xml file). So your file is not a valid xml file. I have tried to strip-out any character out of valid ranges prior to parse file content and now I was able to correctly read your error_file.svg Future version of LaserGRBL will be more strong! |
I'm happy to contribute to the project. Do not forget to allow direct import of the dxf file, without having to convert to svg. ;) |
Hi @arkypita Just been using the awesome SVG feature. I do have some issue where after an SVG had finished engraving, the machine will go over the same paths several times with the fast speed and laser turned off before going into engraving the second path, third path and so on. I mean after every path, it does that before going to the next. SVG file: |
Bump. Any ideas? |
Strange problem. For some reason though when loading it in it also showed the original size path in the window, After it burned ok it then started to go over the original size path but without the laser coming on. As good as it's can be at this size. |
Just tried it again by cutting the object from the original document and pasting it in to a new 40 x 40 mm document. Shrunk it again to fit the document and burned it again. May be worth a try to just select the object, cut it and paste it in to a new document the same size as the original. |
Hi hk89. Had a look at the file with Notepad++. |
I've just got into svg files from inkscape and tried loading them into lasergrbl . The images are great but I have the problem of getting them the exact size I need. Also I have built a jig at 100mm x and y offsets so that I can rapidly repeat burns. The option to resize and offset is not present for svg and i understand you are working on this. I'd love to know how things are going. |
Hi. |
I'm having the same problem. It seems when using Illustrator, LaserGBRL considers mm to be pt and divides by about 2.83465. I had been dividing my measurements by this value but I like Rudi's suggestion as it is easier. |
Looking at the code of the project from which I took the SVG library I see that in the comments it says:
This is exactly the cause of the problem reported here by @Ziggy2013 Looking at the code of file GCodeFromSVG.cs line 319 we can see that the code use only the param "angle" and ignore the rotation point.
Now I'm looking for a trigonometric solution (I'm not very good with this) to implement rotation around a point other than 0.0 |
It would seem to be easy, just replace the assignment of M11, M12, M21, M22 of a transformation matrix with the call to the RotateAt function.
Tested with file pent with vines here and now is imported correctly. I am going to do more test. |
Thanks arkypita for following up on this issue. An explanation of how to handle rotation about a point other than the origin is here on youtube- |
Release v3.1.4 (available as pre release for test) should fix the issue of rotation about point. Let me know |
Hi arkypita
I think the rotation about a non origin point is now working.
However it appears there is still an issue with how rotate is handled.
I have attached three test files;
1) an svg file "test_stencil_brd.svg" which been generated out of a PCB
program. This file renders correctly in Inkscape 0.92.3 It
does not render correctly in LaserGRBL. You will see the difference in
rendering affects just one part of the image.
2) The same svg file "test_stencil_brd.svg" has been openned in Inkscape
0.92.3 then simply saved. This saved file
"test_stencil_brd_saved.svg" renders correctly in Inkscape 0.92.3 but
not in LaserGRBL. If you look at the xml contents
of file 1 and 2 they are very different. However I think the reason
LaserGRBL does not render correctly is the "rotate(-270.000000)"
statement in both files "test_stencil_brd.svg" and
"test_stencil_brd_saved.svg" is not handled correctly.
3) The third file "test_stencil_brd_ungroup.svg" is the result of just
Inkscape "ungrouping" the content of file 1. Both Inkscape
and LaserGRBL now render this file correctly. If you look at the xml
contents of this file you will see that Inkscape uses
rotation about a non origin point. This translation type now appears
to work correctly in LaserGRBL 3.1.4.
I hope this information and test files are helpful. All of these three
files should render the same in Inkscape 0.92.3 and
LaserGRBL. They should also render the same in earlier versions of Inkscape
but I haven't been able to check that.
I can see the svg import code is very complex. If you need further testing
please let me know. I appreciate the massive effort you
have put into LaserGRBL. It's a great app - thanks.
Regards
Ian
…On Wed, Apr 8, 2020 at 9:07 PM arkypita ***@***.***> wrote:
Release v3.1.4 (available as pre release for test) should fix the issue of
rotation about point.
https://github.com/arkypita/LaserGRBL/releases/tag/v3.1.4
Let me know
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#451 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAZMN3HBK4KWCLSVKGHOF5TRLRLGVANCNFSM4FYEXQIQ>
.
|
Mail attachment does not work in github. Can you zip and load via github web page, or send them to [email protected]? |
Hi,
Just sent the zip file to [email protected]
regards
Ian
…On Wed, Apr 8, 2020 at 11:00 PM arkypita ***@***.***> wrote:
Mail attachment does not work in github. Can you zip and load via github
web page, or send them to ***@***.***?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#451 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAZMN3BCKYMZ64DHP4ZEIKTRLRYOLANCNFSM4FYEXQIQ>
.
|
Thanks @Ziggy2013 Now it should be fine with your files and, optimistically speaking, with every file. |
Hi arkypita,
v3.1.5 correctly renders all three test files - it's perfect - thanks.
I agree the root cause issue is more about the order of thransformations.
There is some confusion about how the W3C specification defines
the order in which transformations should be done - the correct order is
from right to left but the specification does not make it easy to
understand this.
There is an interesting discussion about the transformation order is here
https://stackoverflow.com/questions/18582935/the-applying-order-of-svg-transforms
regards and thanks for fixing the problem
Ian
…On Thu, Apr 9, 2020 at 11:55 PM arkypita ***@***.***> wrote:
Thanks @Ziggy2013 <https://github.com/Ziggy2013>
In addition to the lack of "rotate at point" the problem seems to be more
the ability to manage multiple transform operations (rotate translate) in
the same transform attribute. In particular, the order in which these
transformations are indicated because the order in which they are performed
is important (while the library I used ignored this detail).
Now it should be fine with your files and, optimistically speaking, with
every file.
Let me know
https://github.com/arkypita/LaserGRBL/releases/tag/v3.1.5
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#451 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAZMN3BEKEGE526AUBLG7NTRLXHVZANCNFSM4FYEXQIQ>
.
|
Memo: viewbox issue #1126 |
Would it be possible to generate PWM and multiple passes count on elements from some element attribute (opacity, color, stroke-width, etc.)? |
Already in #64 development roadmap |
How about when the outline and filling requires different feedrate and laser intensity ? |
Draw your design using coreldraw software, then set the design scale to 10% and convert it to svg. Everything will be fine. |
If I open your .svg with LaserGRBL v4.2.1 the generated gcode I have is correct. The exported output is:
|
Hmm... but I downloaded it from here: https://github.com/arkypita/LaserGRBL/releases and used the file that I provided. What could influence the processing of this file? Are there any runtime libraries that LaserGRBL relies on for generating paths? |
Download location is correct.
Nothing in my mind.
Maybe some issue with OS localization (internationalization, language settings, decimal point character)? |
I've just tried debugging the code (though I have no experience with C#) and it seems like the root cause is somewhere in the Matrix transformations. I'm trying to run the application in Wine in Linux (yes, I know that's it's not supported, but it would be awesome to finally have an opportunity to use a GPL software to enable a laser engraver in Linux). The .Net framework is Mono there. Adding some prints shows that everything goes well up until However, the
Do you think it's something reasonable that could be included in the code? If so, I can create a pull request. It makes it possible to LaserGRBL on Linux as well, which is quite important as there's currently shortage of free (and especially open source) software for lasers. |
I am sorry but I have no time now to follow the project and SVG issues.
FYI It was reported that LaserGRBL run good on Linux with wine 5.0 and wine mono 4.9.4 (wineprefix 32-bit) and windowsdll gdiplus. |
If the SVG code is rewritten at some point in the future, one really useful feature would be the option to process any interior paths contained within a shape before cutting the exterior outline of the shape itself. Currently, I think LaserGRBL prepares the gcode by processing coordinates in the order in which they are presented in the SVG, which is normally exterior path first, followed by any interior "holes", but this is a problem for cutting interior details in a shape that might shift slightly after cutting (or, worse, fall out of the bed completely!) My workaround for this is to separate any interior holes onto a separate layer in Inkscape, and process that first. But it would be nice if that extra step could be avoided. |
It has been a while since I've done anything with this, but I think level affects order. If you are willing to experiment, try this: Once your design is finished, select all of the elements you want to cut first, and press the "End" button on your keyboard. If you are using a Mac or a crippled laptop keyboard, you can use the menus instead: Object -> Lower to Bottom. At least in SVG 1, rendering order is based on element order, so moving to the bottom, making an object render earlier, means putting it earlier in the file. Note that to select inner edges and manipulate them independently, you may have to convert your objects into paths before changing their render order. (Also note that this is not about layers. Objects have an order within a layer. You can use Page Up and Page Down to move one order level at a time, or Home and End to bring them all the way to the top or the bottom. I believe that if you have multiple elements selected when you do this, they will keep their level relative to each other, but will be moved relative to everything else.) Anyhow, if this works, it would be better than automatically doing that. I've had a few cases of my own, where I needed the outside cut to go first. I don't recall how I solved this, but I suspect I did what you did, and did it as separate cutting jobs. If you try this, please report back here! I am also curious if this works the way I think it does, but I can't use my laser cutter to actually test it right now. |
Hi @Rybec thanks so much for your response. Yes, your suggestion works if the interior and exterior cut lines are defined as separate paths - elements are processed first by layer, and then by order within that layer, so moving the interior cuts to the top will ensure they get processed first. However (and I agree maybe I didn't describe this very well!), the problem I'm having is with elements that are a single path, but that have both an "interior" and "exterior". Imagine cutting a circle out from a rectangle, for example, like this: That's defined in the XML as a single path, but where the exterior coordinates are always listed first, then the interior coordinates. |
There is a way to separate paths that are part of the same object. I just
don't remember what it is anymore. I know I've used it, because I can
recall some projects where I used cuts in the way you are showing.
Typically though, I don't make cuts, but rather I create totally new
independent shapes, because that way I don't have to worry about this. For
example, in the case you mention, with a rectangle with a circular cutout,
there is no reason you need to actually do a cutout operation. Laser
cutters don't need to know the difference between inside and outside. They
just follow the lines. So the proper way to do this for laser cutting is
to just make the square and then a new circle, without cutting out. Turn
off the fill for your shapes, and make the borders fairly thin, so you can
see all of the cuts equally. Once you have everything laid out, select the
circle and end hit End to send it to the bottom. If you need the circle
and square to be movable while staying the same position relative to each
other, you can group them. Select all of the objects you want to group
together, and then do Object -> Group. There's an Ungroup option in the
same menu, if you need to do that. For laser cutting applications,
grouping is way better than making objects with more than one path.
If you still feel you need to do cuts like this (or maybe you are starting
with a file that already has objects of this sort), read on.
So first, I think you may misunderstand what a path is in Inkscape. What
you are talking about is an object. A single object can contain multiple
paths. When you cut something out the way you describe, you are creating a
totally separate path within the object that is part of the same object.
That's why your new path is nested. It's part of the same object as the
outer path, and that means it is going to be treated as being one level
above (cut after) the main/original path for that object.
Now, I know the first step to separating them. That is, select the object,
and then do Path -> Object to Path. I believe this will turn it into
multiple independent paths, but there may be another step after that to
separate them. If there is, I obviously don't remember it. (It is worth
noting: It is generally good practice to convert your objects into paths
when laser cutting anyway, because parsing complex objects doesn't always
work the way it should. If you convert to path before sending to
LaserGRBL, you are more likely to get what you are seeing. If you do want
to keep the object version, then save the path version under a different
name. Personally though, I pretty much always convert to path, once I've
gotten the objects the way I want them.)
Anyhow, I hope this helps. Inkscape is really powerful, but it can be a
bit challenging to learn to use for laser cutting, because it wasn't really
designed for that. It can do almost everything you need, and typically
fairly easily, but it's not always intuitive, and most Inkscape tutorials
don't cover engineering uses. (Maybe I should write some tutorials on
using Inkscape for laser cutting, once I have my cutter setup for use
again.)
…On Sun, May 16, 2021 at 2:14 AM alastaira ***@***.***> wrote:
Hi @Rybec <https://github.com/Rybec> thanks so much for your response.
Yes, your suggestion works if the interior and exterior cut lines are
defined as separate paths - elements are processed first by layer, and then
by order within that layer, so moving the interior cuts to the top will
ensure they get processed first.
However (and I agree maybe I didn't describe this very well!), the problem
I'm having is with elements that are a *single* path, but that have both
an "interior" and "exterior". Imagine cutting a circle out from a
rectangle, for example, like this: That's defined in the XML as a single ,
but where the exterior coordinates are always listed first, then the
interior coordinates.
[image: image]
<https://user-images.githubusercontent.com/901056/118393554-adc8b300-b637-11eb-84b0-1ddbf32f6d2d.png>
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#451 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAN6QYGRGFYA3M6OREUTULLTN6LKBANCNFSM4FYEXQIQ>
.
--
べん
|
Thanks again for your attention, @Rybec, I really appreciate it. I think we might have a terminology issue :) I'm not talking about an object containing multiple paths, but rather an object consisting of a single path that has multiple, closed sections (i.e. if you examine the SVG, there are mutiple sections within the path element, each separated by a z closepath command). I'm not certain what the correct terminology is, but I guess these might be referred to as "subpaths", or perhaps the whole thing is a "compound path". I did try to use Object to Path as you suggested, but it didn't have any effect, I assume because the selected object already is a path. (I'm familiar in general with turning any Inkscape objects into paths before exporting) I've attached a link to a simple file to illustrate the situation - I'd be really grateful if you could take a look just to make sure we have a common understanding of the problem :) : https://drive.google.com/file/d/1ikISmu4ZgXksLr8d1gE2cuIteIxY3I_U/view?usp=sharing Thanks, |
Path -> Break Apart will promote the subpaths into their own paths. All I need to do is to make sure that the new path elements created are inserted in the SVG document structure before the "parent" path from which they were just detached. That, I think, will solve my problem. |
Yeah, exporting SVGs from other CAD software doesn't always come out intelligently. I wish those companies would put more effort into making their software play well. (Adobe is the worst offender, because it uses a non-standard scale for SVG, which will make your cuts come out the wrong size. They claim to be professional, but I hardly consider blatantly ignoring the SVG standard to be professional.) First, compound path is probably the right terminology here, and the independent sections would be subpaths. (I apologize if I came off as patronizing. Terminology issues are a huge reason for miscommunication, so I like to try to resolve those very early, and it can come off as talking down to people. That was not my intent.) Second, it sounds like you found the missing step! Once you've broken the compound path into its component paths, you should be able to change the order the way I described above, to get them to cut in the right order (assuming I am recalling correctly). Ok, so I just checked, and it looks like that workflow should do what you want. Use Path -> Break Apart, then select the elements you want to cut first and press End or use Object -> Lower to Bottom. I tested this with the image you provided. When I loaded it in LaserGRBL, the laser path went to the top right square first, and then worked counter-clockwise through the squares (though it looks like a couple were out of order with the rest). Just to verify, I then selected only the main object border (it turns out there are two lines there, so I selected both) and lowered them to the bottom. When I reloaded the file in LaserGRBL, it went straight to the outer lines first. In theory, if you wanted to do path optimization (I wouldn't bother for highly complex objects, unless cutting time is a serious issue), you could select elements one by one, lowering them to bottom, in the reverse order you want them cut (or you could raise them to top in the order you want them cut). Inkscape doesn't provide any way of telling Z order though, aside from rendering order, which only works when things are overlapping. |
Write here about SVG support
The text was updated successfully, but these errors were encountered: