Is it possible to bake an object with Wireframe mode as ObjectDisplayMode?
If you’re using Rhino 8 you can manage object attributes like this:
Now all you need to do is to bake the Model Object component.
2 Likes
For Rhino 7:
private void RunScript(GeometryBase O, string Dm, bool Bake, ref object A)
{
if (!Bake) return;
var att = new Rhino.DocObjects.ObjectAttributes();
att.SetDisplayModeOverride(Rhino.Display.DisplayModeDescription.FindByName(Dm));
RhinoDocument.Objects.Add(O, att);
}
SetDisplayMode.gh (7.3 KB)
1 Like
Thanks Mahdiyar,
No, I do not own Rhino 8 yet.
Your Rhino7 C# script works, but in my GH definition the baking must also add a name, layer and colour, and delete objects with the same name if there are any. Therefore I use the baking component of Elefront
My knowledge of scripting is close to zero, I hope you can help with combining your script with the elefrot bake component.
Thanks in advance!
Erik
private void RunScript(GeometryBase O, string Name, string Layer, System.Drawing.Color Color, string Dm, bool Bake)
{
if (!Bake) return;
var settings = new Rhino.DocObjects.ObjectEnumeratorSettings();
settings.NameFilter = Name;
var ids = new List<Guid>();
foreach (var rhObj in RhinoDocument.Objects.GetObjectList(settings))
ids.Add(rhObj.Id);
foreach (var id in ids)
RhinoDocument.Objects.Delete(id, true);
var att = new Rhino.DocObjects.ObjectAttributes();
att.Name = Name;
att.LayerIndex = RhinoDocument.Layers.FindName(Layer).Index;
att.ColorSource = Rhino.DocObjects.ObjectColorSource.ColorFromObject;
att.ObjectColor = Color;
att.SetDisplayModeOverride(Rhino.Display.DisplayModeDescription.FindByName(Dm));
RhinoDocument.Objects.Add(O, att);
}
SetDisplayAtt.gh (12 KB)
1 Like
Super!
I will test it later today, will let you know.
Thanks a lot!
Erik
Works great for me, thanks a lot for your help!