Author Topic: close a drawing that is not current  (Read 4225 times)

0 Members and 1 Guest are viewing this topic.

mr_nick

  • Guest
Re: close a drawing that is not current
« Reply #15 on: July 15, 2009, 03:20:57 AM »
I'm going to revive this topic because it's exactly the process I want to carry out but it has caused me grief for many years and I'm now stuck as to how to get past my problem.

I approached this task a few years back using Vlisp but found that there was a flaw which caused the vlisp system to shutdown and stop all further commands running until AutoCAD was restarted. I then used a VBA command to overcome this glitch and it's been working just fine for the last few years. Now with the advent of 2010 and the demise of VBA, I now need to find a replacement for the VBA command:

(command "VBASTMT" (strcat "AutoCAD.Application.Documents.Item(\"temp.dwg\").Close") )

In order to demonstrate the problem I have when using the Vlisp approach, following these steps creates the error each and every time I try it so presumably it will do the same for anybody wishing to have a nosey:

Open a new AutoCAD session so that you have 'Drawing1' open
Open a new drawing so you now have 'Drawing2' open.
Enter the following commands to close 'Drawing1':
(vl-load-com)
(setq docs (vla-get-documents (vlax-get-acad-object)))
(vla-close (vla-item docs "Drawing1.dwg") :vlax-false)


You should now just have 'Drawing2' left open. Now use the following command and see what happens:
(command "_.line" "0,0" "10,10" "")

In my case I get the following error and no further lisp or vlisp will run until I restart CAD:
AecRcpLispSupport::getArgIgnore() got null."

And that's where I'm now stuck. I have re-tried all the above code but continually get the aforementioned error. I'm currently running ACA2010 but I've had this problem on versions as far back as 2006 when I initially tried to get it working. Would I be correct in thinking that nobody else out there has experienced the same glitch?