Quantcast
Channel: Scripting - McNeel Forum
Viewing all articles
Browse latest Browse all 5938

Naming object fail

$
0
0

Hi, using visual studio and C# to create some automation I need to assign a name to an object as follow:

obj.Object().Attributes.Name = obj.Object().Name.Replace("PS", "").Replace("SB", "") + (obj.Brep().GetBoundingBox(true).Center.Y > 0 ? "PS" : "SB");

The problem is that after the code run the object has the same name as before, even using:

doc.Objects.Select(obj.Object().Id);
Rhino.RhinoApp.RunScript("_SetObjectName " + obj.Object().Name.Replace("PS", "").Replace("SB", "") + (obj.Brep().GetBoundingBox(true).Center.Y > 0 ? "PS" : "SB") + " ", true);
doc.Objects.UnselectAll();

What I’m missing? Is a silly behavior because in other codes both way worked
I called commitchanges after all

9 posts - 3 participants

Read full topic


Viewing all articles
Browse latest Browse all 5938

Trending Articles