GeoGebra Script: if command, buttons, checkboxes and curves

Caio Chagas do Amaral shared this question 2 years ago
Answered

Hey everyone, greetings from Brazil. Hope you all are doing fine.

I'm trying to plot a pair of parametric curves in 3D view using the curve command by clicking a button. In the button's properties I'm scripting the following in "On Click":

Curve(u, 5*cos(5*t -2*u + 45),u,0,1000) Curve(u,0, 5*cos(5*t -2*u + 45),u,0,1000)It works but I'm also trying to limit the number of times that I can plot this pair to just one so I'm trying to use checkboxes (boolean variables) as well. The main idea is to create different buttons to plot different curves and only one pair at the time. And the user may "reset" the button (erasing or hiding the associated pair) by clicking it. It's something like:Click the button 1 > If: boolean variable = TRUE > plot curves and prevent other buttons from being clicked (and other curves from being plotted) until button 1 is clicked for the second time, erasing the first pair of curves and allowing the others. I'm scripting something like this (it's a draft) but it's not working at all: If(a == 1, Curve(u, 5*cos(5*t -2*u + 45),u,0,1000), a == 1, Curva(u,0, 5*cos(5*t -2*u + 45),u,0,1000)) SetValue(a, 0) Any suggestions? Thank you for your time.

Comments (4)

photo
2

Please post your .ggb file

photo
2

It's actually a pretty simple file yet... As I said I'm testing those ideas... Is it possible to plot both curves using a button and the if command by scripting (GGS)? How should I do it?

Thank you for your time!

photo
4

Use checkboxes and https://wiki.geogebra.org/e... to show/hide objects as you want, OK?

photo
1

Ok! Thank you.

photo
© 2023 International GeoGebra Institute