Macro Align Working Plane to Camera: Difference between revisions

From FreeCAD Documentation
m (DATE ISO 8601 YYYY-MM-DD)
No edit summary
Line 1: Line 1:
<languages/>
<translate>
<translate>

<!--T:1-->
<!--T:1-->
{{Macro|Icon=Text-x-python|Name=Macro Align Working Plane to Camera|Description=This macro moves the current [[Draft SelectPlane|Draft Working Plane]] to the center of the current view |Author=yorik|Version=1.0|Date=2017-05-10}}
{{Macro|Icon=Text-x-python|Name=Macro Align Working Plane to Camera|Description=This macro moves the current [[Draft SelectPlane|Draft Working Plane]] to the center of the current view |Author=yorik|Version=1.0|Date=2017-05-10}}
Line 24: Line 24:


{{clear}}
{{clear}}
<languages/>

Revision as of 21:24, 5 August 2018

Other languages:

File:Text-x-python Macro Align Working Plane to Camera

Description
This macro moves the current Draft Working Plane to the center of the current view

Macro version: 1.0
Last modified: 2017-05-10
Author: yorik
Author
yorik
Download
None
Links
Macro Version
1.0
Date last modified
2017-05-10
FreeCAD Version(s)
None
Default shortcut
None
See also
None

Description

This macro moves the current Draft Working Plane to the center of the current view. It is useful when you are working quite far from the grid center.

How to use

  • Move the view to the zone where you want to look at
  • Run the macro

Script

Macro Align Working Plane to Camera.FCMacro

import FreeCAD,FreeCADGui
cam = FreeCAD.Vector(FreeCADGui.ActiveDocument.ActiveView.getCameraNode().position.getValue().getValue())
pos = FreeCAD.DraftWorkingPlane.projectPoint(cam)
FreeCAD.DraftWorkingPlane.position = pos
FreeCADGui.Snapper.setGrid()