Is there an example showing how the geogebra.xml file (found in Geogebra's *.ggb file) is structured so I can write a file with custom data using another program?
Version: Geogebra Classic 6 via Firefox web-browser session
Is there an example showing how the geogebra.xml file (found in Geogebra's *.ggb file) is structured so I can write a file with custom data using another program?
Version: Geogebra Classic 6 via Firefox web-browser session
I am posting this here to make life easier for others by offering a simplistic and generic approach to the problem.
Geogebra's *.ggb file is a zip file which can be renamed to *.zip to simplify handling as a zip file.
Examining that zip file, the contents are reported as:
As we can see, there are a number of XML files within that zip file. All those files can be extracted into a folder for manipulation. I strongly recommend that you make a duplicate copy of these files as a backup before manipulating the contents.
After reviewing those files, I concluded that the only one that contains actual geometry constructs (unrelated to viewing, orientation or GUI) is is the geogebra.xml file.
I created a very simplistic *.ggb model with minimal elements to be able to unravel the puzzle. For my simplified model, I was able to "explode" the geogebra.xml file into (as I perceived it) logical components. These were:
The contents of my finalized versions for each of these are included later (below) for study/review/reference.
After manipulating these files to my satisfaction, I then reconstituted the geogebra.xml file from the newly-created parts (simple cat command in Linux).
Having kept the other files that formed the original *.ggb file, I created a new *.ggb file with the appropriate form of the zip command. The *.zip file was then renamed to the *.ggb form expected by Geogebra.
Using the File/Open options in Geogebra, I was able to load the new file successfully with the modified geometry and continue manipulating that without problems.
I created a simple script (Geogebra__BuildCustomModel.sh) to simplify the rebuild of the *.gbb file from the component parts, namely:
Here is a log for a "rebuild" session:
The resulting model seen in Geogebra is as follows:
Here are the contents of the 5 component files for my simplified Geogebra model.
geogebra.xml__01_HEADER:
geogebra.xml__02_GEOMETRY_POINT:
geogebra.xml__03_GEOMETRY_SEGMENT:
geogebra.xml__04_GEOMETRY_FACE:
geogebra.xml__05_TRAILER: