///<summary> This gets called when when the user runs this command.</summary> public override IRhinoCommand.result RunCommand(IRhinoCommandContext context) { RhinoGetAreaObjects go = new RhinoGetAreaObjects(); go.SetCommandPrompt("Select objects to apply area tags"); go.SetGeometryFilter(IRhinoGetObject.GEOMETRY_TYPE_FILTER.curve_object | IRhinoGetObject.GEOMETRY_TYPE_FILTER.surface_object | IRhinoGetObject.GEOMETRY_TYPE_FILTER.mesh_object); go.EnableSubObjectSelect(false); go.GetObjects(1, 0); if (go.CommandResult() != IRhinoCommand.result.success) return go.CommandResult(); EstimatorTagForm form = new EstimatorTagForm(); form.m_str_title = "Add Area Tags"; form.m_str_prompt = "Select one or more area tags."; form.m_type = EstimatorTag.tag_type.area_tag; DialogResult rc = form.ShowDialog(); if (rc == DialogResult.Cancel) return IRhinoCommand.result.cancel; List<string> tag_strings = new List<string>(form.m_selected_tags.Count); EstimatorPlugIn plugin = RMA.Rhino.RhUtil.GetPlugInInstance() as EstimatorPlugIn; int i = 0; for (i = 0; i < form.m_selected_tags.Count; i++) { int index = form.m_selected_tags[i]; tag_strings.Add(plugin.m_tag_table[index].Id()); } for (i = 0; i < go.ObjectCount(); i++) EstimatorHelpers.AddData(go.Object(i).Object(), tag_strings.ToArray()); return IRhinoCommand.result.success; }
///<summary> This gets called when when the user runs this command.</summary> public override IRhinoCommand.result RunCommand(IRhinoCommandContext context) { RhinoGetAreaObjects go = new RhinoGetAreaObjects(); go.SetCommandPrompt("Select objects to apply area tags"); go.SetGeometryFilter(IRhinoGetObject.GEOMETRY_TYPE_FILTER.curve_object | IRhinoGetObject.GEOMETRY_TYPE_FILTER.surface_object | IRhinoGetObject.GEOMETRY_TYPE_FILTER.mesh_object); go.EnableSubObjectSelect(false); go.GetObjects(1, 0); if (go.CommandResult() != IRhinoCommand.result.success) { return(go.CommandResult()); } EstimatorTagForm form = new EstimatorTagForm(); form.m_str_title = "Add Area Tags"; form.m_str_prompt = "Select one or more area tags."; form.m_type = EstimatorTag.tag_type.area_tag; DialogResult rc = form.ShowDialog(); if (rc == DialogResult.Cancel) { return(IRhinoCommand.result.cancel); } List <string> tag_strings = new List <string>(form.m_selected_tags.Count); EstimatorPlugIn plugin = RMA.Rhino.RhUtil.GetPlugInInstance() as EstimatorPlugIn; int i = 0; for (i = 0; i < form.m_selected_tags.Count; i++) { int index = form.m_selected_tags[i]; tag_strings.Add(plugin.m_tag_table[index].Id()); } for (i = 0; i < go.ObjectCount(); i++) { EstimatorHelpers.AddData(go.Object(i).Object(), tag_strings.ToArray()); } return(IRhinoCommand.result.success); }