Keeping layers during meshing of Rhino objects -> OBJ -> Rhino

 From:  Michael Gibson
2720.8 In reply to 2720.1 
Hi Micha, anyway getting back to your convert script problem, please try updating to the attached version.

This version will replace spaces in style names with underscore characters.

If you test it, it should now allow for the data to now be transferred into Rhino with layer names set on each object as a modified object's name.

All the data should now be in place in Rhino to have a script on the Rhino side that will move each object to the proper layer.

The way the Rhino script needs to work is the following:

The script first needs to prepare a translation table between underscore names and a layer. It would do this by populating an associative array by looping through all Rhino layers, take the rhino layer name as a string variable. Replace all spaces in this string with underscores. This string now becomes the key for an associative array entry, and the value for that entry is the layer's index number.

Now that the associative array is constructed, you want to loop through all objects that have been imported (or maybe just all objects in the database is ok), take the object's name and look it up in the associative array. That will produce the layer index, and the object should then be assigned to have that layer index.


It's not really a complex procedure, but I am not familiar enough with the Rhino script API (it was added after I had originally worked on Rhino) to know all the specific syntax for traversing objects and assigning layers, etc... So you'll need to get someone who is familiar with RhinoScript to help to produce the script.


Anyway, with that piece of script processing in place on the Rhino side, it should allow you to have stuff meshed in MoI and then retrieved back into Rhino as you want.

- Michael
Attachments: