Draft SelectPlane: Difference between revisions

From FreeCAD Documentation
No edit summary
(Grid color button added. PR13051.)
(41 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{Page in progress}}
<languages/>
<languages/>
<translate>
<translate>
Line 7: Line 6:
|[[Draft_Shape2DView|Shape2DView]]
|[[Draft_Shape2DView|Shape2DView]]
|[[Draft_SetStyle|SetStyle]]
|[[Draft_SetStyle|SetStyle]]
|[[Draft_Module|Draft]]
|[[Draft_Workbench|Draft]]
|IconL=Draft_Shape2DView.svg
|IconL=Draft_Shape2DView.svg
|IconR=Draft_SetStyle.svg
|IconR=Draft_SetStyle.svg
Line 17: Line 16:
{{GuiCommand
{{GuiCommand
|Name=Draft SelectPlane
|Name=Draft SelectPlane
|MenuLocation=Utilities → Select Plane
|MenuLocation=Utilities → Select plane
|Workbenches=[[Draft_Module|Draft]], [[Arch_Module|Arch]]
|Workbenches=[[Draft_Workbench|Draft]], [[Arch_Workbench|Arch]]
|Shortcut={{KEY|W}} {{KEY|P}}
|Shortcut={{KEY|W}} {{KEY|P}}
|SeeAlso=[[Draft_WorkingPlaneProxy|Draft WorkingPlaneProxy]]
|SeeAlso=[[Draft_WorkingPlaneProxy|Draft WorkingPlaneProxy]]
Line 26: Line 25:


<!--T:2-->
<!--T:2-->
The [[Image:Draft_SelectPlane.svg|24px]] '''Draft SelectPlane''' command selects the current Draft working plane. This is the plane in the [[3D_view|3D view]] where new [[Draft_Module|Draft]] objects are created. A new working plane can be based on one of several [[#Usage_with_presets|presets]] or on a selection. The selection can be created before ([[#Usage_with_pre-selection|pre-selection]]) or after ([[#Usage_with_post-selection|post-selection]]) starting the command.
The [[Image:Draft_SelectPlane.svg|24px]] '''Draft SelectPlane''' command defines the current Draft working plane. This is the plane in the [[3D_view|3D view]] where new [[Draft_Workbench|Draft]] objects are created. A working plane can be based on one of several [[#Usage_with_presets|presets]] or on a selection. The selection can be created before ([[#Usage_with_pre-selection|pre-selection]]) or after ([[#Usage_with_post-selection|post-selection]]) starting the command.

<!--T:42-->
{{Version|0.22}}: For each 3D view a separate working plane is stored.

<!--T:43-->
The [[Image:Draft_tray_button_plane.png]] button in the [[Draft_Tray|Draft Tray]] changes depending on the current working plane. {{Version|0.22}}: If the working plane is not set to {{MenuCommand|Auto}} an asterisk ({{MenuCommand|*}}) is appended to the button label if the origin of the working plane does not match the global origin.


</translate>
</translate>
Line 34: Line 39:
{{Caption|Shapes created on different working planes}}
{{Caption|Shapes created on different working planes}}


==Usage with pre-selection==
==Usage with pre-selection== <!--T:32-->


<!--T:19-->
<!--T:19-->
# Do one of the following:
# Do one of the following:
#* Select a single object. The following objects are supported:
#* Select a single object. The following objects are supported:
#** [[Draft_WorkingPlaneProxy|Draft WorkingPlaneProxies]]: the {{PropertyView|View Data}} (the camera position) and the {{PropertyView|Visibility Map}} (the visibility of objects) of the WP proxy are also applied.
#** [[Draft_WorkingPlaneProxy|Draft WorkingPlaneProxies]]: the {{PropertyView|View Data}} (the camera position) and the {{PropertyView|Visibility Map}} (the saved visibility of objects) of the working plane proxy are also restored.
#** <s>[[Arch_Axis|Arch Axes]]</s>.
#** [[Arch_Axis|Arch Axes]] ({{Version|0.22}})
#** [[Arch_BuildingPart|Arch BuildingParts]].
#** [[Arch_AxisSystem|Arch AxisSystems]] ({{Version|0.22}})
#** [[Arch_SectionPlane|Arch SectionPlanes]].
#** [[Arch_BuildingPart|Arch BuildingParts]]
#** [[Arch_SectionPlane|Arch SectionPlanes]]
#** [[Std_Part|Std Parts]]: to avoid selecting subelements it is advisable to select these in the [[Tree_view|Tree view]].
#** [[Std_Part|Std Parts]]: to avoid selecting subelements it is advisable to select these in the [[Tree_view|Tree view]].
#** [[Part_Feature|Part Feature]] objects that have a single face. [[Part_Plane|Part Planes]] for example.
#** Non-solid objects that consist of a single flat face or a single curved edge, or ({{Version|0.22}}) that have three or more vertices.
#** Objects that are not [[Part_Feature|Part Feature]] objects and have a {{PropertyData|Placement}} property.
#** Solid objects or objects without a shape that have a {{PropertyData|Placement}} property. ({{Version|0.22}})
#* Select one or more subelements. You can select:
#* Select one or more subelements. You can select:
#** A flat face.
#** A flat face.
#** A curved edge.
#** Three vertices.
#** Three vertices.
#** An edge and a vertex, or two edges. The combined vertices must define a plane. ({{Version|0.22}})
#** A circular edge.
#** Two straight edges that are co-planar but not co-linear.
#** A straight edge and a vertex that does not lie on the (extended) edge.
# There are several ways to invoke the command:
# There are several ways to invoke the command:
#* Press the {{Button|[[Image:Draft_SelectPlane.svg|16px]] [[Draft_SelectPlane|Draft SelectPlane]]}} button in the [[Draft_Tray|Draft tray]]. Depending on the current working plane this button can look different.
#* Press the [[Image:Draft_tray_button_plane.png]] button in the [[Draft_Tray|Draft Tray]].
#* Select the {{MenuCommand|Utilities → [[Image:Draft_SelectPlane.svg|16px]] Select Plane}} option from the menu.
#* Select the {{MenuCommand|Utilities → [[Image:Draft_SelectPlane.svg|16px]] Select plane}} option from the menu.
#* Use the keyboard shortcut: {{KEY|W}} then {{KEY|P}}.
#* Use the keyboard shortcut: {{KEY|W}} then {{KEY|P}}.
# The working plane and the button in the [[Draft_Tray|Draft tray]] are updated.
# The working plane and the button in the [[Draft_Tray|Draft Tray]] are updated.


==Usage with post-selection==
==Usage with post-selection== <!--T:33-->


<!--T:34-->
# There are several ways to invoke the command:
# There are several ways to invoke the command:
#* Press the {{Button|[[Image:Draft_SelectPlane.svg|16px]] [[Draft_SelectPlane|Draft SelectPlane]]}} button in the [[Draft_Tray|Draft tray]]. Depending on the current working plane this button can look different.
#* Press the [[Image:Draft_tray_button_plane.png]] button in the [[Draft_Tray|Draft Tray]].
#* Select the {{MenuCommand|Utilities → [[Image:Draft_SelectPlane.svg|16px]] Select Plane}} option from the menu.
#* Select the {{MenuCommand|Utilities → [[Image:Draft_SelectPlane.svg|16px]] Select plane}} option from the menu.
#* Use the keyboard shortcut: {{KEY|W}} then {{KEY|P}}.
#* Use the keyboard shortcut: {{KEY|W}} then {{KEY|P}}.
# The {{MenuCommand|Working plane setup}} task panel opens. See [[#Options|Options]] for more information.
# The {{MenuCommand|Working plane setup}} task panel opens. See [[#Options|Options]] for more information.
# Do one of the following:
# Do one of the following:
#* Select a single object. See the [[#Usage_with_pre-selection|previous paragraph]] for the supported objects.
#* Select a single object. See the [[#Usage_with_pre-selection|previous paragraph]].
#* Select one or more subelements. You can select:
#* Select one or more subelements. See the [[#Usage_with_pre-selection|previous paragraph]].
#** A flat face.
#** Three vertices.
# Click anywhere in the [[3D_view|3D view]] to confirm the selection and finish the command.
# Click anywhere in the [[3D_view|3D view]] to confirm the selection and finish the command.
# The working plane and the button in the [[Draft_Tray|Draft tray]] are updated.
# The working plane and the button in the [[Draft_Tray|Draft Tray]] are updated.


==Usage with presets==
==Usage with presets== <!--T:35-->


<!--T:15-->
<!--T:15-->
# There are several ways to invoke the command:
# There are several ways to invoke the command:
#* Press the {{Button|[[Image:Draft_SelectPlane.svg|16px]] [[Draft_SelectPlane|Draft SelectPlane]]}} button in the [[Draft_Tray|Draft tray]]. Depending on the current working plane this button can look different.
#* Press the [[Image:Draft_tray_button_plane.png]] button in the [[Draft_Tray|Draft Tray]].
#* Select the {{MenuCommand|Utilities → [[Image:Draft_SelectPlane.svg|16px]] Select Plane}} option from the menu.
#* Select the {{MenuCommand|Utilities → [[Image:Draft_SelectPlane.svg|16px]] Select plane}} option from the menu.
#* Use the keyboard shortcut: {{KEY|W}} then {{KEY|P}}.
#* Use the keyboard shortcut: {{KEY|W}} then {{KEY|P}}.
# The {{MenuCommand|Working plane setup}} task panel opens. See [[#Options|Options]] for more information.
# The {{MenuCommand|Working plane setup}} task panel opens. See [[#Options|Options]] for more information.
# Press any of the buttons to finish the command.
# Press any of the buttons to finish the command.
# The working plane and the button in the [[Draft_Tray|Draft tray]] are updated.
# The working plane and the button in the [[Draft_Tray|Draft Tray]] are updated.


==Options== <!--T:28-->
==Options== <!--T:28-->
Line 90: Line 94:
* Press the {{Button|[[Image:View-front.svg|16px]] Front (XZ)}} button to align the working plane with the XZ plane of the global coordinate system.
* Press the {{Button|[[Image:View-front.svg|16px]] Front (XZ)}} button to align the working plane with the XZ plane of the global coordinate system.
* Press the {{Button|[[Image:View-right.svg|16px]] Side (YZ)}} button to align the working plane with the YZ plane of the global coordinate system.
* Press the {{Button|[[Image:View-right.svg|16px]] Side (YZ)}} button to align the working plane with the YZ plane of the global coordinate system.
* Press the {{Button|[[Image:View-isometric.svg|16px]] Align to view}} button to align the working plane with the current [[3D_view|3D view]]. If the {{MenuCommand|Center plane on view}} checkbox is unchecked the working plane origin will match the origin of the global coordinate system, else it will match the center of the current [[3D_view|3D view]].
* Press the {{Button|[[Image:View-isometric.svg|16px]] Align to view}} button to align the working plane with the current [[3D_view|3D view]]. If the {{MenuCommand|Center plane on view}} checkbox is not checked the working plane origin will match the origin of the global coordinate system, else it will match the center of the current [[3D_view|3D view]].
* Press the {{Button|[[Image:View-axonometric.svg|16px]] Automatic}} button to automatically align the working plane with the current [[3D_view|3D view]] whenever a Draft or [[Arch_Module|Arch]] command requiring point input is started. This is equivalent to pressing the {{Button|[[Image:View-isometric.svg|16px]] Align to view}} button before using the command.
* Press the {{Button|[[Image:View-axonometric.svg|16px]] Automatic}} button to set the working plane to {{MenuCommand|Auto}}. A working plane set to {{MenuCommand|Auto}} will automatically align with the current [[3D_view|3D view]] whenever a Draft or [[Arch_Workbench|Arch]] command requiring point input is started. This is equivalent to pressing the {{Button|[[Image:View-isometric.svg|16px]] Align to view}} button before using the command. Additionally the working plane will align to planar faces that have been selected before starting the command, or when points on planar faces are picked during the command.
* The {{MenuCommand|Offset}} defines the perpendicular distance between the calculated plane and the actual working plane.
* The {{MenuCommand|Offset}} defines the perpendicular distance between the calculated plane and the actual working plane.
* Check the {{MenuCommand|Center plane on view}} checkbox to put the origin of the working plane in the center of to the current [[3D_view|3D view]]. This option really only makes sense if the {{Button|[[Image:View-isometric.svg|16px]] Align to view}} button is used.
* Check the {{MenuCommand|Center plane on view}} checkbox to put the origin of the working plane in the center of to the current [[3D_view|3D view]]. This option can be useful in combination with the {{Button|[[Image:View-isometric.svg|16px]] Align to view}} button.
* Select a vertex in the [[3D_view|3D view]] and press the {{Button|[[Image:Draft_Move.svg|16px]] Move working plane}} button to move the working plane so that its origin matches the position of the selected vertex.
* Select a vertex in the [[3D_view|3D view]] and press the {{Button|[[Image:Draft_Move.svg|16px]] Move working plane}} button to move the working plane so that its origin matches the position of the selected vertex.
* The {{MenuCommand|Grid color}} button allows to quickly change the color of the grid. {{Version|0.22}}
* The {{MenuCommand|Grid spacing}} defines the distance between grid lines.
* The {{MenuCommand|Grid spacing}} defines the distance between grid lines.
* The {{MenuCommand|Main line every}} value determines where main grid lines are drawn. Main grid lines are slightly thicker than normal grid lines. For example if the grid spacing is {{Value|0.5 m}} and there is a main line every {{Value|10 lines}}, such a line will occur every {{Value|5 m}}.
* The {{MenuCommand|Main line every}} value determines where main grid lines are drawn. Main grid lines are slightly thicker than normal grid lines. For example if the grid spacing is {{Value|0.5 m}} and there is a main line every {{Value|10 lines}}, such a line will occur every {{Value|5 m}}.
* The {{MenuCommand|Grid extension}} value determines the number of grid lines in the X and Y direction of the grid.
* The {{MenuCommand|Grid extension}} value determines the number of grid lines in the X and Y direction of the grid.
* The {{MenuCommand|Snapping radius}} is the maximum distance at which [[Draft_Snap_Grid|Draft Snap Grid]] detects the intersections of grid lines.
* The {{MenuCommand|Snapping radius}} is the maximum distance at which [[Draft_Snap_Grid|Draft Snap Grid]] detects the intersections of grid lines.
* Press the {{Button|[[Image:view-fullscreen.svg|16px]] Center view}} button to use the origin of the current working plane as the center of the [[3D_view|3D view]].
* Press the {{Button|[[Image:view-fullscreen.svg|16px]] Center view}} button to align the [[3D_view|3D view]] with the current working plane.
* Press the {{Button|[[Image:edit-undo.svg|16px]] Previous}} button to reset the working plane to its previous position.
* Press the {{Button|[[Image:sel-back.svg|16px]] Previous}} button to reset the working plane to its previous position.
* Press {{KEY|Esc}} or the {{button|Close}} button to abort the command.
* Press the {{Button|Next [[Image:sel-forward.svg|16px]]}} button to reset the working plane to its next position. {{Version|0.22}}
* Press {{KEY|Esc}} or the {{Button|Close}} button to abort the command.


==Notes==
==Notes== <!--T:36-->


<!--T:37-->
* It can be useful to align the [[3D_view|3D view]] with the selected Draft working plane. For example after switching the working plane to Front you may want to switch to the [[Std_ViewFront|Front view]] as well.
* It can be useful to align the [[3D_view|3D view]] with the selected Draft working plane. For example after switching the working plane to Front you may want to switch to the [[Std_ViewFront|Front view]] as well.
* The grid can be toggled with the [[Draft_ToggleGrid|Draft ToggleGrid]] command.
* The grid can be toggled with the [[Draft_ToggleGrid|Draft ToggleGrid]] command.
* By double-clicking [[Draft_WorkingPlaneProxy|Draft WorkingPlaneProxies]] in the [[Tree_view|Tree view]] you can quickly switch between working planes.
* By double-clicking [[Draft_WorkingPlaneProxy|Draft WorkingPlaneProxies]] in the [[Tree_view|Tree view]] you can quickly switch between working planes.


==Preferences==
==Preferences== <!--T:38-->


<!--T:39-->
See also: [[Preferences_Editor|Preferences Editor]] and [[Draft_Preferences|Draft Preferences]].
See also: [[Preferences_Editor|Preferences Editor]] and [[Draft_Preferences|Draft Preferences]].


<!--T:40-->
* The grid settings in the task panel as well as several other grid settings are available as preferences: {{MenuCommand|Edit → Preferences... → Draft → Grid and snapping → Grid}}.
* To use the grid the {{MenuCommand|Edit → Preferences... → Draft → Grid and snapping → Grid → Use grid}} option must be selected. After changing this preference you must restart FreeCAD.
* The grid settings in the task panel as well as several other grid settings are available as preferences: {{MenuCommand|Edit → Preferences... → Draft → Grid and snapping}}.
* The Snapping radius can also be changed on-the-fly (see [[Draft_Snap#Preferences|Draft Snap]]) or by changing: {{MenuCommand|Tools → Edit parameters... → BaseApp → Preferences → Mod → Draft → snapRange}}.
* The Snapping radius can also be changed on-the-fly (see [[Draft_Snap#Preferences|Draft Snap]]) or by changing: {{MenuCommand|Tools → Edit parameters... → BaseApp → Preferences → Mod → Draft → snapRange}}.


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


<!--T:6-->
<!--T:6-->
See also: [https://freecad.github.io/SourceDoc/ Autogenerated API documentation] and [[FreeCAD Scripting Basics|FreeCAD Scripting Basics]].
See also: [https://freecad.github.io/SourceDoc/ Autogenerated API documentation] and [[FreeCAD Scripting Basics|FreeCAD Scripting Basics]].


<!--T:8-->
<!--T:44-->
{{Version|0.22}}:
If the [[Draft_Module|Draft Workbench]] is active the FreeCAD application object has a {{incode|DraftWorkingPlane}} property which stores the current Draft working plane. You can access this property and apply transformations to it:

<!--T:45-->
The WorkingPlane module offers two classes to create working plane objects: the {{incode|PlaneBase}} class and the {{incode|PlaneGui}} class. The second class inherits from the first. Objects of the {{incode|PlaneGui}} class interact with the GUI (the [[Draft_Tray|Draft Tray]] button), the [[3D_view|3D view]] and the [[Draft_Snap_Grid|grid]]. {{incode|PlaneBase}} objects do not.

<!--T:46-->
Use the {{incode|get_working_plane()}} method of the WorkingPlane module to get an instance of the {{incode|PlaneGui}} class linked to the current 3D view. The method either returns the existing working plane linked to the view or creates a new working plane if required.


</translate>
</translate>
{{Code|code=
{{Code|code=
# This code only works if the Draft Workbench is active!

import FreeCAD as App
import FreeCAD as App
import FreeCADGui as Gui
import WorkingPlane


wp = WorkingPlane.get_working_plane()
doc = App.newDocument()


workplane = App.DraftWorkingPlane
origin = App.Vector(0, 0, 0)
normal = App.Vector(1, 1, 1).normalize()
offset = 17
wp.align_to_point_and_axis(origin, normal, offset)


v1 = App.Vector(0, 0, 0)
point = App.Vector(10, 15, 2)
projection = wp.project_point(point)
v2 = App.Vector(1, 1, 1).normalize()
print(projection)

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


<!--T:7-->
<!--T:47-->
The {{incode|PlaneBase}} class can be used to create working planes independent of the GUI:
It is also possible to create planes independently of the Draft working plane. This can be useful for calculations and projections:


</translate>
</translate>
Line 152: Line 164:
import WorkingPlane
import WorkingPlane


my_plane = WorkingPlane.plane()
wp = WorkingPlane.PlaneBase()

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>
Line 168: Line 173:
|[[Draft_Shape2DView|Shape2DView]]
|[[Draft_Shape2DView|Shape2DView]]
|[[Draft_SetStyle|SetStyle]]
|[[Draft_SetStyle|SetStyle]]
|[[Draft_Module|Draft]]
|[[Draft_Workbench|Draft]]
|IconL=Draft_Shape2DView.svg
|IconL=Draft_Shape2DView.svg
|IconR=Draft_SetStyle.svg
|IconR=Draft_SetStyle.svg

Revision as of 09:37, 28 March 2024

Draft SelectPlane

Menu location
Utilities → Select plane
Workbenches
Draft, Arch
Default shortcut
W P
Introduced in version
-
See also
Draft WorkingPlaneProxy

Description

The Draft SelectPlane command defines the current Draft working plane. This is the plane in the 3D view where new Draft objects are created. A working plane can be based on one of several presets or on a selection. The selection can be created before (pre-selection) or after (post-selection) starting the command.

introduced in version 0.22: For each 3D view a separate working plane is stored.

The button in the Draft Tray changes depending on the current working plane. introduced in version 0.22: If the working plane is not set to Auto an asterisk (*) is appended to the button label if the origin of the working plane does not match the global origin.

Shapes created on different working planes

Usage with pre-selection

  1. Do one of the following:
  2. There are several ways to invoke the command:
    • Press the button in the Draft Tray.
    • Select the Utilities → Select plane option from the menu.
    • Use the keyboard shortcut: W then P.
  3. The working plane and the button in the Draft Tray are updated.

Usage with post-selection

  1. There are several ways to invoke the command:
    • Press the button in the Draft Tray.
    • Select the Utilities → Select plane option from the menu.
    • Use the keyboard shortcut: W then P.
  2. The Working plane setup task panel opens. See Options for more information.
  3. Do one of the following:
  4. Click anywhere in the 3D view to confirm the selection and finish the command.
  5. The working plane and the button in the Draft Tray are updated.

Usage with presets

  1. There are several ways to invoke the command:
    • Press the button in the Draft Tray.
    • Select the Utilities → Select plane option from the menu.
    • Use the keyboard shortcut: W then P.
  2. The Working plane setup task panel opens. See Options for more information.
  3. Press any of the buttons to finish the command.
  4. The working plane and the button in the Draft Tray are updated.

Options

  • Press the Top (XY) button to align the working plane with the XY plane of the global coordinate system.
  • Press the Front (XZ) button to align the working plane with the XZ plane of the global coordinate system.
  • Press the Side (YZ) button to align the working plane with the YZ plane of the global coordinate system.
  • Press the Align to view button to align the working plane with the current 3D view. If the Center plane on view checkbox is not checked the working plane origin will match the origin of the global coordinate system, else it will match the center of the current 3D view.
  • Press the Automatic button to set the working plane to Auto. A working plane set to Auto will automatically align with the current 3D view whenever a Draft or Arch command requiring point input is started. This is equivalent to pressing the Align to view button before using the command. Additionally the working plane will align to planar faces that have been selected before starting the command, or when points on planar faces are picked during the command.
  • The Offset defines the perpendicular distance between the calculated plane and the actual working plane.
  • Check the Center plane on view checkbox to put the origin of the working plane in the center of to the current 3D view. This option can be useful in combination with the Align to view button.
  • Select a vertex in the 3D view and press the Move working plane button to move the working plane so that its origin matches the position of the selected vertex.
  • The Grid color button allows to quickly change the color of the grid. introduced in version 0.22
  • The Grid spacing defines the distance between grid lines.
  • The Main line every value determines where main grid lines are drawn. Main grid lines are slightly thicker than normal grid lines. For example if the grid spacing is 0.5 m and there is a main line every 10 lines, such a line will occur every 5 m.
  • The Grid extension value determines the number of grid lines in the X and Y direction of the grid.
  • The Snapping radius is the maximum distance at which Draft Snap Grid detects the intersections of grid lines.
  • Press the Center view button to align the 3D view with the current working plane.
  • Press the Previous button to reset the working plane to its previous position.
  • Press the Next button to reset the working plane to its next position. introduced in version 0.22
  • Press Esc or the Close button to abort the command.

Notes

  • It can be useful to align the 3D view with the selected Draft working plane. For example after switching the working plane to Front you may want to switch to the Front view as well.
  • The grid can be toggled with the Draft ToggleGrid command.
  • By double-clicking Draft WorkingPlaneProxies in the Tree view you can quickly switch between working planes.

Preferences

See also: Preferences Editor and Draft Preferences.

  • The grid settings in the task panel as well as several other grid settings are available as preferences: Edit → Preferences... → Draft → Grid and snapping.
  • The Snapping radius can also be changed on-the-fly (see Draft Snap) or by changing: Tools → Edit parameters... → BaseApp → Preferences → Mod → Draft → snapRange.

Scripting

See also: Autogenerated API documentation and FreeCAD Scripting Basics.

introduced in version 0.22:

The WorkingPlane module offers two classes to create working plane objects: the PlaneBase class and the PlaneGui class. The second class inherits from the first. Objects of the PlaneGui class interact with the GUI (the Draft Tray button), the 3D view and the grid. PlaneBase objects do not.

Use the get_working_plane() method of the WorkingPlane module to get an instance of the PlaneGui class linked to the current 3D view. The method either returns the existing working plane linked to the view or creates a new working plane if required.

import FreeCAD as App
import WorkingPlane

wp = WorkingPlane.get_working_plane()

origin = App.Vector(0, 0, 0)
normal = App.Vector(1, 1, 1).normalize()
offset = 17
wp.align_to_point_and_axis(origin, normal, offset)

point = App.Vector(10, 15, 2)
projection = wp.project_point(point)
print(projection)

The PlaneBase class can be used to create working planes independent of the GUI:

import WorkingPlane

wp = WorkingPlane.PlaneBase()