Re: Automatic grouping of animation cells

*To*: mathgroup at smc.vnet.net*Subject*: [mg19167] Re: Automatic grouping of animation cells*From*: "Allan Hayes" <hay at haystack.demon.co.uk>*Date*: Thu, 5 Aug 1999 23:59:09 -0400*References*: <7obah4$3pq@smc.vnet.net>*Sender*: owner-wri-mathgroup at wolfram.com

Adam: Just a little simplification: It seems that since the graphics cells are already grouped, the line FrontEndTokenExecute["CellGroup"] is unnecessary. Thus: (Do[Plot[Sin[2 Pi f t], {t, 0, 1}], {f, 1, 2}]; SelectionMove[EvaluationNotebook[], All, GeneratedCell]; FrontEndTokenExecute["OpenCloseGroup"]); Other variants also work (Do[Plot[Sin[2 Pi f t], {t, 0, 1}], {f, 1, 2}]; SelectionMove[EvaluationNotebook[], Previous, GeneratedCell]; FrontEndTokenExecute["OpenCloseGroup"]); (Do[Plot[Sin[2 Pi f t], {t, 0, 1}], {f, 1, 2}]; SelectionMove[EvaluationNotebook[], Previous, CellGroup]; FrontEndTokenExecute["OpenCloseGroup"]); The following leaves only the input visible. (Do[Plot[Sin[2 Pi f t], {t, 0, 1}], {f, 1, 2}]; SelectionMove[EvaluationNotebook[], All, EvaluationCell]; FrontEndTokenExecute["OpenCloseGroup"]); Allan --------------------- Allan Hayes Mathematica Training and Consulting Leicester UK www.haystack.demon.co.uk hay at haystack.demon.co.uk Voice: +44 (0)116 271 4198 Fax: +44 (0)870 164 0565 <adam.smith at hillsdale.edu> wrote in message news:7obah4$3pq at smc.vnet.net... > Awhile back someone wanted asked how to automatically close a large > number of graphics cells produced for animations. P.J. Hinton replied > with the following (cut from the archives): > > >> Is there a way to automatically close the group of cells for a 100+ > >frame > >> animation? > > >When is the group of cells to be closed? > > >Are you generating a large number of graphics and then attempting to > >close the group of cells after the graphics are generated through some > >programmatic matter? > > >If so, you could do something like this little code snippet. > > > >Do[Plot[Sin[2 Pi f t], {t,0,1}],{f,1,5}]; > >SelectionMove[EvaluationNotebook[], After, EvaluationCell]; > >SelectionMove[EvaluationNotebook[], Next, CellGroup]; > >FrontEndTokenExecute["OpenCloseGroup"] > > Well, this works in closing all the cells and leaving only the input > visible. But what I wanted to do was to group the graphics output and > then collapse it, thus showing only the first frame. Thanks to the > above I started playing around and came up with what I hope is a useful > solution to others: > > Do[Plot[Sin[2 Pi f t], {t,0,1}],{f,1,5}]; > SelectionMove[EvaluationNotebook[], All,GeneratedCell]; > FrontEndTokenExecute["CellGroup"] > FrontEndTokenExecute["OpenCloseGroup"] > > It worked really well when I had a complicated Graphics[ ] expression. > > > Adam Smith > > > Sent via Deja.com http://www.deja.com/ > Share what you know. Learn what you don't. >