public static AddData ( IRhinoObject obj, string string_datum ) : bool | ||
obj | IRhinoObject | |
string_datum | string | |
return | bool |
///<summary> This gets called when when the user runs this command.</summary> public override IRhinoCommand.result RunCommand(IRhinoCommandContext context) { RhinoGetVolumeObjects go = new RhinoGetVolumeObjects(); go.SetCommandPrompt("Select objects to apply area tags"); go.SetGeometryFilter(IRhinoGetObject.GEOMETRY_TYPE_FILTER.surface_object | IRhinoGetObject.GEOMETRY_TYPE_FILTER.polysrf_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 Volume Tags"; form.m_str_prompt = "Select one or more volume tags."; form.m_type = EstimatorTag.tag_type.volume_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) { MRhinoGetObject go = new MRhinoGetObject(); go.SetCommandPrompt("Select objects to apply item tag"); 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 Item Tag"; form.m_str_prompt = "Select an item tag."; form.m_type = EstimatorTag.tag_type.item_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.RemoveAllData(go.Object(i).Object()); EstimatorHelpers.AddData(go.Object(i).Object(), tag_strings.ToArray()); } return(IRhinoCommand.result.success); }