Macro Screen Wiki: Difference between revisions

From FreeCAD Documentation
m (SpinBox)
No edit summary
 
(20 intermediate revisions by 3 users not shown)
Line 6: Line 6:
|Name=Macro Screen Wiki
|Name=Macro Screen Wiki
|Icon=Macro_Screen_Wiki.png
|Icon=Macro_Screen_Wiki.png
|Description=Special macro for the Wiki Worker. This macro allows to save the 3D view in the desired format. The 3D view or the full 3D window of FreeCAD takes the desired dimensions. A rotation of the selected object or of the 3D view is possible to give a rotation angle the number of images is calculated automatically it is possible to give a departure angle and an arrival angle. You must use another Gimp example program to assemble the images and create the animated file.
|Description=Special macro for the Wiki user. This macro allows to save the 3D view in the desired format. The 3D view or the full 3D window of FreeCAD takes the desired dimensions. A rotation of the selected object or of the 3D view is possible to give a rotation angle the number of images is calculated automatically it is possible to give a departure angle and an arrival angle. You must use another Gimp example program to assemble the images and create the animated file.
|Author=Mario52
|Author=Mario52
|Version=00.01
|Version=00.06b
|Date=2020/03/21
|Date=2023/06/26
|FCVersion=0.19
|FCVersion=0.19 and more
|Download=Download the [https://wiki.freecadweb.org/images/f/f5/Macro_Screen_Wiki.png Macro_Screen_Wiki.png] image and paste it in the same directory of the macro
|Download=[https://wiki.freecad.org/images/f/f5/Macro_Screen_Wiki.png ToolBar Icon]
|SeeAlso= [[Image:Macro_Copy3DViewToClipboard.png|24px]][[Macro_Copy3DViewToClipboard|Macro_Copy3DViewToClipboard]]<br/>[[Image:Snip.png|24px]] [[Macro_Snip|Macro_Snip]]
|SeeAlso=[[Macro_Copy3DViewToClipboard|Macro Copy3DViewToClipboard]], [[Macro_Snip|Macro Snip]]
}}
}}


Line 18: Line 18:


<!--T:3-->
<!--T:3-->
This macro allows the user save the [[3D view|3D view]] in a desired format. The 3D view or the full 3D window of FreeCAD takes the desired dimensions. A rotation of the selected object or of the 3D view is possible to give a rotation angle the number of images is calculated automatically it is possible to give a departure angle and an arrival angle. You must use another Gimp example program to assemble the images and create the animated file.
This macro allows the user save the [[3D_view|3D view]] in a desired format. The 3D view or the full 3D window of FreeCAD takes the desired dimensions. A rotation of the selected object or of the 3D view is possible to give a rotation angle the number of images is calculated automatically it is possible to give a departure angle and an arrival angle. You must use another Gimp example program to assemble the images and create the animated file.


</translate>
</translate>
{{Codeextralink|https://gist.githubusercontent.com/mario52a/61571ce0bd41af0471995df7c3ea855f/raw/99d1862bc4cf8fbf71e78d235774febcae7602d6/Macro_Screen_Wiki.FCMacro}}
{{Codeextralink|https://gist.githubusercontent.com/mario52a/61571ce0bd41af0471995df7c3ea855f/raw/2e2f5d1f30acd9fee9ea58596d0bcaa8d19f03f3/Macro_Screen_Wiki.FCMacro}}


[[File:Macro_Screen_Wiki_00.png]]
[[File:Macro_Screen_Wiki_00.png]]
Line 36: Line 36:
{{Caption|Macro Screen Wiki Rotation window}}
{{Caption|Macro Screen Wiki Rotation window}}


==Use== <!--T:6-->
==Usage== <!--T:6-->


===Images options=== <!--T:7-->
===Image options=== <!--T:7-->


====Definition==== <!--T:8-->
====Definition==== <!--T:8-->
Line 68: Line 68:
#{{RadioButton|TRUE|Screen 3D}} : The 3D view of FreeCAD
#{{RadioButton|TRUE|Screen 3D}} : The 3D view of FreeCAD


====Background Color==== <!--T:14-->
====BackGround Color==== <!--T:14-->


<!--T:15-->
<!--T:15-->
Line 81: Line 81:
#{{Button|Set Screen}}: Docked window
#{{Button|Set Screen}}: Docked window
#{{Button|Tile Screen}}: Fly window
#{{Button|Tile Screen}}: Fly window
#{{Button|Save Image}}: Save the image ex: {{FileName|imageBox_000.png}} (the _000 is incremented with each new image)
#{{Button|Save Image}}: Save the image, for ex: {{FileName|imageBox_000.png}} (the _000 is incremented with each new image)
#{{Button|Follow}}: After saving the first image, press this button to save the next image with the same name. The images saved is incremented ex: {{FileName|imageBox_001.png}}, {{FileName|imageBox_002.png}}, {{FileName|imageBox_003.png}}, etc...
#{{Button|Follow}}: After saving the first image, press this button to save the next image with the same name. The images saved is incremented, for ex: {{FileName|imageBox_001.png}}, {{FileName|imageBox_002.png}}, {{FileName|imageBox_003.png}}, [[Image:Macro_Screen_Wiki_ToolBar_04_4b.png]] etc...
#{{Button|Quit}}: ___Screen_Wiki end__________
#{{Button|New Image}}: Save one new image without change the counter
#{{Button|Rotation}}: Access to the rotation menu (the title of the section "Image options" change to "Rotation options"
#{{Button|Rotation}}: Access to the rotation menu (the title of the section "Image options" change to "Rotation options"
#{{Button|Quit}}: ___Screen_Wiki end__________
#{{Button|ToolBar}}: Reduce the image window in a toolBar, the {{Button|Rotation}} option is not available in this mode
##[[Image:Macro_Screen_Wiki_ToolBar_01.png]][[Image:Macro_Screen_Wiki_ToolBar_02.png]][[Image:Macro_Screen_Wiki_ToolBar_03.png]][[Image:Macro_Screen_Wiki_ToolBar_04.png]]
##The button {{Button|[[Image:Macro_Screen_Wiki_ToolBar_04_6.png]]}} Flip/Flop Y/N the mini toolBar [[Image:Macro_Screen_Wiki_ToolBar_Mini.png]]


===Rotation options=== <!--T:18-->
===Rotation options=== <!--T:18-->
Line 116: Line 120:
#{{SpinBox|0 Degrees}} : Value
#{{SpinBox|0 Degrees}} : Value
#{{Button|+}}: Increase the value by 10 degrees
#{{Button|+}}: Increase the value by 10 degrees
*Number images
*Number images: The number image saved with the values given is calculated (approximation + 1)
#{{Button|-}}: Decrease the value by 10 images
#{{SpinBox|0 Images (+1)}} : Value
#{{Button|+}}: Increase the value by 10 images
*Angle Begin Rotation
*Angle Begin Rotation
#{{Button|-}}: Decrease the value by 10 degrees
#{{Button|-}}: Decrease the value by 10 degrees
Line 132: Line 139:
#{{SpinBox|0,00 Delay second}} : If there is a problem saving images due to speed, then add a delay of X seconds.
#{{SpinBox|0,00 Delay second}} : If there is a problem saving images due to speed, then add a delay of X seconds.
#{{CheckBox|Reverse}}: Checked, this option reverses the rotation 3D view or Object
#{{CheckBox|Reverse}}: Checked, this option reverses the rotation 3D view or Object
#{{Button|Point center}}: Visualize the point center of rotation, if the point is visible the point is include in the image (PS: the point can be hidden by an object)
#{{CheckBox|TRUE|Original position}}: This option restores the original position of the 3D View or the Object rotated. Instead fo the 3D view or the Object staying in the last position of the rotation.
#{{CheckBox|TRUE|Original position}}: This option restores the original position of the 3D View or the Object rotated. Instead fo the 3D view or the Object staying in the last position of the rotation.
#{{Button|Test Rot.}}: Testing the rotation without saving images
#{{Button|Save the animation}}: Save the animation
#{{Button|Save the animation}}: Save the animation


Line 163: Line 172:


<!--T:33-->
<!--T:33-->
{{Caption|Animation Object Direction SubObject selected.<br/>The images must be assembled with a 3rd party application that creates an animated .gif<br/>such as [https://daviesmediadesign.com/project/make-animated-gif-gimp/ GIMP] or [https://www.screentogif.com ScreenToGif]}}
{{Caption|Animation mode: Object Direction SubObject selected.<br/>The images must be assembled with a 3rd party application that creates an animated .gif<br/>such as [https://daviesmediadesign.com/project/make-animated-gif-gimp/ GIMP] or [https://www.screentogif.com ScreenToGif]}}


</translate>
</translate>
Line 173: Line 182:


==Versions== <!--T:35-->
==Versions== <!--T:35-->

<!--T:42-->
Version=00.06: Version=00.06b: 2023/06/26 : adding select number image, button test rotation, button visualize the point rotation,
adding code by wmayer center rotation on center screen :

</translate>
{{Code|code=
#https://forum.freecadweb.org/viewtopic.php?f=22&t=10157
cam = Gui.ActiveDocument.ActiveView.getCameraNode()
position = cam.position.getValue()
orient = cam.orientation.getValue()
focalDistance = cam.focalDistance.getValue()
viewdir = coin.SbVec3f(0, 0, -1)
viewdir = orient.multVec(viewdir)
pointRotation = position + viewdir * focalDistance
pointRotation = pointRotation2 = App.Vector(pointRotation.getValue()[0], pointRotation.getValue()[1], pointRotation.getValue()[2])

}}
<translate>

<!--T:40-->
Version=00.05: 2021/05/21 : adding code in Save file section for Linux Mint QFileDialog ignore the extension. Only the Path+name is displayed

</translate>
{{Code|code=
global switchQFileDialogMint
#### mint
if switchQFileDialogMint == True: #
Filter = Filter[Filter.find("."):Filter.find(")")]
SaveName = SaveName + Filter
#### mint
}}
<translate>
<!--T:39-->
Version=00.04: 2021/01/13 : adding mini ToolBar

<!--T:38-->
Version=0.03: 2020/10/30 : create a tool bar for the image and new button for unique image

<!--T:37-->
Version=0.02: 2020/05/04 : correct bug color button (self.PB_01_Color obsolete)


<!--T:36-->
<!--T:36-->
Version=0.01: 2020/03/21
Version=0.01: 2020/03/21



</translate>
</translate>

Latest revision as of 16:23, 30 December 2023

Macro Screen Wiki

Description
Special macro for the Wiki user. This macro allows to save the 3D view in the desired format. The 3D view or the full 3D window of FreeCAD takes the desired dimensions. A rotation of the selected object or of the 3D view is possible to give a rotation angle the number of images is calculated automatically it is possible to give a departure angle and an arrival angle. You must use another Gimp example program to assemble the images and create the animated file.

Macro version: 00.06b
Last modified: 2023/06/26
FreeCAD version: 0.19 and more
Download: ToolBar Icon
Author: Mario52
Author
Mario52
Download
ToolBar Icon
Links
Macro Version
00.06b
Date last modified
2023/06/26
FreeCAD Version(s)
0.19 and more
Default shortcut
None
See also
Macro Copy3DViewToClipboard, Macro Snip

Description

This macro allows the user save the 3D view in a desired format. The 3D view or the full 3D window of FreeCAD takes the desired dimensions. A rotation of the selected object or of the 3D view is possible to give a rotation angle the number of images is calculated automatically it is possible to give a departure angle and an arrival angle. You must use another Gimp example program to assemble the images and create the animated file.

Temporary code for external macro link. Do not use this code. This code is used exclusively by Addon Manager. Link for optional manual installation: Macro


# This code is copied instead of the original macro code
# to guide the user to the online download page.
# Use it if the code of the macro is larger than 64 KB and cannot be included in the wiki
# or if the RAW code URL is somewhere else in the wiki.

from PySide import QtGui, QtCore

diag = QtGui.QMessageBox(QtGui.QMessageBox.Information,
    "Information",
    "This macro must be downloaded from this link\n"
    "\n"
    "https://gist.githubusercontent.com/mario52a/61571ce0bd41af0471995df7c3ea855f/raw/2e2f5d1f30acd9fee9ea58596d0bcaa8d19f03f3/Macro_Screen_Wiki.FCMacro" + "\n"
    "\n"
    "Quit this window to access the download page")

diag.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint)
diag.setWindowModality(QtCore.Qt.ApplicationModal)
diag.exec_()

import webbrowser 
webbrowser.open("https://gist.githubusercontent.com/mario52a/61571ce0bd41af0471995df7c3ea855f/raw/2e2f5d1f30acd9fee9ea58596d0bcaa8d19f03f3/Macro_Screen_Wiki.FCMacro")


Macro Screen Wiki Image and configuration window

Macro Screen Wiki Rotation window

Usage

Image options

Definition

  1. 400x200
  2. 600x400 (Default)
  3. 1024x768
  4. 320x240 (QVGA)
  5. 320x480 (HVGA)
  6. 400x300
  7. 480x360
  8. 640x480 (VGA)
  9. 768x576 (PAL)
  10. 800x600 (SVGA)
  11. 960x720
  12. 1024x768 (XGA)

Format image

  1. 600 px Length (Default: 600 px)
  2. 400 px Height (Default: 400 px)

Window

  1. Window FC : The complete FreeCAD window
  2. Screen 3D : The 3D view of FreeCAD

BackGround Color

  1. Current (Default)
  2. Color
  3. Transparent
  4. Restore

Command

  1. Set Screen: Docked window
  2. Tile Screen: Fly window
  3. Save Image: Save the image, for ex: imageBox_000.png (the _000 is incremented with each new image)
  4. Follow: After saving the first image, press this button to save the next image with the same name. The images saved is incremented, for ex: imageBox_001.png, imageBox_002.png, imageBox_003.png, etc...
  5. New Image: Save one new image without change the counter
  6. Rotation: Access to the rotation menu (the title of the section "Image options" change to "Rotation options"
  7. Quit: ___Screen_Wiki end__________
  8. ToolBar: Reduce the image window in a toolBar, the Rotation option is not available in this mode
    1. The button Flip/Flop Y/N the mini toolBar

Rotation options

Rotation on

  1. 3D View: The complete view is rotated
  2. Object: The object selected is rotated

Axis

X: Rotation on X axis
Y: Rotation on Y axis
Z: Rotation on Z axis
D: Rotation on Direction.
  • To use this option: select first the object, then afterwards select the wire guideline. If D is checked and no wire is selected the direction is Vector(0, 0, 0)

Point Rotation BoundBox

  1. Object: Rotation on the BoundBox center of the object selected
  2. Sub Object: Rotation on the BoundBox center of the sub object selected

Angles

  • Angle Rotation
  1. -: Decrease the value by 10 degrees
  2. 0 Degrees  : Value
  3. +: Increase the value by 10 degrees
  • Number images
  1. -: Decrease the value by 10 images
  2. 0 Images (+1)  : Value
  3. +: Increase the value by 10 images
  • Angle Begin Rotation
  1. -: Decrease the value by 10 degrees
  2. 0 Degrees  : Value: Angle of the starting rotation
  3. +: Increase the value by 10 degrees
  • Degrees Angle End Rotation
  1. -: Decrease the value by 10 degrees
  2. 360 Degrees : Value: Angle of the end rotation
  3. +: Increase the value by 10 degrees

Command

  • Delay between 2 images
  1. 0,00 Delay second  : If there is a problem saving images due to speed, then add a delay of X seconds.
  2. Reverse: Checked, this option reverses the rotation 3D view or Object
  3. Point center: Visualize the point center of rotation, if the point is visible the point is include in the image (PS: the point can be hidden by an object)
  4. Original position: This option restores the original position of the 3D View or the Object rotated. Instead fo the 3D view or the Object staying in the last position of the rotation.
  5. Test Rot.: Testing the rotation without saving images
  6. Save the animation: Save the animation

Examples

Captured screen with dimensions of 640px x 400px

Same dimensions as the previous image, this one is captured as 'Tile Screen'.

Animation mode: Object selected and direction BoundBox center Object.
The images must be assembled with a 3rd party application to create an animated .gif
such as GIMP or ScreenToGif

Animation mode: Object Direction SubObject selected.
The images must be assembled with a 3rd party application that creates an animated .gif
such as GIMP or ScreenToGif

The FreeCAD window resized. The dimension may be different from the definition (depending on the Widget, title bar etc... used.)

Versions

Version=00.06: Version=00.06b: 2023/06/26 : adding select number image, button test rotation, button visualize the point rotation, adding code by wmayer center rotation on center screen :

#https://forum.freecadweb.org/viewtopic.php?f=22&t=10157
                cam = Gui.ActiveDocument.ActiveView.getCameraNode()
                position = cam.position.getValue()
                orient = cam.orientation.getValue()
                focalDistance = cam.focalDistance.getValue()
                viewdir = coin.SbVec3f(0, 0, -1)
                viewdir = orient.multVec(viewdir)
                pointRotation = position + viewdir * focalDistance
                pointRotation = pointRotation2 = App.Vector(pointRotation.getValue()[0], pointRotation.getValue()[1], pointRotation.getValue()[2])

Version=00.05: 2021/05/21 : adding code in Save file section for Linux Mint QFileDialog ignore the extension. Only the Path+name is displayed

global switchQFileDialogMint
                ####  mint
                if switchQFileDialogMint == True:   #
                    Filter = Filter[Filter.find("."):Filter.find(")")]
                    SaveName = SaveName + Filter
                ####  mint

Version=00.04: 2021/01/13 : adding mini ToolBar

Version=0.03: 2020/10/30 : create a tool bar for the image and new button for unique image

Version=0.02: 2020/05/04 : correct bug color button (self.PB_01_Color obsolete)

Version=0.01: 2020/03/21