Menu

Quick Demos

Joseph A. Huwaldt

Back to Tutorial page.

This page contains some quick demonstrations of what you can do with GeomSS.

My First Time

Let's go through some basics of reading in a geometry data file and working with the GeomSS command line.

Run the GeomSS program. If it doesn't start up or gives an error message, check the notes on the [[Installation Instructions]] page.

When the program first starts up, you should have a single window that looks something like the following:

Change the "working directory" to the "Sample Geometry" directory. Do this by choosing "Change Working Directory..." from the File menu and then navigating to the "Sample Geometry" directory that came with the distribution of this program.

Check that the current directory really is the working directory by typing the following exactly (except the % sign which represents the GeomSS prompt):

pwd();

Note the parenthesis and the trailing semi-colon. They are both required.

Let's import a sample geometry file.

  • Choose "Import..." from the file menu.
  • Type in "shuttle" next to "Geometry list name:" (replacing the default value of "geom").
  • Click on the "Select" button and choose the "shuttle.mk5" file from the Sample Geometry directory. This should then put "shuttle.mk5" into the "File to open:" field of the "Inputs" dialog.
  • Click on the "Done" button. This will translate the GUI inputs into GeomSS code and enter that into the command line for you and read in the geometry. It will appear as if nothing has happened, but that's just because you need to draw the geometry to see it. Type the following:
draw(shuttle,true);

You should see half of a Space Shuttle appear in the model view area, just like you see here:

You may have to re-center the geometry and zoom the display so the geometry fits in order to see it.

  • Click on the left-most icon on the toolbar that is a circle with two yellow and two black quadrants (like a "center-of-gravity" symbol). This is the "Center-and-Zoom" button and will adjust the display so that the entire geometry currently drawn fits on-screen and is centered (handy when you get lost). You can get the same effect by typing centerAndZoom(); at the console prompt and pressing enter.

Use the mouse to rotate the view around and see it from different angles by clicking and dragging with the left mouse button. You can see that it is hollow on the inside and made up of quadrilateral panels (it is made up of collections of "PointArrays" in GeomSS terminology).

Use the mouse to zoom in and out on the geometry by using the mouse's scroll wheel (if it has one), or by clicking and dragging with the middle mouse button (or option dragging on a Mac). If you zoom in either to far or to near, the geometry will disappear. I need to fix that some day... When that happens, just hit the "Center-and-Zoom" button and all will be restored.

Use the mouse to translate the geometry around in the display by clicking and dragging with the right mouse button (or control dragging on a single button mouse; or command-dragging on a Mac).

Double click on a portion of the geometry to translate that geometry to the center of the viewing area (so you can zoom in on it for instance).

Hit the Center-and-Zoom button to rescale the display.

Click on the 3rd item from the left in the tool-bar. This is the "Symmetry Toggle" switch. When symmetry is off (the default), then the icon is a circle that is half blue. When symmetry is turned on, then the icon is a circle that is half blue and half red and the geometry will be mirrored about the XZ plane (left-to-right for typical aerospace geometries).

The 2nd icon from the left in the toolbar is actually a menu with some pre-defined viewing angles (top, left, bottom, right, etc). Play with the options.

The right-most icon on the toolbar is a menu that lets you choose how "point geometry" is displayed. Point geometry means anything that is built up of discrete points like points, strings of points, arrays of points, and lists of arrays of points; as opposed to NURBS geometry which is mathematically continuous and not made up of discrete points. Play with the options.

Working with Lists

This continues from the previous My First Time demo, so if you haven't done that one yet, go back and do what it says first.
We find out what geometry is loaded by typing the following at the console prompt:

list();

This gives the following output:

VARIABLE        NAME/ID         TYPE            PHYDIM PARDIM
shuttle         shuttle.mk5     PointVehicle    3      0

This shows that the variable named "shuttle" is the only named geometry object in the workspace. It is named "shuttle.mk5" because it came from a file of that name and it has 3 physical dimensions (it is 3D) and no parametric dimensions (it is made up of discrete points). It is a "PointVehicle". This means that it is a list of "PointComponent" objects. Let's take a look at this lists's contents:

list(shuttle);

This gives the following output:

VARIABLE        NAME/ID         TYPE            PHYDIM PARDIM
shuttle(0)      nose            PointComponent  3      0
shuttle(1)      mdns            PointComponent  3      0
shuttle(2)      ctop            PointComponent  3      0
shuttle(3)      cnpy            PointComponent  3      0
shuttle(4)      botm            PointComponent  3      0
shuttle(5)      wing            PointComponent  3      0
shuttle(6)      side            PointComponent  3      0
shuttle(7)      oms             PointComponent  3      0
shuttle(8)      afft            PointComponent  3      0
shuttle(9)      vtal            PointComponent  3      0
shuttle(10)     fl00            PointComponent  3      0
shuttle(11)     skfr            PointComponent  3      0

So, the list "shuttle" has 12 members, each of which is a PointComponent with various names. Note that lists in GeomSS (like Java) are zero-offset. This means that the 1st item in the list has an index of 0 and the last has an index of the size of the list minus 1. So, to get the 1st item from the list, you would use c = shuttle.get(0);. To get the last item, you could use c = shuttle.get(shuttle.size()-1);. Unlike most Java lists however, geometry lists in GeomSS can also use negative indexing to reach items from the end of the list (Python style). So, for example, c = shuttle.get(-1); will return the last item in the list and c = shuttle.get(-3); will return the vertical tail. Let's do that:

vt = shuttle.get(-3);

Now let's draw just the vertical tail all by itself:

erase();
draw(vt);

We could have combined the two above commands and used just the following:

draw(vt, true);

Recenter and zoom the display if you need to (the button at the left of the toolbar).

Neat. Let's list our work space again:

list();
VARIABLE        NAME/ID         TYPE            PHYDIM PARDIM
vt              vtal            PointComponent  3      0
shuttle         shuttle.mk5     PointVehicle    3      0

Now we have two named geometry variables: "shuttle" and "vt". Take a look at what happens if we list the contents of the "shuttle" list again.

list(shuttle);
VARIABLE        NAME/ID         TYPE            PHYDIM PARDIM
shuttle(0)      nose            PointComponent  3      0
shuttle(1)      mdns            PointComponent  3      0
shuttle(2)      ctop            PointComponent  3      0
shuttle(3)      cnpy            PointComponent  3      0
shuttle(4)      botm            PointComponent  3      0
shuttle(5)      wing            PointComponent  3      0
shuttle(6)      side            PointComponent  3      0
shuttle(7)      oms             PointComponent  3      0
shuttle(8)      afft            PointComponent  3      0
vt              vtal            PointComponent  3      0
shuttle(10)     fl00            PointComponent  3      0
shuttle(11)     skfr            PointComponent  3      0

Look at that! Now, instead of just a generic list index, the vertical tail shows up with it's variable name. Any object that has a variable name shows up in any lists that it is a member of with it's variable name. Handy.

We still don't know what a "PointComponent" is. A PointComponent is a list of arrays that make up a part of a vehicle. List the contents of the vertical tail:

list(vt);
VARIABLE        NAME/ID         TYPE            PHYDIM PARDIM
vt(0)           AFTT            PointArray      3      0
vt(1)           VTAL            PointArray      3      0

You can see that the vertical tail component is made up of two arrays. A "PointArray" is a list of strings of points. Lets list the contents of the 2nd array (the one with the name "VTAL").

list(vt.get(1));
VARIABLE        NAME/ID         TYPE            PHYDIM PARDIM
(0)             774             PointString     3      0
(1)             780             PointString     3      0
(2)             785             PointString     3      0

So, that array contains 3 strings of points (columns of points if you wish). A "PointString" is a list of points. So, the following finally takes us all the way down to the lowest level for point geometry:

list(vt.get(1).get(0));
VARIABLE        NAME/ID         TYPE            PHYDIM PARDIM
(0)             775             Point           3      0
(1)             776             Point           3      0
(2)             777             Point           3      0
(3)             778             Point           3      0

Whew! Finally. Took a while to burrow all the way down. But we have one more step to go. How do we learn anything about these points? You find the value of any variable in GeomSS by using the "print()" command:

print(vt.get(1).get(0).get(0));
{-27.9 in, 0.0 in, 14.25 in}

You can also learn about the boundaries of the geometries using the following commands:

print(shuttle.getBoundsMin());
print(shuttle.getBoundsMax());
print(shuttle.getBoundsMax().minus(shuttle.getBoundsMin()));
{-29.77 in, 0.0 in, 4.64 in}
{-4.113 in, 8.23 in, 14.25 in}
{25.657 in, 8.23 in, 9.61 in}

This is an aerodynamic analysis model of a Space Shuttle wind tunnel model. So, it's only about 25 inches long!

One last thing: how big is the model in centimeters? Easy:

shuttle_cm = shuttle.to(CENTIMETER);
print(shuttle_cm.getBoundsMax().minus(shuttle.getBoundsMin()));
{65.16878 cm, 20.9042 cm, 24.4094 cm}

It is 65.2 cm long.


Related

Wiki: Tutorial

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.