@eebs99 wrote:
I’m using Rhinocommon to generate surfaces, and then I convert them to lineframes and wireframes (a 2D list of ordered curves; using lines and curves, repectively). The wireframe generation is successful, however my issue comes when I try to group them. My goal is to have all the u and v curves grouped separately.
The lineframe code works as intended. All the u and v curves are grouped separately, as well as all the objects being grouped together afterwards. I then simply copied and pasted the same code to the wireframe part, yet the grouping is not the same. This code gives me two groups where both the u and v curves are grouped together, twice (meaning I have to ungroup twice to get the individual curves). Is this a programming issue or is there something I am not aware about how groups work?
Here is the code that I use:
if (lineframes.Count != 0) { child.Name = "Lineframe"; index = doc.Layers.Add(child); foreach (List<List<Polyline>> lineframe in lineframes) { var group = new List<Guid>(); foreach (List<Polyline> list in lineframe) { var guids = new List<Guid>(); foreach (Polyline polyline in list) guids.Add(doc.Objects.AddPolyline(polyline, new Rhino.DocObjects.ObjectAttributes { LayerIndex = index })); doc.Groups.Add(guids); group.AddRange(guids); } doc.Groups.Add(group); } doc.Views.Redraw(); doc.Layers.FindIndex(index).IsVisible = false; } if (wireframes.Count != 0) { child.Name = "Wireframe"; index = doc.Layers.Add(child); foreach (List<List<Curve>> wireframe in wireframes) { var group = new List<Guid>(); foreach (List<Curve> list in wireframe) { var guids = new List<Guid>(); foreach (Curve curve in list) guids.Add(doc.Objects.AddCurve(curve, new Rhino.DocObjects.ObjectAttributes { LayerIndex = index })); doc.Groups.Add(guids); group.AddRange(guids); } doc.Groups.Add(group); } doc.Views.Redraw(); doc.Layers.FindIndex(index).IsVisible = false; }
EDIT: separate question, but still relating to the code above: my goal is to have both of the child layers I create here to be invisible (the parent is always visible). This does work, however when implemented in Rhino, the lightbulb that represents the layer visibility is half open half closed. This is fine, except now I have to click it twice to make the layer visible. For convenience’s sake, I simply want to click it once to unhide the layer. Is there a way to do so?
Posts: 2
Participants: 1