Importing svg for sketch?

Post here for help on using FreeCAD's graphical user interface (GUI).
Forum rules
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!
faosf
Posts: 20
Joined: Sun Jun 17, 2012 3:10 pm

Importing svg for sketch?

Post by faosf »

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.
Attachments
rim.zip
(84.43 KiB) Downloaded 139 times
WinXP, FreeCAD 0.13 Rev. 1306
jmaustpc
Veteran
Posts: 11207
Joined: Tue Jul 26, 2011 6:28 am
Location: Australia

Re: Importing svg for sketch?

Post by jmaustpc »

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
faosf
Posts: 20
Joined: Sun Jun 17, 2012 3:10 pm

Re: Importing svg for sketch?

Post by faosf »

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.
... or not ;-)

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
User avatar
shoogen
Veteran
Posts: 2823
Joined: Thu Dec 01, 2011 5:24 pm

Re: Importing svg for sketch?

Post by shoogen »

faosf wrote:Could you get an svg to work? I also tried with a real simple one, but still nothing.
The sketcher only supports lines and circular arcs at the moment. Bezier curves and spline are not converted.
faosf
Posts: 20
Joined: Sun Jun 17, 2012 3:10 pm

Re: Importing svg for sketch?

Post by faosf »

shoogen wrote:The sketcher only supports lines and circular arcs at the moment. Bezier curves and spline are not converted.
Ah, OK. Instead of no converting at all would it be possible to convert beziers/splines to straight lines - as a temporary solution.

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 371 times
WinXP, FreeCAD 0.13 Rev. 1306
User avatar
NormandC
Veteran
Posts: 18589
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: Importing svg for sketch?

Post by NormandC »

Hi,

I was able to import your test.svg file, but the circle didn't import correctly.

Image
faosf wrote:
shoogen wrote:The sketcher only supports lines and circular arcs at the moment. Bezier curves and spline are not converted.
Ah, OK. Instead of no converting at all would it be possible to convert beziers/splines to straight lines - as a temporary solution.
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.

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 127 times
faosf
Posts: 20
Joined: Sun Jun 17, 2012 3:10 pm

Re: Importing svg for sketch?

Post by faosf »

Hey,
normandc wrote:I was able to import your test.svg file, but the circle didn't import correctly.
yes, thats OK here also. I mean the conversion to sketch as described above from Jim:
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
User avatar
NormandC
Veteran
Posts: 18589
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: Importing svg for sketch?

Post by NormandC »

Gah! I'm having trouble with understanding intent tonight... :roll:

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.
jmaustpc
Veteran
Posts: 11207
Joined: Tue Jul 26, 2011 6:28 am
Location: Australia

Re: Importing svg for sketch?

Post by jmaustpc »

faosf wrote:
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.
... or not ;-)

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.
Hi faosf

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
User avatar
yorik
Founder
Posts: 13640
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: Importing svg for sketch?

Post by yorik »

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!
Post Reply