Color the different parts of an assambly
Hello,
the last few days' I tried to get used with Salome. I find out, that it is a great and very powerful tool.
But I have a question related to colouring different parts of an assembly.
I imported an assembly with different parts. For me it is easier to navigate thru the assembly if I assign to the parts different colours. It is not difficult to do this manually. I also managed to write a little python script to automatize this step.
Now my problem is:
- When I colour the parts manually in the GUI the defined colours stay attached to the part after hiding and showing them again.
- When I colour the parts using the python script I have wrote, I see the colours, but after hiding and showing the parts, they disappear and all parts are coloured in yellow. My python script is:
import salome
import geompy
salome.salome_init()
gg = salome.ImportComponentGUI("GEOM")
...
gg.setDisplayMode(ID,1)
gg.setColor(ID,red,green,blue)
Do anybody know how to improve my python script.
Best Regards
Feri
hello feri,
you could try:
import salome
import SALOMEDS
.....
gg = salome.ImportComponentGUI("GEOM")
ID_objects_list = salome.sg.getAllSelected()
for ID in ID_objects_list:
object = salome.myStudy.FindObjectID(ID).GetObject()
object.SetColor(SALOMEDS.Color( x, y, z )) #where x,y,z are between 0 and 1
gg.createAndDisplayGO(ID)
Regards,
Richard
