Start a new topic

Strip Face Possible In Script?

Original Post by: brianpow Wed Aug 27 19:56:30 2014

Can you access high-level tools like Strip Face and Triangulate from the python script in OpenFlight 4.2 API?

I know you can do this kind of operation in Maya, but I was not sure if Creator supported it or how I would access those commands. Any help is always appreciated!

Original Post by: ChrisRogers Wed Aug 27 20:03:20 2014

We have two levels of scripting in Creator/OpenFlight. In fact, those are the two levels. OpentFlight Script and Creator Script.

OpenFlight Script allows you low level access to all the attributes in a db. Creator Script is an extension to OpenFlight Script that allows you access to many features of Creator. In order to use Creator Script, you need to be running Creator. (no stand alone Creator scripts will work)

So the short answer to your question is Yes. You can access many tools in Creator. Triangulate is one of them, however Strip face is not yet scriptable. You can see the list of Scriptable tools in many ways.

One way (that I find most useful) is when you are writing your script in the OpenFlight Script Editor, click the hammer icon just to the right of the delete icon (red x)

It will bring up the Creator Script Snippet Wizard that allows you to pick a scriptable tool and insert the code required to call that tool.

Original Post by: brianpow Wed Aug 27 20:24:14 2014

Fantastic! This helps tremendously. I can probably just write an attach script to recreate the effects of the Strip Face Tool, I'm just not a math major so I'll need to bug our software people about a formula for deciding the placement of four vertices from two construction points.

Thanks, Chris, you the man!

Original Post by: ChrisRogers Wed Aug 27 22:33:25 2014

Glad I could help... as for your math problem, the trick is to decide on an Up direction, then use the cross product to find the direction to move the vertices.

You could just assume that z is always up for your strip face, then just turn your two points into a vector. Cross that vector with mgVectordZAxis() to get a vector pointing to the side in relation to your line. Move both vertices in this direction, to make two final points, then move those same vertices in the opposite direction to make the other two final points.

Make sure you normalize your vectors.

Here are the math functions from the API that you can use to make this all pretty easy.


mgMakeUnitVectord (coord1, coord2)

mgVectordSetUnitized (vec)

mgVectordCross (vec1, vec2)

mgCoord3dMoveAlongVectord (coord, vec, distance)

Login to post a comment