Drawing templates/ru: Difference between revisions

From FreeCAD Documentation
No edit summary
(Updating to match new version of source page)
 
(41 intermediate revisions by 4 users not shown)
Line 1: Line 1:
<languages/>

{{VeryImportantMessage|The [[Drawing_Workbench|Drawing Workbench]] became obsolete in v0.17. Consider using the [[TechDraw_Workbench|TechDraw Workbench]] instead.}}

{{TOCright}}


== Создание SVG-шаблонов ==
== Создание SVG-шаблонов ==


<div class="mw-translate-fuzzy">
Создавать шаблоны для модуля чертежей (Drawing) легко и приятно. Смотрите также [[Drawing_Template_HowTo|руководство по созданию шаблонов чертежей]]. Шаблон — это файл в формате SVG, который можно создать в любой программе способной экспортировать SVG, например [http://www.inkscape.org Inkscape]. Необходимо соблюдать только два правила:
Создавать шаблоны для модуля чертежей (Drawing) легко и приятно. Смотрите также [[Drawing_Template_HowTo/ru|руководство по созданию шаблонов чертежей]]. Шаблон — это файл в формате SVG, который можно создать в любой программе способной экспортировать SVG, например [http://www.inkscape.org Inkscape]. Необходимо соблюдать только два правила:
* 1 пиксель = 1 миллиметру.
</div>
* Где-нибудь в SVG-код, там где будет размещен чертеж, требуется вставить (например, в конец файла перед тегом </svg>) следующую строку:

<syntaxhighlight>
=== Base rules ===
<!-- DrawingContent -->

<div class="mw-translate-fuzzy">
=== Базовые правила ===
* 1 пиксель = 1 миллиметру. Размер страницы может быть указан внутри открывающего тега <svg> либо без единиц измерения, либо с "мм". Например, эти две формы действительны:
</div>

<syntaxhighlight lang="html">
width="1067mm"
height="762mm"
</syntaxhighlight>
</syntaxhighlight>
Дополнительно, начиная с FreeCAD 0.14 (ревизия 2995), в SVG-коде можно указать положение рамки и основной надписи. Так FreeCAD будет знать где можно располагать проекции, а где нет.


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

<syntaxhighlight>
<syntaxhighlight lang="html">
width="1067"
height = "762"
</syntaxhighlight>

Хотя svg поддерживает дюймы ("42 in"), в настоящее время они не поддерживаются FreeCAD, поэтому всегда лучше указывать размер страницы svg в миллиметрах. Атрибут "viewBox" (видимая область) должен иметь то же значение, например:

<syntaxhighlight lang="html">
viewBox="0 0 1067 762"
</syntaxhighlight>

* Вы должны вставить где-нибудь внутри вашего svg-кода, где вы хотите, чтобы отображалось содержимое чертежа (например, в конце файла, непосредственно перед последним тегом </svg>), следующую строку:

<syntaxhighlight lang="html">
<!-- 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.

=== Namespace ===

* Several objects (specifically those created with the [[Draft_Drawing|Draft Drawing]] command and if your template has editable texts) use a special [[Svg_Namespace|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 ===

<div class="mw-translate-fuzzy">
=== Блок Title ===
В дополнение к этим правилам, начиная с FreeCAD 0.14, информация о границах блока Title может быть добавлена в шаблон для использования инструментом орфографической проекции. Эта область определяет, где FreeCAD может и не может размещать проекции.
</div>

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

<syntaxhighlight lang="html">
<!-- Working space X1 Y1 X2 Y2 -->
<!-- Working space X1 Y1 X2 Y2 -->
</syntaxhighlight>
</syntaxhighlight>

Где:
Где X1, Y1, X2, Y2 определяются как:
* X1 — расстояние по оси X между левой границей листа и левой стороной рамки.
* Y1 расстояние по оси Y между верхней границей листа и верхней стороной рамки.
* X1 - расстояние по оси X от левого края страницы до левой границы Рамки.
* X2 расстояние по оси X между левой границей листа и правой стороной рамки.
* Y1 - расстояние по оси Y от верхнего края страницы до верхней границы Рамки.
* Y2 расстояние по оси Y между верхней границей листа и нижней стороной рамки.
* X2 - расстояние по оси X от левого края страницы до правой границы Рамки.
* Y2 - расстояние по оси Y от верхнего края страницы до нижней границы Рамки.

[[File:XY_Working_v2.svg]]
[[File:XY_Working_v2.svg]]


Для определения блока Title необходимо вставить следующую строку после тега рабочего пространства и перед тегом <metadata>.
To define the Title block the following line must be inserted before the <metadata tag and after the Working space tag.

<syntaxhighlight>
<syntaxhighlight lang="html">
<!-- Title block X1a Y1a X2a Y2a -->
<!-- Title block X1a Y1a X2a Y2a -->
</syntaxhighlight>
</syntaxhighlight>

Where X1a, Y1a, X2a, Y2a are defined as:
<div class="mw-translate-fuzzy">
* 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
* X1a — расстояние по оси X между левой границей листа и левой стороной основной надписи.
* X2a is the X Axis distance from the left edge of the page to the right side of the Title block
* Y1a — расстояние по оси Y между верхней границей листа и верхней стороной основной надписи.
* Y2a is the Y axis distance from the top edge of the page the the bottom of the Title block
* X2a — расстояние по оси X между левой границей листа и правой стороной основной надписи.
* X1a <= X1 or X2a >= X2
* Y2a — расстояние по оси Y между верхней границей листа и нижней стороной основной надписи.
* Y1a <= Y1 or Y2a >= Y2
* X1a <= X1 или X2a >= X2.
* Y1a <= Y1 или Y2a >= Y2.
</div>

[[File:XY_Title_v2.svg]]
[[File:XY_Title_v2.svg]]


<div class="mw-translate-fuzzy">
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:
Положение основной надписи нужно задавать сразу после задания положения рамки:
<syntaxhighlight>
</div>

<syntaxhighlight lang="html">
<!-- 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>
</syntaxhighlight>


Чтобы включить печать в масштабе, реальный размер текста должен быть указан в атрибутах ширины и высоты SVG-тега. Размер документа в пользовательских единицах (px) должен быть указан в атрибуте viewBox.
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 = высота в пикселях.


<syntaxhighlight lang="html">
The following is to be formatted like the example below where:
* xxx = pixel width
* yyy = pixel height
<syntaxhighlight>
width="xxxmm"
width="xxxmm"
height="yyymm"
height="yyymm"
Line 51: Line 110:
</syntaxhighlight>
</syntaxhighlight>


<div class="mw-translate-fuzzy">
* Several custom attributes can be placed in templates. The list of currently supported attributes is available on the [[Svg Namespace]] page.
В шаблоны можно добавлять пользовательские атрибуты. Список атрибутов смотрите в статье [[Svg Namespace]].
</div>


== DXF templates ==
== DXF шаблоны ==


Since version 0.15, FreeCAD can reliably export a [[Drawing Module|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.
Since version 0.15, FreeCAD can reliably export a [[Drawing_Workbench|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.
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.
Line 61: Line 122:
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.
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:


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


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 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.
Line 99: Line 162:


=== A3 Classic: ===
=== A3 Classic: ===

[[Image:A3_Classic.svg|800px]]
[[Image:A3_Classic.svg|800px]]


=== A3 Clean: ===
=== A3 Clean: ===

[[Image:A3_Clean.svg|800px]]
[[Image:A3_Clean.svg|800px]]


=== A3 Modern: ===
=== A3 Modern: ===

[[Image:A3_Modern.svg|800px]]
[[Image:A3_Modern.svg|800px]]


=== A3 Showcase: ===
=== A3 Showcase: ===

[[Image:A3_Showcase.svg|800px]]
[[Image:A3_Showcase.svg|800px]]


=== A3 Landscape english: ===
=== A3 Landscape english: ===

[[File:A3_Landscape_english.svg|800px]]
[[File:A3_Landscape_english.svg|800px]]


Line 128: Line 196:


[[File:US_Letter_landscape.svg|800px]]
[[File:US_Letter_landscape.svg|800px]]



=== US Letter portrait: ===
=== US Letter portrait: ===
Line 153: Line 220:




{{Drawing Tools navi{{#translation:}}}}
[[Category:Documentation]]
{{Userdocnavi{{#translation:}}}}

[[Category:Developer Documentation{{#translation:}}]]
<languages/>
[[Category:Documentation{{#translation:}}]]

Latest revision as of 17:22, 23 August 2021

The Drawing Workbench became obsolete in v0.17. Consider using the TechDraw Workbench instead.

Создание SVG-шаблонов

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

Base rules

Базовые правила

  • 1 пиксель = 1 миллиметру. Размер страницы может быть указан внутри открывающего тега <svg> либо без единиц измерения, либо с "мм". Например, эти две формы действительны:
width="1067mm"
height="762mm"

или

width="1067"
height = "762"

Хотя svg поддерживает дюймы ("42 in"), в настоящее время они не поддерживаются FreeCAD, поэтому всегда лучше указывать размер страницы svg в миллиметрах. Атрибут "viewBox" (видимая область) должен иметь то же значение, например:

viewBox="0 0 1067 762"
  • Вы должны вставить где-нибудь внутри вашего svg-кода, где вы хотите, чтобы отображалось содержимое чертежа (например, в конце файла, непосредственно перед последним тегом </svg>), следующую строку:
<!-- 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.

Namespace

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

xmlns:freecad="http://www.freecadweb.org/wiki/index.php?title=Svg_Namespace"

Title block

Блок Title

В дополнение к этим правилам, начиная с FreeCAD 0.14, информация о границах блока Title может быть добавлена в шаблон для использования инструментом орфографической проекции. Эта область определяет, где FreeCAD может и не может размещать проекции.

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

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

Где X1, Y1, X2, Y2 определяются как:

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

Для определения блока Title необходимо вставить следующую строку после тега рабочего пространства и перед тегом <metadata>.

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

Где:

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

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

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

Чтобы включить печать в масштабе, реальный размер текста должен быть указан в атрибутах ширины и высоты SVG-тега. Размер документа в пользовательских единицах (px) должен быть указан в атрибуте viewBox.

Это должно быть отформатировано, как в примере ниже, где:

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

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

DXF шаблоны

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.

Самый простой шаблон выглядит так:

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

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

A3 Modern:

A3 Showcase:

A3 Landscape english:

A4 Templates

A4 Landscape english:

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:

Other standards available