The Interactive Geometry Software Cinderella

Forum: Cinderella Support (E)

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

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


Hi all,
thanks to the help of Kortenkamp, i have written a small script to view construction steps (i must finish it, but it works).
Try it downloading the attached script.
How it works:
1. Open the cdy file.
2. Select "Move Element" and click on canvas.
3. Now you can press the following buttons:
"h" -> hide all geometric objects
"a" -> show next geometric object (forward)
"x" -> hide last geometric object (backward)
"s" -> show all geometric objects

The script is on the KeyDown? section of script editor. You can copy it and paste on your cdy files.
Otherwise you can copy your geometric objects from your cdy and paste them on the attached file.

Hope this help.

cameyo

attachment viewBeta.cdy (3.66 Kb)
 
on: Wed 16 of May, 2012 [08:38 UTC] reads: 152270

Posted messages

author message
cameyo
3 stars
Re: Script to review construction (forward and backward)
on: Thu 17 of May, 2012 [14:32 UTC]
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)

author message
Re: Script to review construction (forward and backward)
on: Wed 16 of May, 2012 [12:04 UTC]
Hey, that's great - wonderful script to share!

Thank you
Ulli


author message
cameyo
3 stars
Re: Re: Script to review construction (forward and backward)
on: Sun 20 of May, 2012 [07:54 UTC]
New version.
Add: show objects with size=0 too

// 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)
// Side effect: objects with size==0 will change to size=1

attachment ShowMe.cdy (7.77 Kb)



Show posts:
 
Language