Пример #1
0
        ///<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)
        {
            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);
        }
Пример #3
0
        ///<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);
        }
Пример #4
0
        ///<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;
        }