How can I use the Query macro to find more details about my polygon mesh data?

Query Macro

geo.query( <query string>, <object_id> )

Query can first be used to find the object id of the model data you need to pass to the queries.

# get the newest object id (added to or loaded from file into the model manager)

myObjectID = geo.query( "idnewestobject", 0 )

Then use query again to find the volume and surface area, but first check if the polygon mesh is a closed manifold.

if geo.query("manifold", myObjectID):

    myObjectVolume = geo.query( "volume", myObjectID )
    myObjectSurfaceArea = geo.query( "surfacearea", myObjectID )

    #print the volume of the closed manifold polygon mesh to the script output pane (in meters)
    #e.g. given a 10mm sphere

    #0.05235987 0.001256637

    print myObejctVolume, myObjectSurfaceArea

The available id queries are:

idcurrentobject
idnewestobject

Qualify only:

idrefobject
idresultobject
idtestobject

Use idcurrentobject while "walking the list of models" in the model manager.  To walk the list, use a loop that uses these macros to successively show and activate the models:

geo.hide_current_show_next_object()
geo.hide_current_show_previous_object()

These macros are also convenient:

geo.show_all_objects()
geo.hide_inactive_objects()
geo.hide_all_objects()

Other query strings available are:

surfacearea
trianglearea
volume
manifold
name
averagenormaldirection
centerofgavity
#components
#holes

Rating:Rating of 4.5 Stars1 Votes
Was this answer helpful?YesNo

Geomagic Solutions

Topic Information
  • Topic #: 5605-2236
  • Date Created: 5/6/2013
  • Last Modified Since: 3/12/2014
  • Viewed: 1829
Welcome Guest
Help Desk and Customer Support Software by Parature