Color by 'feature'

Hi,

I am looking for a smart way to colour the model surfaces based on a specific feature. For example I use attribute dictionaries to set some surface properties for my simulation engine and I would like to be able to quickly verify whether the property has been assigned or not.

At the moment the only way I could come up with was to store in the attribute dictionary itself the reference to the original material of the face and then use this reference to reassign the original material when needed. This method is quite slow when the number of surfaces increases considerably and this happens very often with the models I deal with.

Is there a better way to do this?

Thanks

Since you’re using attributes, you must be using Ruby and you’re making a tool?
If so, have a look at view.draw(GL_TRIANGLES,@pts)
Just test all your elements if the attribute is set and if so/not add them to the @pts array and draw them in another color.

I’ve been applying a simple named material [made only once] as the back-material of target components/group faces…

they can be removed on mass by purging the material later in the color panel or in code…

it appears to have very little overhead regardless of the number of faces painted…

john

Are the faces all in the same edit context (group, component or model level ) ?

If so you can change the selection color temporarily to something bright (crazy cherry red) and push them into a selection set if they have the property set correctly, or perhaps incorrectly.

… then, as the unset faces are in a set, set them with a block:

sel.to_a.each {|face| 
  face.set_attribute("Rojj_Plugin","some_property","value")
  sel.remove(face)
}

… then reset the original selection color back. (The setting is in the model.rendering_options hash.)

In general yes, but there will be same edge cases with the models I receive from other people.

Maybe I should also have specified that the ‘feature’ is not necessarily ON/OFF. It could be for example a temperature.