Export option for OBJ names needed - object names lost
All  1-3  4-7

Previous
Next
 From:  Michael Gibson
3396.4 In reply to 3396.2 
Hi Micha,

> ... there is also a information channel unused - the
> object colors of the Rhino materials are reset to gray.
> Could be good, if this colors could be keeped too.

MoI does not support this kind of separate individual object color that would override the layer color.

That can tend to be confusing in many ways, and also does not map very well to the way that most mesh file formats are structured.

In an OBJ file for instance, there is no mechanism in place to have a color directly assigned to an object itself, the only way things are colored is by assigning a material.

So having things assigned color by their assignment to a material list is what MoI is focused on using.


> Stop - I have seen now, obj material color it's the layer color.

Yes, in MoI it is the Style color that will become the material color in the exported file - the Styles list in MoI becomes the Materials list in the OBJ file.


> OK, could be nice, if this behavoir could be set to material color
> stay material color too.

In MoI the Style/Layer list is the same thing as the materials list, they are not separate lists.


> OK, could be nice, if this behavoir could be set to material color
> stay material color too.

This is already happening - the Style colors and style names will become material colors and material names in the OBJ file.


> The layer information is saved in two "positions" - obj name
> and obj color.

No, this is not correct - in MoI there is no individual "object color" available at all, there are only colors assigned by style (or by layer as Rhino calls it), and the style name and the object name are separate things, it is not the same name written twice to the OBJ file like you seem to be thinking here.


> But I have objects with different materials at different layers.

Not in MoI you don't - in MoI layers and materials are the same thing.

MoI's system is not as convoluted as Rhino's system so there are some kinds of complex setups that you can do in Rhino (like having things not colored "by layer" and instead colored by individual object settings and stuff like that), which will not map to MoI's system.

It sounds like you've run into some stuff like that.

The nice thing about MoI's system is that it is set up to be more exactly compatible with how materials and names work in mesh files, like as I mentioned previously in an OBJ file there is not anything available in the OBJ structure to have color by other than material, and there is not anything in OBJ files that would allow for setting a "layer assignment" as something different from a "material assignment".

It helps to make for a clean mapping from MoI to OBJ by having things colored in MoI only by their Style assignment and not with all kinds of various other lists and special override properties.

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Micha
3396.5 In reply to 3396.4 
Hello Michael,

ok, the material color can't be used, but here a screenshot that show my problem - at Rhino the object has a name and a layer and opened at MoI it lost the object name. Could be nice if a name exist, that the name can be keeped.



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

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
3396.6 In reply to 3396.5 
Hi Micha,

> at Rhino the object has a name and a layer and opened at
> MoI it lost the object name. Could be nice if a name exist,
> that the name can be keeped.

That is supposed to work, and does work in Rhino v3, for example here is a box I created in Rhino v3 and assigned a name:



Then when opening up the file in MoI, that name is assigned like you want:




If you are seeing different results, can you please post a sample 3DM file that does not work?

- Michael

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
 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
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged
 

Reply to All Reply to All

 

 
 
Show messages: All  1-3  4-7