Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - JohannesRP

Pages: [1]
1
Blocks / How to edit block parameters from a windows form (c#)?
« on: January 17, 2013, 04:13:34 PM »
Hi, i try to change several dynamic blocks using my own application. I have a com connection with AuotCAD 2013 and i can run through all block definitions.
When i run through the block def. in AutoCad i can identify the one i want to change the parameters. But how to continue? How can i set the "heightLeft" to another value?

Code: [Select]
private void bt_openTemplate_Click(object sender, EventArgs e)
        {
            AcadApplication acadApp = null;
            AcadBlocks acadblock = null;
           
            try
            {
                object obj = Marshal.GetActiveObject("AutoCAD.Application.19");
               
                if (obj != null)
                {
                    acadApp = obj as AcadApplication;
                    acadblock = acadApp.ActiveDocument.Blocks;

                    string name = "";

                    foreach (AcadBlock  b in acadblock)
                    {
                        name = name + " :: " + b.Name;

                        if (b.Name == "WT")
                        {
                           
// HELP!!!
// Here i need to change the properties of the block with name "WT"
                           
                        }
                    }
                    tb.Text = name;
                }
                else
                {
                    MessageBox.Show("AutoCAD is not open or version is not right.");
                }
            }
            catch
            {
                MessageBox.Show("AutoCAD is not open or version is not right.");
            }
        }
    }


The main idea is to change several blocks at the same time by changing only one value in my application.

regards
Johannes

Pages: [1]