Std ViewScreenShot: Difference between revisions

From FreeCAD Documentation
mNo edit summary
(Fixed code)
(9 intermediate revisions by 4 users not shown)
Line 1: Line 1:
<languages/>
{{GuiCommand|Name=Std_ViewScreenShot|MenuLocation=Tools -> Save picture...|Workbenches=All|SeeAlso=...}}
<translate>
<!--T:1-->
{{GuiCommand|Name=Std ViewScreenShot|MenuLocation=[[Std Tools Menu|Tools]] Save picture...|Workbenches=All|SeeAlso=...}}


==== Synopsis ==== <!--T:2-->
This command opens a dialog to save the current content of the 3D view to a file. It can save to various image formats. Additionally, you can change the aspect ratio and the resolution of the screen shot using the "Options" button to get access to more parameters.


<!--T:3-->
==== Synopsis ====
This command can also use the image comment field of some image formats, like PNG or JPEG to save [[MIBA]] information along with the picture.


==== Image formats ==== <!--T:4-->
This command opens a dialog to save the current content of the 3D view to
FreeCAD uses the QT built-in image types and some QT plugins in the bin/imageformats directory to save pictures. So how many and what formats you can choose depends on your platform.
a file. It can save to various image formats. Additionally, you can change the
aspect ratio and the resolution of the screen shot using the "Options"
button to get access to more parameters.

This command can also use the image comment field of some image formats, like PNG or JPEG
to save [[MIBA]] information along with the picture.


==== Image formats ====
FreeCAD uses the QT build in image types and some QT plugins in the bin/imageformates directory
to save pictures. So it depends on you platform how many and what formates you can choose.
==== Dialog ====
==== Dialog ====


<!--T:5-->
[[Image:Save_picture.png|550px]]
[[Image:Save_picture.png|550px]]


===== Image Size ===== <!--T:6-->

===== Image Size =====
The image size parameters are set to the screen size of the active 3D view. But you can change it to any value you like. Some OpenGL drivers don't allow renderings greater then 8000 pixels. It depends on your system.
The image size parameters are set to the screen size of the active 3D view. But you can change it to any value you like. Some OpenGL drivers don't allow renderings greater then 8000 pixels. It depends on your system.


<!--T:7-->
With the four buttons you can change the aspect to a certain value.
With the four buttons you can change the aspect to a certain value.


===== Image background =====
===== Image background ===== <!--T:8-->

With this combo box you can choose the background of the picture you make.
With this combo box you can choose the background of the picture you make.
* '''Current''' use the current view background (as chosen in the preferences)
* '''Current''' use the current view background (as chosen in the preferences)
Line 35: Line 31:
* '''Transparent''' creates a transparent background on image formats which support transparency
* '''Transparent''' creates a transparent background on image formats which support transparency


===== Comment =====
===== Comment ===== <!--T:9-->
Some image formats can transport a comment along the picture. In case you choose one of this formats you can insert a comment or use the comment field for the [[MIBA]] information.
Some image formats can transport a comment along the picture. In case you choose one of this formats you can insert a comment or use the comment field for the [[MIBA]] information.


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

It's also possible to save the screen by python:
It's also possible to save the screen by python:
</translate>

{{Code|code=
Gui.ActiveDocument.ActiveView.saveImage('C:/temp/test.png',1656,783,'Current')
Gui.ActiveDocument.ActiveView.saveImage('C:/temp/test.png',1656,783,'Current')

}}
<translate>
<!--T:11-->
This script makes a series of pictures of different sizes and from different
This script makes a series of pictures of different sizes and from different
points of view. The type of the camera, i.e. orthographic or perspective can also be changed.
points of view. The type of the camera, i.e. orthographic or perspective can also be changed.
</translate>


{{Code|code=
import Part,PartGui
import Part,PartGui
# loading test part
# loading test part
Part.open("C:/Documents and Settings/jriegel/My Documents/Projects/FreeCAD/data/Blade.stp")
Part.open("C:/Documents and Settings/jriegel/My Documents/Projects/FreeCAD/data/Blade.stp")
OutDir = 'c:/temp/'
OutDir = 'c:/temp/'
# creating images with different Views, Cameras and sizes
# creating images with different Views, Cameras and sizes
for p in ["PerspectiveCamera","OrthographicCamera"]:
for p in ["PerspectiveCamera","OrthographicCamera"]:
Gui.SendMsgToActiveView(p)
Gui.SendMsgToActiveView(p)
for f in ["ViewAxo","ViewFront","ViewTop"]:
for f in ["ViewAxo","ViewFront","ViewTop"]:
Gui.SendMsgToActiveView(f)
Gui.SendMsgToActiveView(f)
for x,y in [[500,500],[1000,3000],[3000,1000],[3000,3000],[8000,8000]]:
for x,y in [[500,500],[1000,3000],[3000,1000],[3000,3000],[8000,8000]]:
Gui.ActiveDocument.ActiveView.saveImage(OutDir + "Blade_" + p +"_" + f + "_" + `x` + "_" + `y` + ".jpg",x,y,"White")
Gui.ActiveDocument.ActiveView.saveImage(OutDir + "Blade_" + p +"_" + f + "_" + `x` + "_" + `y` + ".jpg",x,y,"White")
Gui.ActiveDocument.ActiveView.saveImage(OutDir + "Blade_" + p +"_" + f + "_" + `x` + "_" + `y` + ".png",x,y,"Transparent")
Gui.ActiveDocument.ActiveView.saveImage(OutDir + "Blade_" + p +"_" + f + "_" + `x` + "_" + `y` + ".png",x,y,"Transparent")

# close active document
# close active document
App.closeDocument(App.ActiveDocument.Name)
App.closeDocument(App.ActiveDocument.Name)
}}


{{Std Base}}
{{languages | {{es|Std_ViewScreenShot/es}} }}
{{Userdocnavi}}
{{clear}}

Revision as of 00:11, 21 October 2019

Std ViewScreenShot

Menu location
Tools → Save picture...
Workbenches
All
Default shortcut
None
Introduced in version
-
See also
...

Synopsis

This command opens a dialog to save the current content of the 3D view to a file. It can save to various image formats. Additionally, you can change the aspect ratio and the resolution of the screen shot using the "Options" button to get access to more parameters.

This command can also use the image comment field of some image formats, like PNG or JPEG to save MIBA information along with the picture.

Image formats

FreeCAD uses the QT built-in image types and some QT plugins in the bin/imageformats directory to save pictures. So how many and what formats you can choose depends on your platform.

Dialog

Image Size

The image size parameters are set to the screen size of the active 3D view. But you can change it to any value you like. Some OpenGL drivers don't allow renderings greater then 8000 pixels. It depends on your system.

With the four buttons you can change the aspect to a certain value.

Image background

With this combo box you can choose the background of the picture you make.

  • Current use the current view background (as chosen in the preferences)
  • White creates a plain white background (for e.g. printings)
  • Black plain black background
  • Transparent creates a transparent background on image formats which support transparency
Comment

Some image formats can transport a comment along the picture. In case you choose one of this formats you can insert a comment or use the comment field for the MIBA information.

Scripting

It's also possible to save the screen by python:

Gui.ActiveDocument.ActiveView.saveImage('C:/temp/test.png',1656,783,'Current')

This script makes a series of pictures of different sizes and from different points of view. The type of the camera, i.e. orthographic or perspective can also be changed.

import Part,PartGui
# loading test part
Part.open("C:/Documents and Settings/jriegel/My Documents/Projects/FreeCAD/data/Blade.stp")
OutDir = 'c:/temp/'
 
# creating images with different Views, Cameras and sizes
for p in ["PerspectiveCamera","OrthographicCamera"]:
    Gui.SendMsgToActiveView(p)
    for f in ["ViewAxo","ViewFront","ViewTop"]:
        Gui.SendMsgToActiveView(f)
        for x,y in [[500,500],[1000,3000],[3000,1000],[3000,3000],[8000,8000]]:
            Gui.ActiveDocument.ActiveView.saveImage(OutDir + "Blade_" + p +"_" + f + "_" + `x` + "_" + `y` + ".jpg",x,y,"White")
            Gui.ActiveDocument.ActiveView.saveImage(OutDir + "Blade_" + p +"_" + f + "_" + `x` + "_" + `y` + ".png",x,y,"Transparent")

# close active document
App.closeDocument(App.ActiveDocument.Name)