private void m_listbox_SelectedIndexChanged(object sender, EventArgs e) { if (m_bInEvent) { return; } m_bInSelect = true; MRhinoDoc doc = RhUtil.RhinoApp().ActiveDoc(); // Select what got selected ListBox.SelectedIndexCollection selected = m_listbox.SelectedIndices; // Select what got selected int i = 0; for (i = 0; i < selected.Count; i++) { int index = selected[i]; if (!m_selected.Contains(index)) { Guid guid = new Guid(m_listbox.Items[index].ToString()); MRhinoObject obj = doc.LookupObject(guid); if (obj != null && obj.IsSelectable()) { obj.Select(true); } } } // Unselect what got unselected for (i = 0; i < m_selected.Count; i++) { int index = m_selected[i]; if (!selected.Contains(index)) { Guid guid = new Guid(m_listbox.Items[index].ToString()); MRhinoObject obj = doc.LookupObject(guid); if (obj != null) { obj.Select(false); } } } SaveSelectedIndices(); doc.Redraw(); m_bInSelect = false; }
public int ExplodeHatch(MRhinoDoc doc, Guid hatchGuid, ref List<Guid> objectGuids) { int objectGuids_Count = objectGuids.Count; if (null != doc) { IRhinoHatch hatchObject = MRhinoHatch.ConstCast(doc.LookupObject(hatchGuid)); if (null != hatchObject) { MRhinoObject[] subObjects = null; int subObjects_Count = hatchObject.GetSubObjects(out subObjects); if (0 < subObjects_Count || null != subObjects) { for (int i = 0; i < subObjects_Count; i++) { bool rc = doc.AddObject(subObjects[i]); if (rc) objectGuids.Add(subObjects[i].Attributes().m_uuid); } } } } return objectGuids.Count - objectGuids_Count; }
public int ExplodeHatch(MRhinoDoc doc, Guid hatchGuid, ref List <Guid> objectGuids) { int objectGuids_Count = objectGuids.Count; if (null != doc) { IRhinoHatch hatchObject = MRhinoHatch.ConstCast(doc.LookupObject(hatchGuid)); if (null != hatchObject) { MRhinoObject[] subObjects = null; int subObjects_Count = hatchObject.GetSubObjects(out subObjects); if (0 < subObjects_Count || null != subObjects) { for (int i = 0; i < subObjects_Count; i++) { bool rc = doc.AddObject(subObjects[i]); if (rc) { objectGuids.Add(subObjects[i].Attributes().m_uuid); } } } } } return(objectGuids.Count - objectGuids_Count); }