Quantcast
Channel: Rhino Developer - McNeel Forum
Viewing all articles
Browse latest Browse all 8562

Change surface color retrieved from GetObject

$
0
0

@thomas.vincent wrote:

Hello,

I am currently trying to change the color of selected surfaces with GetObject.
When the object is exploded, there is no problem, my code works, but as long as different surfaces are joined, it colors the whole object.

I’ve used this loop to color the object, and I understand that selecting the RhinoObject is the problem, but I couldn’t find a way to change the color of a BrepFace or simply a Surface (go is my GetObject object).

for (int i = 0; i < go.ObjectCount; i++) {
    ObjRef objRef = go.Object(i);
    RhinoObject obj = objRef.Object();
                
    RhinoDoc doc = obj.Document;
    obj.Attributes.ObjectColor = System.Drawing.Color.FromArgb(color.ToArgb());
    obj.Attributes.ColorSource = ObjectColorSource.ColorFromObject;
    obj.CommitChanges();

    doc.Views.Redraw();
}

I am able to retrieve the BrepFace with objRef.Face() and the Surface from the BrepObject but I can’t find any method or attribute that can help me. Any ideas?

Thank you for your answers,
Thomas.

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 8562

Trending Articles