Drawing Workbench/ru: Difference between revisions

From FreeCAD Documentation
m (Created page with "{{docnav/ru|Part Module/ru|Raytracing Module/ru}}")
(Updating to match new version of source page)
 
(69 intermediate revisions by 4 users not shown)
Line 1: Line 1:
<languages/>
Модуль Черчения позволяет поместить ваши 3D наработки на бумагу. То есть, поместить проекции ваших моделей в 2D окно и вставить это окно в рисунок, например на лист с рамкой, вашим заголовком и логотипом и наконец распечатать всё это. Модуль черчения находится в стадии разработки и приблизительного технологического тестирования!


<div class="mw-translate-fuzzy">
== GUI Инструменты ==
{{Docnav/ru
|[[Draft Workbench/ru|Верстак Draft]]
|[[FEM Workbench/ru|Верстак FEM]]
|IconL=Workbench_Draft.svg
|IconC=Online Help Toc.svg
|IconR=Workbench_FEM.svg
}}
</div>


{{VeryImportantMessage|The '''Drawing Workbench''' is no longer included after version 0.20.<br>
{{Drawing Tools/ru}}
The [[TechDraw_Workbench|TechDraw Workbench]] is its more advanced replacement.}}


[[Image:Workbench_Drawing.svg|thumb|128px|Drawing workbench icon]]


<span id="Introduction"></span>
'''Note'''
== Введение ==
The [[Draft Module]] has its own [[Draft_Drawing]] too to place Draft objects on paper. It has a couple of extra capabilities over the standard Drawing tools, and supports specific objects like [[Draft Dimension|Draft dimensions]].


Модуль Черчения позволяет поместить ваши 3D наработки на бумагу. То есть, поместить проекции ваших моделей в 2D окно и вставить это окно в рисунок, например на лист с рамкой, вашим заголовком и логотипом и наконец распечатать всё это.


{{TOCright}}
[[Image:Drawing_extraction.png|800px]]
[[Image:Drawing_extraction.png|600px]]


<span id="Tools"></span>
На картинке вы видите, основные концепции модуля Черчения. Документ содержит объект-форму (Schenkel) который мы хотим извлеч для черчения. Поэтому создается "Лист". Лист автоматически получает шаблон, в даннном случае шаблон "A3_Landscape". Шаблон это SVG документ, может содержать обычно чертежную рамку, ваш логотип или же соблюдать ваши собственные стандарты.
== Инструменты ==


Это инструменты для создания, настройки и экспортирования 2D чертежных листов
На этот лист вы можете поместить один и более видов. Каждый вид обладает своей позицией на странице (свойства X,Y), и коэффициентом масштабирования (свойство scale) и другие дополнительные свойства. Каждый раз когда лист или вид или объект на который они ссылаются, изменяются лист перерисовывается, и отображение листа обновляется.


* [[Image:Drawing_New.png|32px]] [[Drawing_Open_SVG/ru|Открыть SVG]]: Открывает чертеж, ранее сохранённый в формате SVG
== Написание сценариев ==


* [[Image:Drawing_Landscape_A3.png|32px]] [[Drawing_Landscape_A3/ru|Новый чертеж A3]]: Создает чертёж формата A3 c шаблоном FreeCAD по умолчанию
На данный момент рабочий процес для конечного пользователя(GUI) очень ограничен, поэтому интересней писать сценарии для API. Ниже следуют примеры о том как сценариев API чертежного модуля.


* [[Image:Drawing_View.png|32px]] [[Drawing_View/ru|Вставить вид в чертёж]]: Помещает вид выделенного объекта на активный лист чертежа.
Here a script that can easily fill the [[Macro_CartoucheFC]] leaf FreeCAD A3_Landscape.


* [[Image:Drawing_Annotation.png|32px]] [[Drawing_Annotation/ru|Аннотация]]: Добавляет аннотацию на текущий чертёжный лист
=== Простейшие примеры ===


* [[Image:Drawing_Clip.png|32px]] [[Drawing_Clip/ru|Клип]]: Добавляет группу клипов на текущий чертёжный лист
прежде всего нам нужны модуль черчения и модуль Деталей:
<syntaxhighlight>
import FreeCAD, Part, Drawing
</syntaxhighlight>
Создадим простую маленькую деталь
<syntaxhighlight>
Part.show(Part.makeBox(100,100,100).cut(Part.makeCylinder(80,100)).cut(Part.makeBox(90,40,100)).cut(Part.makeBox(20,85,100)))
</syntaxhighlight>
Прямая проекция. G0 будет жесткой гранью, а G1 непрерывно касается.
<syntaxhighlight>
Shape = App.ActiveDocument.Shape.Shape
[visibleG0,visibleG1,hiddenG0,hiddenG1] = Drawing.project(Shape)
print "visible edges:", len(visibleG0.Edges)
print "hidden edges:", len(hiddenG0.Edges)
</syntaxhighlight>
Всё было в проекции на плоскость Z:
<syntaxhighlight>
print "Bnd Box shape: X=",Shape.BoundBox.XLength," Y=",Shape.BoundBox.YLength," Z=",Shape.BoundBox.ZLength
print "Bnd Box project: X=",visibleG0.BoundBox.XLength," Y=",visibleG0.BoundBox.YLength," Z=",visibleG0.BoundBox.ZLength
</syntaxhighlight>
Различные вектора проекции
<syntaxhighlight>
[visibleG0,visibleG1,hiddenG0,hiddenG1] = Drawing.project(Shape,App.Vector(1,1,1))
</syntaxhighlight>
Спроецировать в SVG
<syntaxhighlight>
resultSVG = Drawing.projectToSVG(Shape,App.Vector(1,1,1))
print resultSVG
</syntaxhighlight>
=== Параметрический метод ===


* [[Image:Drawing_Openbrowser.png|32px]] [[Drawing_Openbrowser/ru|Открыть в браузере]]: Открывает предварительный просмотр текущего чертёжного листа в браузере
Создадим новое тело
<syntaxhighlight>
import FreeCAD
import Part
import Drawing


* [[Image:Drawing_Orthoviews.png|32px]] [[Drawing_Orthoviews/ru|Вставить ортографические виды]]: Автоматически создаёт ортографические виды объекта на текущем чертёжном листе
# Create three boxes and a cylinder
App.ActiveDocument.addObject("Part::Box","Box")
App.ActiveDocument.Box.Length=100.00
App.ActiveDocument.Box.Width=100.00
App.ActiveDocument.Box.Height=100.00


* [[Image:Drawing_Symbol.png|32px]] [[Drawing_Symbol/ru|Символ]]: Добавляет содержимое файла SVG как символ на текущий чертёжный лист
App.ActiveDocument.addObject("Part::Box","Box1")
App.ActiveDocument.Box1.Length=90.00
App.ActiveDocument.Box1.Width=40.00
App.ActiveDocument.Box1.Height=100.00


* [[Image:Drawing_DraftView.png|32px]] [[Draft_Drawing/ru|Draft View]]: Вставляет специальный вид выбранного объекта на текущий чертёжный лист
App.ActiveDocument.addObject("Part::Box","Box2")
App.ActiveDocument.Box2.Length=20.00
App.ActiveDocument.Box2.Width=85.00
App.ActiveDocument.Box2.Height=100.00


* [[Image:Drawing_SpreadsheetView.png|32px]] [[Drawing_SpreadsheetView/ru|Spreadsheet View]]: Вставляет вид выбранного листа электронной таблицы на текущий чертёжный лист
App.ActiveDocument.addObject("Part::Cylinder","Cylinder")
App.ActiveDocument.Cylinder.Radius=80.00
App.ActiveDocument.Cylinder.Height=100.00
App.ActiveDocument.Cylinder.Angle=360.00
# Fuse two boxes and the cylinder
App.ActiveDocument.addObject("Part::Fuse","Fusion")
App.ActiveDocument.Fusion.Base = App.ActiveDocument.Cylinder
App.ActiveDocument.Fusion.Tool = App.ActiveDocument.Box1


* [[Image:Drawing_Save.png|32px]] [[Drawing_Save/ru|Экспортировать страницу]]: Сохраняет указанный лист в SVG формате
App.ActiveDocument.addObject("Part::Fuse","Fusion1")
App.ActiveDocument.Fusion1.Base = App.ActiveDocument.Box2
App.ActiveDocument.Fusion1.Tool = App.ActiveDocument.Fusion
# Cut the fused shapes from the first box
App.ActiveDocument.addObject("Part::Cut","Shape")
App.ActiveDocument.Shape.Base = App.ActiveDocument.Box
App.ActiveDocument.Shape.Tool = App.ActiveDocument.Fusion1
# Hide all the intermediate shapes
Gui.ActiveDocument.Box.Visibility=False
Gui.ActiveDocument.Box1.Visibility=False
Gui.ActiveDocument.Box2.Visibility=False
Gui.ActiveDocument.Cylinder.Visibility=False
Gui.ActiveDocument.Fusion.Visibility=False
Gui.ActiveDocument.Fusion1.Visibility=False
</syntaxhighlight>
вставляем на лист и добавляем шаблон
<syntaxhighlight>
App.ActiveDocument.addObject('Drawing::FeaturePage','Page')
App.ActiveDocument.Page.Template = App.getResourceDir()+'Mod/Drawing/Templates/A3_Landscape.svg'
</syntaxhighlight>
Создает вид на "Форму" объекта,определяем положение и масштаб и помещаем его на лист
<syntaxhighlight>
App.ActiveDocument.addObject('Drawing::FeatureViewPart','View')
App.ActiveDocument.View.Source = App.ActiveDocument.Shape
App.ActiveDocument.View.Direction = (0.0,0.0,1.0)
App.ActiveDocument.View.X = 10.0
App.ActiveDocument.View.Y = 10.0
App.ActiveDocument.Page.addObject(App.ActiveDocument.View)
</syntaxhighlight>
Создать второй вид на тот же объект, но на этот раз вид представление объекта будет повернуто на 90 градусов.
<syntaxhighlight>
App.ActiveDocument.addObject('Drawing::FeatureViewPart','ViewRot')
App.ActiveDocument.ViewRot.Source = App.ActiveDocument.Shape
App.ActiveDocument.ViewRot.Direction = (0.0,0.0,1.0)
App.ActiveDocument.ViewRot.X = 290.0
App.ActiveDocument.ViewRot.Y = 30.0
App.ActiveDocument.ViewRot.Scale = 1.0
App.ActiveDocument.ViewRot.Rotation = 90.0
App.ActiveDocument.Page.addObject(App.ActiveDocument.ViewRot)
</syntaxhighlight>
Создание третьего вида на данный объект , но с изометрической точки зрения. Также активируем скрытые линии.
<syntaxhighlight>
App.ActiveDocument.addObject('Drawing::FeatureViewPart','ViewIso')
App.ActiveDocument.ViewIso.Source = App.ActiveDocument.Shape
App.ActiveDocument.ViewIso.Direction = (1.0,1.0,1.0)
App.ActiveDocument.ViewIso.X = 335.0
App.ActiveDocument.ViewIso.Y = 140.0
App.ActiveDocument.ViewIso.ShowHiddenLines = True
App.ActiveDocument.Page.addObject(App.ActiveDocument.ViewIso)
</syntaxhighlight>
Изменим кое-что и обновим. В процессе обновления, изменится отображение и лист.
<syntaxhighlight>
App.ActiveDocument.View.X = 30.0
App.ActiveDocument.View.Y = 30.0
App.ActiveDocument.View.Scale = 1.5
App.ActiveDocument.recompute()
</syntaxhighlight>
=== Получение доступа к битам и деталям ===


* [[Drawing_ProjectShape/ru|Проекция фигуры]]: Создаёт проекцию выбранного объекта (источинка) в трёхмерном виде.
Получить SVG фрагмент первого вида
<syntaxhighlight>
ViewSVG = App.ActiveDocument.View.ViewResult
print ViewSVG
</syntaxhighlight>
Получить весь лист (это файл в во временном каталоге документа, доступный только для чтения)
<syntaxhighlight>
print "Resulting SVG document: ",App.ActiveDocument.Page.PageResult
file = open(App.ActiveDocument.Page.PageResult,"r")
print "Result page is ",len(file.readlines())," lines long"
</syntaxhighlight>
Важно : освобождаем файл!
<syntaxhighlight>
del file
</syntaxhighlight>
Вставить вид с вашим собственным содержанием:
<syntaxhighlight>
App.ActiveDocument.addObject('Drawing::FeatureView','ViewSelf')
App.ActiveDocument.ViewSelf.ViewResult = """<g id="ViewSelf"
stroke="rgb(0, 0, 0)"
stroke-width="0.35"
stroke-linecap="butt"
stroke-linejoin="miter"
transform="translate(30,30)"
fill="#00cc00"
>


* {{Emphasis|Примечание:}} Инструмент [[Draft_Drawing/ru|Draft Drawing]] главным образом используется с [[Draft Workbench/ru|объектами Draft]]. Он имеет некоторые дополнительных возможностей кроме стандартных инструментов верстака Drawing, и поддерживает специфические объекты вроде [[Draft Dimension/ru|размеров Draft]].
<ellipse cx="40" cy="40" rx="30" ry="15"/>
</g>"""
App.ActiveDocument.Page.addObject(App.ActiveDocument.ViewSelf)
App.ActiveDocument.recompute()


== Workflow ==
del ViewSVG
Документ содержит трёхмерный объект-форму (Schenkel), по которому мы хотим сделать чертёж. Поэтому создается "Лист". Лист автоматически получает шаблон, в данном случае шаблон "A3_Landscape". Этот шаблон представляет собой документ [[SVG/ru|SVG]] и может содержать обычную чертежную рамку, ваш логотип или другие элементы.
</syntaxhighlight>
Это приводит к следующим результатам:


На этот лист вы можете поместить один и более видов. Каждый вид обладает своей позицией на странице, и коэффициентом масштабирования и другие дополнительные свойства. Каждый раз когда лист или вид или объект на который они ссылаются, изменяются, лист перерисовывается, и отображение листа обновляется.
[[Image:DrawingScriptResult.jpg|800px]]


<span id="Scripting"></span>
=== General Dimensioning and Tolerancing ===
== Написание сценариев ==


На данный момент рабочий процес через графический интерфейс пользователя (GUI) очень ограничен, поэтому интересней писать сценарии для API.
Drawing dimensions an toleranecs are still under development but you can get some basic functionality with a bit of work.


See the [[Drawing API example]] page for a description of the functions used to create drawing pages and views.
First you need to get the gdtsvg python module from here (WARNING: This could be broken at any time!):


<span id="Templates"></span>
https://github.com/jcc242/FreeCAD
== Шаблоны ==


FreeCAD поставляется вместе с набором стандартных шаблонов, но вы также можете найти больше на странице [[Drawing templates|Чертежных шаблонов]] .
To get a feature control frame, try out the following:
<syntaxhighlight>
import gdtsvg as g # Import the module, I like to give it an easy handle
ourFrame = g.ControlFrame("0","0", g.Perpendicularity(), ".5", g.Diameter(), g.ModifyingSymbols("M"), "A",
g.ModifyingSymbols("F"), "B", g.ModifyingSymbols("L"), "C", g.ModifyingSymbols("I"))
</syntaxhighlight>
Here is a good breakdown of the contents of a feature control frame: http://www.cadblog.net/adding-geometric-tolerances.htm


<span id="Extending_the_Drawing_Module"></span>
The parameters to pass to control frame are:
== Расширение модуля Drawing ==
#X-coordinate in SVG-coordinate system (type string)
#Y-coordinate in SVG-coordinate system (type string)
#The desired geometric characteristic symbol (tuple, svg string as first, width of symbol as second, height of symbol as third)
#The tolerance (type string)
#(optional) The diameter symbol (tuple, svg string as first, width of symbol as second, height of symbol as third)
#(optional) The condition modifying material (tuple, svg string as first, width of symbol as second, height of symbol as third)
#(optional) The first datum (type string)
#(optional) The first datum's modifying condition (tuple, svg string as first, width of symbol as second, height of symbol as third)
#(optional) The second datum (type string)
#(optional) The second datum's modifying condition (tuple, svg string as first, width of symbol as second, height of symbol as third)
#(optional) The third datum (type string)
#(optional) The third datum's material condition (tuple, svg string as first, width of symbol as second, height of symbol as third)


Некоторые примечания по программной стороне модуля были добавлены на страницу [[Drawing Documentation]]. Это для быстрого понимания, как работает модуль Drawing, позволяя программистам быстро начать программирование для него.
The ControlFrame function returns a type containing (svg string, overall width of control frame, overall height of control frame)'''


<div class="mw-translate-fuzzy">
To get a dimension, try out the following:
== Учебники ==
<syntaxhighlight>
* [[Drawing_tutorial/ru|Учебник по модулю Drawing]]
import gdtsvg
</div>
ourDimension = linearDimension(point1, point2, textpoint, dimensiontext, linestyle=getStyle("visible"),
arrowstyle=getStyle("filled"), textstyle=getStyle("text")
</syntaxhighlight>
Inputs for linear dimension are:
#point1, an (x,y) tuple with svg-coordinates, this is one of the points you would like to dimension between
#point2, an (x,y) tuple with svg-coordinates, this is the second point you would like to dimension between
#textpoint, an (x,y) tuple of svg-coordinates, this is where the text of your dimension will be
#dimensiontext, a string containing the text you want the dimension to say
#linestyle, a string containing svg (i.e. css) styles, using the getStyle function to retrieve a preset string, for styling the how the lines look
#arrowstyle, a string containing svg (i.e. css) styles, using the getStyle function to retrieve a preset string, for styling how the arrows look
#textstyle, a string containing svg (i.e. css) styles, using the getStyle function to retrieve a preset string, for styling how the text looks


== Macros ==
With those two, you can proceed as above for displaying them on the drawing page. This module is very buggy and can be broken at any given moment, bug reports are welcome on the github page for now, or contact jcc242 on the forums if you post a bug somewhere else.


* {{MacroLink|Icon=Macro_Automatic_drawing.png|Macro_Automatic_drawing|Macro Automatic drawing}}: Allows the user to get the view of his object in a drawing with 4 different position (front,top,iso,right). Needs some modification to be perfectly effective.
== Templates ==


* {{MacroLink|Icon=Macro_CartoucheFC.png|Macro_CartoucheFC|Macro CartoucheFC}}: This GUI macro to fill simply all fields of the cartridge of the plan implementation worksheet FreeCAD, the format of the date and the symbol of the projection mode adapt to the EU region or US selected.
FreeCAD comes bundled with a set of default templates, but you can find more on the [[Drawing templates]] page.


* {{MacroLink|Icon=Macro_CartoucheFC_2.png|Macro_CartoucheFC_2|Macro CartoucheFC 2}}: This GUI macro to fill simply all fields of the cartridge '''model 2''' of the plan implementation worksheet FreeCAD.
== Extending the Drawing Module ==


* {{MacroLink|Icon=Macro_CartoucheFC_Full.png|Macro_CartoucheFC_Full|Macro CartoucheFC Full}}: This GUI macro to fill simply all fields of the cartridge [[Misc_templates_Full|Misc templates Full]] of the plan implementation worksheet FreeCAD, the format of the date and the symbol of the projection mode adapt to the EU region or US selected.
Some notes on the programming side of the drawing module will be added to the [[Drawing Documentation]] page. This is to help quickly understand how the drawing module works, enabling programmers to rapidly start programming for it.


* {{MacroLink|Icon=Macro_Corner_shapes_wizard.png|Macro_Corner_shapes_wizard/update|Macro Corner shapes wizard/update}}: Pops up a dialog asking for the dimensions of your corner piece, then creates the object in the document and creates a page view with top, front and lateral views of the piece.
{{docnav/ru|Part Module/ru|Raytracing Module/ru}}


== External links ==
[[Category:User Documentation/ru]]

<languages/>
<div class="mw-translate-fuzzy">
== Внешние ссылки ==
* [https://www.youtube.com/watch?v=1Hm5Zyjmjac Intro to mechanical drawing on Youtube - by Normal Universe]
</div>


<div class="mw-translate-fuzzy">
{{Docnav/ru
|[[Draft Workbench/ru|Верстак Draft]]
|[[FEM Workbench/ru|Верстак FEM]]
|IconL=Workbench_Draft.svg
|IconC=Online Help Toc.svg
|IconR=Workbench_FEM.svg
}}
</div>

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

Latest revision as of 08:47, 8 July 2023

The Drawing Workbench is no longer included after version 0.20.
The TechDraw Workbench is its more advanced replacement.
Drawing workbench icon

Введение

Модуль Черчения позволяет поместить ваши 3D наработки на бумагу. То есть, поместить проекции ваших моделей в 2D окно и вставить это окно в рисунок, например на лист с рамкой, вашим заголовком и логотипом и наконец распечатать всё это.

Инструменты

Это инструменты для создания, настройки и экспортирования 2D чертежных листов

  • Открыть SVG: Открывает чертеж, ранее сохранённый в формате SVG
  • Аннотация: Добавляет аннотацию на текущий чертёжный лист
  • Клип: Добавляет группу клипов на текущий чертёжный лист
  • Открыть в браузере: Открывает предварительный просмотр текущего чертёжного листа в браузере
  • Символ: Добавляет содержимое файла SVG как символ на текущий чертёжный лист
  • Draft View: Вставляет специальный вид выбранного объекта на текущий чертёжный лист
  • Spreadsheet View: Вставляет вид выбранного листа электронной таблицы на текущий чертёжный лист
  • Проекция фигуры: Создаёт проекцию выбранного объекта (источинка) в трёхмерном виде.
  • Примечание: Инструмент Draft Drawing главным образом используется с объектами Draft. Он имеет некоторые дополнительных возможностей кроме стандартных инструментов верстака Drawing, и поддерживает специфические объекты вроде размеров Draft.

Workflow

Документ содержит трёхмерный объект-форму (Schenkel), по которому мы хотим сделать чертёж. Поэтому создается "Лист". Лист автоматически получает шаблон, в данном случае шаблон "A3_Landscape". Этот шаблон представляет собой документ SVG и может содержать обычную чертежную рамку, ваш логотип или другие элементы.

На этот лист вы можете поместить один и более видов. Каждый вид обладает своей позицией на странице, и коэффициентом масштабирования и другие дополнительные свойства. Каждый раз когда лист или вид или объект на который они ссылаются, изменяются, лист перерисовывается, и отображение листа обновляется.

Написание сценариев

На данный момент рабочий процес через графический интерфейс пользователя (GUI) очень ограничен, поэтому интересней писать сценарии для API.

See the Drawing API example page for a description of the functions used to create drawing pages and views.

Шаблоны

FreeCAD поставляется вместе с набором стандартных шаблонов, но вы также можете найти больше на странице Чертежных шаблонов .

Расширение модуля Drawing

Некоторые примечания по программной стороне модуля были добавлены на страницу Drawing Documentation. Это для быстрого понимания, как работает модуль Drawing, позволяя программистам быстро начать программирование для него.

Macros

  • Macro Automatic drawing: Allows the user to get the view of his object in a drawing with 4 different position (front,top,iso,right). Needs some modification to be perfectly effective.
  • Macro CartoucheFC: This GUI macro to fill simply all fields of the cartridge of the plan implementation worksheet FreeCAD, the format of the date and the symbol of the projection mode adapt to the EU region or US selected.
  • Macro CartoucheFC 2: This GUI macro to fill simply all fields of the cartridge model 2 of the plan implementation worksheet FreeCAD.
  • Macro CartoucheFC Full: This GUI macro to fill simply all fields of the cartridge Misc templates Full of the plan implementation worksheet FreeCAD, the format of the date and the symbol of the projection mode adapt to the EU region or US selected.
  • Macro Corner shapes wizard/update: Pops up a dialog asking for the dimensions of your corner piece, then creates the object in the document and creates a page view with top, front and lateral views of the piece.

External links