Export option for OBJ names needed - object names lost

 From:  Micha
3396.7 In reply to 3396.6 
I found the reason for the confusion - it's the script for open rhino documents for meshing. I found the function AssignObjectNamesFromStyles();, set it as comment and it works now. Since I found no rhino script for layer keeping I can keep my object names.

Thanks,
Micha



----------
function AssignObjectNamesFromStyles()
{
// Set object names to be their Style name + unique number.

var objs = moi.geometryDatabase.getObjects();
var styles = moi.geometryDatabase.getObjectStyles();

for ( var i = 0; i < objs.length; ++i )
{
var obj = objs.item(i);
var name = styles.item(obj.styleIndex).name + '§' + i;

// Replace all spaces with underscore characters, since spaces don't work as
// object names in OBJ files.
obj.name = name.replace( /\s/g, '§' );
}
}

function Convert(FileName)
{
var gd = moi.geometryDatabase;

// Open the file, set 2nd param to true to suppress any save changes prompt.
gd.open( FileName, true );

AssignObjectNamesFromStyles();

moi.view.resetAll();

// Create the output file name by breaking off the file extension and adding 'obj'.

OBJFileName = FileName.substr( 0, FileName.lastIndexOf('.') + 1 ) + 'obj';

// Save out to the output file, passing the option to suppress the UI. You
// add other options separated by semi-colons with no spaces. These
// options are available for controlling the meshing:
// NoUI=true
// Angle=6.0
// Output=ngons | quads | triangles
// MaxLength=
// MaxLengthApplyTo=curved | planes | all
// MinLength=4
// AspectRatio=0.0
// Weld=true
// Display=shadedwithedges | shadednoedges | wireframe
// ExpandedDialog=false

gd.saveAs( OBJFileName, 'Angle=;MinLength=;MaxLength=;AspectRatio=;Weld=true;Output=quads');

// Let's clear out and suppress any save changes prompt again.
gd.fileNew( true );
}

Convert('d:\\Temp\\#moi.3dm');

moi.exit( true ); // Pass true to suppress save changes prompt.

Visualisation for Designer and Architects | http://www.simulacrum.de