Drawing Template HowTo/it

Questo tutorial è una guida per creare la base e per modificare un file grafico SVG da usare come un modello di squadratura nell'ambiente Drawing di FreeCAD. A partire dalla versione 0.14, rev. 2995, di FreeCAD, il modulo Drawing proietta su un foglio di disegno la parte selezionata del modello attenendosi alle regole stabilite nel documento SVG. Tali regole definiscono l'area di lavoro, in coordinate X e Y, dove FreeCAD può proiettare la parte senza invadere lo spazio occupato dal blocco titolo o tabella.

Chiunque progetti dei modelli da condividere dovrebbe seguire tutte le direttive di base enunciate in questo tutorial. Nel modello sono inclusi i tag per “Working space” (area di lavoro) e “Title block” (blocco titolo) che non sono inclusi nelle versioni precedenti di FreeCAD. Includendo questi tag si rende il modello completamente funzionante per la versione attuale.

Questo tutorial inizia dalla creazione di una pagina in Inkscape e la costruzione di un disegno di base del modello. Continua con l'aggiunta di alcune opere grafiche per dare al proprio lavoro un tocco di personalizzazione o di professionalità. Dopo, si vedrà come modificare il nuovo modello e quali informazioni deve contenere per essere utilizzo con FreeCAD.

Questo tutorial presuppone che il lettore abbia una conoscenza di base di Inkscape e di un editor di testo.

Impostare la pagina
Iniziare con un nuovo documento in Inkscape. In riferimento alla pagina del Wiki di FreeCAD sul disegno di modelli: un pixel = un millimetro. Questo significa che se si vuole creare un modello per una pagina di dimensioni ANSI A (letter size), che è 216mm X 279mm, il modello deve avere le dimensioni di 216px X 279px. Se si desidera che la pagina sia orientata orizzontale, questi numeri devono essere invertiti. In questa esercitazione, viene utilizzato l'orientamento orizzontale. La pagina è definito in 279px per la larghezza e 216px per l'altezza.

In Inkscape, aprire il menu File e selezionare Proprietà del documento, si dovrebbe vedere la finestra delle Proprietà del documento. Modificare la larghezza e l'altezza come detto prima e assicursi che l'unità impostata sia px.



Ora si dispone di un documento Inkscape che è largo 279px e alto 216px e si può procedere e aggiungendo un bordo.

Il bordo
Quindi, creare il bordo. Sebbene ai fini di questa esercitazione non sia necessario, si farà riferimento in seguito.

Usare lo strumento “Disegna tracciati e linee dritte”, e selezionare la Modalità “Crea una sequenza di segmenti parassiali”, creare un rettangolo entro i confini del documento. Quando il rettangolo è chiuso, cliccare sullo strumento "Seleziona e trasforma oggetti". Ora il rettangolo dovrebbe apparire selezionato. In caso contrario, utilizzare lo strumento e selezionarlo.

Utilizzando le coordinate orizzontali e verticali di impostazioni di selezione, insieme alle impostazioni di Larghezza e Altezza della selezione, posizionare il bordo a 10 unità, (px) dai bordi del documento. Inserire i seguenti valori: per X inserire 10, per Y inserire 10, per W inserire 259, e per H inserire 196. Si vede che questo imposta l'angolo inferiore sinistro del rettangolo disegnato a 10 unità dal lato sinistro e 10 dal lato inferiore dell'angolo inferiore sinistro della pagina. Inserendo Larghezza e Altezza si dimensiona e si centra il rettangolo che così ora è spaziato uniformemente entro i confini del documento.



The Title Block
Next you will make a Title Block. This is where the editable text about the Drawing will be entered when used with FreeCAD. This tutorial will use a simple example. The Title Block can be as simple, or complex as one wishes.

This example Title Block will contain the following, Project Name, Date, Scale, and Author. It will then be placed in the lower right hand corner of the border.

First you start with making a rectangle somewhere within the borders of the document. Make it in the same manner as you did the border. Then divide it into 4 sections as you see fit. Once done, Select the box and the dividing lines, make them a group, and locate it at X =169, Y 10 and size it W=100, H=50, in the same manner done for the border.



Fixed Text
Next, you will add the text blocks that will be fixed within the Title Block. These will be Project Name, Date, Scale, and Author. To do this, select the text tool and click it somewhere in the document. Then simply type in the text, one block to each name. Click the text tool in the document and after selecting the appropriate font size, (size 6 works for this example), type in Project Name. Then move the pointer to a new location and click again, starting a new text block and type in Date. Do the same for Scale, and Author. Now using the select tool the individual text blocks can be moved by dragging and / or the arrow keys to place them into the desired locations.

After the text blocks are placed they should all be selected, along with the title block and made a group. At this point the Title Block and the fixed text are joined together as one.



Editable Text
Now you will add the text blocks that we will want to be editable from within FreeCAD. In the same manner that the fixed text was done, the editable text will be made and placed in their respective locations, You will use the text as follows. NAME, DATE, SCALE, AUTHOR, and make them font size 8. Once the text is placed, select the 4 text fields you wish to be editable and make them a separate group. Do not include them into the same group as the Title Block or Border. For now you are done with the editable text. After the graphical part of the template is done, you will complete the process of making this text editable from within FreeCAD. For now, we will complete this part with adding a little artwork to your template.



Adding Artwork
Now that the basic template is done, you can add a bit of artwork to it. This can be whatever you wish. A company or personal graphical logo, a picture or rendering of the project, etc.. For this tutorial the FreeCAD logo, found in the Artwork section of the FreeCAD Wiki will be used. You can simply right click on it and select save image. Once saved, import it into Inkscape. With the image imported into your template, it can be sized and placed where ever you may wish it to be. Adding artwork to your template is as easy as that.

At this point, you can select File, then Save. In this tutorial, the file was simply named example.svg but you may name it whatever you wish.



Opening The File With A Text Editor
Once your template is saved, open it with your favorite text editor. This can be something as basic as Windows Notepad or a more complete editor like Kate. In this tutorial, Kate will be used and all screenshots will be of that editor.

Opening the SVG file with your text editor you will see the following.



The “xmlns:freecad” Tag
The first thing is to insert the following line into the document. This line is the SVG namespace declaration and must be provided so that all SVG elements are identified as belonging to the SVG namespace. xmlns:freecad="http://www.freecadweb.org/wiki/index.php?title=Svg_Namespace" This line is added immediately following the first <svg tag, and in the same margin spacing as the other xmlns entries are placed.



Working space and Title block Tags
The next lines to add will be the Working space and Title block tag. These tags and their usage are defined on the Drawing Templates page. While these tags are not required, newer versions of the FreeCAD Drawing Workbench benefit from them and they will not affect older versions.

The Working space tag is used to define the space that FreeCAD may make projections into. This allows FreeCAD to make automatic projections on the drawing template and stay within the border that has be drawn, or withing any defined space on the page.

The Title block tag is used to define where within the Working space it resides. This information is used by FreeCAD to avoid using that space within the Working space. This can be referred to as Title block avoidance.

If both tags are used, the Working space tag must appear first and be immediately followed by the title block tag. Both tags must also appear before the first <metadata tag. These tags can be placed either at the top, following the <? xml tag or immediately before the <metadata tag. For this tutorial we will place them at the top.

The Working space Tag
The first tag is the Working space tag and is formated as follows. 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 the 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 the the bottom of the Border.

So for this tutorial template, the Working space tag will be.

The Title block Tag
The next tag will be the Title block tag and is formated as follows: 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 the 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 the the bottom of the Title block
 * X1a <= X1 or X2a >= X2
 * Y1a <= Y1 or Y2a >= Y2

Again, referencing the template created with this tutorial, the title block tag will be as follows: Placing these two tags, in proper order at the top of the document looks like this:



The freecad:editable Tag
Adding the freecad:editable tags into the SVG document allows FreeCAD to access the defined text blocks for editing. For those blocks of text that you wish to be editable from within FreeCAD, do the following.

Search down through the SVG document until you find the section that contains the text you wish to have editable. When making the template, you placed these in a group, and as a result, they should appear within the document as a group as well. Once this group of text elements is located, you will add the line freecad:editable=” “ to each text block where the text that you wish to make editable is contained within the quote marks. Place them as shown for all four lines of text to be editable.



The DrawingContent Tag
The last tag that is needed in the Template is the DrawingContent tag. Without it, FreeCAD can not access the drawing template. This tag informs FreeCAD where within the document it may write it's projections and other attributes. It is the one tag that must be within the SVG document for the drawing template to work with FreeCAD.

Questo tag è formattato come segue e si inserisce immediatamente prima dell'ultimo tag .



That's it. The SVG document can now be saved and used with FreeCAD.

Complete Example Template
Below is the finished SVG template. Sense it is in SVG format, you can save and open it in your text editor for review as reference to this tutorial and the creation of your own templates.



Tools
The two tools used in this tutorial were Inkscape and Kate. They can be found by following the links provided below.


 * Inkscape
 * Kate