SVG Import/Export

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

SVG Import/Export

ayaromenok
it's a number of question about SVG (in 2.2 branch):

1) Export>Export as MakerCAM SVG:
 - since MakerCAM SVG is a Macromedia/Adobe Flash application, which it's blocked by default by browser for some time, is it still necessary to use name of MakerCAM and related default settings dialog (which is huge and hard for reading) in SVG Export Dialog?
 - some entities not exported (like RS_Image). In fact, I make a patch to support RS_Image, but, probably, need to add a option to MakeCAM dialog exporter.

2) As I understand, SVG import for some reason appear as bitmap(Image). Is it any plans to add SVG import as vector?
Reply | Threaded
Open this post in threaded view
|

Re: SVG Import/Export

LordOfBikes
Administrator
There is not much SVG support in LibreCAD at all.

SVG import is managed completely by Qt, that's the reason for handling it as a pixel image.

The focus of MakerCAM SVG export is on MakerCAM, not on SVG I think.
This function is relatively young. The motivation of the inventor of this feature was to use the exported SVG with MakerCAM for CNC G-Code generation. So exporting RS_Image e.g. doesn't make much sense for this tool to my mind.

Nobody has put any efforts yet into an universal SVG import/export tool in LibreCAD.

If you plan to work on this, I suggest to leave the MakerCAM export dialog as it is.
Create a new SVG export tool with it's own, different export dialog.
Move the MakerCAM SVG output functions to a more universal SVG export library for common use.
Maybe there is already a 3rd party SVG library out there which is license compatible with LibreCAD.

This extends to SVG import, there should be a separate import tool then.
The SVG file has to be parsed and interpreted.
Probably a new SVG import dialog is needed.

That sounds like a lot of work for me and feels like reinventing the wheel as the DXF support in Inkscape e.g. is very well.
May be there are reasons which account these efforts, but as said, there is no active work yet and no plans for future currently.

Armin
Reply | Threaded
Open this post in threaded view
|

Re: SVG Import/Export

ayaromenok
Thank you for detailed reply.

Reason for my question was that it's no way to share drawing with bitmaps (which necessary for papercarft design in my case) data between LibreCad and Inkscape (no image support in LibreCad/SVG and Inkscape/DXF). and SVG pipeline more suitable for me due to support in EleskCAM (which I need to use later).

I will take a more detailed look on this issue soon.
Reply | Threaded
Open this post in threaded view
|

Re: SVG Import/Export

LordOfBikes
Administrator
No problem, you're welcome!

So this sounds like a similar motivation as for the MakerCAM SVG export.
Then I suggest to rename it to "CAM SVG export" and improve the MakerCAM export dialog with needed options for EleskCAM export.
Is RS_Image all you need for EleskCAM or are there more options to consider?
When this doesn't break the MakerCAM export, I see no problems to merge your work into the main repo.

So for export this seems to be an appropriate option, but for a SVG vector graphics import I still see a whole bunch of work to do.

Armin
Reply | Threaded
Open this post in threaded view
|

Re: SVG Import/Export

ayaromenok
This post was updated on .
RS_Image is necessary for Inkscape(when SVG used, and other SVG editors), but, probably, not for CAM's, which just ignore SVG image element (make test on MakerCAM, EleskCAM and LaserWeb).

Also I found that all three tested CAM(MakerCAM, EleskCAM and LaserWeb) ignore line type settings (dash/dot type of line, which can be useful for paper and plywood cutting), so some kind of baking is required (similar to already implemented inside MakerCAM exporter to workaround about elipse rotation bug).

For import it's looks like possible to use QXmlStreamReader(pair to MakerCAM's QXmlStreamWriter) to make code more similar in Export/Import and avoid any additional dependencies.

upd: I would like to make evaluation of exporting baked lines(for all 3 CAM's) and became more familiar with UI organization of librecad in my local copy of repo before merge request ;)





Reply | Threaded
Open this post in threaded view
|

Re: SVG Import/Export

ayaromenok
This post was updated on .
updated UI for SVG export on screenshot below:
 - renamed to Export as CAM/plain SVG;
 - MakerCAM option description, which originally was implemented as QLabel, replaced with ToolTips - to make it more similar to other UI/save space in dialog;
 - all options by default is the same, as was before;
 - added option to set line width (it was hardcoded to 1mm, so default value is the same)
 - added export of image and option to dialog (absolute path used)
 - added baking of lines of all supported types(dot, dash, dashdot, etc)

code can be found as a branch at https://github.com/ayaromenok/LibreCAD/tree/00_RollOutBranch

Any suggestion are welcome!

I will make a few more tests with different CAM's, Inkscape, etc,  and if everything is OK - will make a pull request.

Screnshot of updated SVG export dialog


result of export of test scene with existing and new exporter, as shown in Inkskape 0.9.2
line width, images and baked lines showed
Reply | Threaded
Open this post in threaded view
|

Re: SVG Import/Export

ayaromenok
test changes
on Linux with:
  Inkscape 0.9.2, Maya 2017;
on WIndows with:
 sK1 2.0b, Inkscape 0.9.2;
 MakerCAM(in Firefox browser), EleskCam 3.1, LaserWeb 4

looks like all ok - so make a make pull request;

PS: I use github issues/comments binding for developing, so can't just pull a my dev-brach due to different issues with same number in  LibreCAD repo - so use a patch diff/apply and merge everything in 1 commit:(