The Interactive Geometry Software Cinderella

Forum: Cinderella Support (E)

Forums->Cinderella Support (E)->Script to review construction (forward and backward)->Re: Script to review construction (forward and backward)

cameyo
3 stars
Re: Script to review construction (forward and backward)


New version.
Added: last object viewed is selected
Added: also show the object with alpha=0

// ShowIt?.cdy
// A cindyscript for Cinderella 2.6
// copyright by cameyo (2012)

// This script allow to view the steps of any geometric construction
// The key "a" show next geometric object (forward)
// The key "z" hide last geometric object (backward)
// The key "h" hide all geometric objects
// The key "s" show all geometric objects
// The last drawed object is selected.

// WARNING: you must click on canvas (with "Move Element" tool) before use the keys !!!

// Side effect: all the objects showed will change their alpha to 1.0 (full visible)

//get key pressed
keyID = key();
//print(keyID);

//show all geometric objects
if(keyID == "s", (forall(allelements(), (#.visible=true; #.alpha=1.0))));

//hide all geometric objects
if(keyID == "h", (forall(allelements(), #.visible=false)));

//show next geometric object
if(keyID == "a",
(ele = allelements();
//remove selection on objects
forall(ele,e, e.selected=false);
//show next object
stop = false;
forall(ele,e,
if(and(e.visible == false,stop == false),(e.visible=true; e.alpha=1.0; e.selected = true; stop=true));
);
));

//hide last geometric object
if(keyID=="z",
(ele = reverse(allelements());
//remove selection on objects
forall(ele,e, e.selected=false);
//hide last object
stop = false;
forall(ele,e,
if(and(e.visible == true,stop == false),(e.visible=false; stop=true));
);
//select previous object
stop = false;
forall(ele,e,
if(and(e.visible == true,stop == false),(e.selected=true; stop=true));
);
));


cameyo




attachment ShowMe.cdy (7.50 Kb)
 
on: Thu 17 of May, 2012 [14:32 UTC] reads: 9731

Show posts:
 
Language