<?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 How to insert an entity from another drawing using vb.net in stand-alone program in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/how-to-insert-an-entity-from-another-drawing-using-vb-net-in/m-p/5063034#M43806</link>
    <description>&lt;P&gt;Hello, I'm wondering how to get a point from the user to insert an entity into a drawing from another drawing using vb.net in a stand-alone program. I'm having to write this as a stand alone program because this is only a small portion of my overall program and I'm interfacing with 3 other softwares besides Autocad. I know how to do this when writing the vb program as a dll and how to do it in AutoLisp but not as a stand alone vb program. Any help would be appreciated. Thank you.&lt;/P&gt;</description>
    <pubDate>Thu, 29 May 2014 11:59:18 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2014-05-29T11:59:18Z</dc:date>
    <item>
      <title>How to insert an entity from another drawing using vb.net in stand-alone program</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-insert-an-entity-from-another-drawing-using-vb-net-in/m-p/5063034#M43806</link>
      <description>&lt;P&gt;Hello, I'm wondering how to get a point from the user to insert an entity into a drawing from another drawing using vb.net in a stand-alone program. I'm having to write this as a stand alone program because this is only a small portion of my overall program and I'm interfacing with 3 other softwares besides Autocad. I know how to do this when writing the vb program as a dll and how to do it in AutoLisp but not as a stand alone vb program. Any help would be appreciated. Thank you.&lt;/P&gt;</description>
      <pubDate>Thu, 29 May 2014 11:59:18 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-insert-an-entity-from-another-drawing-using-vb-net-in/m-p/5063034#M43806</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-05-29T11:59:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to insert an entity from another drawing using vb.net in stand-alone pro</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-insert-an-entity-from-another-drawing-using-vb-net-in/m-p/5064220#M43807</link>
      <description>&lt;P&gt;You need to prompt the user for a point:&lt;BR /&gt;Dim insertionPnt = AcadDoc.Utility.GetPoint(, "Enter a point: ")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then get block ref into your drawing:&lt;BR /&gt;Dim AcadApp As AcadApplication = CType(GetObject(, "AutoCAD.Application.?"), AcadApplication)&lt;/P&gt;&lt;P&gt;Dim TargetDoc As AcadDocument = AcadApp.ActiveDocument&lt;BR /&gt;Dim DbxDoc As Object = AcadApp.GetInterfaceObject("ObjectDBX.AxDbDocument.?")&lt;BR /&gt;DbxDoc.Open("the_Source_FileName")&lt;BR /&gt;Dim Objects(0) As Common.AcadBlock&lt;BR /&gt;For Each entry As Common.AcadBlock In CType(DbxDoc.Blocks, IEnumerable)&lt;BR /&gt;If (Not entry.IsLayout) AndAlso (Not entry.Name.StartsWith("*")) Then&lt;BR /&gt;Objects(0) = entry&lt;BR /&gt;DbxDoc.CopyObjects(CObj(Objects), TargetDoc.Blocks)&lt;BR /&gt;End If&lt;BR /&gt;Next entry&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then insert block into drawing at the prompted point:&lt;BR /&gt;AcadDoc.ModelSpace.InsertBlock(insertionPnt, "SomeBlock", 1#, 1#, 1#, 0)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I haven't done this in a while but I think this is all thats needed.&amp;nbsp; Maybe somebody can give you more complete code to use but if you play around with this a bit you should be able to figure it out.&amp;nbsp; Then again, I could be way off base &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 29 May 2014 20:34:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-insert-an-entity-from-another-drawing-using-vb-net-in/m-p/5064220#M43807</guid>
      <dc:creator>Mikko</dc:creator>
      <dc:date>2014-05-29T20:34:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to insert an entity from another drawing using vb.net in stand-alone pro</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-insert-an-entity-from-another-drawing-using-vb-net-in/m-p/5064352#M43808</link>
      <description>&lt;P&gt;That worked great! Here is what worked for me:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Dim acadapp As Autodesk.AutoCAD.Interop.AcadApplication = Nothing
        Dim acadDoc As Autodesk.AutoCAD.Interop.AcadDocument = Nothing

        Try
            acadapp = CType(GetObject(, "AutoCAD.Application"), Autodesk.AutoCAD.Interop.AcadApplication)
            acadDoc = CType(acadapp.ActiveDocument, Autodesk.AutoCAD.Interop.AcadDocument)

            If acadapp IsNot Nothing And acadDoc IsNot Nothing Then

                Dim insertionPT = acadDoc.Utility.GetPoint(, "Pick Insertion Point Between Radii At Bottom Of Pocket:")

                Dim DbxDoc As Object = acadapp.GetInterfaceObject("ObjectDBX.AxDbDocument.19")
                DbxDoc.Open("C:\Path_To_Block_Drawing.dwg")

                Dim Objects(0) As AcadBlock
                For Each entry As AcadBlock In CType(DbxDoc.Blocks, IEnumerable)
                    If (Not entry.IsLayout) AndAlso (Not entry.Name.StartsWith("*")) Then
                        Objects(0) = entry
                        DbxDoc.CopyObjects(CObj(Objects), acadDoc.Blocks)
                    End If
                Next entry

                acadDoc.ModelSpace.InsertBlock(insertionPT, "NameOfBlock", 1.0#, 1.0#, 1.0#, 0)                
            End If

        Catch InsertBlockError As Exception
            Debug.WriteLine(InsertBlockError)
        End Try&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;Thank You Very Much! I was starting to write a bunch of small AutoLisp programs that I would start with:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;acadDoc.SendCommand("_startlispcommand ")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This will work much better for me and not require a bunch of AutoLisp program maintenence on our network. Thanks again!&lt;/P&gt;</description>
      <pubDate>Thu, 29 May 2014 21:22:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-insert-an-entity-from-another-drawing-using-vb-net-in/m-p/5064352#M43808</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-05-29T21:22:47Z</dc:date>
    </item>
  </channel>
</rss>

