Draft SelectPlane: Difference between revisions

From FreeCAD Documentation
(Image caption; translate tags in correct location)
No edit summary
(27 intermediate revisions by 7 users not shown)
Line 1: Line 1:
<languages/>
<languages/>
<translate>
<translate>
<!--T:24-->
{{Docnav
|[[Draft_Stretch|Stretch]]
|[[Draft_FinishLine|Finish line]]
|[[Draft_Module|Draft]]
|IconL=Draft_Stretch.svg
|IconR=Draft_FinishLine.svg
|IconC=Workbench_Draft.svg
}}

<!--T:1-->
<!--T:1-->
{{GuiCommand
{{GuiCommand
|Name=Draft SelectPlane
|Name=Draft SelectPlane
|MenuLocation=Draft → Utilities → Select Plane
|MenuLocation=Draft → Utilities → Select Plane
|Workbenches=[[Draft Module|Draft]], [[Arch Module|Arch]]
|Workbenches=[[Draft_Module|Draft]], [[Arch_Module|Arch]]
|Shortcut=W P
|Shortcut={{KEY|W}} {{KEY|P}}
|SeeAlso=[[Draft SetWorkingPlaneProxy]], [[Draft ToggleGrid]]
|SeeAlso=[[Draft_SetWorkingPlaneProxy|Draft SetWorkingPlaneProxy]], [[Draft_ToggleGrid|Draft ToggleGrid]]
}}
}}


==Description== <!--T:2-->
==Description== <!--T:27-->

The [[Draft Workbench]] features a working plane system. A plane in the 3D view indicates where a Draft shape will be built. There are several methods to define the working plane:
<!--T:2-->
The [[Image:Workbench_Draft.svg|24px]] [[Draft_Module|Draft Workbench]] features a working plane system. A plane in the [[3D_view|3D view]] indicates where a Draft shape will be built. There are several methods to define the working plane:
* From a selected face.
* From a selected face.
* From three selected vertices.
* From three selected vertices.
Line 19: Line 31:


</translate>
</translate>
[[Image:Workingplane_example.jpg|400px]]
[[Image:WorkingPlane_example.png|400px]]
<translate>
<translate>
<!--T:3-->
<!--T:12-->
{{Caption|Different working planes can be set in the model on which to draw shapes}}
{{Caption|Different working planes can be set on which to draw shapes}}


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


<!--T:13-->
The {{Button|[[Image:Draft SelectPlane.svg|16px]] [[Draft SelectPlane|SelectPlane]]}} button is present in the [[Draft Tray]] toolbar, which only appears in the [[Draft Workbench|Draft]] and [[Arch Workbench]]es.
The {{Button|[[Image:Draft SelectPlane.svg|16px]] [[Draft SelectPlane|SelectPlane]]}} button is present in the [[Draft Tray|Draft Tray]] toolbar, which only appears in the [[Draft Module|Draft]] and [[Arch Module|Arch]] workbenches.


=== Without element selected ===
=== Without element selected === <!--T:14-->

# Press the {{Button|[[Image:Draft SelectPlane.svg|16px]] [[Draft SelectPlane|SelectPlane]]}} button.
<!--T:15-->
# Press the {{Button|[[Image:Draft_SelectPlane.svg|16px]] [[Draft SelectPlane|SelectPlane]]}} button, or use {{KEY|Draft}} → {{KEY|Utilities}} → {{KEY|[[Image:Draft_SelectPlane.svg|16px]] [[Draft SelectPlane|SelectPlane]]}} from the top menu, or the keyboard shortcut {{KEY|W}} then {{KEY|P}}
# Select the offset, the grid spacing, and the main lines
# Select the offset, the grid spacing, and the main lines
# Select one of the presets: {{Button|[[Image:View-top.svg|16px]] XY (top)}}, {{Button|[[Image:View-front.svg|16px]] XZ (front)}}, {{Button|[[Image:View-right.svg|16px]] YZ (side)}}, {{Button|[[Image:View-isometric.svg|16px]] View}}, or {{Button|[[Image:View-axonometric.svg|16px]] Auto}}.
# Select one of the presets: {{Button|[[Image:View-top.svg|16px]] XY (top)}}, {{Button|[[Image:View-front.svg|16px]] XZ (front)}}, {{Button|[[Image:View-right.svg|16px]] YZ (side)}}, {{Button|[[Image:View-isometric.svg|16px]] View}}, or {{Button|[[Image:View-axonometric.svg|16px]] Auto}}.


<!--T:16-->
Once the plane is set, the button will change to indicate the active plane {{Button|[[Image:Draft SelectPlane.png|16px]] Top}}, {{Button|[[Image:Draft SelectPlane.svg|16px]] Front}}, {{Button|[[Image:Draft SelectPlane.svg|16px]] Side}}, {{Button|[[Image:Draft SelectPlane.png|16px]] Auto}}, {{Button|[[Image:Draft SelectPlane.svg|16px]] d(0.0,-1.0,0.0)}}.
Once the plane is set, the button will change to indicate the active plane {{Button|[[Image:Draft_SelectPlane.svg|16px]] Top}}, {{Button|[[Image:Draft SelectPlane.svg|16px]] Front}}, {{Button|[[Image:Draft SelectPlane.svg|16px]] Side}}, {{Button|[[Image:Draft_SelectPlane.svg|16px]] Auto}}, {{Button|[[Image:Draft SelectPlane.svg|16px]] d(0.0,-1.0,0.0)}}.


<!--T:17-->
You can show and hide the grid with the shortcut {{KEY|G}} {{KEY|R}}.
You can show and hide the grid with the shortcut {{KEY|G}} {{KEY|R}}.


=== With element selected ===
=== With element selected === <!--T:18-->

# Select a face of an existing object in the 3D view, or hold {{KEY|Ctrl}} and select three vertices of any object. {{Version|0.17}}
<!--T:19-->
# Select a face of an existing object in the [[3D view]], or hold {{KEY|Ctrl}} and select three vertices of any object. {{Version|0.17}}
# Press the {{Button|[[Image:Draft SelectPlane.svg|16px]] [[Draft SelectPlane|SelectPlane]]}} button, or right click and select {{MenuCommand|Utilities → [[Image:Draft SelectPlane.svg|16px]] [[Draft SelectPlane|SelectPlane]]}}.
# Press the {{Button|[[Image:Draft SelectPlane.svg|16px]] [[Draft SelectPlane|SelectPlane]]}} button, or right click and select {{MenuCommand|Utilities → [[Image:Draft SelectPlane.svg|16px]] [[Draft SelectPlane|SelectPlane]]}}.


<!--T:20-->
The plane will be created aligned to the face of the object, or to the plane defined by the three vertices.
The plane will be created aligned to the face of the object, or to the plane defined by the three vertices.


==Options== <!--T:5-->
==Options== <!--T:28-->

<!--T:5-->
* Press the {{Button|[[Image:View-top.svg|16px]] XY (top)}} button to set the working plane on the XY plane. To easily draw on this plane, you should set the view to the top or bottom (the normal is in the positive or negative Z direction). Press {{KEY|2}} or {{KEY|5}} to quickly switch to these views.
* Press the {{Button|[[Image:View-top.svg|16px]] XY (top)}} button to set the working plane on the XY plane. To easily draw on this plane, you should set the view to the top or bottom (the normal is in the positive or negative Z direction). Press {{KEY|2}} or {{KEY|5}} to quickly switch to these views.
* Press the {{Button|[[Image:View-front.svg|16px]] XZ (front)}} button to set the working plane on the XZ plane. To easily draw on this plane, you should set the view to the front or rear (the normal is in the negative or positive Y direction). Press {{KEY|1}} or {{KEY|4}} to quickly switch to these views.
* Press the {{Button|[[Image:View-front.svg|16px]] XZ (front)}} button to set the working plane on the XZ plane. To easily draw on this plane, you should set the view to the front or rear (the normal is in the negative or positive Y direction). Press {{KEY|1}} or {{KEY|4}} to quickly switch to these views.
Line 51: Line 73:
* Set the "Offset" value to set the working plane at a certain perpendicular distance from the plane you selected.
* Set the "Offset" value to set the working plane at a certain perpendicular distance from the plane you selected.
* Set the "Grid spacing" value to define the space between each line in the grid.
* Set the "Grid spacing" value to define the space between each line in the grid.
* Set the "Grid size" value to define the overall extension of the grid plane.
* Set the "Main line every" value to draw a slightly thicker line in the grid at the set value. For example, if the grid spacing is 0.5 m, and there is a main line every 20 lines, there will be slightly thicker line every 10 m.
* Set the "Main line every" value to draw a slightly thicker line in the grid at the set value. For example, if the grid spacing is 0.5 m, and there is a main line every 20 lines, there will be slightly thicker line every 10 m.
* Click on the "Center plane on view" checkbox to draw the plane and grid closer to the camera view in the 3D view.
* Click on the "Center plane on view" checkbox to draw the plane and grid closer to the camera view in the 3D view.
* Press {{KEY|Esc}} or the {{button|Close}} button to abort the current command.
* Press {{KEY|Esc}} or the {{button|Close}} button to abort the current command.
* The grid displays an additional border with mainline spacing indicated in the bottom left corner {{Version|0.19}}. This can be disabled via Edit->Preferences->Draft->Grid and snapping->Show grid border


==Scripting== <!--T:6-->
==Scripting== <!--T:6-->
{{emphasis|See also:}} [[Draft API]] and [[FreeCAD Scripting Basics]]. See the [http://www.freecadweb.org/api/DraftWorkingPlane.html WorkingPlane API].
{{emphasis|See also:}} [[Draft API|Draft API]] and [[FreeCAD Scripting Basics|FreeCAD Scripting Basics]]. See the [http://www.freecadweb.org/api/DraftWorkingPlane.html WorkingPlane API].


<!--T:21-->
Working plane objects can easily be created and manipulated in [[macros]] and from the [[Python]] console.
Working plane objects can easily be created and manipulated in [[macros|macros]] and from the [[Python|Python]] console.


<!--T:8-->
<!--T:8-->
You can access the current Draft working plane, and apply transformations to it:
You can access the current Draft working plane, and apply transformations to it:

</translate>
</translate>
{{Code|code=
{{Code|code=
import FreeCAD
import FreeCAD as App
import FreeCADGui as Gui


Workplane = FreeCAD.DraftWorkingPlane
workplane = App.DraftWorkingPlane


v1 = FreeCAD.Vector(0, 0, 0)
v1 = App.Vector(0, 0, 0)
v2 = FreeCAD.Vector(1, 1, 1).normalize()
v2 = App.Vector(1, 1, 1).normalize()


Workplane.alignToPointAndAxis(v1, v2, 17)
workplane.alignToPointAndAxis(v1, v2, 17)
Gui.Snapper.toggleGrid()
Gui.Snapper.toggleGrid()
}}
}}
<translate>
<translate>


<!--T:22-->
A Draft command must be issued after changing the working plane to update the visible grid.
A Draft command must be issued after changing the working plane to update the visible grid, for example, [[Draft_Line|Line]], or just [[Draft_ToggleGrid|ToggleGrid]].


You can create your own planes, and use them independently of the current working plane.
<!--T:7-->
<!--T:7-->
You can create your own planes, and use them independently of the current working plane. This is useful if you need to make calculations or projections in these other planes.

</translate>
</translate>
{{Code|code=
{{Code|code=
import WorkingPlane
import WorkingPlane


Plane = WorkingPlane.plane()
my_plane = WorkingPlane.plane()

v1 = App.Vector(0, 0, 0)
v2 = App.Vector(1, 1, 1).normalize()
my_plane.alignToPointAndAxis(v1, v2, 17)

projection = my_plane.projectPoint(App.Vector(10, 15, 2))
print(projection)
}}
}}
<translate>
<translate>


<!--T:29-->
{{Draft Tools navi}}
To display a new grid use a new tracker object. First set up the normal working plane as you need, then create a new tracker object, then set it to the current plane, and then you can turn it on or off.
{{Userdocnavi}}
</translate>
{{Code|code=
import FreeCAD as App
import DraftTrackers

App.DraftWorkingPlane.alignToPointAndAxis(App.Vector(0, 0, 0),
App.Vector(1, 0, 0),
0)

my_grid = DraftTrackers.gridTracker()
my_grid.set()
my_grid.on()
my_grid.off()
}}
<translate>

<!--T:30-->
This grid is merely a visual aid and doesn't allow snapping.

<!--T:31-->
To have the possibility of switching quickly to different grids, in different positions, you should create a {{Button|[[File:Draft_SetWorkingPlaneProxy.svg|16px]] [[Draft_SetWorkingPlaneProxy|Working plane proxy]]}}.

<!--T:23-->
{{Docnav
|[[Draft_Stretch|Stretch]]
|[[Draft_FinishLine|Finish line]]
|[[Draft_Module|Draft]]
|IconL=Draft_Stretch.svg
|IconR=Draft_FinishLine.svg
|IconC=Workbench_Draft.svg
}}

</translate>
</translate>
{{Draft Tools navi{{#translation:}}}}
{{Userdocnavi{{#translation:}}}}
{{clear}}
{{clear}}

Revision as of 16:20, 29 November 2020

Draft SelectPlane

Menu location
Draft → Utilities → Select Plane
Workbenches
Draft, Arch
Default shortcut
W P
Introduced in version
-
See also
Draft SetWorkingPlaneProxy, Draft ToggleGrid

Description

The Draft Workbench features a working plane system. A plane in the 3D view indicates where a Draft shape will be built. There are several methods to define the working plane:

  • From a selected face.
  • From three selected vertices.
  • From the current view.
  • From a preset: top, front, or side.
  • None, in which case the working plane is adapted automatically to the current view when you start a command, or to a face if you start drawing on an existing face.

Different working planes can be set on which to draw shapes

Usage

The SelectPlane button is present in the Draft Tray toolbar, which only appears in the Draft and Arch workbenches.

Without element selected

  1. Press the SelectPlane button, or use DraftUtilities SelectPlane from the top menu, or the keyboard shortcut W then P
  2. Select the offset, the grid spacing, and the main lines
  3. Select one of the presets: XY (top), XZ (front), YZ (side), View, or Auto.

Once the plane is set, the button will change to indicate the active plane Top, Front, Side, Auto, d(0.0,-1.0,0.0).

You can show and hide the grid with the shortcut G R.

With element selected

  1. Select a face of an existing object in the 3D view, or hold Ctrl and select three vertices of any object. introduced in version 0.17
  2. Press the SelectPlane button, or right click and select Utilities → SelectPlane.

The plane will be created aligned to the face of the object, or to the plane defined by the three vertices.

Options

  • Press the XY (top) button to set the working plane on the XY plane. To easily draw on this plane, you should set the view to the top or bottom (the normal is in the positive or negative Z direction). Press 2 or 5 to quickly switch to these views.
  • Press the XZ (front) button to set the working plane on the XZ plane. To easily draw on this plane, you should set the view to the front or rear (the normal is in the negative or positive Y direction). Press 1 or 4 to quickly switch to these views.
  • Press the YZ (side) button to set the working plane on the YZ plane. To easily draw on this plane, you should set the view to the left or right side (the normal is in the positive or negative X direction). Press 3 or 6 to quickly switch to these views.
  • Press the View button to set the working plane to the current 3D view, perpendicular to the camera axis and passing through the origin (0,0,0).
  • Press the Auto button to unset any current working plane, and automatically set a working plane when a tool is used. When a drawing tool is selected the grid will be automatically updated to the current view; then, if the view is rotated, and another tool is selected, the grid redraws in the new view. This is equivalent of pressing View automatically before using a tool.
  • Set the "Offset" value to set the working plane at a certain perpendicular distance from the plane you selected.
  • Set the "Grid spacing" value to define the space between each line in the grid.
  • Set the "Grid size" value to define the overall extension of the grid plane.
  • Set the "Main line every" value to draw a slightly thicker line in the grid at the set value. For example, if the grid spacing is 0.5 m, and there is a main line every 20 lines, there will be slightly thicker line every 10 m.
  • Click on the "Center plane on view" checkbox to draw the plane and grid closer to the camera view in the 3D view.
  • Press Esc or the Close button to abort the current command.
  • The grid displays an additional border with mainline spacing indicated in the bottom left corner introduced in version 0.19. This can be disabled via Edit->Preferences->Draft->Grid and snapping->Show grid border

Scripting

See also: Draft API and FreeCAD Scripting Basics. See the WorkingPlane API.

Working plane objects can easily be created and manipulated in macros and from the Python console.

You can access the current Draft working plane, and apply transformations to it:

import FreeCAD as App
import FreeCADGui as Gui

workplane = App.DraftWorkingPlane

v1 = App.Vector(0, 0, 0)
v2 = App.Vector(1, 1, 1).normalize()

workplane.alignToPointAndAxis(v1, v2, 17)
Gui.Snapper.toggleGrid()
Gui.Snapper.toggleGrid()

A Draft command must be issued after changing the working plane to update the visible grid, for example, Line, or just ToggleGrid.

You can create your own planes, and use them independently of the current working plane. This is useful if you need to make calculations or projections in these other planes.

import WorkingPlane

my_plane = WorkingPlane.plane()

v1 = App.Vector(0, 0, 0)
v2 = App.Vector(1, 1, 1).normalize()
my_plane.alignToPointAndAxis(v1, v2, 17)

projection = my_plane.projectPoint(App.Vector(10, 15, 2))
print(projection)

To display a new grid use a new tracker object. First set up the normal working plane as you need, then create a new tracker object, then set it to the current plane, and then you can turn it on or off.

import FreeCAD as App
import DraftTrackers

App.DraftWorkingPlane.alignToPointAndAxis(App.Vector(0, 0, 0),
                                          App.Vector(1, 0, 0),
                                          0)

my_grid = DraftTrackers.gridTracker()
my_grid.set()
my_grid.on()
my_grid.off()

This grid is merely a visual aid and doesn't allow snapping.

To have the possibility of switching quickly to different grids, in different positions, you should create a Working plane proxy.