Drawing templates
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
Drawing templates
OK, I'm still working on getting my wheels on...
Drawing templates
I notice that there are a whole whack of DIN Ax templates, and only a couple of US/ANSI templates which match the paper sizes
we regularly work with
so I come across https://wiki.freecadweb.org/Drawing_templates
which describes in gory details the requirements for drawing templates: <!-- DrawingContent -->, <!-- Working space X1 Y1 X2 Y2 -->, etc
on the same page are various .svg templates
so I just grab one, open it in notepad++ and look for those "mandatory" must have xml code
nothing...
I read this: https://wiki.freecadweb.org/TechDraw_Te ... _Templates
and it talks about garbage SVG
well it certainly looks like there is a lot of garbage SVG in those sample templates
so I look at the templates in ...\FreeCAD_0.19.23578-Win-Conda_vc14.x-x86_64\data\Mod\TechDraw\Templates
they also don't have those "must have" xml code
so what gives ?
Does some of that stuff still date back to the previous Drawing workspace stuff and is now obsoleted by TechDraw
workspace but the documentation is still deprecated ?
There is a description of how to create custom templates: https://wiki.freecadweb.org/TechDraw_TemplateHowTo
Is it still a good idea to save as optimized SVG in inkscape to strip out the garbage SVG ?
Does one then need to go back in after and add-in the required freecad-specific code/tags etc?
Are there any templates which are fully optimized and compliant, or does everyone have to create their own because the
official ones are just random ueberbleibsel ?
Drawing templates
I notice that there are a whole whack of DIN Ax templates, and only a couple of US/ANSI templates which match the paper sizes
we regularly work with
so I come across https://wiki.freecadweb.org/Drawing_templates
which describes in gory details the requirements for drawing templates: <!-- DrawingContent -->, <!-- Working space X1 Y1 X2 Y2 -->, etc
on the same page are various .svg templates
so I just grab one, open it in notepad++ and look for those "mandatory" must have xml code
nothing...
I read this: https://wiki.freecadweb.org/TechDraw_Te ... _Templates
and it talks about garbage SVG
well it certainly looks like there is a lot of garbage SVG in those sample templates
so I look at the templates in ...\FreeCAD_0.19.23578-Win-Conda_vc14.x-x86_64\data\Mod\TechDraw\Templates
they also don't have those "must have" xml code
so what gives ?
Does some of that stuff still date back to the previous Drawing workspace stuff and is now obsoleted by TechDraw
workspace but the documentation is still deprecated ?
There is a description of how to create custom templates: https://wiki.freecadweb.org/TechDraw_TemplateHowTo
Is it still a good idea to save as optimized SVG in inkscape to strip out the garbage SVG ?
Does one then need to go back in after and add-in the required freecad-specific code/tags etc?
Are there any templates which are fully optimized and compliant, or does everyone have to create their own because the
official ones are just random ueberbleibsel ?
Re: Drawing templates
Moved to TechDraw forum.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Re: Drawing templates
GitHub username "donovaly" == Forum username "uwestoehr". My GitHub username == "aapo-aapo". I coded the Qt5 enhancements needed for the extra paper sizes, and I think it was indeed Uwe who did the work for including the new SVG templates.
uwestoehr wrote: pinged by pinger macro
Re: Drawing templates
uwestoehr. I also already wrote to you: https://forum.freecadweb.org/viewtopic. ... 40#p470803
Re: Drawing templates
Can you please describe precisely what you want to achieve and what is not working for you?
I e.g. don't know what you mean by "garbage SVG". You should avoid unnecessary SVG tags and this is achieved by simply saving the final SVG as "plain SVG" via Inkscape. So there is no need to dive into SVG details.
Re: Drawing templates
Moin,
Inkscape provides you with lots of unnecessary information, transformations, irrelevant groupings. That is the garbage.
Some parameters are set redundantly and not every e.g. path or rect needs an ID.
Typing templates by hand isn't slower as to paint them with Inkscape and gives you a better overview of your file.
I described how I would type or copy/paste my template in the German Forum https://forum.freecadweb.org/viewtopic. ... w+vorlagen . The Python code is English anyway, maybe that helps a bit.
Or just load the file and have a look: https://forum.freecadweb.org/download/f ... ?id=103792
Inkscape provides you with lots of unnecessary information, transformations, irrelevant groupings. That is the garbage.
Some parameters are set redundantly and not every e.g. path or rect needs an ID.
Typing templates by hand isn't slower as to paint them with Inkscape and gives you a better overview of your file.
I described how I would type or copy/paste my template in the German Forum https://forum.freecadweb.org/viewtopic. ... w+vorlagen . The Python code is English anyway, maybe that helps a bit.
Or just load the file and have a look: https://forum.freecadweb.org/download/f ... ?id=103792
Re: Drawing templates
Well, Inkscape is OpenSource as FreeCAD and there are volunteers - same situation as in FreeCAD. And When I read in some CAD forums how they bash FreeCAD... This is not fair.
Please report bugs to Inkscape. The issues I found are meanwhile almost fixed and to be able to fix a bout one needs to be aware of. Yes, FreeCAD is for example also aware of Toponaming and we don't have yet the ressources to fix this. So maybe Inkscape also has these substantial drawbacks. However, the Inkscape community was always very responsible in providing workarounds, when I asked.
So please help Inkscape and for FreeCAD we found out that creating drawings with Inkscape and saving the SVG as "plain SVG" works well.
Re: Drawing templates
I haven't coined the term Garbage SVG, but I'm guilty to have used it, because I thought it was kinda common language...
It wasn't my intention to bash Inkscape. it is an excellent Tool to create illustrations.
If you don't mind how much code is generated and how readable its, there's nothing to complain about garbage.
But I still think it isn't the best choice to generate templates (or icons).
Typing a template (and bit of copy and paste as well) ensures you to get a readable and quite short svg-file.
To show what could be removed from Inkscape svg-files I grabbed a simple icon :
That's quite a lot of code...
Let's try to reduce it a bit.
The last 2 groups draw the lower and upper lines and contains 3 single stroke paths each.
We can reduce the groups which contains all identical attributes/properties. (I'll stick to "attributes" for both now...)
(We still need two groups due to different transformations.)
But first we remove redundant information.
- There's nothing to fill for a single stroke, and so the fill attributes can be removed
- No need for miter-related attributes for single strokes - 2 more to be removed
- No dashing involved - one attribute less
- For a simple svg-file there's no need for Inkscape and Sodipodi attributes nor for IDs - and three more to go
- Stroke-opacity:1 is default and doesn't need to be set (redundant information) - last one to be dumped
Finally the line-cap attribute is transferred to the group tag and only stroke (colour) and stroke-width stay with the Path tag.
That's what we need to draw both lines in the end (Quite readable, isn't it?):
Now we'll have a look at the dashed frame.
The involved group contains 4 rectangles. Three of them have stroke:none and fill:none which means nothing will be drawn and they are completely redundant. (That might not be Inkscape's fault...)
(The missing indentation seems to be no problem here)
We only need the framing strokes an no filling and so fill:none is mandatory but also implies that no further fill attributed are needed.
Obviously redundant are opacity:1, stroke-dashoffset:0, and stroke-opacity:1 which are default settings.
Since the stroke-linejoin attribute is set to round and not miter there's no need to set a stroke-miterlimit.
(Stroke-linejoin:round could be omitted in this case as the stroke-dasharray values are well adjusted)
And that is enough to draw the dashed frame:
The group that contains frame and lines has no usable information and can be removed.
Now to the def section: No perspective or gradients are used with the geometry descriptions - remove.
The markers seem to be unused - without them the icon shows no difference.
The same applies to the meta-data and the Sodipodi-data as well.
And finally the svg-tag: The content regarding Inkscape and Sodipodi are obsolete now and only one namespace declaration is really needed: xmlns="http://www.w3.org/2000/svg with its version="1.1".
Witte number of decimals reduced we receive:
That is short and readable.
Even the first two lines can be omitted and it it is drawn perfectly in Safari, Firefox, and FreeCAD as drawing and as importSVG.
(The importSVG needs another value to be set as the file is not created with Inkscape)
If wanted the paths could be tuned a bit and so the transformations can be removed.
Even the removed stuff if it is no garbage and necessary for further work within Inkscape it is not necessary to display icons (or templates) in FreeCAD.
It wasn't my intention to bash Inkscape. it is an excellent Tool to create illustrations.
If you don't mind how much code is generated and how readable its, there's nothing to complain about garbage.
But I still think it isn't the best choice to generate templates (or icons).
Typing a template (and bit of copy and paste as well) ensures you to get a readable and quite short svg-file.
To show what could be removed from Inkscape svg-files I grabbed a simple icon :
Code: Select all
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="64px"
height="64px"
id="svg2980"
sodipodi:version="0.32"
inkscape:version="0.91 r13725"
sodipodi:docname="Assembly_ConstraintColinear.svg"
inkscape:output_extension="org.inkscape.output.svg.inkscape"
version="1.1"
inkscape:export-filename="/home/user/Downloads/cad/mystuff/icons/assembly/Assembly_constraints/Assembly_Constraint_Align_32px.png"
inkscape:export-xdpi="45"
inkscape:export-ydpi="45">
<defs
id="defs2982">
<linearGradient
id="linearGradient3864">
<stop
id="stop3866"
offset="0"
style="stop-color:#71b2f8;stop-opacity:1;" />
<stop
id="stop3868"
offset="1"
style="stop-color:#002795;stop-opacity:1;" />
</linearGradient>
<inkscape:perspective
sodipodi:type="inkscape:persp3d"
inkscape:vp_x="0 : 32 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_z="64 : 32 : 1"
inkscape:persp3d-origin="32 : 21.333333 : 1"
id="perspective2988" />
<linearGradient
id="linearGradient3377">
<stop
id="stop3379"
offset="0"
style="stop-color:#faff2b;stop-opacity:1;" />
<stop
id="stop3381"
offset="1"
style="stop-color:#ffaa00;stop-opacity:1;" />
</linearGradient>
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient3377"
id="radialGradient3701"
gradientUnits="userSpaceOnUse"
cx="84.883324"
cy="77.042847"
fx="84.883324"
fy="77.042847"
r="19.467436"
gradientTransform="matrix(2.8492421,1.2585119,-0.4040415,0.9147407,-125.84131,-100.25805)" />
<linearGradient
id="linearGradient3007">
<stop
id="stop3009"
offset="0"
style="stop-color:#faff2b;stop-opacity:1;" />
<stop
id="stop3011"
offset="1"
style="stop-color:#ffaa00;stop-opacity:1;" />
</linearGradient>
<linearGradient
id="linearGradient3377-6">
<stop
id="stop3379-2"
offset="0"
style="stop-color:#00afff;stop-opacity:1;" />
<stop
id="stop3381-4"
offset="1"
style="stop-color:#0034ff;stop-opacity:1;" />
</linearGradient>
<radialGradient
r="19.467436"
fy="77.042847"
fx="84.883324"
cy="77.042847"
cx="84.883324"
gradientTransform="matrix(2.8492421,1.2585119,-0.4040415,0.9147407,-125.84131,-100.25805)"
gradientUnits="userSpaceOnUse"
id="radialGradient3017-8"
xlink:href="#linearGradient3377-6"
inkscape:collect="always" />
<linearGradient
id="linearGradient3835">
<stop
id="stop3837"
offset="0"
style="stop-color:#faff2b;stop-opacity:1;" />
<stop
id="stop3839"
offset="1"
style="stop-color:#ffaa00;stop-opacity:1;" />
</linearGradient>
<linearGradient
id="linearGradient3377-2">
<stop
id="stop3379-7"
offset="0"
style="stop-color:#faff2b;stop-opacity:1;" />
<stop
id="stop3381-8"
offset="1"
style="stop-color:#ffaa00;stop-opacity:1;" />
</linearGradient>
<radialGradient
r="19.467436"
fy="77.042847"
fx="84.883324"
cy="77.042847"
cx="84.883324"
gradientTransform="matrix(2.8492421,1.2585119,-0.4040415,0.9147407,-125.84131,-100.25805)"
gradientUnits="userSpaceOnUse"
id="radialGradient3017-6"
xlink:href="#linearGradient3377-2"
inkscape:collect="always" />
<linearGradient
id="linearGradient3835-1">
<stop
id="stop3837-0"
offset="0"
style="stop-color:#faff2b;stop-opacity:1;" />
<stop
id="stop3839-9"
offset="1"
style="stop-color:#ffaa00;stop-opacity:1;" />
</linearGradient>
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient4032"
id="radialGradient4112"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(-0.19157613,0.46621455,-1.1364164,-0.41904304,156.5648,24.076707)"
cx="86.836884"
cy="90.601151"
fx="86.836884"
fy="90.601151"
r="19.467436" />
<linearGradient
id="linearGradient4032">
<stop
style="stop-color:#71b2f8;stop-opacity:1;"
offset="0"
id="stop4034" />
<stop
style="stop-color:#002795;stop-opacity:1;"
offset="1"
id="stop4036" />
</linearGradient>
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient4032"
id="radialGradient4114"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.19036833,-0.61386357,1.99853,-0.19092801,-47.133199,165.45559)"
cx="113.50187"
cy="65.849281"
fx="113.50187"
fy="65.849281"
r="19.467436" />
<linearGradient
id="linearGradient3171">
<stop
style="stop-color:#71b2f8;stop-opacity:1;"
offset="0"
id="stop3173" />
<stop
style="stop-color:#002795;stop-opacity:1;"
offset="1"
id="stop3175" />
</linearGradient>
<radialGradient
r="19.467436"
fy="65.849281"
fx="113.50187"
cy="65.849281"
cx="113.50187"
gradientTransform="matrix(0.19036833,-0.61386357,1.99853,-0.19092801,-47.133199,165.45559)"
gradientUnits="userSpaceOnUse"
id="radialGradient3180"
xlink:href="#linearGradient4032"
inkscape:collect="always" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient4032-7"
id="radialGradient4112-9"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(-0.19157613,0.46621455,-1.1364164,-0.41904304,162.99236,26.56694)"
cx="86.836884"
cy="90.601151"
fx="86.836884"
fy="90.601151"
r="19.467436" />
<linearGradient
id="linearGradient4032-7">
<stop
style="stop-color:#71b2f8;stop-opacity:1;"
offset="0"
id="stop4034-3" />
<stop
style="stop-color:#002795;stop-opacity:1;"
offset="1"
id="stop4036-6" />
</linearGradient>
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient4032-7"
id="radialGradient4114-3"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.19036833,-0.61386357,1.99853,-0.19092801,-47.133199,165.45559)"
cx="113.50187"
cy="65.849281"
fx="113.50187"
fy="65.849281"
r="19.467436" />
<linearGradient
id="linearGradient3171-9">
<stop
style="stop-color:#71b2f8;stop-opacity:1;"
offset="0"
id="stop3173-7" />
<stop
style="stop-color:#002795;stop-opacity:1;"
offset="1"
id="stop3175-5" />
</linearGradient>
<radialGradient
r="19.467436"
fy="65.849281"
fx="113.50187"
cy="65.849281"
cx="113.50187"
gradientTransform="matrix(0.19036833,-0.61386357,1.99853,-0.19092801,-47.133199,165.45559)"
gradientUnits="userSpaceOnUse"
id="radialGradient3180-6"
xlink:href="#linearGradient4032-7"
inkscape:collect="always" />
<linearGradient
id="linearGradient4032-8">
<stop
style="stop-color:#71b2f8;stop-opacity:1;"
offset="0"
id="stop4034-4" />
<stop
style="stop-color:#002795;stop-opacity:1;"
offset="1"
id="stop4036-3" />
</linearGradient>
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient4032-8"
id="radialGradient4114-9"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.19036833,-0.61386357,1.99853,-0.19092801,-47.133199,165.45559)"
cx="113.50187"
cy="65.849281"
fx="113.50187"
fy="65.849281"
r="19.467436" />
<linearGradient
id="linearGradient3171-1">
<stop
style="stop-color:#71b2f8;stop-opacity:1;"
offset="0"
id="stop3173-0" />
<stop
style="stop-color:#002795;stop-opacity:1;"
offset="1"
id="stop3175-3" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient4032-0"
id="linearGradient3822"
x1="154.13527"
y1="33.267025"
x2="165.61629"
y2="46.429642"
gradientUnits="userSpaceOnUse" />
<linearGradient
id="linearGradient4032-0">
<stop
style="stop-color:#71b2f8;stop-opacity:1;"
offset="0"
id="stop4034-37" />
<stop
style="stop-color:#002795;stop-opacity:1;"
offset="1"
id="stop4036-1" />
</linearGradient>
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient4032-0"
id="radialGradient3703"
gradientUnits="userSpaceOnUse"
cx="132.70454"
cy="90.193245"
fx="132.70454"
fy="90.193245"
r="19.467436"
gradientTransform="matrix(-0.08162339,1.3949072,-1.1572569,-0.26963374,245.22773,-105.44363)" />
<linearGradient
id="linearGradient3284">
<stop
style="stop-color:#71b2f8;stop-opacity:1;"
offset="0"
id="stop3286" />
<stop
style="stop-color:#002795;stop-opacity:1;"
offset="1"
id="stop3288" />
</linearGradient>
<radialGradient
r="19.467436"
fy="90.193245"
fx="132.70454"
cy="90.193245"
cx="132.70454"
gradientTransform="matrix(-0.08162339,1.3949072,-1.1572569,-0.26963374,245.22773,-105.44363)"
gradientUnits="userSpaceOnUse"
id="radialGradient3294"
xlink:href="#linearGradient4032-0"
inkscape:collect="always" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3193"
id="linearGradient3191"
x1="11.757756"
y1="27.363932"
x2="21.165751"
y2="55.146343"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(-0.99995601,0.00937982,-0.00937982,-0.99995601,39.608226,75.665997)" />
<linearGradient
id="linearGradient3193">
<stop
id="stop3195"
offset="0"
style="stop-color:#68ff00;stop-opacity:1;" />
<stop
id="stop3197"
offset="1"
style="stop-color:#078b00;stop-opacity:1;" />
</linearGradient>
<linearGradient
y2="28.943888"
x2="8.4806471"
y1="44.720886"
x1="25.351208"
gradientTransform="matrix(-0.61089092,0.00703486,-0.0057303,-0.74996724,94.131825,75.276247)"
gradientUnits="userSpaceOnUse"
id="linearGradient4353"
xlink:href="#linearGradient3193"
inkscape:collect="always" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3801-6"
id="linearGradient3807-3"
x1="110"
y1="35"
x2="85"
y2="35"
gradientUnits="userSpaceOnUse"
spreadMethod="reflect"
gradientTransform="matrix(0.45833337,0,0,0.51724135,-28.625003,1.4482735)" />
<linearGradient
inkscape:collect="always"
id="linearGradient3801-6">
<stop
style="stop-color:#204a87;stop-opacity:1"
offset="0"
id="stop3803-7" />
<stop
style="stop-color:#729fcf;stop-opacity:1"
offset="1"
id="stop3805-5" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3801-6"
id="linearGradient3282"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.45833337,0,0,0.51724135,-28.053929,1.9502092)"
spreadMethod="reflect"
x1="110"
y1="35"
x2="85"
y2="35" />
<marker
inkscape:stockid="TriangleInS"
orient="auto"
refY="0"
refX="0"
id="TriangleInS-6"
style="overflow:visible"
inkscape:isstock="true">
<path
inkscape:connector-curvature="0"
id="path4510-0"
d="m 5.77,0 -8.65,5 0,-10 8.65,5 z"
style="fill:#280000;fill-opacity:1;fill-rule:evenodd;stroke:#280000;stroke-width:1pt;stroke-opacity:1"
transform="scale(-0.2,-0.2)" />
</marker>
<marker
inkscape:stockid="TriangleOutS"
orient="auto"
refY="0"
refX="0"
id="TriangleOutS-6"
style="overflow:visible"
inkscape:isstock="true">
<path
inkscape:connector-curvature="0"
id="path4519-2"
d="m 5.77,0 -8.65,5 0,-10 8.65,5 z"
style="fill:#280000;fill-opacity:1;fill-rule:evenodd;stroke:#280000;stroke-width:1pt;stroke-opacity:1"
transform="scale(0.2,0.2)" />
</marker>
<marker
inkscape:stockid="TriangleInS"
orient="auto"
refY="0"
refX="0"
id="TriangleInS"
style="overflow:visible"
inkscape:isstock="true">
<path
inkscape:connector-curvature="0"
id="path4510"
d="m 5.77,0 -8.65,5 0,-10 8.65,5 z"
style="fill:#cc0000;fill-opacity:1;fill-rule:evenodd;stroke:#cc0000;stroke-width:1pt;stroke-opacity:1"
transform="scale(-0.2,-0.2)" />
</marker>
<marker
inkscape:stockid="TriangleOutS"
orient="auto"
refY="0"
refX="0"
id="TriangleOutS"
style="overflow:visible"
inkscape:isstock="true">
<path
inkscape:connector-curvature="0"
id="path4519"
d="m 5.77,0 -8.65,5 0,-10 8.65,5 z"
style="fill:#cc0000;fill-opacity:1;fill-rule:evenodd;stroke:#cc0000;stroke-width:1pt;stroke-opacity:1"
transform="scale(0.2,0.2)" />
</marker>
<marker
inkscape:stockid="TriangleInS"
orient="auto"
refY="0"
refX="0"
id="TriangleInS-1"
style="overflow:visible"
inkscape:isstock="true">
<path
inkscape:connector-curvature="0"
id="path4510-8"
d="m 5.77,0 -8.65,5 0,-10 8.65,5 z"
style="fill:#ef5050;fill-opacity:1;fill-rule:evenodd;stroke:#ef5050;stroke-width:1pt;stroke-opacity:1"
transform="scale(-0.2,-0.2)" />
</marker>
<marker
inkscape:stockid="TriangleOutS"
orient="auto"
refY="0"
refX="0"
id="TriangleOutS-7"
style="overflow:visible"
inkscape:isstock="true">
<path
inkscape:connector-curvature="0"
id="path4519-9"
d="m 5.77,0 -8.65,5 0,-10 8.65,5 z"
style="fill:#ef5050;fill-opacity:1;fill-rule:evenodd;stroke:#ef5050;stroke-width:1pt;stroke-opacity:1"
transform="scale(0.2,0.2)" />
</marker>
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="3.1601563"
inkscape:cx="-33.789288"
inkscape:cy="56.245813"
inkscape:current-layer="layer1"
showgrid="true"
inkscape:document-units="px"
inkscape:grid-bbox="true"
inkscape:window-width="1375"
inkscape:window-height="876"
inkscape:window-x="65"
inkscape:window-y="24"
inkscape:window-maximized="1"
inkscape:snap-global="true"
inkscape:snap-bbox="true"
inkscape:snap-nodes="false">
<inkscape:grid
type="xygrid"
id="grid3192"
empspacing="2"
visible="true"
enabled="true"
snapvisiblegridlinesonly="true" />
</sodipodi:namedview>
<metadata
id="metadata2985">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
<dc:creator>
<cc:Agent>
<dc:title>[jmaustpc]</dc:title>
</cc:Agent>
</dc:creator>
<dc:title>Assembly_ConstraintParallel</dc:title>
<dc:date>2013-12-24</dc:date>
<dc:relation>http://www.freecadweb.org/wiki/index.php?title=Artwork</dc:relation>
<dc:publisher>
<cc:Agent>
<dc:title>FreeCAD</dc:title>
</cc:Agent>
</dc:publisher>
<dc:identifier>FreeCAD/src/Mod/Assembly/Gui/Resources/icons/constraints/Assembly_ConstraintParallel.svg</dc:identifier>
<dc:rights>
<cc:Agent>
<dc:title>FreeCAD LGPL2+</dc:title>
</cc:Agent>
</dc:rights>
<cc:license>https://www.gnu.org/copyleft/lesser.html</cc:license>
<dc:contributor>
<cc:Agent>
<dc:title>[agryson] Alexander Gryson</dc:title>
</cc:Agent>
</dc:contributor>
</cc:Work>
</rdf:RDF>
</metadata>
<g
id="layer1"
inkscape:label="Layer 1"
inkscape:groupmode="layer">
<g
id="g3760-8"
transform="matrix(0.39800085,0,0,0.49338099,18.710208,-4.5784768)" />
<rect
style="opacity:1;fill:none;fill-opacity:1;stroke:#ef2929;stroke-width:2.06500006;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:6.19500017,6.19500017;stroke-opacity:1;stroke-dashoffset:0"
id="rect4296"
width="61.935482"
height="61.935486"
x="1.0322579"
y="1.0322562" />
<rect
style="opacity:1;fill:none;fill-opacity:1;stroke:none;stroke-width:2;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:2, 2;stroke-dashoffset:0;stroke-opacity:1"
id="rect4226"
width="10.600741"
height="38.447464"
x="-5.3794808"
y="-22.704573" />
<rect
style="opacity:1;fill:none;fill-opacity:1;stroke:none;stroke-width:2;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:2, 2;stroke-dashoffset:0;stroke-opacity:1"
id="rect4228"
width="11.708282"
height="3.7972806"
x="-41.611866"
y="-16.059332" />
<rect
style="opacity:1;fill:none;fill-opacity:1;stroke:none;stroke-width:2;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:2, 2;stroke-dashoffset:0;stroke-opacity:1"
id="rect4230"
width="11.866502"
height="17.562422"
x="-62.022247"
y="-19.698391" />
<g
id="g4353-3"
transform="matrix(0.70749404,-0.70671931,0.70671931,0.70749404,-37.537841,46.887342)">
<path
sodipodi:nodetypes="cc"
inkscape:connector-curvature="0"
id="path4266-6-6"
d="M 24.945074,38.847113 50.39785,38.957138"
style="fill:none;fill-rule:evenodd;stroke:#280000;stroke-width:10;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<path
sodipodi:nodetypes="cc"
inkscape:connector-curvature="0"
id="path4266-7"
d="m 24.948749,38.661103 25.508433,0.166245"
style="fill:none;fill-rule:evenodd;stroke:#cc0000;stroke-width:6;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<path
sodipodi:nodetypes="cc"
inkscape:connector-curvature="0"
id="path4266-3-5"
d="m 24.200821,37.437628 25.452494,0.165963"
style="fill:none;fill-rule:evenodd;stroke:#ef5050;stroke-width:2;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
</g>
<g
id="g4353-3-3"
transform="matrix(0.70749404,-0.70671931,0.70671931,0.70749404,-6.7323942,15.429821)">
<path
sodipodi:nodetypes="cc"
inkscape:connector-curvature="0"
id="path4266-6-6-5"
d="M 24.945074,38.847113 50.39785,38.957138"
style="fill:none;fill-rule:evenodd;stroke:#280000;stroke-width:10;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<path
sodipodi:nodetypes="cc"
inkscape:connector-curvature="0"
id="path4266-7-6"
d="m 24.948749,38.661103 25.508433,0.166245"
style="fill:none;fill-rule:evenodd;stroke:#cc0000;stroke-width:6;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<path
sodipodi:nodetypes="cc"
inkscape:connector-curvature="0"
id="path4266-3-5-2"
d="m 24.200821,37.437628 25.452494,0.165963"
style="fill:none;fill-rule:evenodd;stroke:#ef5050;stroke-width:2;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
</g>
</g>
</svg>
Let's try to reduce it a bit.
The last 2 groups draw the lower and upper lines and contains 3 single stroke paths each.
We can reduce the groups which contains all identical attributes/properties. (I'll stick to "attributes" for both now...)
(We still need two groups due to different transformations.)
But first we remove redundant information.
- There's nothing to fill for a single stroke, and so the fill attributes can be removed
- No need for miter-related attributes for single strokes - 2 more to be removed
- No dashing involved - one attribute less
- For a simple svg-file there's no need for Inkscape and Sodipodi attributes nor for IDs - and three more to go
- Stroke-opacity:1 is default and doesn't need to be set (redundant information) - last one to be dumped
Finally the line-cap attribute is transferred to the group tag and only stroke (colour) and stroke-width stay with the Path tag.
That's what we need to draw both lines in the end (Quite readable, isn't it?):
Code: Select all
<g
id="lineLower"
style="stroke-linecap:round"
transform="matrix(0.70749404,-0.70671931,0.70671931,0.70749404,-37.537841,46.887342)">
<path
d="M 24.945074,38.847113 50.39785,38.957138"
style="stroke:#280000;stroke-width:10" />
<path
d="m 24.948749,38.661103 25.508433,0.166245"
style="stroke:#cc0000;stroke-width:6" />
<path
d="m 24.200821,37.437628 25.452494,0.165963"
style="stroke:#ef5050;stroke-width:2" />
</g>
<g
id="lineUpper"
style="stroke-linecap:round"
transform="matrix(0.70749404,-0.70671931,0.70671931,0.70749404,-6.7323942,15.429821)">
<path
d="M 24.945074,38.847113 50.39785,38.957138"
style="stroke:#280000;stroke-width:10" />
<path
d="m 24.948749,38.661103 25.508433,0.166245"
style="stroke:#cc0000;stroke-width:6" />
<path
d="m 24.200821,37.437628 25.452494,0.165963"
style="stroke:#ef5050;stroke-width:2" />
</g>
The involved group contains 4 rectangles. Three of them have stroke:none and fill:none which means nothing will be drawn and they are completely redundant. (That might not be Inkscape's fault...)
(The missing indentation seems to be no problem here)
We only need the framing strokes an no filling and so fill:none is mandatory but also implies that no further fill attributed are needed.
Obviously redundant are opacity:1, stroke-dashoffset:0, and stroke-opacity:1 which are default settings.
Since the stroke-linejoin attribute is set to round and not miter there's no need to set a stroke-miterlimit.
(Stroke-linejoin:round could be omitted in this case as the stroke-dasharray values are well adjusted)
And that is enough to draw the dashed frame:
Code: Select all
<g id="frame"
transform="matrix(0.39800085,0,0,0.49338099,18.710208,-4.5784768)" />
<rect
style="fill:none;stroke:#ef2929;stroke-width:2;stroke-linejoin:round;stroke-dasharray:6.2,6.2"
width="61.9" height="61.9" x="1.0" y="1.0" />
Now to the def section: No perspective or gradients are used with the geometry descriptions - remove.
The markers seem to be unused - without them the icon shows no difference.
The same applies to the meta-data and the Sodipodi-data as well.
And finally the svg-tag: The content regarding Inkscape and Sodipodi are obsolete now and only one namespace declaration is really needed: xmlns="http://www.w3.org/2000/svg with its version="1.1".
Witte number of decimals reduced we receive:
Code: Select all
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg id="Assembly_ConstraintColinear"
xmlns="http://www.w3.org/2000/svg"
width="64"
height="64"
version="1.1">
<g id="frame"
transform="matrix(0.4,0,0,0.5,18.7,-4.6)" />
<rect
style="fill:none;stroke:#ef2929;stroke-width:2;stroke-linejoin:round;stroke-dasharray:6.2,6.2"
width="61.9" height="61.9" x="1.0" y="1.0" />
<g id="lineLower"
style="stroke-linecap:round"
transform="matrix(0.7,-0.7,0.7,0.7,-37.5,46.9)">
<path
d="M 24.9,38.8 50.4,38.9"
style="stroke:#280000;stroke-width:10" />
<path
d="m 24.9,38.7 25.5,0.2"
style="stroke:#cc0000;stroke-width:6" />
<path
d="m 24.2,37.4 25.5,0.2"
style="stroke:#ef5050;stroke-width:2" />
</g>
<g id="lineUpper"
style="stroke-linecap:round"
transform="matrix(0.7,-0.7,0.7,0.7,-6.7,15.4)">
<path
d="M 24.9,38.8 50.4,38.9"
style="stroke:#280000;stroke-width:10" />
<path
d="m 24.9,38.7 25.5,0.2"
style="stroke:#cc0000;stroke-width:6" />
<path
d="m 24.2,37.4 25.5,0.2"
style="stroke:#ef5050;stroke-width:2" />
</g>
</svg>
Even the first two lines can be omitted and it it is drawn perfectly in Safari, Firefox, and FreeCAD as drawing and as importSVG.
(The importSVG needs another value to be set as the file is not created with Inkscape)
If wanted the paths could be tuned a bit and so the transformations can be removed.
Even the removed stuff if it is no garbage and necessary for further work within Inkscape it is not necessary to display icons (or templates) in FreeCAD.
Re: Drawing templates
This is what we know. Therefore we try to assure that only SVG that had been saved as "plain SVG" are committed. When you see that even the "plan SVG" in Inkscape has unnecessary code, please open a bug report for Inkscape that they can fix this.