Importing svg for sketch?
Forum rules
and Helpful information
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help
Also, be nice to others! Read the FreeCAD code of conduct!
Also, be nice to others! Read the FreeCAD code of conduct!
Importing svg for sketch?
Hi,
I have seen on this page (https://sourceforge.net/apps/mediawiki/ ... =Draft_SVG) that it is possible to import svgs as drawings.
I tried to reproduce the FreeCAD tutorial 2 - Making a bike rim. Pt1 of 2, but with an svg file as a sketch template. But when I import the svg file (as a drawing), I somehow only get it as a "3d" part. I thought I could import in the sketch mode to edit it there - is this possible?
Attached my files and progress so far.
I have seen on this page (https://sourceforge.net/apps/mediawiki/ ... =Draft_SVG) that it is possible to import svgs as drawings.
I tried to reproduce the FreeCAD tutorial 2 - Making a bike rim. Pt1 of 2, but with an svg file as a sketch template. But when I import the svg file (as a drawing), I somehow only get it as a "3d" part. I thought I could import in the sketch mode to edit it there - is this possible?
Attached my files and progress so far.
- Attachments
-
- rim.zip
- (84.43 KiB) Downloaded 125 times
WinXP, FreeCAD 0.13 Rev. 1306
Re: Importing svg for sketch?
Go to Draft WB, import svg as geometry, select an individual path (the 3d part), click on "Draft/Sketcher-item converter....and you will have a sketch.
It is the tool in the toolbar with blue and red outline shapes, 2 to the left of the storm trooper helmet.
Jim
It is the tool in the toolbar with blue and red outline shapes, 2 to the left of the storm trooper helmet.
Jim
Re: Importing svg for sketch?
... or notjmaustpc wrote:Go to Draft WB, import svg as geometry, select an individual path (the 3d part), click on "Draft/Sketcher-item converter....and you will have a sketch.

When I try it here, I get indeed a sketch (with no error messages), but its empty...

Could you get an svg to work? I also tried with a real simple one, but still nothing.
WinXP, FreeCAD 0.13 Rev. 1306
Re: Importing svg for sketch?
The sketcher only supports lines and circular arcs at the moment. Bezier curves and spline are not converted.faosf wrote:Could you get an svg to work? I also tried with a real simple one, but still nothing.
Re: Importing svg for sketch?
Ah, OK. Instead of no converting at all would it be possible to convert beziers/splines to straight lines - as a temporary solution.shoogen wrote:The sketcher only supports lines and circular arcs at the moment. Bezier curves and spline are not converted.
Also I don't think it works currently at all. As I said I tried with a really simple on. I have attached a test.svg (rename zip to svg) and I didn't get a single sketch from it. Please test it.
- Attachments
-
- test.zip
- Change File Extension to SVG
- (2.63 KiB) Downloaded 359 times
WinXP, FreeCAD 0.13 Rev. 1306
Re: Importing svg for sketch?
Hi,
I was able to import your test.svg file, but the circle didn't import correctly.

For example I used BSplines to make the guitar body here (although I don't remember the whole process): viewtopic.php?f=8&t=1222&start=150#p17559
I was able to import your test.svg file, but the circle didn't import correctly.

One thing you could do is work in Draft instead, since it supports bezier curves (or rather they are converted to BSplines I think). Draft elements are compatible with the Part Design workbench. They can be padded, pocketed, revolved.faosf wrote:Ah, OK. Instead of no converting at all would it be possible to convert beziers/splines to straight lines - as a temporary solution.shoogen wrote:The sketcher only supports lines and circular arcs at the moment. Bezier curves and spline are not converted.
For example I used BSplines to make the guitar body here (although I don't remember the whole process): viewtopic.php?f=8&t=1222&start=150#p17559
- Attachments
-
- test-SVG.fcstd
- (11.74 KiB) Downloaded 116 times
Re: Importing svg for sketch?
Hey,
yes, thats OK here also. I mean the conversion to sketch as described above from Jim:normandc wrote:I was able to import your test.svg file, but the circle didn't import correctly.
jmaustpc wrote:Go to Draft WB, import svg as geometry, select an individual path (the 3d part), click on "Draft/Sketcher-item converter....and you will have a sketch.
WinXP, FreeCAD 0.13 Rev. 1306
Re: Importing svg for sketch?
Gah! I'm having trouble with understanding intent tonight...
Ok, I tried the Draft --> Sketch conversion, and it doesn't work on my end either. I believe it's because it's imported geometry. The converter is for use with Draft objects, and these are not. I tried to convert one of the paths to a Draft object using the Upgrade or Downgrade tools, but basic elements are created (edges, wire or face), not Draft elements. A basic element has a blue cube icon in the Project tree, while a Draft object will have a blue square with circle icon.
Possibly those path objects could be converted to Draft objects with some python code, but I'm a GUI guy myself, so I would know more.
P.S. Just created Draft objects and converted them to sketches just fine.

Ok, I tried the Draft --> Sketch conversion, and it doesn't work on my end either. I believe it's because it's imported geometry. The converter is for use with Draft objects, and these are not. I tried to convert one of the paths to a Draft object using the Upgrade or Downgrade tools, but basic elements are created (edges, wire or face), not Draft elements. A basic element has a blue cube icon in the Project tree, while a Draft object will have a blue square with circle icon.
Possibly those path objects could be converted to Draft objects with some python code, but I'm a GUI guy myself, so I would know more.
P.S. Just created Draft objects and converted them to sketches just fine.
Re: Importing svg for sketch?
Hi faosffaosf wrote:... or notjmaustpc wrote:Go to Draft WB, import svg as geometry, select an individual path (the 3d part), click on "Draft/Sketcher-item converter....and you will have a sketch.
When I try it here, I get indeed a sketch (with no error messages), but its empty...
Could you get an svg to work? I also tried with a real simple one, but still nothing.
The answer is simple, unfortunately, it was late at night in my time zone and I had a brain fart! I was thinking of, and hence told you what to do with, DXF files rather than SVG. Whoops!

With dxf import you have several options for how to import it, go to Draft WB, Edit menu ....preference, Draft, import/export....You can set import dxf as, amongst others, "parametric Draft WB items" or "directly as sketcher items". It was this functionality, which I was referring to.
In principle I don't see any reason for not doing the same with svgs except that no one has written the code to do so.
Sorry for the inconvenience.
Jim
Re: Importing svg for sketch?
Hi all,
Just to remind you that indeed the Draft <-> Sketch conversion tool still has a lot of problems, especially with arcs... Still had no luck in trying to solve them
But I'm on it!
Just to remind you that indeed the Draft <-> Sketch conversion tool still has a lot of problems, especially with arcs... Still had no luck in trying to solve them
