<?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: AutoCAD &amp;quot;hangs&amp;quot; when opening file.... in VBA Forum</title>
    <link>https://forums.autodesk.com/t5/vba-forum/autocad-quot-hangs-quot-when-opening-file/m-p/329992#M90559</link>
    <description>Hi Trond,&lt;BR /&gt;
    (command "-VBARUN" "bkk.dvb!ThisDrawing.init") ?&lt;BR /&gt;
Sendcommand fires at the end of the macro, it doesn't necessarily wait for your&lt;BR /&gt;
lisp routine to finish. A couple of possible options, Try rearranging your code&lt;BR /&gt;
so that the "IDAOpen" macro will run at the end if called (even after changing&lt;BR /&gt;
back cmdecho to it's previous setting) or try using an open dialogue and opening&lt;BR /&gt;
the file with the open method instead of trying to initiate the open command&lt;BR /&gt;
with sendcommand.&lt;BR /&gt;
-Josh&lt;BR /&gt;
&lt;BR /&gt;
Trond Hasse Lie wrote:&lt;BR /&gt;
&lt;BR /&gt;
&amp;gt; Hi everyone.&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; I have an acad.lsp file that looks like this:&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; (defun S::STARTUP()&lt;BR /&gt;
&amp;gt;  (setvar "ACADLSPASDOC" 1)&lt;BR /&gt;
&amp;gt;  (setq cmdechostate(getvar "cmdecho"))&lt;BR /&gt;
&amp;gt;  (setvar "CMDECHO" 0)&lt;BR /&gt;
&amp;gt;  (command "undefine" "open")&lt;BR /&gt;
&amp;gt;  (defun C:open()&lt;BR /&gt;
&amp;gt;   (command "-vbarun" "bkk.dvb!IDAOpen")(princ)&lt;BR /&gt;
&amp;gt;  )&lt;BR /&gt;
&amp;gt;  (command "-VBARUN" "bkk.dvb!ThisDrawing.init")&lt;BR /&gt;
&amp;gt;  (setvar "cmdecho" cmdechostate)&lt;BR /&gt;
&amp;gt; )&lt;BR /&gt;
&amp;gt; (princ "\nIDA is initialized.\n")&lt;BR /&gt;
&amp;gt; (princ)&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; And I have a BKK.DVB with a module1 with this in it:&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; Option Explicit&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; Public Sub IDAOpen()&lt;BR /&gt;
&amp;gt;     If MsgBox("Open from IDA ?", vbQuestion + vbYesNo, "IDAOpen?") = vbNo&lt;BR /&gt;
&amp;gt; Then&lt;BR /&gt;
&amp;gt;         ThisDrawing.SendCommand ".open" &amp;amp; vbCr&lt;BR /&gt;
&amp;gt;     Else&lt;BR /&gt;
&amp;gt;         MsgBox "Here I open from IDA!"&lt;BR /&gt;
&amp;gt;     End If&lt;BR /&gt;
&amp;gt; End Sub&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; SO..... When I press OPEN, I get a messagebox, asking if I want to open a&lt;BR /&gt;
&amp;gt; drawing from the IDA archive... If I say yes, a new macro will be run.  If I&lt;BR /&gt;
&amp;gt; press NO, the OPEN drawing dialog is shown. If I press CANCEL in this&lt;BR /&gt;
&amp;gt; dialog, everything is fine. If I press OPEN (to open a selected drawing),&lt;BR /&gt;
&amp;gt; the drawing opens, but AutoCAD just "dies".... I can access menus, buttons&lt;BR /&gt;
&amp;gt; on toolbars etc. but nothing works.... If I try to close AutoCAD, I get a&lt;BR /&gt;
&amp;gt; message saying that "A command is active so I can't close the window&lt;BR /&gt;
&amp;gt; etc....".&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; Anyone knows of a solution?&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; Trond Hasse Lie&lt;BR /&gt;
&amp;gt; Nestor&lt;BR /&gt;
&amp;gt; Norway</description>
    <pubDate>Thu, 07 Sep 2000 14:48:13 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2000-09-07T14:48:13Z</dc:date>
    <item>
      <title>AutoCAD "hangs" when opening file....</title>
      <link>https://forums.autodesk.com/t5/vba-forum/autocad-quot-hangs-quot-when-opening-file/m-p/329991#M90558</link>
      <description>Hi everyone.&lt;BR /&gt;
&lt;BR /&gt;
I have an acad.lsp file that looks like this:&lt;BR /&gt;
&lt;BR /&gt;
(defun S::STARTUP()&lt;BR /&gt;
 (setvar "ACADLSPASDOC" 1)&lt;BR /&gt;
 (setq cmdechostate(getvar "cmdecho"))&lt;BR /&gt;
 (setvar "CMDECHO" 0)&lt;BR /&gt;
 (command "undefine" "open")&lt;BR /&gt;
 (defun C:open()&lt;BR /&gt;
  (command "-vbarun" "bkk.dvb!IDAOpen")(princ)&lt;BR /&gt;
 )&lt;BR /&gt;
 (command "-VBARUN" "bkk.dvb!ThisDrawing.init")&lt;BR /&gt;
 (setvar "cmdecho" cmdechostate)&lt;BR /&gt;
)&lt;BR /&gt;
(princ "\nIDA is initialized.\n")&lt;BR /&gt;
(princ)&lt;BR /&gt;
&lt;BR /&gt;
And I have a BKK.DVB with a module1 with this in it:&lt;BR /&gt;
&lt;BR /&gt;
Option Explicit&lt;BR /&gt;
&lt;BR /&gt;
Public Sub IDAOpen()&lt;BR /&gt;
    If MsgBox("Open from IDA ?", vbQuestion + vbYesNo, "IDAOpen?") = vbNo&lt;BR /&gt;
Then&lt;BR /&gt;
        ThisDrawing.SendCommand ".open" &amp;amp; vbCr&lt;BR /&gt;
    Else&lt;BR /&gt;
        MsgBox "Here I open from IDA!"&lt;BR /&gt;
    End If&lt;BR /&gt;
End Sub&lt;BR /&gt;
&lt;BR /&gt;
SO..... When I press OPEN, I get a messagebox, asking if I want to open a&lt;BR /&gt;
drawing from the IDA archive... If I say yes, a new macro will be run.  If I&lt;BR /&gt;
press NO, the OPEN drawing dialog is shown. If I press CANCEL in this&lt;BR /&gt;
dialog, everything is fine. If I press OPEN (to open a selected drawing),&lt;BR /&gt;
the drawing opens, but AutoCAD just "dies".... I can access menus, buttons&lt;BR /&gt;
on toolbars etc. but nothing works.... If I try to close AutoCAD, I get a&lt;BR /&gt;
message saying that "A command is active so I can't close the window&lt;BR /&gt;
etc....".&lt;BR /&gt;
&lt;BR /&gt;
Anyone knows of a solution?&lt;BR /&gt;
&lt;BR /&gt;
Trond Hasse Lie&lt;BR /&gt;
Nestor&lt;BR /&gt;
Norway</description>
      <pubDate>Thu, 07 Sep 2000 10:38:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/autocad-quot-hangs-quot-when-opening-file/m-p/329991#M90558</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2000-09-07T10:38:39Z</dc:date>
    </item>
    <item>
      <title>Re: AutoCAD "hangs" when opening file....</title>
      <link>https://forums.autodesk.com/t5/vba-forum/autocad-quot-hangs-quot-when-opening-file/m-p/329992#M90559</link>
      <description>Hi Trond,&lt;BR /&gt;
    (command "-VBARUN" "bkk.dvb!ThisDrawing.init") ?&lt;BR /&gt;
Sendcommand fires at the end of the macro, it doesn't necessarily wait for your&lt;BR /&gt;
lisp routine to finish. A couple of possible options, Try rearranging your code&lt;BR /&gt;
so that the "IDAOpen" macro will run at the end if called (even after changing&lt;BR /&gt;
back cmdecho to it's previous setting) or try using an open dialogue and opening&lt;BR /&gt;
the file with the open method instead of trying to initiate the open command&lt;BR /&gt;
with sendcommand.&lt;BR /&gt;
-Josh&lt;BR /&gt;
&lt;BR /&gt;
Trond Hasse Lie wrote:&lt;BR /&gt;
&lt;BR /&gt;
&amp;gt; Hi everyone.&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; I have an acad.lsp file that looks like this:&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; (defun S::STARTUP()&lt;BR /&gt;
&amp;gt;  (setvar "ACADLSPASDOC" 1)&lt;BR /&gt;
&amp;gt;  (setq cmdechostate(getvar "cmdecho"))&lt;BR /&gt;
&amp;gt;  (setvar "CMDECHO" 0)&lt;BR /&gt;
&amp;gt;  (command "undefine" "open")&lt;BR /&gt;
&amp;gt;  (defun C:open()&lt;BR /&gt;
&amp;gt;   (command "-vbarun" "bkk.dvb!IDAOpen")(princ)&lt;BR /&gt;
&amp;gt;  )&lt;BR /&gt;
&amp;gt;  (command "-VBARUN" "bkk.dvb!ThisDrawing.init")&lt;BR /&gt;
&amp;gt;  (setvar "cmdecho" cmdechostate)&lt;BR /&gt;
&amp;gt; )&lt;BR /&gt;
&amp;gt; (princ "\nIDA is initialized.\n")&lt;BR /&gt;
&amp;gt; (princ)&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; And I have a BKK.DVB with a module1 with this in it:&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; Option Explicit&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; Public Sub IDAOpen()&lt;BR /&gt;
&amp;gt;     If MsgBox("Open from IDA ?", vbQuestion + vbYesNo, "IDAOpen?") = vbNo&lt;BR /&gt;
&amp;gt; Then&lt;BR /&gt;
&amp;gt;         ThisDrawing.SendCommand ".open" &amp;amp; vbCr&lt;BR /&gt;
&amp;gt;     Else&lt;BR /&gt;
&amp;gt;         MsgBox "Here I open from IDA!"&lt;BR /&gt;
&amp;gt;     End If&lt;BR /&gt;
&amp;gt; End Sub&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; SO..... When I press OPEN, I get a messagebox, asking if I want to open a&lt;BR /&gt;
&amp;gt; drawing from the IDA archive... If I say yes, a new macro will be run.  If I&lt;BR /&gt;
&amp;gt; press NO, the OPEN drawing dialog is shown. If I press CANCEL in this&lt;BR /&gt;
&amp;gt; dialog, everything is fine. If I press OPEN (to open a selected drawing),&lt;BR /&gt;
&amp;gt; the drawing opens, but AutoCAD just "dies".... I can access menus, buttons&lt;BR /&gt;
&amp;gt; on toolbars etc. but nothing works.... If I try to close AutoCAD, I get a&lt;BR /&gt;
&amp;gt; message saying that "A command is active so I can't close the window&lt;BR /&gt;
&amp;gt; etc....".&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; Anyone knows of a solution?&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; Trond Hasse Lie&lt;BR /&gt;
&amp;gt; Nestor&lt;BR /&gt;
&amp;gt; Norway</description>
      <pubDate>Thu, 07 Sep 2000 14:48:13 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/autocad-quot-hangs-quot-when-opening-file/m-p/329992#M90559</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2000-09-07T14:48:13Z</dc:date>
    </item>
    <item>
      <title>Re:</title>
      <link>https://forums.autodesk.com/t5/vba-forum/autocad-quot-hangs-quot-when-opening-file/m-p/329993#M90560</link>
      <description>Hi Trond&lt;BR /&gt;
I also have a LSP routine which loads and fires off a VBARUN... command with each file open. I have discovered that if there is an untitled, unsaved blank drawing (e.g Drawing1.dwg)active when I open another drawing, Acad2k will hang like you described. However, we're not trying to open a file using DVB like you are so it's easy for us to simply close the blank unnamed drawing before opening an existing file. Maybe you can add a line in the bkk.dvb to check to see if one or more of the current drawings opened are unsaved of the Drawing*.dwg name and close them before using the SendCommand ".open" command.</description>
      <pubDate>Wed, 08 Nov 2000 17:19:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/autocad-quot-hangs-quot-when-opening-file/m-p/329993#M90560</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2000-11-08T17:19:25Z</dc:date>
    </item>
  </channel>
</rss>

