Macro FCCamera: Difference between revisions

From FreeCAD Documentation
m (minor)
m (ver 0.6 (13/12/2016))
Line 1: Line 1:
<translate>
<translate>
<!--T:1-->
<!--T:1-->
{{Macro|Icon=FCCamera_00|Name=Macro FCCamera|Description=This macro can rotate the screen in a defined angle and the defined axis and creates a plan to face the screen.|Author=Mario52|Version=0.5 (06/09/2016)}}
{{Macro|Icon=FCCamera_00|Name=Macro FCCamera|Description=This macro can rotate the screen in a defined angle and the defined axis and creates a plan to face the screen.|Author=Mario52|Version=0.6 (13/12/2016)}}


==Description== <!--T:2-->
==Description== <!--T:2-->
Line 145: Line 145:
==Version== <!--T:37-->
==Version== <!--T:37-->


*'''ver 0.6 (13/12/2016):''' new system for search the macro path directly in the preferences
{{Code|code=
#path = FreeCAD.ConfigGet("AppHomePath")
#path = FreeCAD.ConfigGet("UserAppData")
#path = "your path"
param = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Macro")# macro path
path = param.GetString("MacroPath","") + "/" # macro path
path = path.replace("\\","/")
App.Console.PrintMessage("Path locality to FCCamera.....images.png [ " + path + " ]"+"\n")
}}
<!--T:38-->
<!--T:38-->
*'''ver 0.5 06/09/2016:''' correct name "FCCamera_Axis_rotation_X.png" in reset block
*'''ver 0.5 06/09/2016:''' correct name "FCCamera_Axis_rotation_X.png" in reset block

Revision as of 16:25, 13 December 2016

File:FCCamera 00 Macro FCCamera

Description
This macro can rotate the screen in a defined angle and the defined axis and creates a plan to face the screen.

Macro version: 0.6 (13/12/2016)
Author: Mario52
Author
Mario52
Download
None
Links
Macro Version
0.6 (13/12/2016)
Date last modified
None
FreeCAD Version(s)
None
Default shortcut
None
See also
None

Description

This macro can rotate the screen in a defined angle and the defined axis and creates a plan to face the screen to create a form in the specified plan positions the selected face facing the screen, to detect the position of the camera, align view to face or to axis, align the object to view.

How to use

Use is easy,

FCCamera
FCCamera

Camera of Axis: The dialog box to enter the rotation value angle in degrees.

Angle rotation Axis in degrees: Select the rotation axis X Y or Z.

Axe of rotation

  • Accept the rotation : Accept the rotation give to angle selected

Virtual

  • Detect camera orientation : Detect the camera orientation and print in report view. The returned value is the value provided by the function getCameraOrientation().

Align view to face selected

  • To Face. : Align the view to the selected face. Click and repeat the click for NormalAt : "(0,0,1) (0,0,-1) (0,1,0) (0,-1,0) (1,0,0) (-1,0,0)"
  • To Axis. : Align the view to Axis face selected. Click and repeat the click for Surface Axis : "(0,0,1) (0,0,-1) (0,1,0) (0,-1,0) (1,0,0) (-1,0,0)"
  • Align object to view. : Align the object selected to the actual view. The changed values are : Rotation Axis((X, Y, Z), Angle) Same Euler angles : Yaw, Pitch, Roll, The Translation is not modify.
  • Create plane of view. : A circular plane is created facing the screen to mouse click coordinates on an object. The radius of the plane is equal to the maximum dimension of BoundBox. If no object is selected, the plane is created to 0, 0, 0 coordinates with a radius of 20 mm. The radius is modifiable to line 515:
rayon = 20                            # Radius of plane
  • Reset. : Reset all values.
  • Quit. : Quit FCCamera.

Icons

Download the file image and copy in your macro repertory.

Click the image, in the new window position the mouse over the image, click the right mouse and do "Save target as ..."

The path of icons is displayed in the View report

ex: Path locality to FCCamera.....images.png [ C:\Users\xx\AppData\Roaming\FreeCAD\ ]

You can change the path by changing the path in the line 165

Icons program :

Logo FCCamera Accept Detect To Face To Axis Align Object to View Create plane Reset Quit

Icons tableau : Axis X Axis Y Axis Z


Links

Related Links with FCCamera

Macro Rotate View, Macro Align Object to View, Macro Align Face Object to View, Macro WorkFeatures

Discussion Forum MACRO:Work Feature 2014_12

Script

Download the macro to Gist Macro FCCamera.FCMacro

Examples

How to place an angle hole

The same result can be achieved by creating a plan in the corner gave the mouse click position and a sketch.

Version

  • ver 0.6 (13/12/2016): new system for search the macro path directly in the preferences
#path = FreeCAD.ConfigGet("AppHomePath")
#path = FreeCAD.ConfigGet("UserAppData")
#path = "your path"
param = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Macro")# macro path
path = param.GetString("MacroPath","") + "/"                        # macro path
path = path.replace("\\","/")
App.Console.PrintMessage("Path locality to FCCamera.....images.png [ " + path + " ]"+"\n")
  • ver 0.5 06/09/2016: correct name "FCCamera_Axis_rotation_X.png" in reset block
  • ver 0.4 28/02/2016 : add display all camera detection and the Direction
  • ver 0.3 18/03/2015 : modify line 492 replace "pl.Base = App.Vector(0,0,0)" to "pl.Base = sel[0].Placement.Base" now no longer moves the form at point (0,0,0) and leaves has the coordinates
  • ver 0.2 25/02/2015 : correct names files in for compatibility Linux (case sensitive) thanks microelly2


Other languages: