<?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 send a command from a vb.net form to AutoCAD? in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/how-to-send-a-command-from-a-vb-net-form-to-autocad/m-p/3607392#M53434</link>
    <description>&lt;P&gt;I don’t often used VB.net but I would like to know how I can create a form with a button that will send a command to AutoCAD. I’ve goggled but get nothing near enough to what I find understandable.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could anybody assist in this?&lt;/P&gt;</description>
    <pubDate>Wed, 05 Sep 2012 07:16:51 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2012-09-05T07:16:51Z</dc:date>
    <item>
      <title>how to send a command from a vb.net form to AutoCAD?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-send-a-command-from-a-vb-net-form-to-autocad/m-p/3607392#M53434</link>
      <description>&lt;P&gt;I don’t often used VB.net but I would like to know how I can create a form with a button that will send a command to AutoCAD. I’ve goggled but get nothing near enough to what I find understandable.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could anybody assist in this?&lt;/P&gt;</description>
      <pubDate>Wed, 05 Sep 2012 07:16:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-send-a-command-from-a-vb-net-form-to-autocad/m-p/3607392#M53434</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-09-05T07:16:51Z</dc:date>
    </item>
    <item>
      <title>Re: how to send a command from a vb.net form to AutoCAD?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-send-a-command-from-a-vb-net-form-to-autocad/m-p/3607464#M53435</link>
      <description>&lt;P&gt;Not clearly enough for me&lt;/P&gt;&lt;P&gt;Do you want to create stand alone&lt;/P&gt;&lt;P&gt;project using .exe application&amp;nbsp;or&lt;/P&gt;&lt;P&gt;you want to create managed API call?&lt;/P&gt;&lt;P&gt;And also, what the language you're prefering?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="arial,helvetica,sans-serif"&gt;~'J'~&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Sep 2012 08:26:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-send-a-command-from-a-vb-net-form-to-autocad/m-p/3607464#M53435</guid>
      <dc:creator>Hallex</dc:creator>
      <dc:date>2012-09-05T08:26:24Z</dc:date>
    </item>
    <item>
      <title>Re: how to send a command from a vb.net form to AutoCAD?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-send-a-command-from-a-vb-net-form-to-autocad/m-p/3607474#M53436</link>
      <description>&lt;P&gt;What I would like is to make an exe which sends a comand to autocad. I'm not all to concerned about automatically starting autocad or any of that as the exe would be called up ussing a lisp function/ command hens AutoCAD is already running otherewise you couldnt just run the exe.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Im ussing vb.net to create an application, think thats clear enougth...&lt;/P&gt;</description>
      <pubDate>Wed, 05 Sep 2012 08:42:54 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-send-a-command-from-a-vb-net-form-to-autocad/m-p/3607474#M53436</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-09-05T08:42:54Z</dc:date>
    </item>
    <item>
      <title>Re: how to send a command from a vb.net form to AutoCAD?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-send-a-command-from-a-vb-net-form-to-autocad/m-p/3607536#M53437</link>
      <description>&lt;P&gt;Okay lets put this simple wher can I get the very basics of vb.net in relation to AutoCAD. Is it even possible to Build a form with a button as a trigger in VB.net express&amp;nbsp;which is responsible for sending a command to AutoCAD, which triggers my lisp?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(the problem is theres no simple basic introduction online, it all just seams to jump in somewhere)&lt;/P&gt;</description>
      <pubDate>Wed, 05 Sep 2012 09:21:53 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-send-a-command-from-a-vb-net-form-to-autocad/m-p/3607536#M53437</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-09-05T09:21:53Z</dc:date>
    </item>
    <item>
      <title>Re: how to send a command from a vb.net form to AutoCAD?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-send-a-command-from-a-vb-net-form-to-autocad/m-p/3607576#M53438</link>
      <description>&lt;P&gt;I will be back in a 2-3 hours back,&lt;/P&gt;&lt;P&gt;Wait, please, if somebody else could not&lt;/P&gt;&lt;P&gt;add an example you need,&lt;/P&gt;&lt;P&gt;Cheers &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="arial,helvetica,sans-serif"&gt;~'J'~&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Sep 2012 10:22:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-send-a-command-from-a-vb-net-form-to-autocad/m-p/3607576#M53438</guid>
      <dc:creator>Hallex</dc:creator>
      <dc:date>2012-09-05T10:22:44Z</dc:date>
    </item>
    <item>
      <title>Re: how to send a command from a vb.net form to AutoCAD?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-send-a-command-from-a-vb-net-form-to-autocad/m-p/3607860#M53439</link>
      <description>&lt;P&gt;Okay from what I get is that I have to create a class1.vb and attach a user form by adding a usser controll from eher on im lost&lt;/P&gt;</description>
      <pubDate>Wed, 05 Sep 2012 13:24:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-send-a-command-from-a-vb-net-form-to-autocad/m-p/3607860#M53439</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-09-05T13:24:11Z</dc:date>
    </item>
    <item>
      <title>Re: how to send a command from a vb.net form to AutoCAD?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-send-a-command-from-a-vb-net-form-to-autocad/m-p/3607976#M53440</link>
      <description>&lt;P&gt;create Windows Forms Application, name it "LoadLisp" or something else,&lt;/P&gt;&lt;P&gt;drop Button1 on form and add caption on the button, say "Load my lisp" add references to:&lt;/P&gt;&lt;P&gt;&amp;nbsp;AutoCAD xxxx Type Library&lt;/P&gt;&lt;P&gt;AutoCAD ObjectDBX/Common xx.x Type Library&lt;/P&gt;&lt;P&gt;Add following code on form module, click Build solution&lt;/P&gt;&lt;P&gt;Then go to folder ///...bin/Debug select application and load&lt;/P&gt;&lt;P&gt;its &amp;nbsp;icon on windows screen, then try it&lt;/P&gt;&lt;P&gt;(change lisp file name in command within the code before)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;'______________________________________'
Imports System.Reflection

Imports Autodesk.AutoCAD.Interop
Imports Autodesk.AutoCAD.Interop.Common

Public Class Form1

    Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
        Me.Hide()
        LoadLisp()
        Me.Show()
    End Sub
    Public Sub LoadLisp()
        Dim appver As Object = TryCast(My.Computer.Registry.GetValue("HKEY_CURRENT_USER\Software\Autodesk\AutoCAD", "CurVer", Nothing), Object)
        If appver Is Nothing Then
            MessageBox.Show("Out of luck, sorry, you get a problem to read Registry", "Bad for you")
            Return
        End If
        Dim oAcadApp As AcadApplication = New AcadApplication

        Try
            If oAcadApp Is Nothing Then
                oAcadApp = GetObject(, "AutoCAD.Application" + appver.ToString())
            End If
        Catch ex As System.Exception
            MessageBox.Show("Working in opened document only!")
            Return
        End Try
        oAcadApp.Visible = True
        oAcadApp.WindowState = AcWindowState.acMax
        Dim oAcDoc = oAcadApp.ActiveDocument
        '' lisp with command C:SPLASH is loaded from disk C:\Test\Splash.lsp
        ''------------------------------------------------------''
        '' Change both lines of next code block to suit:
        Dim command As String = "(load ""C:/Test/Splash.lsp"")"
        oAcDoc.SendCommand(command &amp;amp; "(C:SPLASH) ")
        ''------------------------------------------------------''
    End Sub


End Class  


''___________________________________________________''&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;I can't help you other then that, coz I have very limited&lt;/P&gt;&lt;P&gt;&amp;nbsp;skills with work from forms&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="arial,helvetica,sans-serif"&gt;~'J'~&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Sep 2012 14:25:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-send-a-command-from-a-vb-net-form-to-autocad/m-p/3607976#M53440</guid>
      <dc:creator>Hallex</dc:creator>
      <dc:date>2012-09-05T14:25:51Z</dc:date>
    </item>
    <item>
      <title>Re: how to send a command from a vb.net form to AutoCAD?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-send-a-command-from-a-vb-net-form-to-autocad/m-p/3608680#M53441</link>
      <description>&lt;P&gt;There can't be a "simple" introduction, as there is no such thing.&amp;nbsp; Even forms require a fair understanding of a number of programming concepts.&amp;nbsp; Where you're at is the creation of an application, which involves tying together&amp;nbsp;those various&amp;nbsp;programming and IDE concepts into a working product.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;dotNET is certainly *not* plug-and-play.&lt;/P&gt;</description>
      <pubDate>Wed, 05 Sep 2012 20:34:53 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-send-a-command-from-a-vb-net-form-to-autocad/m-p/3608680#M53441</guid>
      <dc:creator>dgorsman</dc:creator>
      <dc:date>2012-09-05T20:34:53Z</dc:date>
    </item>
    <item>
      <title>Re: how to send a command from a vb.net form to AutoCAD?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-send-a-command-from-a-vb-net-form-to-autocad/m-p/3609158#M53442</link>
      <description>&lt;P&gt;&lt;FONT size="2"&gt;&lt;FONT face="Century Gothic"&gt;&lt;FONT color="#000000"&gt;Well VBA seemed a lot simpler I would only need the following code.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&lt;FONT face="Century Gothic"&gt;&lt;FONT color="#000000"&gt;&lt;FONT color="#000000"&gt;Don’t even know where to start replicating this in vb.net?&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Private Sub CommandButton1_Click()

ThisDrawing.SendCommand ("(c:MYcustomLISPcommand)" &amp;amp; vbCr)

Unload UserForm1

End Sub

&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&lt;FONT face="Century Gothic"&gt;&lt;FONT color="#000000"&gt;&lt;FONT color="#000000"&gt;How can I do this in vb.net (my apologies I wasn’t thinking it doesn’t need to be in form of an exe it may also be in form of a DLL file)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Sep 2012 08:52:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-send-a-command-from-a-vb-net-form-to-autocad/m-p/3609158#M53442</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-09-06T08:52:44Z</dc:date>
    </item>
    <item>
      <title>Re: how to send a command from a vb.net form to AutoCAD?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-send-a-command-from-a-vb-net-form-to-autocad/m-p/3610236#M53443</link>
      <description>&lt;P&gt;you need to get started by reaing the Autocad VB.net developers guide&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="http://docs.autodesk.com/ACD/2010/ENU/AutoCAD%20.NET%20Developer%27s%20Guide/index.html" target="_blank"&gt;http://docs.autodesk.com/ACD/2010/ENU/AutoCAD%20.NET%20Developer%27s%20Guide/index.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;First you need to install MicroSoft Visual Studio VB.net (Express version is free)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then add references&amp;nbsp;to the required AutoCad files which allow Visual Studio VB to access the Autocad .net libraries. Configure Visual Studio for the right version of .NET depending on your version of AutCAD.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Create a userform and code, then compile to a DLL which is loaded into AutoCAD using "NETLOAD" AutoCAD command.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hallex described the details to help you after&amp;nbsp;you do the other things first.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Sep 2012 22:08:23 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-send-a-command-from-a-vb-net-form-to-autocad/m-p/3610236#M53443</guid>
      <dc:creator>fxcastil</dc:creator>
      <dc:date>2012-09-06T22:08:23Z</dc:date>
    </item>
  </channel>
</rss>

