Prod.: Engine, ver.: 6, ID: 60001293, HowTo : How can I make a copy command that will do multiple copies of the selected items

HowTo : How can I make a copy command that will do multiple copies of the selected items

Article60001293
TypeHowTo
ProductEngine
Version6
Date Added1/26/2011
Submitted byM. Hosan
Keywords

Subject

How can I make a copy command that will do multiple copies of the selected items

Summary

How can I make a copy command that will do multiple copies of the selected items. For example the copy command does not end when you are finished copying the selection, and remains active to continue copying the same selection active?

Solution

You can do this by creating your own commands. In this case try a code like :
        private void button2_Click(object sender, EventArgs e)
        {
            bool flag = MultipleCopy(vdFramedControl1.BaseControl.ActiveDocument);
            this.Text = flag.ToString();
        }

        private Boolean MultipleCopy(vdDocument doc)
        {
            bool isCopy = true;
            doc.Prompt("Select Entities to copy: ");
            if (!doc.CommandAction.CmdSelect("USER"))
            {
                doc.Prompt("");
                return false;
            }
            vdSelection sel = doc.Selections.FindName("VDRAW_PREVIOUS_SELSET");
            if ((sel == null) | (sel.Count < 1)) return false;
            doc.Prompt("Copy from Point: ");
            gPoint ptFrom = doc.ActionUtility.getUserPoint() as gPoint;
            if ((ptFrom == null))
            {
                doc.Prompt("");
                return false;
            }
            int i = 0;
            while (isCopy)
            {
                isCopy = doc.CommandAction.CmdCopy(sel, ptFrom, "USER");
                if ((i==0) & (isCopy==false))
                {
                 doc.Prompt("");
                 return false;
                }
                i++;
            }
            doc.Prompt("");
            return true;
        }