Hi there,
I am new to this forum. I collaborate to the FreeCAD project ( http://free-cad.sf.net ) and I have this little question some of you might be able to help:
FreeCAD is capable of outputting (with some bugs here and there but it works) SVG documents either directly from the 3D view, by flattening everything to a 2D plane, or by using a special module which creates custom 2D views of a 3D scene. That module draws everything in SVG format. I'm currently trying to output DXF format too (producing 2D DXF docs of your 3D work is pretty useful in CAD world). For this, the simplest path is to convert directly from SVG to DXF, which freecad itself is capable to do - more about that here: http://yorik.uncreated.net/guestblog.php?2010=250 (I tried using inkscape too - http://yorik.uncreated.net/guestblog.php?2010=174 ).
The question is this: Some "technical" entities, such as dimensions, are not supported by the SVG format. But in order to be exported as DXF dimensions too, they must be identificable as such inside the svg file. Since many people here have more experience than me with svg format, I'd like to read opinions on how would be the best way to do that:
- put everything in a common <g> tag, and give it custom attributes that only FreeCAD would recognize/read?
- create a custom node such as <dimension> (that I suppose other apps would simply skip)?
- any other more canonical solution?
Cheers & thanks,
Yorik
Custom object types (CAD dimensions) in SVG
-
- Posts: 4
- Joined: Wed Mar 30, 2011 5:36 am
Re: Custom object types (CAD dimensions) in SVG
I'd love to know more about this as well. I'm more in the way of making widgets that can easily be parameterised in an SVG-like fashion but that aren't standard SVG shapes, nor fixed shapes as in <use xlink::href="template"/>
-
- Posts: 626
- Joined: Wed Jun 06, 2007 2:37 am
Re: Custom object types (CAD dimensions) in SVG
You want to declare a namespace and then add parameters in that namespace that tell you what the object is. Thats how we do stars, polygons, 3d boxes, etc. If you draw a star then look at the inkscape svg you'll find a number of inkscape: or sodipodi: tags, these are things we use internally in inkscape to store the toolbar parameters etc, so that we can use edit the shapes again with the tool rather than them becoming dumb paths. You could easily create tags inside a group FreeCAD:dimension-name FreeCAD:dimension-value FreeCAD:dimension-units etc that save the parameters.
Custom nodes arent a good idea as they wouldnt be valid svg, and you've no idea how other renderers might deal with them.
the other alternative is to put it in the inkscape namespace and get inkscape to support it. Might be worth emailing the dev list about that...
Custom nodes arent a good idea as they wouldnt be valid svg, and you've no idea how other renderers might deal with them.
the other alternative is to put it in the inkscape namespace and get inkscape to support it. Might be worth emailing the dev list about that...
Re: Custom object types (CAD dimensions) in SVG
I finally implemented Simarilius's solution (at the moment with FreeCAD namespace), it's an excellent solution... Other apps are not aware of it and treat your document normally, but yourself can read it the way you want. Thanks a lot Simarilius!