Шаблоны чертежей

From FreeCAD Documentation
Jump to navigation Jump to search
This page is a translated version of the page Drawing templates and the translation is 8% complete.
Outdated translations are marked like this.
Other languages:
Deutsch • ‎English • ‎español • ‎français • ‎italiano • ‎polski • ‎svenska • ‎čeština • ‎русский

Создание 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:

Создавать шаблоны для модуля чертежей (Drawing) легко и приятно. Смотрите также руководство по созданию шаблонов чертежей. Шаблон — это файл в формате SVG, который можно создать в любой программе способной экспортировать SVG, например Inkscape. Необходимо соблюдать только два правила:

  • 1 пиксель = 1 миллиметру.
  • Где-нибудь в SVG-код, там где будет размещен чертеж, требуется вставить (например, в конец файла перед тегом </svg>) следующую строку:


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:
 <!-- DrawingContent -->

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.


  • Several objects (specifically those created with the Draft_Drawing 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:

Дополнительно, начиная с FreeCAD 0.14 (ревизия 2995), в SVG-коде можно указать положение рамки и основной надписи. Так FreeCAD будет знать где можно располагать проекции, а где нет.

Чтобы задать положение рамки, необходимо вставить следующую строку перед тегом <metadata>:

<!-- Working space X1 Y1 X2 Y2 -->


  • X1 — расстояние по оси X между левой границей листа и левой стороной рамки.
  • Y1 — расстояние по оси Y между верхней границей листа и верхней стороной рамки.
  • X2 — расстояние по оси X между левой границей листа и правой стороной рамки.
  • Y2 — расстояние по оси Y между верхней границей листа и нижней стороной рамки.

XY Working v2.svg

Чтобы задать положение основной надписи, необходимо вставить следующую строку перед тегом <metadata>:

<!-- Title block X1a Y1a X2a Y2a -->


  • X1a — расстояние по оси X между левой границей листа и левой стороной основной надписи.
  • Y1a — расстояние по оси Y между верхней границей листа и верхней стороной основной надписи.
  • X2a — расстояние по оси X между левой границей листа и правой стороной основной надписи.
  • Y2a — расстояние по оси Y между верхней границей листа и нижней стороной основной надписи.
  • X1a <= X1 или X2a >= X2.
  • Y1a <= Y1 или Y2a >= Y2.

XY Title v2.svg

Положение основной надписи нужно задавать сразу после задания положения рамки:

<!-- Working space X1 Y1 X2 Y2 -->
<!-- Title block X1a Y1a X2a Y2a -->

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.

  • xxx = ширина в пикселях,
  • yyy = высота в пикселях.
viewBox="0 0 xxx yyy"

В шаблоны можно добавлять пользовательские атрибуты. Список атрибутов смотрите в статье Svg Namespace.

DXF templates

Since version 0.15, FreeCAD can reliably export a Drawing page to the DXF format. This system also uses templates. If a dxf file with the same name is found in the same folder as the SVG template used for a page, it will be used for export. If not, a default empty template is created on the fly.

Consequently, if you create your own SVG templates, and wish to be able to export the Drawing pages that you create with it to DXF, you just need to create a corresponding DXF template, and save it with the same name in the same folder.

DXF templates can be created with any application that produces DXF files, such as LibreCAD. You then need to edit them with a text editor, and add two additional lines, one at the beginning or end of the BLOCKS section, and another at the beginning or end of the ENTITIES section, which are where FreeCAD will add its own blocks and entities.

A very simple template looks like this:

FreeCAD DXF exporter v0.15

The above template doesn't contain any entity. If you create your DXF file with a CAD application, there will likely be much more content inside the HEADER, BLOCKS and ENTITIES sections.

The two lines that FreeCAD will be looking for are "$blocks" and "$entities". They must exist in the template, and they must be placed on their own line. You can choose to place them right after the BLOCKS or ENTITIES line, which is easier (just use the "search" function of your text editor to find them), or at the end, just before the "0 ENDSEC" lines (beware that there is one for each SECTION, make sure to use the ones relative to BLOCKS and ENTITIES). The latter method will place the FreeCAD objects after the objects defined in the template, which might be more logical.

A3 templates

A3 Classic:

A3 Classic.svg

A3 Clean:

A3 Clean.svg

A3 Modern:

A3 Modern.svg

A3 Showcase:

A3 Showcase.svg

A3 Landscape english:

A3 Landscape english.svg

A4 Templates

A4 Landscape english:

A4 Landscape english.svg

A4 Portrait 1 english:

A4 Portrait 1 english.svg

US Letter Templates

US Letter landscape:

US Letter landscape.svg

US Letter portrait:

US Letter portrait.svg

US Letter ds Landscape:

US Letter ds Landscape.svg

US Legal ds Landscape:

US Legal ds Landscape.svg

US Ledger ds Landscape:

US Ledger ds Landscape.svg

Other standards available