[WWW-Vrml] [www-vrml] Resolve Transforms

Bederov, Sergey bederov at cortona3d.com
Tue Apr 7 00:15:01 PDT 2009


Hello everyone,

 

Sorry for probable double-posting, it seems that my previous message had
not passed through because my e-mail address changed.

 

VrmlPad, a text-level VRML editor from ParallelGraphics, exposes a
powerful scripting interface, and anyone can write scripts and macros to
manipulate VRML scenes. Simply place a .vbs or .js file into the Program
Files\ParallelGraphics\VrmlPad\AddIns folder, and VrmlPad will
automatically parse it and display the list of available commands in the
Tools menu.

 

Download VrmlPad:

http://www.parallelgraphics.com/products/vrmlpad

 

Read more about VrmlPad scripting:

http://www.parallelgraphics.com/developer/products/vrmlpad

 

Attached is an archive with two VrmlPad scripts:

 

 

eval.js

 

This script contains only one function that is available in the VrmlPad
context menu. Write any arithmetic expression using the JavaScript
syntax, for example, (Math.sqrt(5)+1)/2, select it, click the right
mouse button and select "Evaluate selection". The script will calculate
the expression result and paste it back to VrmlPad. Very useful for
quick modifications of VRML files without having to launch a calculator.

 

ifsTools-eng.vbs

 

This script contains more functions; I used VBScript because of its
customizable MessageBoxes and the InputBox feature.

 

Collapse IndexedFaceSets

This function is available in the IFS Tools submenu and in the context
menu of Transforms. It applies the transformation to all IndexedFaceSets
contained in the selected Transform. It checks node types and processes
only valid IndexedFaceSets.

 

Collapse IndexedFaceSets in the whole file

This function is available in the IFS Tools submenu. It collapses
IndexedFaceSets in the whole file, removing transformations from all
Transforms and applying them directly to the geometry.

 

Collapse Transforms

This function is available in the IFS Tools submenu and in the context
menu of Transforms. It combines nested transforms, replacing two
transformations by a single transformation. It doesn't modify
IndexedFaceSets.

 

Collapse Transforms in the whole file

This function is available in the IFS Tools submenu. It collapses all
Transforms recursively, eliminating all nested Transforms.

 

Locate in MF field

This function is available in the Tools menu and in the context menu of
any MF field. It displays the index of the element under the cursor.

 

Find item in MF field

This function is available in the Tools menu and in the context menu of
any MF field. It selects the element with the desired index.

 

Merge IndexedFaceSets

This function is available in the IFS Tools submenu and in the context
menu of Transforms, Groups and MFNode fields. It merges all contained
IndexedFaceSets into one.

 

Reverse MFValue field

This function is available in the context menu of MF fields. It reverses
the values in the MF field.

 

Triangulate faces randomly

This function is available in the IFS Tools submenu and in the context
menu of IndexedFaceSets. It converts all polygons into triangles. For
non-convex triangles the result may be incorrect.

 

Convert all IndexedFaceSets to ccw TRUE

This function is available in the IFS Tools submenu. It changes ccw to
TRUE in all IndexedFaceSets, rearranging coordIndex if needed.

 

Round numeric values

This function is available in the context menu of MFFloat, MFVec and
MFRotation fields. It rounds values to a needed precision.

 

 

Feel free to use and modify these scripts. See the VrmlPad API
documentation, there is nothing difficult. Please note that my scripts
can produce strange results if nodes are USEd multiple times in the
file.

 

                                              Sergey Bederov

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/www-vrml_web3d.org/attachments/20090407/761a04f7/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: vrmlpad-scripts.zip
Type: application/x-zip-compressed
Size: 3697 bytes
Desc: vrmlpad-scripts.zip
URL: <http://web3d.org/pipermail/www-vrml_web3d.org/attachments/20090407/761a04f7/attachment.bin>


More information about the Www-vrml mailing list