Page 1 of 2

Importing svg for sketch?

Posted: Mon Jun 18, 2012 9:40 pm
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.

Re: Importing svg for sketch?

Posted: Tue Jun 19, 2012 12:16 am
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

Re: Importing svg for sketch?

Posted: Tue Jun 19, 2012 6:44 pm
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.

Re: Importing svg for sketch?

Posted: Tue Jun 19, 2012 8:24 pm
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.

Re: Importing svg for sketch?

Posted: Tue Jun 19, 2012 9:02 pm
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.

Re: Importing svg for sketch?

Posted: Tue Jun 19, 2012 10:47 pm
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

Re: Importing svg for sketch?

Posted: Tue Jun 19, 2012 10:59 pm
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.

Re: Importing svg for sketch?

Posted: Tue Jun 19, 2012 11:46 pm
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.

Re: Importing svg for sketch?

Posted: Wed Jun 20, 2012 12:35 am
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

Re: Importing svg for sketch?

Posted: Wed Jun 20, 2012 5:07 pm
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!