Svg Namespace/es

Introduction
En los documentos SVG exportados por el Módulo de dibujo de FreeCAD y utilizados como páginas de plantillas, se pueden utilizar diversos atributos personalizados, originalmente para uso interno de FreeCAD, pero podrían también utilizarse por otras aplicaciones sobre FreeCAD en el futuro. Todos esos atributos utilizan el prefijo freecad: para el namespace. La URL de namespace definida en dichos documentos SVG refiere a esta página.

Like any XML document an SVG document consist of two sections:
 * Head: just one line to declare which version of the XML language is used for the instructions in the body of this document.
 * Body: a list of instructions. SVG documents enclose all instructions in -tags.
 * The opening tag contains information about the size and the used SVG namespaces.

Default namespace
The default SVG namespace used by FreeCAD is declared with this line:

The external link leads to a web site containing information about the namespace and its set of instructions. Attributes of this namespace are used without prefix.

Namespace extension
Attributes missing from the SVG namespace can be added by namespace extensions. FreeCAD uses such an extension for drawing templates. Templates for the Drawing workbench used four custom attributes which are marked with a "freecad:" prefix:
 * freecad:EditableText, this is still used with templates for the TechDraw workbench.
 * freecad:basepoint1
 * freecad:basepoint2
 * freecad:dimpoint

A namespace declaration is used to introduce the prefix and the link to the related web site, this page:

The link is not used to retrieve information or values at runtime, but it is the key to activate the custom attributes.

Drawing templates
In the SVG documents exported by FreeCAD's Drawing Workbench and used as (Drawing) page templates, the 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.
 * The Drawing workbench is no longer included in FreeCAD and so these Drawing templates are obsolate now.

TechDraw templates
The TechDraw workbench also uses SVG templates but can not create and export templates. It relies on freecad:EditableText for entries in title blocks.

Migration to freecad.org
Since the FreeCAD wiki, including this page, was migrated from freecadweb.org to freecad.org in version 0.21 the link has to be updated accordingly to:

Updated TechDraw templates now contain a key that can not activate the custom attributes when used with FreeCAD and as a result editable texts of recent templates are not recognised and so handled as plain text.
 * In such cases the "web" has to be manually re-inserted into the namespace declaration of the template.

It seems like can deal with either link address.

Utilización
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   tag), the following line:

In order to enable up to scale printing, the real word size has to be given in the width and height attributes of the SVG-Tag. The size of the document in user units, (px), has to be given in the viewBox attribute.

The following is to be formatted like the example below where:
 * xxx = pixel width
 * yyy = pixel height

Additional information for Working space and Title block may be added, and is defined on the Drawing templates page.

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 tag:

Define un texto en una plantilla que puede ser editado por FreeCAD.

Ejemplo:

freecad:basepoint1
Define el primer punto de un objeto de Acotación (representado como un grupo en un documento SVG). Este atributo se utiliza cuando se importa el fragmento de SVG en FreeCAD, para recrear el objeto de acotación. El grupo contiene rutas y otros elementos gráficos para representar correctamente el objeto de acotación en otra aplicación SVG.

Ejemplo:

freecad:basepoint2
Define el segundo punto de un objeto de Acotación (representado como un grupo en un documento SVG). Este atributo se utiliza cuando se importa el fragmento de SVG en FreeCAD, para recrear el objeto de acotación. El grupo contiene rutas y otros elementos gráficos para representar correctamente el objeto de acotación en otra aplicación SVG.

Ejemplo: see freecad:basepoint1

freecad:dimpoint
Define el punto de un objeto de Acotación a través del que pasa la línea de cota. Este atributo se utiliza cuando se importa el fragmento de SVG en FreeCAD, para recrear el objeto de acotación. El grupo contiene rutas y otros elementos gráficos para representar correctamente el objeto de acotación en otra aplicación SVG.

Ejemplo: see freecad:basepoint1

Example of code freecad:EditableText
This example is taken from a cartridge to a sheet A3_Landscape

Explanations
Beginning of the framework

Data on the framework

Beginning of the text block

All the information about the text that will be displayed

Coordinates and identity where the text will appear

Here AuthorName is the var managed by freecad:editable who saves the string to change that will be displayed

Coordinates and identity of the text that is displayed by default and   means the end of the block text

Other blocks texts and end  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