RE: Automatic Closing of Animation Graphics Cells
- To: mathgroup at smc.vnet.net
- Subject: [mg38009] RE: [mg37978] Automatic Closing of Animation Graphics Cells
- From: "David Park" <djmp at earthlink.net>
- Date: Mon, 25 Nov 2002 01:57:47 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
Robert, The exact commands that should be used depend upon whether you are using Automatic or Manual Grouping. For Automatic Grouping... Needs["Graphics`Animation`"] Animate[ Plot[ Sin[x t], {x, -Pi, Pi}, PlotRange -> {-1.1, 1.1} ], {t, 0, 1}, Frames -> 10 ]; SelectionMove[EvaluationNotebook[], All, GeneratedCell] FrontEndTokenExecute["OpenCloseGroup"]; Pause[0.01]; FrontEndTokenExecute["SelectionAnimate"]; For Manual Grouping... Animate[ Plot[ Sin[x t], {x, -Pi, Pi}, PlotRange -> {-1.1, 1.1} ], {t, 0, 1}, Frames -> 10 ]; SelectionMove[EvaluationNotebook[], All, GeneratedCell] FrontEndTokenExecute["CellGroup"]; FrontEndTokenExecute["OpenCloseGroup"]; Pause[0.01] FrontEndTokenExecute["SelectionAnimate"]; I recommend AutomaticGrouping. I have never seen a good notebook done with manual grouping. Many people fall into using it but I have never seen a good reason for it and it usually results in long messy and unstructured notebooks that are difficult to add to or modify. David Park djmp at earthlink.net http://home.earthlink.net/~djmp/ From: Dr. Robert Kragler [mailto:kragler at fh-weingarten.de] To: mathgroup at smc.vnet.net Hello, I am stuck with subsequent problem of FrontEnd programming. Perhaps, someone knows the solution. I would appreciate an answer : when a sequence of graphics cells for an animation is generated it would be favorable if all subsequent graphics cells would be grouped with respect to the top graphic cell (and not with respect to the preceding input cell evaluated). Then the graphics cells to be grouped should be closed so that only the top level graphics cell is visible and animation is started with double- clicking the top level graphics cell only. I found a partial solution which does the correct marking of the graphics cells being generated by a command such as Animate[ Plot[ Sin[x t], {x,-Pi,Pi} ], Frames -> 3 ]; CloseAniSequenceTest where the following code for manipulating the notebook is used : CloseAniSequenceTest := Module[ { }, SelectionMove[ EvaluationNotebook[ ], After, EvaluationCell ]; SelectionMove[ EvaluationNotebook[ ], Next, Cell ]; SelectionMove[ EvaluationNotebook[ ], Next, GeneratedCell ]; ????? FrontEndTokenExecute["OpenCloseGroup"] ] But before using the final command FrontEndTokenExecute["OpenCloseGroup"] there should be another command preceding that actually does the cell grouping wanted. The option SetOption[ NotebookSelection[ ], CellGrouping -> Automatic ] does not perform the action I expected, and I could not find any hint in chapt. 2.10 of the Mathematica book for the solution. With the code above the graphics cells are marked correctly using the command CloseAniSequenceTest but no cell grouping as intended is done. Which additional Notebook command has to be inserted instead of "????". I think only one additional line of code is required to do this but I cannot not find the right answer. Thanks in advance. Robert Kragler --------------------------------------------------------------------- Prof. Dr. Robert Kragler Fachhochschule Ravensburg-Weingarten University of Applied Sciences FB Physikalische Technik / Rechenzentrum P.O.B 1241 , D-88241 Weingarten Germany Tel: +49 (751) 501-9603 Fax: +49 (751) 501-5-9603 E-Mail: kragler at rz.fh-weingarten.de HomePage: http://www.fh-weingarten.de/ ---------------------------------------------------------------------