5

After manipulating the graphics in a dynamic module like this:

Synchronizing manual rotations for multiple Graphics3D outputs?

How do I get at the current graphic so that I can Export the image?

The answer might be burried in here Using DynamicModule variables outside the DynamicModule someplace but i am unable to decipher it..

george2079
  • 38,913
  • 1
  • 43
  • 110

3 Answers3

11

You need to identify the graphics object with a (local, dynamic) variable to use in a call to Export[]. It's easy to use a button to export from within the scope of the dynamic block. If you want the button to be external to the block, you can use TaggingRules as explained in your link. I prefer not to play around with extending the scope of variables.

SetDirectory[NotebookDirectory[]];
DynamicModule[{vp = {2, -2, 1}, vv = {0, 0, 1}, g},
 Grid[{{
    g = GraphicsRow[{Graphics3D[{Cone[{{0, 0, 0}, {2, 3, 4}}, 3]}, 
        SphericalRegion -> True, ViewPoint -> Dynamic[vp], 
        ViewVertical -> Dynamic[vv]], 
       Graphics3D[{Cone[{{1, 0, 1}, {1, 1, 1}}, 4]}, 
        SphericalRegion -> True, ViewPoint -> Dynamic[vp], 
        ViewVertical -> Dynamic[vv]], 
       Graphics3D[{Cone[{{1, 1, 1}, {9, 9, 9}}, 4]}, 
        SphericalRegion -> True, ViewPoint -> Dynamic[vp], 
        ViewVertical -> Dynamic[vv]]}]},  
   {Button["Save Figure", Export["dynamicfigure.png", g]]}}]]

With a button!

Corey Kelly
  • 1,738
  • 9
  • 23
2

You can simply use Save Selection As... (png for example) option in Menu. Using example of Corey Kelly:

enter image description here enter image description here

Kuba
  • 136,707
  • 13
  • 279
  • 740
1

A useful alternative based on Corey Kelly's answer, make the button "save" the dynamic varibles:

Button["save data", {savevp, savevv} = {vp, vv}; ]

Then outside the dynamic module these are available to make a 'statiic' graphic by repeating the graphic directive using ViewPoint -> savevp , etc.

Here I've "saved" a number of manipulated views, then combined into a single image for Export[].

enter image description here

george2079
  • 38,913
  • 1
  • 43
  • 110