TechDraw View: Difference between revisions

From FreeCAD Documentation
m ([[ | ]])
No edit summary
 
(75 intermediate revisions by 11 users not shown)
Line 1: Line 1:
<languages/>
<languages/>
<translate>
<translate>

<!--T:19-->
<!--T:19-->
{{Docnav
{{Docnav
|[[TechDraw_PrintAll|PrintAll]]
|[[TechDraw_New_Pick|New Pick]]
|[[TechDraw_BrokenView|BrokenView]]
|[[TechDraw_NewProjGroup|New Projection Group]]
|[[TechDraw_Module|TechDraw]]
|[[TechDraw_Workbench|TechDraw]]
|IconL=TechDraw_New_Pick.png
|IconL=TechDraw_PrintAll.svg
|IconR=TechDraw_BrokenView.svg
|IconC=Workbench_TechDraw.svg
|IconC=Workbench_TechDraw.svg
|IconR=techdraw-projgroup.png
}}
}}


<!--T:1-->
<!--T:1-->
{{GuiCommand
{{GuiCommand
|Name=TechDraw NewView
|Name=TechDraw View
|MenuLocation=TechDraw → View
|MenuLocation=TechDraw → TechDraw Views → Insert View
|Workbenches=[[TechDraw Module|TechDraw]]
|Workbenches=[[TechDraw_Workbench|TechDraw]]
|SeeAlso=[[TechDraw NewProjGroup|TechDraw NewProjGroup]], [[TechDraw NewSection|TechDraw NewSection]]
|SeeAlso=[[TechDraw_ProjectionGroup|TechDraw Projection Group]], [[TechDraw_SectionView|TechDraw Section View]]
}}
}}


Line 22: Line 23:


<!--T:10-->
<!--T:10-->
The View tool adds a representation of one or more objects to a Drawing page. This is the basic building block of the TechDraw module. Most other Views are derived in some way from NewView.
The '''TechDraw View''' tool adds a representation of one or more objects to a Drawing page. This is the basic building block of the TechDraw workbench. Most other Views are derived in some way from View.

<!--T:13-->
View will try to draw anything with a {{incode|Shape}} property. You can select [[Sketcher_Workbench|sketches]], [[PartDesign_Body|PartDesign Bodies]], [[Draft_Workbench|Draft objects]] etc. View will also extract any shapes from objects within a [[Std_Part|Std Part]] or a [[Std_Group|Std Group]].


</translate>
</translate>
Line 30: Line 34:
{{Caption|View of a solid box with hidden lines}}
{{Caption|View of a solid box with hidden lines}}


==How to use== <!--T:3-->
==Usage== <!--T:3-->


<!--T:12-->
<!--T:12-->
# Optionally rotate the [[3D_view|3D view]]. Unless a face is selected in the next step, the camera direction in the [[3D_view|3D view]] determines the initial value of the {{PropertyData|Direction}} property of the View.
# Select one or more objects (Body, App::Part, Part::Feature, Draft object, ... See Notes) in the 3D window or tree.
# Select one or more objects in the [[3D_view|3D view]] or [[Tree_view|Tree view]]. When selecting in the 3D view the first selected face determines the initial value of the {{PropertyData|Direction}} property.
# If you have multiple drawing pages in your document, you will also need to select the desired page in the tree.
# If there are multiple drawing pages in the document: optionally add the desired page to the selection by selecting it in the [[Tree_view|Tree view]].
# Press the {{Button|[[Image:Techdraw-view.svg|16px]] [[TechDraw NewView|View]]}} button
# There are several ways to invoke the tool:

#* Press the {{Button|[[Image:TechDraw_View.svg|16px]] [[TechDraw_View|Insert View]]}} button.
<!--T:13-->
#* Select the {{MenuCommand|TechDraw → TechDraw Views → [[Image:TechDraw_View.svg|16px]] Insert View}} option from the menu.
View will try to draw anything with a {{incode|Shape}} property. You can select [[Draft Workbench|Draft]] objects and [[PartDesign Body|PartDesign Bodies]] also. View will also extract any shapes from objects within an [[Std_Part|App::Part]] container or a [[Std Group|Group]].
# If there are multiple drawing pages in the document and you have not yet selected a page, the {{MenuCommand|Page Chooser}} dialog box opens: {{Version|0.20}}
## Select the desired page.
## Press the {{Button|OK}} button.


==Properties== <!--T:5-->
==Properties== <!--T:5-->


=== Data === <!--T:14-->
=== Data === <!--T:21-->

* {{PropertyData|X}}: The view's horizontal position on the page. (1)
<!--T:25-->
* {{PropertyData|Y}}: The view's vertical position on the page. (1)
{{TitleProperty|Base}}
* {{PropertyData|LockPosition}}: Prevents Views from being dragged in the Gui when true. The View can still be moved by changing X,Y properties. (1)

* {{PropertyData|Rotation}}: Counterclockwise rotation of the View on the page in degrees. (1)
<!--T:14-->
* {{PropertyData|ScaleType}}: "Document": use the Page's scale setting. "Custom": use a scale unique to this view. "Automatic": fit view to page. (1)
* {{PropertyData|Scale}}: A view will be rendered on the page in Scale:1 ratio to the Source. (1)
* {{PropertyData|X|Distance}}: The view's horizontal position on the page. (1)
* {{PropertyData|Caption}}: Optional short text caption.
* {{PropertyData|Y|Distance}}: The view's vertical position on the page. (1)
* {{PropertyData|Lock Position|Bool}}: Prevents Views from being dragged in the Gui when {{TRUE}}. The View can still be moved by changing X,Y properties. (1)
* {{PropertyData|Source}}: Links to the Drawable Objects to be depicted
* {{PropertyData|Rotation|Angle}}: Counterclockwise rotation of the View on the page in degrees. (1)
* {{PropertyData|Direction}}: this vector controls the direction from which you are viewing the object. +X is right, -X is left, +Y is rear, -Y is front (looking into the screen), +Z is up and -Z is down. So a Front view is (0,-1,0) and an isometric view is (1,-1,1). (1)
* {{PropertyData|Perspective}}: True for perspective projection, false for orthogonal projection.
* {{PropertyData|Scale Type|Enumeration}}: The scale type. Options: (1)
** {{Value|Page}}: Use the [[TechDraw_PageDefault|Page]]'s scale setting.
* {{PropertyData|Focus}}: Distance from camera to projection plane for perspective projections. Needs to be adjusted to fit the object. Too far and the perspective is lost, too close and the object is distorted.
** {{Value|Automatic}}: Fit the view to the page.
* {{PropertyData|CoarseView}}: If true, TechDraw will use a polygon approximation to calculate drawing geometry. If false, TechDraw will use a precision algorithm. CoarseView can be much faster for complex models. The quality of the drawing is reduced, since every curve is approximated as a series of short line segments. Vertices are not displayed in CoarseView since each short segment would result in two new Vertices and the display becomes cluttered. Linear Dimensions can be added to a CoarseView, but are unlikely to be useful.
** {{Value|Custom}}: Use the scale defined by {{PropertyData|Scale}}.
:{{Emphasis|Note:}} CoarseView is affected by an upstream bug in OCCT ([https://www.freecadweb.org/tracker/view.php?id=3332 #3332]) which causes the View's position on the Page to be slightly off from the specified X,Y values.
* {{PropertyData|Smooth Visible Lines}}: Visible Smooth lines on/off.
* {{PropertyData|Scale|FloatConstant}}: The view will be rendered on the page in Scale:1 ratio to the Source. (1)
* {{PropertyData|Seam Visible Lines}}: Visible Seam lines on/off.
* {{PropertyData|Caption|String}}: Optional short text caption. (1)

* {{PropertyData|Iso Visible Lines}}: Visible Isometric(u,v) lines on/off.
<!--T:22-->
* {{PropertyData|Hard Hidden Lines}}: Hidden lines on/off.
{{TitleProperty|Cosmetics}}
* {{PropertyData|Smooth Hidden Lines}}: Hidden Smooth lines on/off.

* {{PropertyData|Seam Hidden Lines}}: Hidden Seam lines on/off.
<!--T:29-->
* {{PropertyData|Iso Hidden Lines}}: Hidden Isometric(u,v) lines on/off.
* {{PropertyData|Cosmetic Vertexes|TechDraw::PropertyCosmeticVertexList|Hidden}}
* {{PropertyData|Iso Count}}: Number of Isometric(u,v) lines to draw on each face.
* {{PropertyData|Cosmetic Edges|TechDraw::PropertyCosmeticEdgeList|Hidden}}
* {{PropertyData|Center Lines|TechDraw::PropertyCenterLineList|Hidden}}
* {{PropertyData|Geom Formats|TechDraw::PropertyGeomFormatList|Hidden}}

<!--T:26-->
{{TitleProperty|HLR Parameters}}

<!--T:23-->
* {{PropertyData|Coarse View|Bool}}: If {{TRUE}}, TechDraw will use a polygon approximation to calculate drawing geometry. If {{FALSE}}, TechDraw will use a precision algorithm. CoarseView can be much faster for complex models. The quality of the drawing is reduced, since every curve is approximated as a series of short line segments. Vertices are not displayed in CoarseView since each short segment would result in two new Vertices and the display becomes cluttered. Linear Dimensions can be added to a CoarseView, but are unlikely to be useful.
* {{PropertyData|Smooth Visible|Bool}}: Visible Smooth lines on/off.
* {{PropertyData|Seam Visible|Bool}}: Visible Seam lines on/off.
* {{PropertyData|Iso Visible|Bool}}: Visible Isometric(u,v) lines on/off.
* {{PropertyData|Hard Hidden|Bool}}: Hidden lines on/off.
* {{PropertyData|Smooth Hidden|Bool}}: Hidden Smooth lines on/off.
* {{PropertyData|Seam Hidden|Bool}}: Hidden Seam lines on/off.
* {{PropertyData|Iso Hidden|Bool}}: Hidden Isometric(u,v) lines on/off.
* {{PropertyData|Iso Count|Integer}}: Number of Isometric(u,v) lines to draw on each face.

<!--T:27-->
{{TitleProperty|Projection}}

<!--T:24-->
* {{PropertyData|Source|LinkList}}: Links to the drawable objects to be depicted.
* {{PropertyData|XSource|XLinkList}}: Links to the drawable objects in an external file.
* {{PropertyData|Direction|Vector}}: This vector controls the direction from which you are viewing the object. +X is right, -X is left, +Y is rear, -Y is front (looking into the screen), +Z is up and -Z is down. So a Front view is (0,-1,0) and an isometric view is (1,-1,1).
* {{PropertyData|XDirection|Vector}}: This vector controls the rotation of the view around the Direction.
* {{PropertyData|Perspective|Bool}}: {{TRUE}} for perspective projection, {{FALSE}} for orthogonal projection.
* {{PropertyData|Focus|Distance}}: Distance from camera to projection plane for perspective projections. Needs to be adjusted to fit the object. Too far and the perspective is lost, too close and the object is distorted.

=== View === <!--T:28-->

<!--T:30-->
{{TitleProperty|Base}}

<!--T:31-->
* {{PropertyView|Keep Label|Bool}}: Always show view label if {{TRUE}}. (1)
* {{PropertyView|Stack Order|Integer}}: Over or under lap relative to other views. (1) {{Version|0.21}}

<!--T:32-->
{{TitleProperty|Decoration}}

<!--T:33-->
* {{PropertyView|Arc Center Marks|Bool}}: Circular arc center marks on/off.
* {{PropertyView|Center Scale|Float}}: Circular arc center mark size adjustment, if enabled.
* {{PropertyView|Horiz Center Line|Bool}}: Show a horizontal centerline through the view.
* {{PropertyView|Section Line Color|Color}}: Set the section line color if applicable.
* {{PropertyView|Section Line Style|Enumeration}}: Set the section line style if applicable.
* {{PropertyView|Show All Edges|Bool}}: Temporarily show invisible lines.
* {{PropertyView|Show Section Line|Bool}}: Show/hide the section line if applicable.
* {{PropertyView|Vert Center Line|Bool}}: Show a vertical centerline through the view.

<!--T:34-->
{{TitleProperty|Highlight}}

<!--T:35-->
* {{PropertyView|Highlight Adjust|Float}}: Adjust the rotation of the Detail highlight if applicable.
* {{PropertyView|Highlight Line Color|Color}}: Set the highlight line color if applicable.
* {{PropertyView|Highlight Line Style|Enumeration}}: Set the highlight line style if applicable.

<!--T:36-->
{{TitleProperty|Lines}}

<!--T:37-->
* {{PropertyView|Extra Width|Length}}: Not implemented yet.
* {{PropertyView|Hidden Width|Length}}: The thickness of hidden lines, if enabled.
* {{PropertyView|Iso Width|Length}}: The thickness of isometric(u,v) surface lines and Dimension lines.
* {{PropertyView|Line Width|Length}}: The thickness of visible lines. See [[TechDraw_LineGroup|Line Groups]].


<!--T:8-->
<!--T:8-->
(1) these properties are common to all View types.
(1) these properties are common to all View types.

=== View === <!--T:9-->
* {{PropertyView|Keep Label}}: Always show View Label if true.
* {{PropertyView|LineWidth}}: The thickness of visible lines. See [[TechDraw_LineGroup|Line Groups]].
* {{PropertyView|HiddenWidth}}: The thickness of hidden lines, if enabled.
* {{PropertyView|IsoWidth}}: The thickness of isometric(u,v) surface lines and Dimension lines.
* {{PropertyView|ExtraWidth}}: not implemented yet.
* {{PropertyView|ShowCenters}}: Circle/arc center marks on/off.
* {{PropertyView|CenterScale}}: Circular arc center mark size adjustment, if enabled.
* {{PropertyView|HorizCenterLine}}: Show a horizontal centerline through view.
* {{PropertyView|VertCenterLine}}: Show a vertical centerline through view.
* {{PropertyView|ShowSectionLine}}: Show/hide section line if applicable.


==Scripting== <!--T:6-->
==Scripting== <!--T:6-->


<!--T:15-->
<!--T:15-->
{{Emphasis|See also:}} [[TechDraw API/fr|TechDraw API]] and [[FreeCAD Scripting Basics/fr|FreeCAD Scripting Basics]].
See also: [https://freecad.github.io/SourceDoc/ Autogenerated API documentation] and [[FreeCAD_Scripting_Basics|FreeCAD Scripting Basics]].


<!--T:16-->
<!--T:38-->
The New View tool can be used in [[macros/fr|macros]] and from the [[Python/fr|Python]] console by using the following functions:
A View can be created with [[Macros|macros]] and from the [[Python|Python]] console by using the following functions:


</translate>
</translate>
{{Code|code=
{{Code|code=
import FreeCAD as App
view = FreeCAD.ActiveDocument.addObject('TechDraw::DrawViewPart','View')

rc = page.addView(view)
FreeCAD.ActiveDocument.View.Source = [App.ActiveDocument.Box]
doc = App.ActiveDocument
box = doc.addObject("Part::Box", "Box")
FreeCAD.ActiveDocument.View.Direction = (0.0,0.0,1.0)

page = doc.addObject("TechDraw::DrawPage", "Page")
template = doc.addObject("TechDraw::DrawSVGTemplate", "Template")
template.Template = App.getResourceDir() + "Mod/TechDraw/Templates/A4_LandscapeTD.svg"
page.Template = template

# Toggle the visibility of the page to ensure its width and height are updated (hack):
page.Visibility = False
page.Visibility = True

view = doc.addObject("TechDraw::DrawViewPart", "View")
page.addView(view)
view.Source = [box]
view.Direction = (0, 0, 1)

view.X = page.PageWidth / 2
view.Y = page.PageHeight / 2

doc.recompute()
}}
}}
<translate>
<translate>



<!--T:20-->
<!--T:20-->
{{Docnav
{{Docnav
|[[TechDraw_PrintAll|PrintAll]]
|[[TechDraw_New_Pick|New Pick]]
|[[TechDraw_BrokenView|BrokenView]]
|[[TechDraw_NewProjGroup|New Projection Group]]
|[[TechDraw_Module|TechDraw]]
|[[TechDraw_Workbench|TechDraw]]
|IconL=TechDraw_New_Pick.png
|IconL=TechDraw_PrintAll.svg
|IconR=TechDraw_BrokenView.svg
|IconC=Workbench_TechDraw.svg
|IconC=Workbench_TechDraw.svg
|IconR=techdraw-projgroup.png
}}
}}


<!--T:17-->
{{TechDraw Tools navi}}

<!--T:18-->
{{Userdocnavi}}
</translate>
</translate>
{{TechDraw Tools navi{{#translation:}}}}
{{Userdocnavi{{#translation:}}}}

Latest revision as of 15:38, 7 April 2024

TechDraw View

Menu location
TechDraw → TechDraw Views → Insert View
Workbenches
TechDraw
Default shortcut
None
Introduced in version
-
See also
TechDraw Projection Group, TechDraw Section View

Description

The TechDraw View tool adds a representation of one or more objects to a Drawing page. This is the basic building block of the TechDraw workbench. Most other Views are derived in some way from View.

View will try to draw anything with a Shape property. You can select sketches, PartDesign Bodies, Draft objects etc. View will also extract any shapes from objects within a Std Part or a Std Group.

View of a solid box with hidden lines

Usage

  1. Optionally rotate the 3D view. Unless a face is selected in the next step, the camera direction in the 3D view determines the initial value of the DataDirection property of the View.
  2. Select one or more objects in the 3D view or Tree view. When selecting in the 3D view the first selected face determines the initial value of the DataDirection property.
  3. If there are multiple drawing pages in the document: optionally add the desired page to the selection by selecting it in the Tree view.
  4. There are several ways to invoke the tool:
    • Press the Insert View button.
    • Select the TechDraw → TechDraw Views → Insert View option from the menu.
  5. If there are multiple drawing pages in the document and you have not yet selected a page, the Page Chooser dialog box opens: introduced in version 0.20
    1. Select the desired page.
    2. Press the OK button.

Properties

Data

Base

  • DataX (Distance): The view's horizontal position on the page. (1)
  • DataY (Distance): The view's vertical position on the page. (1)
  • DataLock Position (Bool): Prevents Views from being dragged in the Gui when true. The View can still be moved by changing X,Y properties. (1)
  • DataRotation (Angle): Counterclockwise rotation of the View on the page in degrees. (1)
  • DataScale Type (Enumeration): The scale type. Options: (1)
    • Page: Use the Page's scale setting.
    • Automatic: Fit the view to the page.
    • Custom: Use the scale defined by DataScale.
  • DataScale (FloatConstant): The view will be rendered on the page in Scale:1 ratio to the Source. (1)
  • DataCaption (String): Optional short text caption. (1)

Cosmetics

  • Data (Hidden)Cosmetic Vertexes (TechDraw::PropertyCosmeticVertexList)
  • Data (Hidden)Cosmetic Edges (TechDraw::PropertyCosmeticEdgeList)
  • Data (Hidden)Center Lines (TechDraw::PropertyCenterLineList)
  • Data (Hidden)Geom Formats (TechDraw::PropertyGeomFormatList)

HLR Parameters

  • DataCoarse View (Bool): If true, TechDraw will use a polygon approximation to calculate drawing geometry. If false, TechDraw will use a precision algorithm. CoarseView can be much faster for complex models. The quality of the drawing is reduced, since every curve is approximated as a series of short line segments. Vertices are not displayed in CoarseView since each short segment would result in two new Vertices and the display becomes cluttered. Linear Dimensions can be added to a CoarseView, but are unlikely to be useful.
  • DataSmooth Visible (Bool): Visible Smooth lines on/off.
  • DataSeam Visible (Bool): Visible Seam lines on/off.
  • DataIso Visible (Bool): Visible Isometric(u,v) lines on/off.
  • DataHard Hidden (Bool): Hidden lines on/off.
  • DataSmooth Hidden (Bool): Hidden Smooth lines on/off.
  • DataSeam Hidden (Bool): Hidden Seam lines on/off.
  • DataIso Hidden (Bool): Hidden Isometric(u,v) lines on/off.
  • DataIso Count (Integer): Number of Isometric(u,v) lines to draw on each face.

Projection

  • DataSource (LinkList): Links to the drawable objects to be depicted.
  • DataXSource (XLinkList): Links to the drawable objects in an external file.
  • DataDirection (Vector): This vector controls the direction from which you are viewing the object. +X is right, -X is left, +Y is rear, -Y is front (looking into the screen), +Z is up and -Z is down. So a Front view is (0,-1,0) and an isometric view is (1,-1,1).
  • DataXDirection (Vector): This vector controls the rotation of the view around the Direction.
  • DataPerspective (Bool): true for perspective projection, false for orthogonal projection.
  • DataFocus (Distance): Distance from camera to projection plane for perspective projections. Needs to be adjusted to fit the object. Too far and the perspective is lost, too close and the object is distorted.

View

Base

  • ViewKeep Label (Bool): Always show view label if true. (1)
  • ViewStack Order (Integer): Over or under lap relative to other views. (1) introduced in version 0.21

Decoration

  • ViewArc Center Marks (Bool): Circular arc center marks on/off.
  • ViewCenter Scale (Float): Circular arc center mark size adjustment, if enabled.
  • ViewHoriz Center Line (Bool): Show a horizontal centerline through the view.
  • ViewSection Line Color (Color): Set the section line color if applicable.
  • ViewSection Line Style (Enumeration): Set the section line style if applicable.
  • ViewShow All Edges (Bool): Temporarily show invisible lines.
  • ViewShow Section Line (Bool): Show/hide the section line if applicable.
  • ViewVert Center Line (Bool): Show a vertical centerline through the view.

Highlight

  • ViewHighlight Adjust (Float): Adjust the rotation of the Detail highlight if applicable.
  • ViewHighlight Line Color (Color): Set the highlight line color if applicable.
  • ViewHighlight Line Style (Enumeration): Set the highlight line style if applicable.

Lines

  • ViewExtra Width (Length): Not implemented yet.
  • ViewHidden Width (Length): The thickness of hidden lines, if enabled.
  • ViewIso Width (Length): The thickness of isometric(u,v) surface lines and Dimension lines.
  • ViewLine Width (Length): The thickness of visible lines. See Line Groups.

(1) these properties are common to all View types.

Scripting

See also: Autogenerated API documentation and FreeCAD Scripting Basics.

A View can be created with macros and from the Python console by using the following functions:

import FreeCAD as App

doc = App.ActiveDocument
box = doc.addObject("Part::Box", "Box")

page = doc.addObject("TechDraw::DrawPage", "Page")
template = doc.addObject("TechDraw::DrawSVGTemplate", "Template")
template.Template = App.getResourceDir() + "Mod/TechDraw/Templates/A4_LandscapeTD.svg"
page.Template = template

# Toggle the visibility of the page to ensure its width and height are updated (hack):
page.Visibility = False
page.Visibility = True

view = doc.addObject("TechDraw::DrawViewPart", "View")
page.addView(view)
view.Source = [box]
view.Direction = (0, 0, 1)

view.X = page.PageWidth / 2
view.Y = page.PageHeight / 2

doc.recompute()