Std ViewScreenShot: Difference between revisions

From FreeCAD Documentation
No edit summary
No edit summary
Line 14: Line 14:


[[Image:Save_picture.png]]
[[Image:Save_picture.png]]


''' scripting '''

== Making Miba pictures by script ==

<python>
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.document().view().saveImage(OutDir + "Blade_" + p +"_" + f + "_" + `x` + "_" + `y` + ".jpg",x,y,"White")
Gui.document().view().saveImage(OutDir + "Blade_" + p +"_" + f + "_" + `x` + "_" + `y` + ".png",x,y,"Transparent")

# close document
App.Close("Unnamed")
</python>

Revision as of 14:55, 23 October 2008

Std_ViewScreenShot

Menu location
None
Workbenches
All
Default shortcut
None
Introduced in version
-
See also
...

Synopsis

This command open a dialog to save the actual view of the 3D view to a file. It can save various file formats. Adittional you can change the aspect ratio and the resolution of the screen shot be using the "Extended" Button to get access to more parameters.

This command can also use the image comment field of some file formats to save MIBA information along with the picture.


Dialog


scripting

Making Miba pictures by script

<python> import Part,PartGui

  1. loading test part

Part.open("C:/Documents and Settings/jriegel/My Documents/Projects/FreeCAD/data/Blade.stp") OutDir = 'c:/temp/'

  1. 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.document().view().saveImage(OutDir + "Blade_" + p +"_" + f + "_" + `x` + "_" + `y` + ".jpg",x,y,"White")
     Gui.document().view().saveImage(OutDir + "Blade_" + p +"_" + f + "_" + `x` + "_" + `y` + ".png",x,y,"Transparent")
  1. close document

App.Close("Unnamed") </python>