Drawing templates/fr: Difference between revisions

From FreeCAD Documentation
(Updating to match new version of source page)
(Updating to match new version of source page)
Line 2: Line 2:
==Création d'une feuille SVG==
==Création d'une feuille SVG==


Créer des modèles de feuille pour l'atelier de [[Drawing Module/fr|Mise en plan (Drawing)]] est très facile. Voir le tutoriel [[Drawing_Template_HowTo/fr|Comment créer ses feuilles simplement]] il s'agit de fichiers SVG qui peuvent être créés avec n'importe quelle application capable d'exporter au format de fichier SVG, tel que [http://www.inkscape.org Inkscape]. Seul deux directives doivent être respectées :
Creating templates for the Drawing module is very easy. See also the tutorial [[Drawing_Template_HowTo]]. Templates are svg files, created with any application capable of exporting svg files, such as [http://www.inkscape.org Inkscape]. However, you will often need to open the svg file in a text editor afterwards, to comply with the following rules. Only two rules must be followed:
=== Base rules ===
* Un pixel = un millimètre
* One pixel = one millimeter. You can have the page size specified inside the opening <svg> tag, either without units or with "mm". For example, these two forms are valid:
* Vous devez insérer, quelque part dans votre code SVG, et où vous désirez que le contenu de votre dessin apparaisse (par exemple à la fin du fichier, juste avant la dernière balise </svg>), la ligne suivante :
width="1067mm"
width="1067mm"
height="762mm"
height="762mm"
Line 13: Line 13:
viewBox="0 0 1067 762"
viewBox="0 0 1067 762"
* 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:
* 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:
{{Code|code=
<syntaxhighlight>
<!-- DrawingContent -->
<!-- DrawingContent -->
}}
</syntaxhighlight>
This text above (which is actually an XML comment) must be on a separate line, and not embedded in the middle of other pieces of text. Beware that if you reopen and resave your template in inkscape, after adding the above line, inkscape will keep the line, but will add other xml elements on the same line, causing the template to not work anymore. You will need to edit it with a text editor and isolate the comment above on its own line again.
This text above (which is actually an XML comment) must be on a separate line, and not embedded in the middle of other pieces of text. Beware that if you reopen and resave your template in inkscape, after adding the above line, inkscape will keep the line, but will add other xml elements on the same line, causing the template to not work anymore. You will need to edit it with a text editor and isolate the comment above on its own line again.
=== Namespace ===
=== Namespace ===
* Several objects (specifically those created with the [[Drawing_Draft]] command and if your template has editable texts) use a special [[Svg Namespace]] specific to FreeCAD. This makes FreeCAD able to detect specific items inside svg files, that other applications will just ignore. If you plan to use any of these, you must add this line inside the opening <svg> tag, for example together with the other xmlns lines added by inkscape:
* Several objects (specifically those created with the [[Drawing_Draft]] command and if your template has editable texts) use a special [[Svg Namespace]] specific to FreeCAD. This makes FreeCAD able to detect specific items inside svg files, that other applications will just ignore. If you plan to use any of these, you must add this line inside the opening <svg> tag, for example together with the other xmlns lines added by inkscape:
xmlns:freecad="http://www.freecadweb.org/wiki/index.php?title=Svg_Namespace"
xmlns:freecad="http://www.freecadweb.org/wiki/index.php?title=Svg_Namespace"
=== Title block ===
En plus de ces deux règles, à partir de FreeCAD 0,14, révision 2995, les informations sur le bloc de la bordure et le cartouche peuvent être ajoutés pour le modèle à utiliser par l'outil de projection orthographique. Ces informations définissent les emplacements où FreeCAD peut et ne peut pas placer les projections.
In addition to these rules, since FreeCAD 0.14, information about the Border and Title block can be added to the template for use by the orthographic projection tool. This information defines where FreeCAD can, and can not place the projections.


To define the Border, the following line must appear before the <metadata> tag in the svg file.
To define the Border, the following line must appear before the <metadata> tag in the svg file.
{{Code|code=
<syntaxhighlight>
<!-- Working space X1 Y1 X2 Y2 -->
<!-- Working space X1 Y1 X2 Y2 -->
}}
</syntaxhighlight>
Where X1, Y1, X2, Y2 are defined as:
Where X1, Y1, X2, Y2 are defined as:
* X1 is the X axis distance from the left edge of the page to the left side of the Border.
* X1 is the X axis distance from the left edge of the page to the left side of the Border.
Line 34: Line 35:


To define the Title block the following line must be inserted before the <metadata> tag and after the Working space tag.
To define the Title block the following line must be inserted before the <metadata> tag and after the Working space tag.
{{Code|code=
<syntaxhighlight>
<!-- Title block X1a Y1a X2a Y2a -->
<!-- Title block X1a Y1a X2a Y2a -->
}}
</syntaxhighlight>
Where X1a, Y1a, X2a, Y2a are defined as:
Where X1a, Y1a, X2a, Y2a are defined as:
* X1a is the X axis distance from the left edge of the page to the left side of the Title block
* X1a is the X axis distance from the left edge of the page to the left side of the Title block
Line 47: Line 48:


The following is an example of the code that defines the Working space and Title block areas that are to be inserted before the <metadata> tag. You needn't specify a title block, but if you do it must be defined on the next line immediately following the Working space:
The following is an example of the code that defines the Working space and Title block areas that are to be inserted before the <metadata> tag. You needn't specify a title block, but if you do it must be defined on the next line immediately following the Working space:
{{Code|code=
<syntaxhighlight>
<!-- Working space X1 Y1 X2 Y2 -->
<!-- Working space X1 Y1 X2 Y2 -->
<!-- Title block X1a Y1a X2a Y2a -->
<!-- Title block X1a Y1a X2a Y2a -->
}}
</syntaxhighlight>


Afin d'avoir une impression à la bonne échelle, la taille réelle du texte doit être fixée dans les attributs width et height de la section SVG-Tag. L'unité du document doit être donnée en (px), et doit être donnée dans l'attribut viewBox.
Afin d'avoir une impression à la bonne échelle, la taille réelle du texte doit être fixée dans les attributs width et height de la section SVG-Tag. L'unité du document doit être donnée en (px), et doit être donnée dans l'attribut viewBox.
Line 57: Line 58:
* xxx = pixel width
* xxx = pixel width
* yyy = pixel height
* yyy = pixel height
{{Code|code=
<syntaxhighlight>
width="xxxmm"
width="xxxmm"
height="yyymm"
height="yyymm"
viewBox="0 0 xxx yyy"
viewBox="0 0 xxx yyy"
}}
</syntaxhighlight>


* Plusieurs attributs personnalisés peuvent être placés dans les modèles. La liste des attributs pris en charge actuellement est disponible sur la page [[Svg Namespace/fr|Svg Namespace]].
* Plusieurs attributs personnalisés peuvent être placés dans les modèles. La liste des attributs pris en charge actuellement est disponible sur la page [[Svg Namespace/fr|Svg Namespace]].

Revision as of 21:13, 11 October 2016

Création d'une feuille SVG

Creating templates for the Drawing module is very easy. See also the tutorial Drawing_Template_HowTo. Templates are svg files, created with any application capable of exporting svg files, such as Inkscape. However, you will often need to open the svg file in a text editor afterwards, to comply with the following rules. Only two rules must be followed:

Base rules

  • One pixel = one millimeter. You can have the page size specified inside the opening <svg> tag, either without units or with "mm". For example, these two forms are valid:
width="1067mm"
height="762mm"

or

width="1067"
height = "762"

Although svg supports inches ("42 in"), these are currently not supported by FreeCAD, so it's always better to have your svg page size specified in millimeters. The "viewBox" attribute must have the same value, for example:

viewBox="0 0 1067 762"
  • 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:

This text above (which is actually an XML comment) must be on a separate line, and not embedded in the middle of other pieces of text. Beware that if you reopen and resave your template in inkscape, after adding the above line, inkscape will keep the line, but will add other xml elements on the same line, causing the template to not work anymore. You will need to edit it with a text editor and isolate the comment above on its own line again.

Namespace

  • Several objects (specifically those created with the Drawing_Draft command and if your template has editable texts) use a special Svg Namespace specific to FreeCAD. This makes FreeCAD able to detect specific items inside svg files, that other applications will just ignore. If you plan to use any of these, you must add this line inside the opening <svg> tag, for example together with the other xmlns lines added by inkscape:
xmlns:freecad="http://www.freecadweb.org/wiki/index.php?title=Svg_Namespace"

Title block

In addition to these rules, since FreeCAD 0.14, information about the Border and Title block can be added to the template for use by the orthographic projection tool. This information defines where FreeCAD can, and can not place the projections.

To define the Border, the following line must appear before the <metadata> tag in the svg file.

Where X1, Y1, X2, Y2 are defined as:

  • X1 is the X axis distance from the left edge of the page to the left side of the Border.
  • Y1 is the Y axis distance from the top edge of the page to the top of the Border.
  • X2 is the X axis distance from the left edge of the page to the right side of the Border.
  • Y2 is the Y axis distance from the top edge of the page to the bottom of the Border.

To define the Title block the following line must be inserted before the <metadata> tag and after the Working space tag.

Where X1a, Y1a, X2a, Y2a are defined as:

  • X1a is the X axis distance from the left edge of the page to the left side of the Title block
  • Y1a is the Y axis distance from the top edge of the page to the top of the Title block
  • X2a is the X Axis distance from the left edge of the page to the right side of the Title block
  • Y2a is the Y axis distance from the top edge of the page to the bottom of the Title block
  • X1a <= X1 or X2a >= X2
  • Y1a <= Y1 or Y2a >= Y2

The following is an example of the code that defines the Working space and Title block areas that are to be inserted before the <metadata> tag. You needn't specify a title block, but if you do it must be defined on the next line immediately following the Working space:

Afin d'avoir une impression à la bonne échelle, la taille réelle du texte doit être fixée dans les attributs width et height de la section SVG-Tag. L'unité du document doit être donnée en (px), et doit être donnée dans l'attribut viewBox.

Ce qui suit doit être formaté comme dans l'exemple ci-dessous où:

  • xxx = pixel width
  • yyy = pixel height
width="xxxmm"
height="yyymm"
viewBox="0 0 xxx yyy"
  • Plusieurs attributs personnalisés peuvent être placés dans les modèles. La liste des attributs pris en charge actuellement est disponible sur la page Svg Namespace.

Templates au format DXF

Depuis la version 0.15, FreeCAD peut exporter une page Drawing au format DXF. Ce système utilise également des templates. Si un fichier DXF avec le même nom se trouve dans le même dossier que le modèle SVG utilisé pour une page, il sera utilisé pour l'exportation. Si non, un modèle vide sera créé par défaut.

Par conséquence, si vous créez vos propres templates au format SVG, et que vous souhaitez exporter les pages de dessin que vous créez au format DXF, il vous suffit de créer un modèle DXF correspondant, et de l'enregistrer avec le même nom et dans le même dossier.

Les modèles DXF peuvent être créés avec n'importe quelle application qui produit des fichiers au format DXF, comme LibreCAD. Vous devez ensuite les éditer avec un éditeur de texte, et ajouter deux lignes supplémentaires, une au début ou à la fin de la section BLOCKS, et l'autre au début ou à la fin de la section ENTITIES, entre ces deux lignes se trouve l'espace où FreeCAD va ajouter ses propres blocs et entités.

Un modèle (feuille de dessin) très simple ressemble à ceci:

999
FreeCAD DXF exporter v0.15
0
SECTION
2
HEADER
9
$ACADVER
1
AC1009
0
ENDSEC
0
SECTION
2
BLOCKS
$blocks
0
ENDSEC
0
SECTION
2
ENTITIES
$entities
0
ENDSEC
0
EOF

Le modèle ci-dessus ne contient aucune entité. Si vous créez votre fichier DXF avec une application de CAO, il y aura probablement beaucoup plus de contenu dans les sections HEADER, BLOCKS et ENTITIES.

Les deux lignes que FreeCAD recherchera sont "$blocks" et "$entities". Elles doivent exister dans le modèle, et doivent être placées leur place. Vous pouvez choisir de les placer juste après les lignes BLOCKS ou ENTITIES, ce qui est plus facile (il suffit d'utiliser la fonction "recherche" de votre éditeur de texte pour les trouver), ou à la fin, juste avant les lignes "0 ENDSEC" (méfiez-vous il y en a un pour chaque section, assurez-vous d'utiliser ceux relatifs aux BLOCKS et ENTITIES). Cette dernière méthode sera utilisée pour placer les objets de FreeCAD après que les objets soient définis dans le modèle, ce qui devrait être plus logique.

Modèles A3

A3 Classic:

A3 Clean:

A3 Modern:

A3 Showcase:

A3 Landscape english:

A4 Templates

Landscape:

A4 Portrait 1 english:

US Letter Templates

US Letter Landscape:


US Letter portrait:

US Letter ds Landscape:

US Legal ds Landscape:

US Ledger ds Landscape:

Autres standards disponibles