Svg Namespace/fr: Difference between revisions
(mise à jour sur le nouveau lien "http://www.freecadweb.org/wiki/index.php?title=Svg_Namespace") |
(Updating to match new version of source page) |
||
Line 1: | Line 1: | ||
In the [http://en.wikipedia.org/wiki/Scalable_Vector_Graphics SVG] documents exported by FreeCAD's [[Drawing Module|Drawing Module]] and used as page [[Drawing templates|templates]], several custom [http://www.w3schools.com/xml/xml_attributes.asp attributes] can be used, originally for FreeCAD's own internal use, but could also be used by other FreeCAD-aware applications in the future. These attributes all use the '''freecad:''' [http://www.w3schools.com/xml/xml_namespaces.asp namespace] prefix. The namespace URL defined in those SVG documents refers to this page. |
|||
=Svg_Namespace/fr= |
|||
__TOC__ |
|||
Dans les documents [http://fr.wikipedia.org/wiki/Scalable_Vector_Graphics SVG] exportés par le [[Drawing Module/fr|Module de dessin]] de FreeCAD et utilisés comme [[Drawing templates/fr|template (modèle)]] de page, plusieurs [http://www.w3schools.com/xml/xml_attributes.asp attributs] personnalisés peuvent être utilisés, à l'origine pour un usage interne de FreeCAD, mais pourraient aussi être utilisés par d'autres applications FreeCAD à l'avenir. Tous ces attributs utilisent le préfixe '''freecad:[http://www.w3schools.com/xml/xml_namespaces.asp namespaces]'''. L'URL '''Namespaces''', défini dans le document [http://fr.wikipedia.org/wiki/Scalable_Vector_Graphics SVG] fait référence à cette page. |
|||
== |
==Usage== |
||
One pixel = one millimeter. |
|||
Pour utiliser l'attribut FreeCAD, dans vos documents '''SVG''', vous devez d'abord définir '''FreeCAD namespace''', comme attribut de la balise (tag) d'ouverture <svg> : |
|||
You must insert, somewhere inside your svg code, where you want the contents of the drawing to appear (for example at the end of the file, just before the last '''</svg>''' tag), the following line: |
|||
<svg |
|||
xmlns:freecad="http://www.freecadweb.org/wiki/index.php?title=Svg_Namespace" |
|||
> |
|||
<syntaxhighlight> |
|||
==Attributs== |
|||
<!-- DrawingContent --> |
|||
</syntaxhighlight> |
|||
===freecad:EditableText=== |
|||
<syntaxhighlight> |
|||
Définit un texte dans un '''template''', qui peut être édité par FreeCAD. |
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?> |
|||
<svg |
|||
xmlns:freecad="http://www.freecadweb.org/wiki/index.php?title=Svg_Namespace" |
|||
</syntaxhighlight> |
|||
Additional information for Working space and Title block may be added, and is defined on the [[Drawing templates]] page. |
|||
Exemple: |
|||
==Attributes== |
|||
===[[#Example_of_code freecad:EditableText|freecad:EditableText]]=== |
|||
To use any of the '''freecad:''' attributes in your SVG documents, you must first define the freecad namespace as an attribute of the opening <svg> tag: |
|||
Defines a text in a template that can be edited by FreeCAD. |
|||
Example: |
|||
<syntaxhighlight> |
|||
<text freecad:EditableText="MyTitleText"> |
<text freecad:EditableText="MyTitleText"> |
||
<tspan>This is a title</tspan> |
<tspan>This is a title</tspan> |
||
</text> |
</text> |
||
</syntaxhighlight> |
|||
===freecad:basepoint1=== |
===freecad:basepoint1=== |
||
Defines the first point of a [[Draft Dimension]] object (represented as a group in a SVG document). This attribute is used when importing the SVG fragment in FreeCAD, in order to recreate the dimension object. The group contains paths and other graphical items to correctly render the dimension object in other SVG applications. |
|||
Exemple: |
|||
Example: |
|||
<syntaxhighlight> |
|||
<g freecad:basepoint1="0.5 4.34" freecad:basepoint2="2.4 5.8" dimpoint="3.2 7.76"> |
<g freecad:basepoint1="0.5 4.34" freecad:basepoint2="2.4 5.8" dimpoint="3.2 7.76"> |
||
<path d="..."> |
<path d="..."> |
||
</g> |
</g> |
||
</syntaxhighlight> |
|||
===freecad:basepoint2=== |
===freecad:basepoint2=== |
||
Defines the second point of a [[Draft Dimension|Draft Dimension]] object (represented as a group in a SVG document). This attribute is used when importing the SVG fragment in FreeCAD, in order to recreate the dimension object. The group contains paths and other graphical items to correctly render the dimension object in other SVG applications. |
|||
Example: see [[#freecad:basepoint1|freecad:basepoint1]] |
|||
===freecad:dimpoint=== |
===freecad:dimpoint=== |
||
Defines the point of a [[Draft Dimension]] object through which the dimension line passes. This attribute is used when importing the SVG fragment in FreeCAD, in order to recreate the dimension object. The group contains paths and other graphical items to correctly render the dimension object in other SVG applications. |
|||
Example: see [[#freecad:basepoint1|freecad:basepoint1]] |
|||
===Example of code freecad:EditableText=== |
|||
This example is taken from a cartridge to a sheet [[Misc_templates#A3_Landscape_US_Text_Complet_With_Convention_US|A3_Landscape]] |
|||
====1 : Title without textedit==== |
|||
[[Image:Svg Namespace 01.png|300px]] |
|||
<syntaxhighlight> |
|||
<g |
|||
id="g3587"> |
|||
<text |
|||
sodipodi:linespacing="119.00001%" |
|||
id="text3482" |
|||
y="229.10912" |
|||
x="220.8476" |
|||
style="font-size:1.97555566px;font-style:normal;font-weight:normal;line-height:119.00000572%;letter-spacing:0.01975556px;word-spacing:0.00846667px;writing-mode:lr-tb;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans;-inkscape-font-specification:Sans" |
|||
xml:space="preserve"><tspan |
|||
y="229.10912" |
|||
x="220.8476" |
|||
id="tspan3484" |
|||
sodipodi:role="line">AUTHOR NAME :</tspan></text> |
|||
</syntaxhighlight> |
|||
====2 : Title with textedit==== |
|||
[[Image:Svg Namespace 02.png|300px]] |
|||
<syntaxhighlight> |
|||
<g |
|||
style="fill:none;stroke:#000000;stroke-width:0.13;stroke-linecap:butt;stroke-linejoin:miter" |
|||
id="g578-7" |
|||
transform="translate(0,4)"> |
|||
<text |
|||
xml:space="preserve" |
|||
style="font-size:4px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:sans;-inkscape-font-specification:sans" |
|||
x="220.9935" |
|||
y="228.95425" |
|||
id="text3331" |
|||
sodipodi:linespacing="125%" |
|||
freecad:editable="AuthorName"><tspan |
|||
sodipodi:role="line" |
|||
id="tspan3333" |
|||
x="220.9935" |
|||
y="228.95425">AUTHOR NAME</tspan></text> |
|||
<text |
|||
... |
|||
... |
|||
... |
|||
... </text> |
|||
</g> |
|||
</syntaxhighlight> |
|||
====Explanations==== |
|||
<syntaxhighlight> |
|||
<g |
|||
</syntaxhighlight> |
|||
Beginning of the framework |
|||
<syntaxhighlight> |
|||
style="fill:none;stroke:#000000;stroke-width:0.13;stroke-linecap:butt;stroke-linejoin:miter" |
|||
id="g578-7" |
|||
transform="translate(0,4)"> |
|||
</syntaxhighlight> |
|||
Data on the framework |
|||
<syntaxhighlight> |
|||
<text |
|||
</syntaxhighlight> |
|||
Beginning of the text block |
|||
<syntaxhighlight> |
|||
xml:space="preserve" |
|||
style="font-size:4px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:sans;-inkscape-font-specification:sans" |
|||
</syntaxhighlight> |
|||
All the information about the text that will be displayed |
|||
<syntaxhighlight> |
|||
x="220.9935" |
|||
y="228.95425" |
|||
id="text3331" |
|||
sodipodi:linespacing="125%" |
|||
</syntaxhighlight> |
|||
Coordinates and identity where the text will appear |
|||
<syntaxhighlight> |
|||
freecad:editable="AuthorName"><tspan |
|||
</syntaxhighlight> |
|||
Here '''AuthorName''' is the var managed by '''freecad:editable''' who saves the string to change that will be displayed |
|||
<syntaxhighlight> |
|||
sodipodi:role="line" |
|||
id="tspan3333" |
|||
x="220.9935" |
|||
y="228.95425">AUTHOR NAME</tspan></text> |
|||
</syntaxhighlight> |
|||
Coordinates and identity of the text that is displayed by default and '''</text>''' means the end of the block text |
|||
<syntaxhighlight> |
|||
<text |
|||
... |
|||
... |
|||
... |
|||
... </text> |
|||
</g> |
|||
</syntaxhighlight> |
|||
Other blocks texts and end '''</g>''' the framework grouping text blocks |
|||
It is possible after having worked the Inkscape SVG file as the file no longer works, it is possible that information has gone missing. |
|||
Then check that the edit text is not modified |
|||
Example : |
|||
* '''editable''' = "AuthorName" |
|||
* replace by '''freecad:editable''' = "AuthorName" |
|||
==Other attributes availlables== |
|||
See [[Drawing_templates]] |
|||
Exemple: voir [[#freecad:basepoint1]] |
|||
<languages/> |
|||
<br> |
|||
{{languages/fr | {{en|Svg_Namespace}} {{es|Svg_Namespace/es}} {{it|Svg_Namespace/it}} }} |
Revision as of 20:36, 16 January 2014
In the SVG documents exported by FreeCAD's Drawing Module and used as page templates, several custom attributes can be used, originally for FreeCAD's own internal use, but could also be used by other FreeCAD-aware applications in the future. These attributes all use the freecad: namespace prefix. The namespace URL defined in those SVG documents refers to this page.
Usage
One pixel = one millimeter.
You must insert, somewhere inside your svg code, where you want the contents of the drawing to appear (for example at the end of the file, just before the last </svg> tag), the following line:
<!-- DrawingContent -->
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:freecad="http://www.freecadweb.org/wiki/index.php?title=Svg_Namespace"
Additional information for Working space and Title block may be added, and is defined on the Drawing templates page.
Attributes
freecad:EditableText
To use any of the freecad: attributes in your SVG documents, you must first define the freecad namespace as an attribute of the opening <svg> tag:
Defines a text in a template that can be edited by FreeCAD.
Example:
<text freecad:EditableText="MyTitleText">
<tspan>This is a title</tspan>
</text>
freecad:basepoint1
Defines the first point of a Draft Dimension object (represented as a group in a SVG document). This attribute is used when importing the SVG fragment in FreeCAD, in order to recreate the dimension object. The group contains paths and other graphical items to correctly render the dimension object in other SVG applications.
Example:
<g freecad:basepoint1="0.5 4.34" freecad:basepoint2="2.4 5.8" dimpoint="3.2 7.76">
<path d="...">
</g>
freecad:basepoint2
Defines the second point of a Draft Dimension object (represented as a group in a SVG document). This attribute is used when importing the SVG fragment in FreeCAD, in order to recreate the dimension object. The group contains paths and other graphical items to correctly render the dimension object in other SVG applications.
Example: see freecad:basepoint1
freecad:dimpoint
Defines the point of a Draft Dimension object through which the dimension line passes. This attribute is used when importing the SVG fragment in FreeCAD, in order to recreate the dimension object. The group contains paths and other graphical items to correctly render the dimension object in other SVG applications.
Example: see freecad:basepoint1
Example of code freecad:EditableText
This example is taken from a cartridge to a sheet A3_Landscape
1 : Title without textedit
<g
id="g3587">
<text
sodipodi:linespacing="119.00001%"
id="text3482"
y="229.10912"
x="220.8476"
style="font-size:1.97555566px;font-style:normal;font-weight:normal;line-height:119.00000572%;letter-spacing:0.01975556px;word-spacing:0.00846667px;writing-mode:lr-tb;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans;-inkscape-font-specification:Sans"
xml:space="preserve"><tspan
y="229.10912"
x="220.8476"
id="tspan3484"
sodipodi:role="line">AUTHOR NAME :</tspan></text>
2 : Title with textedit
<g
style="fill:none;stroke:#000000;stroke-width:0.13;stroke-linecap:butt;stroke-linejoin:miter"
id="g578-7"
transform="translate(0,4)">
<text
xml:space="preserve"
style="font-size:4px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:sans;-inkscape-font-specification:sans"
x="220.9935"
y="228.95425"
id="text3331"
sodipodi:linespacing="125%"
freecad:editable="AuthorName"><tspan
sodipodi:role="line"
id="tspan3333"
x="220.9935"
y="228.95425">AUTHOR NAME</tspan></text>
<text
...
...
...
... </text>
</g>
Explanations
<g
Beginning of the framework
style="fill:none;stroke:#000000;stroke-width:0.13;stroke-linecap:butt;stroke-linejoin:miter"
id="g578-7"
transform="translate(0,4)">
Data on the framework
<text
Beginning of the text block
xml:space="preserve"
style="font-size:4px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:sans;-inkscape-font-specification:sans"
All the information about the text that will be displayed
x="220.9935"
y="228.95425"
id="text3331"
sodipodi:linespacing="125%"
Coordinates and identity where the text will appear
freecad:editable="AuthorName"><tspan
Here AuthorName is the var managed by freecad:editable who saves the string to change that will be displayed
sodipodi:role="line"
id="tspan3333"
x="220.9935"
y="228.95425">AUTHOR NAME</tspan></text>
Coordinates and identity of the text that is displayed by default and </text> means the end of the block text
<text
...
...
...
... </text>
</g>
Other blocks texts and end </g> the framework grouping text blocks
It is possible after having worked the Inkscape SVG file as the file no longer works, it is possible that information has gone missing.
Then check that the edit text is not modified
Example :
- editable = "AuthorName"
- replace by freecad:editable = "AuthorName"