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 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,



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


 * FCCamera_01.png : Accept the rotation give to angle selected

Virtual


 * FCCamera_02.png : 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


 * FCCamera_03.png : 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)"


 * FCCamera_04.png : 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)"


 * FCCamera_05.png : 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.


 * FCCamera_06.png : 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:


 * : Reset all values.
 * : Section save the screen rotation an image in angle value
 * : Quit FCCamera.

Section Photo



 * : choice your screen definition for the image format
 * Available (pre-defined):
 * "Actual" (definition actual of screen)
 * "Icon 16 x 16"
 * "Icon 32 x 32"
 * "Icon 64 x 64"
 * "Icon 128 x 128"
 * "CGA 320 x 200"
 * "QVGA 320 x 240"
 * "VGA 640 x 480"
 * "SVGA 800 x 600"
 * "XGA 1024 x 768"
 * "XGA+ 1152 x 864"
 * "SXGA 1280 x 1024"
 * "SXGA+ 1400 x 1050"
 * "UXGA 1600 x 1200"
 * "QXGA 2048 x 1536"
 * "Free"




 * Available :
 * "BMP *.bmp"
 * "ICO *.ico"
 * "JPEG *.jpeg"
 * "JPG *.jpg"
 * "PNG *.png" (by default)
 * "PPM *.ppm"
 * "TIF *.tif"
 * "TIFF *.tiff"
 * "XBM *.xbm"
 * "XPM *.xpm"
 * "XPM *.xpm"


 * Line 1 : Number image calculated by the angle give (ex: angle 60 degrees = 360 (complete rotation) / 60 (angle) = 6 images


 * Line 2 : The definition of screen used


 * Background image :
 * Actual : save image with the screen colour actual
 * White : save image with the screen colour white
 * Black : save image with the screen colour black


 * : Open the file window, give the name and the path
 * : Reset the default value
 * : Quit the photo panel and return to FCCamera panel

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 :

Download the package with the icon files FCCamera_Icones.zip. Unziped the package and paste the total icon in the same directory as the macro.



Icons tableau :

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 icon files FCCamera_Icones.zip

Download the macro to Gist Macro FCCamera.FCMacro

Version

 * ver 00.12.1 (12/02/2020): suppress the bad character lines 674 and 675 (accent...) again


 * ver 12 (01/08/2019): compatible Python 3 ( print to print )


 * ver 11 (13/01/2018): minor


 * ver 10 (13/01/2018): add "def centerBoundBoxGlobal:"


 * ver 09 (08/01/2018): minor


 * ver 08 (08/01/2018): supp "Pyqt4" and adjust number image
 * ver 07 (03/01/2018): add photo panel and rotation to axis selected (wire, edge, line )

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.6 (13/12/2016): new system for search the macro path directly in the preferences
 * 1) path = FreeCAD.ConfigGet("AppHomePath")
 * 2) path = FreeCAD.ConfigGet("UserAppData")
 * 3) path = "your path"


 * 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