How to use a Copy Jig for an Entity Array

How to use a Copy Jig for an Entity Array

muckmailer
Collaborator Collaborator
661 Views
2 Replies
Message 1 of 3

How to use a Copy Jig for an Entity Array

muckmailer
Collaborator
Collaborator

I am able to populate dataGridView1  with an attribute list.

I am attempting to pass that from the column 3 of dataGridView1  back to mycommands class without luck.

Code attached.

  //****Located in form1****
        private void button4_Click(object sender, EventArgs e)
        {
            MyCommands ObjCommands = new MyCommands();
            gridarray();
            var doc = Autodesk.AutoCAD.ApplicationServices.Core.Application.DocumentManager.MdiActiveDocument;
            if (doc != null)
            {
                //doc.SendStringToExecute("THWU", true, false, false);
                doc.SendStringToExecute("TEST1\n", false, false, false);
            }
            // Command Send End
            
        }
 
        public void gridarray() 
           {
            MyCommands ObjCommands = new MyCommands();
            //string[] column0Array = new string[dataGridView1.Rows.Count];
            column1Array = new string[dataGridView1.Rows.Count];
            column2Array = new string[dataGridView1.Rows.Count];
            
            int i = 0;
            foreach (DataGridViewRow row in dataGridView1.Rows)
            {
                //column0Array[i] = row.Cells[0].Value != null ? row.Cells[0].Value.ToString() : string.Empty;
                column1Array[i] = row.Cells[1].Value != null ? row.Cells[1].Value.ToString() : string.Empty;
                column2Array[i] = row.Cells[2].Value != null ? row.Cells[2].Value.ToString() : string.Empty;
                i++;
            }
            System.Windows.Forms.MessageBox.Show("grid xy");  
           // foreach (string MsgName in column2Array)
           //{

           // System.Windows.Forms.MessageBox.Show(MsgName);
          // }
            ObjCommands.column2Array = column2Array;
        }
 
 //****Located in My Commands Class****  
        [CommandMethod("TEST1")]
        public void ListTest()
       //Commands AcadCommands = new MyCommands();
        //Form1 objForm1 = new Form1();
        
        {
            PickBlock();
            Form1 ObjForm1 = new Form1();
          // column2Array = column2Array;
            column2Array = ObjForm1.column2Array;
            System.Windows.Forms.MessageBox.Show("here");   
            foreach (string MsgName in column2Array)
            {

                System.Windows.Forms.MessageBox.Show(MsgName);
            }

            System.Windows.Forms.MessageBox.Show("xxx");   
             //string[] AttStringChglist;
            //AttStringChglist = ObjForm1.column2Array;
            //AttStringChglist = ObjForm1.column2Array;
            }//End list test 

I think should be see the array members in that foreach member box in mycommands but that is not the case

What is the solution to this?.

Image of form1 is showen

Untitled.png 

 

0 Likes
662 Views
2 Replies
Replies (2)
Message 2 of 3

_gile
Consultant
Consultant

Hello,

Out of respect for those to whom you are asking for help, you should show a readable code, cleaned of any unnecessary lines commented on, but which contains all the information that might be useful.
By the way, always out of respect, you could make a feedback when someone tried to help you.



Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

Message 3 of 3

ActivistInvestor
Mentor
Mentor

@muckmailer wrote:

I am able to populate dataGridView1  with an attribute list.

I am attempting to pass that from the column 3 of dataGridView1  back to mycommands class without luck.

Code attached.

 

I think should be see the array members in that foreach member box in mycommands but that is not the case

What is the solution to this?.

 

 

My suggestion would be to visit the learning resources Microsoft has on the web, to learn how to properly use a DataGridView, because you're not doing it correctly and that's what making your problem even more difficult. You also seem to be lacking a basic understanding of what classes and instances of classes are, and that is also making things more difficult.