algorithmic modeling for Rhino
hi everybody,
i am in the process of writing a little component displaying blocks with transforms. that comes in handy if you would like to check your block instances before actually baking them to the rhino document. To my best knowledge there is no component out there at the moment doing this, in case I am wrong, let me know ;) So I got this far that i can display the blocks using the display override methods provided by david :
public override void DrawViewportMeshes(IGH_PreviewArgs args) {
////.... for the non selected state of the component :
foreach (RhinoObject RhObj in InstanceObjs) {
Rhino.DocObjects.ObjectAttributes OriginalAtts = RhObj.Attributes.Duplicate(); RhObj.Attributes.SetDisplayModeOverride(Rhino.Display.DisplayModeDescription.FindByName("Shaded"));
RhObj.Attributes.ObjectColor = args.WireColour;
RhObj.Attributes.ColorSource = ObjectColorSource.ColorFromObject;
RhObj.CommitChanges();
foreach (Transform tr in Xform) {
args.Display.DrawObject(RhObj, tr);
}
// attributes back to initial state
RhObj.Attributes = OriginalAtts;
RhObj.CommitChanges(); }
}
I am having 2 problems :
1. SetDisplayModeOverride does work, so that the block is displayed according to GH settings (shaded or wireframe), but resetting the attributes to the original state just changes back the color, however the DisplayModeOverride remains. So when baking the block it remains unchangeable either shaded or in wireframe mode. I also tried RemoveDisplayModeOverride, however no luck there either.
2. When working with nested blocks, the color of the geometry remains according to the layer the block was created on. I guess this is due to the fact,that the RhObjects are still dependent on the block in the hierarchy above.
Would really appreciate if anybody has an idea how to solve this. I tried some other approaches before, including casting the geometry of the block to gh classes, but it gets quite slow when you deal with a lot of instances to display.
Cheers, Philipp
Tags:
Welcome to
Grasshopper
Added by Parametric House 1 Comment 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2026 Created by Scott Davidson.
Powered by