SVG Import

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

SVG Import

davecoventry
Some time ago I had a look at LibreCAD and it included a tool for importing vector svg files.

After a Hardrive overwrite (thank you, Microsoft) I have installed LibreCAD on a clean system but I find that the function is no longer there. There is the outline of a raster image, but the vector image no longer appears.

Am I going mad?

QCAD has an SVG import tool, but this discards critical line data that I need.

Version: 2.1.3
Compiler: GNU GCC 9.3.0
Compiled on: Mar 23 2020
Qt Version: 5.14.2
Boost Version: 1.71.0
System: Ubuntu 20.10

I have also installed the Github files from source but the issue remains.
~Dave
Reply | Threaded
Open this post in threaded view
|

Re: SVG Import

dellus
What is the LibreCAD version you say that imports true vector drawing from svg? Present versions only import as bitmap image.

You may try to open in Inkscape (open source) and export to dxf, to see if the outcome is more usable.
Reply | Threaded
Open this post in threaded view
|

Re: SVG Import

davecoventry
Unfortunately, Windows 10 recovery on my laptop trashed my linux partitions, so I can't find what version I had installed.

Yes, Inkscape does save as DXF. However, I need to differentiate between hidden lines and visible lines and Inkscape does not do this.

QCad also has a function to import SVG files, but the hidden lines are also styled identically to the visible lines.

I'm using FreeCAD to render views of objects which I then export as SVG files which I then import into my CAD drawings.
~Dave
Reply | Threaded
Open this post in threaded view
|

Re: SVG Import

dellus
Probably there is no way to do what you want. But interesting, could you provide a sample SVG file from FreeCAD to play with? Is it not possible to make a free projection as DXF within FreeCAD?  
Reply | Threaded
Open this post in threaded view
|

Re: SVG Import

davecoventry
Yes, FreeCAD does have a dxf export function, but this is unable to differentiate between hidden lines.

I can define hidden lines as having a different line thickness and/or a different colour, but when exported to dxf these are lost.

They are present in the svg file, but are lost when Inscape converts the file to dxf.

What I can do is split the svg into 2 separate svg files in Inkscape, but this is tedious.

The version of LibreCAD that I was using previously had an import function that imported the files with the line colours intact which allowed me to place them on separate layers so that I could style the hidden linetypes.

iso.svg 
~Dave
Reply | Threaded
Open this post in threaded view
|

Re: SVG Import

perepujal
This post was updated on .
If you know approximately the installation date of the LibreCAD version you are missing, probably you could find it in the archives of your linux distribution

EDIT:
BTW, svg2dxf from here keeps grey/black lines in the dxf
https://raw.githubusercontent.com/Zigazou/svg2dxf/master/svg2dxf
Is a bash script that uses inkscape and pstoedit, I see a problem with curved lines, but at least it keeps colors
HTH
Reply | Threaded
Open this post in threaded view
|

Re: SVG Import

davecoventry
Yes, that script used to work perfectly, but it appears that the process changed in pstoedit which caused the aberrations.
~Dave
Reply | Threaded
Open this post in threaded view
|

Re: SVG Import

dellus
In reply to this post by davecoventry
Thanks for the sample file. I didn't find a way or a different app that could keep the colours intact when exporting to dxf. I understand it would be a tedious task to change lines to different colour or layer manually, with such a complex drawing.

I had one idea for a workaround. If it's possible in FreeCAD, you could make a dxf with hidden lines shown and one with only the visible lines, with the same position. Open the first in LibreCAD, then import the second on an extra layer, lying exactly upon the other, maybe giving it a slightly larger line thickness to cover the one beneath. Choose colours, and use the Order commands if necessary.
For the importing operation you may use copy and paste from one drawing into the other.
Reply | Threaded
Open this post in threaded view
|

Re: SVG Import

davecoventry
Complex?

I cut out 90% of it to make it simpler! ;)

The design is proprietary to my client, so I didn't want to splash a full drawing onto the internet.

It is possible to produce multiple versions of the projection from FreeCAD, but each iteration takes a few hours, so it's not really practical.
~Dave
Reply | Threaded
Open this post in threaded view
|

Re: SVG Import

dellus
The saga is going on.
I tried with Blender, a very old version so it ran on my old XP pc. It could import svg but it seemed not to show the colours, and couldn't export to dxf. I didn't grasp Blender anyway and didn't want to spend too much time on it.
Then I had an idea. I converted the svg to pdf in Inkscape. I had an old test version of an app called  pdf 2 dxf. This did the job, it produced some 256 layers, the black lines on layer 0, the grey lines on layer 253. The other layers were empty. So for each possible colour one layer. iso_test.dxf
LibreCAD 2.2.0 rc2-1 (the latest) wouldn't open it. "Please test its existence and permissions".
I tried with NanoCAD5, yes! And I tried with Freedraft, an older simple free app. Yes! I deleted the empty layers and saved it in Freedraft. iso_test_freedraft_bereinigt.dxf
This one LibreCAD 2.2.0 rc2-1 was inclined to open.
Just to be sure there was no difference I tried the first iso_test.dxf with LibreCAD 2.1.3 and to my surprise it opened! Tadaa!
Reply | Threaded
Open this post in threaded view
|

Re: SVG Import

davecoventry
Ok, that direction is quite profitable.

Niether QCAD nor LibreCAD can import PDF, but I have software that can and which retains the difference between hidden lines and solid.

Thanks very much. That is extremely helpfiul.
~Dave