<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: C# AutoCAD drawing file write protection errors in Batch loop. in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/c-autocad-drawing-file-write-protection-errors-in-batch-loop/m-p/5671441#M39694</link>
    <description>&lt;P&gt;I have modified and cleaned my code.&lt;/P&gt;
&lt;P&gt;As of now I can generate new drawings but I can't overwrite existing drawings.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;using&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt; System;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;using&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; System.Collections.Generic;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;using&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; System.ComponentModel;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;using&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; System.Data;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;using&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; System.Drawing;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;using&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; System.Linq;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;using&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; System.Text;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;using&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; System.Windows.Forms;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;using&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; System.IO;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;using&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; Autodesk.AutoCAD.Runtime;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;using&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; Autodesk.AutoCAD.ApplicationServices;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;using&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; Autodesk.AutoCAD.DatabaseServices;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;using&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; Autodesk.AutoCAD.Geometry;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;using&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; Autodesk.AutoCAD.EditorInput;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;// Added for Autocad&lt;/P&gt;
&lt;P&gt;//using Autodesk.AutoCAD.Interop.AcadDocument;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;using&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; Autodesk.AutoCAD.Interop;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;namespace&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; MyAcadCSharpPlugin1&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;public&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;partial&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;class&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;Form1&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; : &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;Form&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;public&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; Form1()&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;InitializeComponent();&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;Document&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; acDoc = Autodesk.AutoCAD.ApplicationServices.&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;Application&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;.DocumentManager.MdiActiveDocument;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;private&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;string&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; strFileName;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;private&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;string&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; strDwgName;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;private&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;string&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;[] thisFormsArray;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;public&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;string&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;[] myArray&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;get&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;return&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; thisFormsArray;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;set&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; thisFormsArray = &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;value&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;private&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;void&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; button1_Click(&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;object&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; sender, &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;EventArgs&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; e)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;FormDialog&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; FormDialog = &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;new&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;FormDialog&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;();&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; Autodesk.AutoCAD.ApplicationServices.&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;Application&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;.ShowModelessDialog(FormDialog); &lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;//on form2:&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;//create a method to show content of array:&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;public&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;void&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; ShowingArray(&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;string&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;[] array)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;//1. or to pass to some control: &lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;foreach&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; (&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;string&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; item &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;in&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; array)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;listBox1.Items.Add(item);&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;//2. or to show in meesageBox (or similar):&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;StringBuilder&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; sb = &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;new&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;StringBuilder&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;();&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;foreach&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; (&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;string&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; item &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;in&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; array)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;sb.AppendLine(item);&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;MessageBox&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;.Show(sb.ToString());&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;private&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;void&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; Form1_Load(&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;object&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; sender, &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;EventArgs&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; e)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;//Document acDoc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;private&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;string&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;[] StArray; &lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;private&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;void&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; button4_Click(&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;object&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; sender, &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;EventArgs&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; e)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;ListDrawings();&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;public&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;void&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; ListDrawings()&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;//Loop through each item in the array&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;listBox1.Items.Clear();&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;foreach&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; (&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;string&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; myStr &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;in&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; thisFormsArray)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;MessageBox&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;.Show(myStr);&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;listBox1.Items.Add(myStr);&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;public&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;void&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; DrawingChangeRoutine()&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;MessageBox&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;.Show(&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;"Code Here"&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;);&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; AddCircle();&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;// My Sample Routine&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;// SetLayerCurrent();&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;//Posted &lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;private&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;void&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; button5_Click(&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;object&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; sender, &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;EventArgs&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; e)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;//Loop through each item in the array&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;//foreach (string myStr in thisFormsArray)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;BatchLoop();&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;//Batch loop to open close drawings &lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;public&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;void&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; BatchLoop()&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;foreach&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; (&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;String&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; myStr &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;in&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; thisFormsArray)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;MessageBox&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;.Show(myStr);&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;// Open the Drawing&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;strFileName = myStr;&lt;/P&gt;
&lt;P&gt;OpenDrawing();&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;//Add Drawing Changes code here.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; AddCircle();&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;//Sample code routine to add circle in model space&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;//DrawingSaved();&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;SaveActiveDrawing1();&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;Document&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; doc = Autodesk.AutoCAD.ApplicationServices.&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;Application&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;.DocumentManager.MdiActiveDocument;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;//Close drawing&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;doc.CloseAndDiscard();&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;//------------------------------------------- &lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;public&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;static&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;void&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; SaveActiveDrawing1()&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;Document&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; acDoc = Autodesk.AutoCAD.ApplicationServices.&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;Application&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;.DocumentManager.MdiActiveDocument;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;int&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; StrSaveNameLgh;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;string&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; strDWGName = acDoc.Name;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;string&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; StrSaveName;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;string&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; StrFileName;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;string&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; StrPathName;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;String&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; StrPath;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;object&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; obj = Autodesk.AutoCAD.ApplicationServices.&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;Application&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;.GetSystemVariable(&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;"DWGTITLED"&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;);&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;//' Check to see if the drawing has been named &lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;if&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; (System.&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;Convert&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;.ToInt16(obj) == 0)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;//' If the drawing is using a default name (Drawing1, Drawing2, etc)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;//' then provide a new name&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; strDWGName = &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;"c:\\MyDrawing1.dwg"&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;StrPathName = strDWGName;&lt;/P&gt;
&lt;P&gt;StrPathName = StrPathName.Remove(StrPathName.Length - 4, 4);&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; StrFileName = &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;Path&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;.GetFileName(strDWGName);&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; StrSaveName = StrPathName + &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;"\\"&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; + &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;"New-"&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; + StrFileName;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;MessageBox&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;.Show(StrSaveName);&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; acDoc.Database.SaveAs(StrSaveName, &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;true&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;, &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;DwgVersion&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;.Current, acDoc.Database.SecurityParameters);&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;//acDoc.Database.SaveAs(strDWGName, true, DwgVersion.Current, acDoc.Database.SecurityParameters);&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;public&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;void&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; OpenDrawing()&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;DocumentCollection&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; acDocMgr = Autodesk.AutoCAD.ApplicationServices.&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;Application&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;.DocumentManager;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;//Document doc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;if&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; (&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;File&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;.Exists(strFileName))&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;//acDocMgr.Open(strDwgName, false);&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;DocumentCollectionExtension&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;.Open(acDocMgr, strFileName);&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;else&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; acDocMgr.MdiActiveDocument.Editor.WriteMessage(&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;"File "&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; + strFileName +&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;" does not exist."&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;);&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;//---------------&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;public&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;static&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;void&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; AddCircle()&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;//Sample code routine to add circle in model space&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;// Get the current document and database&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;// Document acDoc = Application.DocumentManager.MdiActiveDocument;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;Document&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; acDoc = Autodesk.AutoCAD.ApplicationServices.&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;Application&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;.DocumentManager.MdiActiveDocument;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;Database&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; acCurDb = acDoc.Database;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;using&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; (&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;DocumentLock&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; docLock = acDoc.LockDocument()) &lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;// Start a transaction&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;using&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; (&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;Transaction&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; acTrans = acCurDb.TransactionManager.StartTransaction())&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;// Open the Block table for read&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;BlockTable&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; acBlkTbl;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;acBlkTbl = acTrans.GetObject(acCurDb.BlockTableId,&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;OpenMode&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;.ForRead) &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;as&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;BlockTable&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;// Open the Block table record Model space for write&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;BlockTableRecord&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; acBlkTblRec;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; acBlkTblRec = acTrans.GetObject(acBlkTbl[&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;BlockTableRecord&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;.ModelSpace],&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;OpenMode&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;.ForWrite) &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;as&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;BlockTableRecord&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;// Create a circle that is at 2,3 with a radius of 4.25&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;using&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; (&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;Circle&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; acCirc = &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;new&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;Circle&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;())&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; acCirc.Center = &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;new&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;Point3d&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;(2, 3, 0);&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;acCirc.Radius = 4.25;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;// Add the new object to the block table record and the transaction&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;acBlkTblRec.AppendEntity(acCirc);&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; acTrans.AddNewlyCreatedDBObject(acCirc, &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;true&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;);&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;// Save the new object to the database&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;acTrans.Commit();&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; }&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;// for lock document&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;//---------------&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;using&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt; System;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;using&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; System.Collections.Generic;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;using&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; System.ComponentModel;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;using&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; System.Data;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;using&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; System.Drawing;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;using&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; System.Linq;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;using&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; System.Text;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;using&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; System.Windows.Forms;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;using&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; System.IO;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;using&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; Autodesk.AutoCAD.Runtime;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;using&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; Autodesk.AutoCAD.ApplicationServices;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;using&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; Autodesk.AutoCAD.DatabaseServices;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;using&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; Autodesk.AutoCAD.Geometry;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;using&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; Autodesk.AutoCAD.EditorInput;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;// Added for Autocad&lt;/P&gt;
&lt;P&gt;//using Autodesk.AutoCAD.Interop.AcadDocument;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;using&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; Autodesk.AutoCAD.Interop;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;namespace&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; MyAcadCSharpPlugin1&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;public&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;partial&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;class&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;Form1&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; : &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;Form&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;public&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; Form1()&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;InitializeComponent();&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;Document&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; acDoc = Autodesk.AutoCAD.ApplicationServices.&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;Application&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;.DocumentManager.MdiActiveDocument;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;private&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;string&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; strFileName;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;private&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;string&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; strDwgName;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;private&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;string&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;[] thisFormsArray;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;public&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;string&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;[] myArray&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;get&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;return&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; thisFormsArray;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;set&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; thisFormsArray = &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;value&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;private&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;void&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; button1_Click(&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;object&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; sender, &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;EventArgs&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; e)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;FormDialog&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; FormDialog = &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;new&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;FormDialog&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;();&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; Autodesk.AutoCAD.ApplicationServices.&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;Application&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;.ShowModelessDialog(FormDialog); &lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;//on form2:&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;//create a method to show content of array:&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;public&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;void&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; ShowingArray(&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;string&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;[] array)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;//1. or to pass to some control: &lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;foreach&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; (&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;string&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; item &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;in&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; array)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;listBox1.Items.Add(item);&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;//2. or to show in meesageBox (or similar):&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;StringBuilder&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; sb = &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;new&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;StringBuilder&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;();&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;foreach&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; (&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;string&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; item &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;in&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; array)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;sb.AppendLine(item);&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;MessageBox&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;.Show(sb.ToString());&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;private&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;void&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; Form1_Load(&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;object&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; sender, &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;EventArgs&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; e)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;//Document acDoc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;private&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;string&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;[] StArray; &lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;private&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;void&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; button4_Click(&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;object&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; sender, &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;EventArgs&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; e)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;ListDrawings();&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;public&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;void&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; ListDrawings()&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;//Loop through each item in the array&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;listBox1.Items.Clear();&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;foreach&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; (&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;string&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; myStr &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;in&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; thisFormsArray)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;MessageBox&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;.Show(myStr);&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;listBox1.Items.Add(myStr);&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;public&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;void&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; DrawingChangeRoutine()&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;MessageBox&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;.Show(&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;"Code Here"&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;);&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; AddCircle();&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;// My Sample Routine&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;// SetLayerCurrent();&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;//Posted &lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;private&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;void&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; button5_Click(&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;object&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; sender, &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;EventArgs&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; e)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;//Loop through each item in the array&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;//foreach (string myStr in thisFormsArray)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;BatchLoop();&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;//Batch loop to open close drawings &lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;public&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;void&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; BatchLoop()&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;foreach&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; (&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;String&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; myStr &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;in&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; thisFormsArray)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;MessageBox&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;.Show(myStr);&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;// Open the Drawing&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;strFileName = myStr;&lt;/P&gt;
&lt;P&gt;OpenDrawing();&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;//Add Drawing Changes code here.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; AddCircle();&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;//Sample code routine to add circle in model space&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;//DrawingSaved();&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;SaveActiveDrawing1();&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;Document&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; doc = Autodesk.AutoCAD.ApplicationServices.&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;Application&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;.DocumentManager.MdiActiveDocument;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;//Close drawing&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;doc.CloseAndDiscard();&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;//------------------------------------------- &lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;public&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;static&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;void&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; SaveActiveDrawing1()&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;Document&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; acDoc = Autodesk.AutoCAD.ApplicationServices.&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;Application&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;.DocumentManager.MdiActiveDocument;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;int&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; StrSaveNameLgh;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;string&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; strDWGName = acDoc.Name;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;string&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; StrSaveName;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;string&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; StrFileName;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;string&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; StrPathName;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;String&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; StrPath;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;object&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; obj = Autodesk.AutoCAD.ApplicationServices.&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;Application&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;.GetSystemVariable(&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;"DWGTITLED"&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;);&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;//' Check to see if the drawing has been named &lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;if&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; (System.&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;Convert&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;.ToInt16(obj) == 0)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;//' If the drawing is using a default name (Drawing1, Drawing2, etc)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;//' then provide a new name&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; strDWGName = &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;"c:\\MyDrawing1.dwg"&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;StrPathName = strDWGName;&lt;/P&gt;
&lt;P&gt;StrPathName = StrPathName.Remove(StrPathName.Length - 4, 4);&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; StrFileName = &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;Path&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;.GetFileName(strDWGName);&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; StrSaveName = StrPathName + &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;"\\"&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; + &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;"New-"&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; + StrFileName;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;MessageBox&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;.Show(StrSaveName);&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; acDoc.Database.SaveAs(StrSaveName, &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;true&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;, &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;DwgVersion&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;.Current, acDoc.Database.SecurityParameters);&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;//acDoc.Database.SaveAs(strDWGName, true, DwgVersion.Current, acDoc.Database.SecurityParameters);&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;public&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;void&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; OpenDrawing()&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;DocumentCollection&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; acDocMgr = Autodesk.AutoCAD.ApplicationServices.&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;Application&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;.DocumentManager;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;//Document doc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;if&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; (&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;File&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;.Exists(strFileName))&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;//acDocMgr.Open(strDwgName, false);&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;DocumentCollectionExtension&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;.Open(acDocMgr, strFileName);&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;else&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; acDocMgr.MdiActiveDocument.Editor.WriteMessage(&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;"File "&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; + strFileName +&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;" does not exist."&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;);&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;//---------------&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;public&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;static&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;void&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; AddCircle()&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;//Sample code routine to add circle in model space&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;// Get the current document and database&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;// Document acDoc = Application.DocumentManager.MdiActiveDocument;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;Document&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; acDoc = Autodesk.AutoCAD.ApplicationServices.&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;Application&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;.DocumentManager.MdiActiveDocument;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;Database&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; acCurDb = acDoc.Database;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;using&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; (&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;DocumentLock&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; docLock = acDoc.LockDocument()) &lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;// Start a transaction&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;using&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; (&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;Transaction&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; acTrans = acCurDb.TransactionManager.StartTransaction())&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;// Open the Block table for read&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;BlockTable&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; acBlkTbl;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;acBlkTbl = acTrans.GetObject(acCurDb.BlockTableId,&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;OpenMode&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;.ForRead) &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;as&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;BlockTable&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;// Open the Block table record Model space for write&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;BlockTableRecord&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; acBlkTblRec;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; acBlkTblRec = acTrans.GetObject(acBlkTbl[&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;BlockTableRecord&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;.ModelSpace],&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;OpenMode&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;.ForWrite) &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;as&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;BlockTableRecord&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;// Create a circle that is at 2,3 with a radius of 4.25&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;using&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; (&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;Circle&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; acCirc = &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;new&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;Circle&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;())&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; acCirc.Center = &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;new&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;Point3d&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;(2, 3, 0);&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;acCirc.Radius = 4.25;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;// Add the new object to the block table record and the transaction&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;acBlkTblRec.AppendEntity(acCirc);&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; acTrans.AddNewlyCreatedDBObject(acCirc, &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;true&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;);&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;// Save the new object to the database&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;acTrans.Commit();&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; }&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;// for lock document&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;//---------------&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 10 Jun 2015 12:09:34 GMT</pubDate>
    <dc:creator>muckmailer</dc:creator>
    <dc:date>2015-06-10T12:09:34Z</dc:date>
    <item>
      <title>C# AutoCAD drawing file write protection errors in Batch loop.</title>
      <link>https://forums.autodesk.com/t5/net-forum/c-autocad-drawing-file-write-protection-errors-in-batch-loop/m-p/5668262#M39692</link>
      <description>&lt;P&gt;The following batch loop will work for as far as pulling up a group of drawings and saving them &lt;BR /&gt;when the&amp;nbsp; sample routine&amp;nbsp; "public static void AddCircle()" is flagged out. When I try to make drawing&lt;BR /&gt;changes using routine public static void AddCircle() the DrawingSaved routine give me drawing write&lt;BR /&gt;protection errors. How can I avoid drawing write protections errors in my batch loop.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;//CODE&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; private void button5_Click(object sender, EventArgs e)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Loop through each item in the array&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //foreach (string myStr in thisFormsArray)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; BatchLoop();&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR /&gt;&amp;nbsp; //Batch loop to open close drawings&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public void BatchLoop()&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; foreach (String myStr in thisFormsArray)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MessageBox.Show(myStr);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Open the Drawing&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; strFileName = myStr;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; OpenDrawing();&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Add Drawing Changes code here.&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AddCircle();// My Sample Routine&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DrawingSaved();&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Document doc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Close drawing&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; doc.CloseAndDiscard();&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public static void DrawingSaved()&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Savedwg&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; object obj = Autodesk.AutoCAD.ApplicationServices.Application.GetSystemVariable("DBMOD");&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Check the value of DBMOD, if 0 then the drawing has no unsaved changes&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (System.Convert.ToInt16(obj) != 0)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (System.Windows.Forms.MessageBox.Show("Do you wish to save this drawing?",&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "Save Drawing",&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.Windows.Forms.MessageBoxButtons.YesNo,&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.Windows.Forms.MessageBoxIcon.Question)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; == System.Windows.Forms.DialogResult.Yes)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Document acDoc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; acDoc.Database.SaveAs(acDoc.Name, true, DwgVersion.Current,&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; acDoc.Database.SecurityParameters);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //-------------------------------------------&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public void OpenDrawing()&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // strFileName = "C:\\campus.dwg";&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //string strFileName = myStr;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DocumentCollection acDocMgr = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Document doc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (File.Exists(strFileName))&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //acDocMgr.Open(strDwgName, false);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DocumentCollectionExtension.Open(acDocMgr, strFileName);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; acDocMgr.MdiActiveDocument.Editor.WriteMessage("File " + strFileName +&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; " does not exist.");&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR /&gt;//---------------&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // public static void AddCircle(Document acDoc)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public static void AddCircle()// My sample code&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Get the current document and database&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Document acDoc = Application.DocumentManager.MdiActiveDocument;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Document acDoc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Database acCurDb = acDoc.Database;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; using (DocumentLock docLock = acDoc.LockDocument()) &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Start a transaction&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; using (Transaction acTrans = acCurDb.TransactionManager.StartTransaction())&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Open the Block table for read&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; BlockTable acBlkTbl;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; acBlkTbl = acTrans.GetObject(acCurDb.BlockTableId,&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; OpenMode.ForRead) as BlockTable;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Open the Block table record Model space for write&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; BlockTableRecord acBlkTblRec;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Here******************************************************************&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; acBlkTblRec = acTrans.GetObject(acBlkTbl[BlockTableRecord.ModelSpace],&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; OpenMode.ForWrite) as BlockTableRecord;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Heres&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Create a circle that is at 2,3 with a radius of 4.25&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; using (Circle acCirc = new Circle())&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; acCirc.Center = new Point3d(2, 3, 0);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; acCirc.Radius = 4.25;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Add the new object to the block table record and the transaction&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; acBlkTblRec.AppendEntity(acCirc);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; acTrans.AddNewlyCreatedDBObject(acCirc, true);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Save the new object to the database&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; acTrans.Commit();&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }// for lockdocument&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 08 Jun 2015 12:11:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/c-autocad-drawing-file-write-protection-errors-in-batch-loop/m-p/5668262#M39692</guid>
      <dc:creator>muckmailer</dc:creator>
      <dc:date>2015-06-08T12:11:19Z</dc:date>
    </item>
    <item>
      <title>Re: C# AutoCAD drawing file write protection errors in Batch loop.</title>
      <link>https://forums.autodesk.com/t5/net-forum/c-autocad-drawing-file-write-protection-errors-in-batch-loop/m-p/5670509#M39693</link>
      <description>Call Database.CloseInput and make sure you Dispose the Database variable when you're done (try the 'using' keyword)</description>
      <pubDate>Tue, 09 Jun 2015 17:19:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/c-autocad-drawing-file-write-protection-errors-in-batch-loop/m-p/5670509#M39693</guid>
      <dc:creator>augusto.goncalves</dc:creator>
      <dc:date>2015-06-09T17:19:17Z</dc:date>
    </item>
    <item>
      <title>Re: C# AutoCAD drawing file write protection errors in Batch loop.</title>
      <link>https://forums.autodesk.com/t5/net-forum/c-autocad-drawing-file-write-protection-errors-in-batch-loop/m-p/5671441#M39694</link>
      <description>&lt;P&gt;I have modified and cleaned my code.&lt;/P&gt;
&lt;P&gt;As of now I can generate new drawings but I can't overwrite existing drawings.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;using&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt; System;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;using&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; System.Collections.Generic;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;using&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; System.ComponentModel;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;using&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; System.Data;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;using&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; System.Drawing;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;using&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; System.Linq;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;using&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; System.Text;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;using&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; System.Windows.Forms;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;using&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; System.IO;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;using&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; Autodesk.AutoCAD.Runtime;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;using&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; Autodesk.AutoCAD.ApplicationServices;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;using&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; Autodesk.AutoCAD.DatabaseServices;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;using&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; Autodesk.AutoCAD.Geometry;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;using&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; Autodesk.AutoCAD.EditorInput;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;// Added for Autocad&lt;/P&gt;
&lt;P&gt;//using Autodesk.AutoCAD.Interop.AcadDocument;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;using&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; Autodesk.AutoCAD.Interop;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;namespace&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; MyAcadCSharpPlugin1&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;public&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;partial&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;class&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;Form1&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; : &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;Form&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;public&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; Form1()&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;InitializeComponent();&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;Document&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; acDoc = Autodesk.AutoCAD.ApplicationServices.&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;Application&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;.DocumentManager.MdiActiveDocument;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;private&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;string&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; strFileName;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;private&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;string&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; strDwgName;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;private&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;string&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;[] thisFormsArray;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;public&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;string&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;[] myArray&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;get&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;return&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; thisFormsArray;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;set&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; thisFormsArray = &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;value&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;private&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;void&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; button1_Click(&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;object&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; sender, &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;EventArgs&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; e)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;FormDialog&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; FormDialog = &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;new&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;FormDialog&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;();&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; Autodesk.AutoCAD.ApplicationServices.&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;Application&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;.ShowModelessDialog(FormDialog); &lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;//on form2:&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;//create a method to show content of array:&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;public&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;void&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; ShowingArray(&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;string&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;[] array)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;//1. or to pass to some control: &lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;foreach&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; (&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;string&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; item &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;in&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; array)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;listBox1.Items.Add(item);&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;//2. or to show in meesageBox (or similar):&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;StringBuilder&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; sb = &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;new&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;StringBuilder&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;();&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;foreach&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; (&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;string&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; item &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;in&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; array)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;sb.AppendLine(item);&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;MessageBox&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;.Show(sb.ToString());&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;private&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;void&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; Form1_Load(&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;object&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; sender, &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;EventArgs&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; e)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;//Document acDoc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;private&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;string&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;[] StArray; &lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;private&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;void&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; button4_Click(&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;object&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; sender, &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;EventArgs&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; e)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;ListDrawings();&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;public&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;void&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; ListDrawings()&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;//Loop through each item in the array&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;listBox1.Items.Clear();&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;foreach&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; (&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;string&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; myStr &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;in&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; thisFormsArray)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;MessageBox&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;.Show(myStr);&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;listBox1.Items.Add(myStr);&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;public&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;void&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; DrawingChangeRoutine()&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;MessageBox&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;.Show(&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;"Code Here"&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;);&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; AddCircle();&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;// My Sample Routine&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;// SetLayerCurrent();&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;//Posted &lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;private&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;void&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; button5_Click(&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;object&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; sender, &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;EventArgs&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; e)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;//Loop through each item in the array&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;//foreach (string myStr in thisFormsArray)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;BatchLoop();&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;//Batch loop to open close drawings &lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;public&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;void&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; BatchLoop()&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;foreach&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; (&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;String&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; myStr &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;in&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; thisFormsArray)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;MessageBox&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;.Show(myStr);&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;// Open the Drawing&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;strFileName = myStr;&lt;/P&gt;
&lt;P&gt;OpenDrawing();&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;//Add Drawing Changes code here.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; AddCircle();&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;//Sample code routine to add circle in model space&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;//DrawingSaved();&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;SaveActiveDrawing1();&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;Document&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; doc = Autodesk.AutoCAD.ApplicationServices.&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;Application&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;.DocumentManager.MdiActiveDocument;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;//Close drawing&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;doc.CloseAndDiscard();&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;//------------------------------------------- &lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;public&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;static&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;void&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; SaveActiveDrawing1()&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;Document&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; acDoc = Autodesk.AutoCAD.ApplicationServices.&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;Application&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;.DocumentManager.MdiActiveDocument;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;int&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; StrSaveNameLgh;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;string&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; strDWGName = acDoc.Name;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;string&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; StrSaveName;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;string&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; StrFileName;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;string&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; StrPathName;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;String&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; StrPath;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;object&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; obj = Autodesk.AutoCAD.ApplicationServices.&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;Application&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;.GetSystemVariable(&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;"DWGTITLED"&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;);&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;//' Check to see if the drawing has been named &lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;if&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; (System.&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;Convert&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;.ToInt16(obj) == 0)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;//' If the drawing is using a default name (Drawing1, Drawing2, etc)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;//' then provide a new name&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; strDWGName = &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;"c:\\MyDrawing1.dwg"&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;StrPathName = strDWGName;&lt;/P&gt;
&lt;P&gt;StrPathName = StrPathName.Remove(StrPathName.Length - 4, 4);&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; StrFileName = &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;Path&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;.GetFileName(strDWGName);&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; StrSaveName = StrPathName + &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;"\\"&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; + &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;"New-"&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; + StrFileName;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;MessageBox&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;.Show(StrSaveName);&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; acDoc.Database.SaveAs(StrSaveName, &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;true&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;, &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;DwgVersion&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;.Current, acDoc.Database.SecurityParameters);&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;//acDoc.Database.SaveAs(strDWGName, true, DwgVersion.Current, acDoc.Database.SecurityParameters);&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;public&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;void&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; OpenDrawing()&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;DocumentCollection&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; acDocMgr = Autodesk.AutoCAD.ApplicationServices.&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;Application&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;.DocumentManager;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;//Document doc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;if&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; (&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;File&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;.Exists(strFileName))&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;//acDocMgr.Open(strDwgName, false);&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;DocumentCollectionExtension&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;.Open(acDocMgr, strFileName);&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;else&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; acDocMgr.MdiActiveDocument.Editor.WriteMessage(&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;"File "&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; + strFileName +&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;" does not exist."&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;);&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;//---------------&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;public&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;static&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;void&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; AddCircle()&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;//Sample code routine to add circle in model space&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;// Get the current document and database&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;// Document acDoc = Application.DocumentManager.MdiActiveDocument;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;Document&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; acDoc = Autodesk.AutoCAD.ApplicationServices.&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;Application&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;.DocumentManager.MdiActiveDocument;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;Database&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; acCurDb = acDoc.Database;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;using&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; (&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;DocumentLock&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; docLock = acDoc.LockDocument()) &lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;// Start a transaction&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;using&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; (&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;Transaction&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; acTrans = acCurDb.TransactionManager.StartTransaction())&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;// Open the Block table for read&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;BlockTable&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; acBlkTbl;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;acBlkTbl = acTrans.GetObject(acCurDb.BlockTableId,&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;OpenMode&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;.ForRead) &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;as&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;BlockTable&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;// Open the Block table record Model space for write&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;BlockTableRecord&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; acBlkTblRec;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; acBlkTblRec = acTrans.GetObject(acBlkTbl[&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;BlockTableRecord&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;.ModelSpace],&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;OpenMode&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;.ForWrite) &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;as&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;BlockTableRecord&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;// Create a circle that is at 2,3 with a radius of 4.25&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;using&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; (&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;Circle&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; acCirc = &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;new&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;Circle&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;())&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; acCirc.Center = &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;new&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;Point3d&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;(2, 3, 0);&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;acCirc.Radius = 4.25;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;// Add the new object to the block table record and the transaction&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;acBlkTblRec.AppendEntity(acCirc);&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; acTrans.AddNewlyCreatedDBObject(acCirc, &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;true&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;);&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;// Save the new object to the database&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;acTrans.Commit();&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; }&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;// for lock document&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;//---------------&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;using&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt; System;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;using&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; System.Collections.Generic;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;using&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; System.ComponentModel;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;using&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; System.Data;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;using&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; System.Drawing;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;using&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; System.Linq;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;using&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; System.Text;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;using&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; System.Windows.Forms;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;using&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; System.IO;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;using&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; Autodesk.AutoCAD.Runtime;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;using&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; Autodesk.AutoCAD.ApplicationServices;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;using&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; Autodesk.AutoCAD.DatabaseServices;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;using&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; Autodesk.AutoCAD.Geometry;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;using&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; Autodesk.AutoCAD.EditorInput;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;// Added for Autocad&lt;/P&gt;
&lt;P&gt;//using Autodesk.AutoCAD.Interop.AcadDocument;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;using&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; Autodesk.AutoCAD.Interop;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;namespace&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; MyAcadCSharpPlugin1&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;public&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;partial&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;class&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;Form1&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; : &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;Form&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;public&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; Form1()&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;InitializeComponent();&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;Document&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; acDoc = Autodesk.AutoCAD.ApplicationServices.&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;Application&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;.DocumentManager.MdiActiveDocument;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;private&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;string&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; strFileName;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;private&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;string&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; strDwgName;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;private&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;string&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;[] thisFormsArray;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;public&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;string&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;[] myArray&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;get&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;return&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; thisFormsArray;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;set&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; thisFormsArray = &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;value&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;private&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;void&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; button1_Click(&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;object&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; sender, &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;EventArgs&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; e)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;FormDialog&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; FormDialog = &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;new&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;FormDialog&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;();&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; Autodesk.AutoCAD.ApplicationServices.&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;Application&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;.ShowModelessDialog(FormDialog); &lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;//on form2:&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;//create a method to show content of array:&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;public&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;void&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; ShowingArray(&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;string&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;[] array)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;//1. or to pass to some control: &lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;foreach&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; (&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;string&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; item &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;in&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; array)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;listBox1.Items.Add(item);&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;//2. or to show in meesageBox (or similar):&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;StringBuilder&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; sb = &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;new&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;StringBuilder&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;();&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;foreach&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; (&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;string&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; item &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;in&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; array)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;sb.AppendLine(item);&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;MessageBox&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;.Show(sb.ToString());&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;private&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;void&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; Form1_Load(&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;object&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; sender, &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;EventArgs&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; e)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;//Document acDoc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;private&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;string&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;[] StArray; &lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;private&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;void&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; button4_Click(&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;object&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; sender, &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;EventArgs&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; e)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;ListDrawings();&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;public&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;void&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; ListDrawings()&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;//Loop through each item in the array&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;listBox1.Items.Clear();&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;foreach&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; (&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;string&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; myStr &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;in&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; thisFormsArray)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;MessageBox&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;.Show(myStr);&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;listBox1.Items.Add(myStr);&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;public&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;void&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; DrawingChangeRoutine()&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;MessageBox&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;.Show(&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;"Code Here"&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;);&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; AddCircle();&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;// My Sample Routine&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;// SetLayerCurrent();&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;//Posted &lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;private&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;void&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; button5_Click(&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;object&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; sender, &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;EventArgs&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; e)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;//Loop through each item in the array&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;//foreach (string myStr in thisFormsArray)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;BatchLoop();&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;//Batch loop to open close drawings &lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;public&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;void&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; BatchLoop()&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;foreach&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; (&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;String&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; myStr &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;in&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; thisFormsArray)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;MessageBox&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;.Show(myStr);&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;// Open the Drawing&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;strFileName = myStr;&lt;/P&gt;
&lt;P&gt;OpenDrawing();&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;//Add Drawing Changes code here.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; AddCircle();&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;//Sample code routine to add circle in model space&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;//DrawingSaved();&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;SaveActiveDrawing1();&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;Document&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; doc = Autodesk.AutoCAD.ApplicationServices.&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;Application&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;.DocumentManager.MdiActiveDocument;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;//Close drawing&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;doc.CloseAndDiscard();&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;//------------------------------------------- &lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;public&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;static&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;void&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; SaveActiveDrawing1()&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;Document&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; acDoc = Autodesk.AutoCAD.ApplicationServices.&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;Application&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;.DocumentManager.MdiActiveDocument;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;int&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; StrSaveNameLgh;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;string&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; strDWGName = acDoc.Name;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;string&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; StrSaveName;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;string&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; StrFileName;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;string&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; StrPathName;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;String&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; StrPath;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;object&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; obj = Autodesk.AutoCAD.ApplicationServices.&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;Application&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;.GetSystemVariable(&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;"DWGTITLED"&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;);&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;//' Check to see if the drawing has been named &lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;if&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; (System.&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;Convert&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;.ToInt16(obj) == 0)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;//' If the drawing is using a default name (Drawing1, Drawing2, etc)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;//' then provide a new name&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; strDWGName = &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;"c:\\MyDrawing1.dwg"&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;StrPathName = strDWGName;&lt;/P&gt;
&lt;P&gt;StrPathName = StrPathName.Remove(StrPathName.Length - 4, 4);&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; StrFileName = &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;Path&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;.GetFileName(strDWGName);&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; StrSaveName = StrPathName + &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;"\\"&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; + &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;"New-"&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; + StrFileName;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;MessageBox&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;.Show(StrSaveName);&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; acDoc.Database.SaveAs(StrSaveName, &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;true&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;, &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;DwgVersion&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;.Current, acDoc.Database.SecurityParameters);&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;//acDoc.Database.SaveAs(strDWGName, true, DwgVersion.Current, acDoc.Database.SecurityParameters);&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;public&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;void&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; OpenDrawing()&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;DocumentCollection&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; acDocMgr = Autodesk.AutoCAD.ApplicationServices.&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;Application&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;.DocumentManager;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;//Document doc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;if&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; (&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;File&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;.Exists(strFileName))&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;//acDocMgr.Open(strDwgName, false);&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;DocumentCollectionExtension&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;.Open(acDocMgr, strFileName);&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;else&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; acDocMgr.MdiActiveDocument.Editor.WriteMessage(&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;"File "&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; + strFileName +&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;&lt;FONT face="Consolas" size="2" color="#a31515"&gt;" does not exist."&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;);&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;//---------------&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;public&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;static&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;void&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; AddCircle()&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;//Sample code routine to add circle in model space&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;// Get the current document and database&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;// Document acDoc = Application.DocumentManager.MdiActiveDocument;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;Document&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; acDoc = Autodesk.AutoCAD.ApplicationServices.&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;Application&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;.DocumentManager.MdiActiveDocument;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;Database&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; acCurDb = acDoc.Database;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;using&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; (&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;DocumentLock&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; docLock = acDoc.LockDocument()) &lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;// Start a transaction&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;using&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; (&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;Transaction&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; acTrans = acCurDb.TransactionManager.StartTransaction())&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;// Open the Block table for read&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;BlockTable&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; acBlkTbl;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;acBlkTbl = acTrans.GetObject(acCurDb.BlockTableId,&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;OpenMode&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;.ForRead) &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;as&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;BlockTable&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;// Open the Block table record Model space for write&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;BlockTableRecord&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; acBlkTblRec;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; acBlkTblRec = acTrans.GetObject(acBlkTbl[&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;BlockTableRecord&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;.ModelSpace],&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;OpenMode&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;.ForWrite) &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;as&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;BlockTableRecord&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;// Create a circle that is at 2,3 with a radius of 4.25&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;using&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; (&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;Circle&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; acCirc = &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;new&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;Circle&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;())&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; acCirc.Center = &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;new&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;&lt;FONT face="Consolas" size="2" color="#2b91af"&gt;Point3d&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;(2, 3, 0);&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;acCirc.Radius = 4.25;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;// Add the new object to the block table record and the transaction&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;acBlkTblRec.AppendEntity(acCirc);&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; acTrans.AddNewlyCreatedDBObject(acCirc, &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;&lt;FONT face="Consolas" size="2" color="#0000ff"&gt;true&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;);&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;// Save the new object to the database&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;acTrans.Commit();&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt; }&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;// for lock document&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;&lt;FONT face="Consolas" size="2" color="#008000"&gt;//---------------&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jun 2015 12:09:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/c-autocad-drawing-file-write-protection-errors-in-batch-loop/m-p/5671441#M39694</guid>
      <dc:creator>muckmailer</dc:creator>
      <dc:date>2015-06-10T12:09:34Z</dc:date>
    </item>
    <item>
      <title>Re: C# AutoCAD drawing file write protection errors in Batch loop.</title>
      <link>https://forums.autodesk.com/t5/net-forum/c-autocad-drawing-file-write-protection-errors-in-batch-loop/m-p/5672654#M39695</link>
      <description>&lt;PRE&gt;using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace CopyFile
{
    class clsCopyFile
    {

        internal void ProcessFile(string strFullPath)
        {
            
            // This has been my work around for a long long time. 
            // Autocad may lock the file in use so we can do our processing in a copy and
            // then write the file back when finished, as long as the file is not already in use.
            // this will leave a copy in the temp folder. 
            // the temp file will be locked until you close AutoCAD.
            
      

            string strNewFullPath = "";
            // Copy File to Temp

            if (!IsFileinUse(strFullPath))
            {
                Copyfile(strFullPath, ref strNewFullPath);

                // Process File

                //  Write File back
                Copyfile(strNewFullPath, ref strFullPath);
            }
            else
            {
                System.Windows.Forms.MessageBox.Show("Unable to Process file :" + strFullPath);

            }
        }

        /// &amp;lt;summary&amp;gt;
        /// Copy File that can be in use
        /// &amp;lt;/summary&amp;gt;
        /// &amp;lt;param name="strFullPath"&amp;gt;&amp;lt;/param&amp;gt;
        /// &amp;lt;param name="strNewFullPath"&amp;gt;&amp;lt;/param&amp;gt;
        /// &amp;lt;returns&amp;gt;&amp;lt;/returns&amp;gt;
        public bool Copyfile(string strFullPath, ref string strNewFullPath)
        {
            try
            {
                strNewFullPath = System.IO.Path.GetTempFileName() + ".dwg";

                using (var inputFile = new FileStream(strFullPath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
                {
                    using (var outputFile = new FileStream(strNewFullPath, FileMode.Create))
                    {
                        var buffer = new byte[0x10000];
                        int bytes;

                        while ((bytes = inputFile.Read(buffer, 0, buffer.Length)) &amp;gt; 0)
                        {
                            outputFile.Write(buffer, 0, bytes);
                        }
                    }
                }
            }
            catch (System.Exception)
            {
                return false;
            }
            return true;
        }


        internal bool IsFileinUse(string path)
        {
            try
            {
                //Just opening the file as open/create
                using (FileStream fs = new FileStream(path, FileMode.OpenOrCreate))
                {
                    //If required we can check for read/write by using fs.CanRead or fs.CanWrite                                 }
                    return false;
                }
            }

            catch (IOException)
            {
                return true;
            }
        }
    }

}
&lt;/PRE&gt;</description>
      <pubDate>Wed, 10 Jun 2015 20:34:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/c-autocad-drawing-file-write-protection-errors-in-batch-loop/m-p/5672654#M39695</guid>
      <dc:creator>arcticad</dc:creator>
      <dc:date>2015-06-10T20:34:52Z</dc:date>
    </item>
    <item>
      <title>Re: C# AutoCAD drawing file write protection errors in Batch loop.</title>
      <link>https://forums.autodesk.com/t5/net-forum/c-autocad-drawing-file-write-protection-errors-in-batch-loop/m-p/5673324#M39696</link>
      <description>Seems like you're missing the CloseInput... without that, AutoCAD will maintain the .dwg file locked.&lt;BR /&gt;&lt;BR /&gt;Or you may try SaveAs and the replace, as described at &lt;A href="http://adndevblog.typepad.com/autocad/2012/04/batch-process-in-memory-1.html" target="_blank"&gt;http://adndevblog.typepad.com/autocad/2012/04/batch-process-in-memory-1.html&lt;/A&gt;</description>
      <pubDate>Thu, 11 Jun 2015 11:54:57 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/c-autocad-drawing-file-write-protection-errors-in-batch-loop/m-p/5673324#M39696</guid>
      <dc:creator>augusto.goncalves</dc:creator>
      <dc:date>2015-06-11T11:54:57Z</dc:date>
    </item>
  </channel>
</rss>

