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

  • 2
    $\begingroup$ If don't need something automated, right click and copy graphic and then paste into Export["filename.png",<paste here>] $\endgroup$ – bobthechemist Jun 6 '13 at 16:39
  • $\begingroup$ Thanks, that does indeed work -- not a terribly satisfying approach though. $\endgroup$ – george2079 Jun 6 '13 at 16:50
  • $\begingroup$ With a GraphcsRow/Grid you need to copy/paste the whole cell.. $\endgroup$ – george2079 Jun 6 '13 at 16:53
  • 1
    $\begingroup$ I agree - were I more imaginative, I would have posted an answer instead of a comment :-) $\endgroup$ – bobthechemist Jun 6 '13 at 16:58

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.

DynamicModule[{vp = {2, -2, 1}, vv = {0, 0, 1}, g},
    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!

  • $\begingroup$ pretty slick!! 15 characters $\endgroup$ – george2079 Jun 6 '13 at 17:43
  • $\begingroup$ You can also use an InputField[] with a dynamic string variable to define a file name, if you like. $\endgroup$ – Corey Kelly Jun 6 '13 at 18:15

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


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


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.