scripting commands and spreadsheet

pfb shared this question 4 years ago
Needs Answer

Hi all,

I would like to write an applet where a script creates some objects based on the data in the spreadsheet, but I'm not really sure how to go about it.

My final goal is to have a script that creates the 3D model for a molecule.

It is not hard to create a single model by introducing each individual atom and bond manually, but it is going to be pretty tedious for molecules that are not very simple.

The script I have in mind should inspect the spreadsheet for data and create spheres and cylinders accordingly.

I am clear on the structure of the data and on all the checks, but I'm not sure about other, perhaps more basic, things

  1. where should I write the script, considering that before reading the spreadsheet there is no object around? It seems to me that a script can be only "attached" to an object.
  2. is there a list of commands for interacting with the spreadsheet? I expect that, other than reading the cell content, I would need to check for the number of nonempty rows, and for the number of nonempty cells in a row.

I'm not sure that what I have in mind can be done with geogebra.

Another possibility is to write the data directly in the script, as opposed to reading it from the spreadsheet. The two questions I asked above would still need answering, except for the bit about reading from the spreadsheet.

Another possible way of doing what I have in mind is reading the data in a html page (with javascript) and use geogebra API for creating the objects in a ggb applet, which would work as a 3D display.

If possible I'd like to go with my first option, though (script+spreadsheet in geogebra).

Thanks a lot for any input.

Francesco

Comments (3)

photo
1

Maybe this is helpful!


http://zbynek.github.io/201...

photo
1

Hi Michael,

thanks a lot for the pointer!

This is similar to my "option 3", with the added bonus that one does not even need to bother with the molecule structure, because it is pulled from a database.

This is pretty cool.

Still, I'm curious about the feasibility of my "option 1".

Would it be possible to write a script that reads from the spreadsheet even if the applet does not contain anything yet?

photo
1

You would need to use JavaScript, eg

ggbApplet.getValue("A1")
https://wiki.geogebra.org/e...

© 2023 International GeoGebra Institute