I have a single model item that is made of 4 fragments which appear to have different colours.
I am aware that I am able to retrieve the colour of a ModelItem using Geomtetry.PermanantColour, but this will return a single colour which is not enough here.
I tried using the Fragment.Appearance but this also appeared to return the same colour for every fragment.
This issue appears to be similar to https://forums.autodesk.com/t5/navisworks-api/can-t-access-the-colour-of-model-lines-on-files-with-s...
Note - even the Navsiworks built in FBX exporter will incorrectly export the window as a single grey colour.
Is there something I might be missing or is this a bug in the API? NWC file attached.
Thanks,
Pete
Solved! Go to Solution.
Solved by naveen.kumar.t. Go to Solution.
Hi,
Nodes in NW can't have different materials (i.e. all the fragments in a model item have to have the same material). What I suspect you're seeing here is an object with no material but per-vertex colours
I think you can probably get hold of the per-vertex colours, but you'll need to use the COM API I think
Thanks for the quick reply! I think you might be right.
I attempted to get the colour of the vertices using
I seem to be on the right track as when processing the 4 fragments I see two distinct sets of RGB value (presumably red and grey). However, the values that get returned don't mean much to me
Am I retrieving the values for vertex colours incorrectly? Is there any example code for how to retrieve vertex colours?
Thanks,
Pete
Hi @peter_mortonFX5VV ,
I discussed with the Navisworks Engineering team.
I think you have to ask to get per-vertex colours, otherwise the values you get back might be garbage.
frag.GenerateSimplePrimitives(ComApi.nwEVertexProperty.eCOLOR,callbkListener);
Array array_v1 = (Array)(object)v1.color;
var v1_1 = array_v1.GetValue(1);
var v1_2 = array_v1.GetValue(2);
var v1_3 = array_v1.GetValue(3);
Could you please try and let me know?
Hi @naveen.kumar.t ,
I may have spoken to soon. That method appears to have solved my issue for model items where the colour is stored in the vertices. As a result the bits of the model that previously had issues (windows etc) now appear correct:
Yet for the model items that previously worked with Geomtetry.PermanantColour are now returning garbage vertex colour values. (the values tend to be near zero or less than zero)
Is there way of identifying when you would use the colour from the vertices vs using the colour from the model item? I tried adding a check that if rgb values returned from vertex colour were all <= 0 then use the Geometry.PemanantColour. However, this doesn't hold true all of the time.
Thanks,
Pete
Hi,
Yes, you should have been given some flags to say which vertex parts are valid
Can't find what you're looking for? Ask the community or share your knowledge.