View Full Version : Closing a non-current drawing
mr_nick
2009-07-17, 12:35 PM
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, my move over to 64bit 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. Installing VBA is a definite no-go for obvious reasons but I can't fathom any way of getting a non-current drawing to close without using one of the two methods I've outlined. Does anybody know of a third method or possibly a fix for the vlisp method?
ccowgill
2009-07-17, 01:08 PM
first off I should ask, does this glitch still exist?
mr_nick
2009-07-17, 03:27 PM
first off I should ask, does this glitch still exist?
Well, I'm running ACA2010 64bit and it's very much still in there - hence me needing to find a way around it. I first encountered it on ABS2005 so it been in there for many years.
RobertB
2009-07-17, 10:31 PM
I did this in MEP 2010 (32-bit):
Command: (vl-load-com)
Command: (setq myDocs (vla-Get-Documents (vlax-get-acad-object)))
#<VLA-OBJECT IAcadDocuments 1f7d5200>
Command: (setq myDoc (vla-Item myDocs "Drawing1.dwg"))
#<VLA-OBJECT IAcadDocument 1393d988>
Command: (vla-Close myDoc :vlax-False)
nil
Command: (command "line" "0,0" "1,1" "")
line Specify first point: 0,0
Specify next point or [Undo]: 1,1
Specify next point or [Undo]:
Command: nil
No errors.
From your post I'm gathering that there seems to be an issue with the ARX related to reflected ceiling plans (?).
mr_nick
2009-07-18, 04:38 AM
No errors.
From your post I'm gathering that there seems to be an issue with the ARX related to reflected ceiling plans (?).
Now that is frustrating. We have just done this on ACA 2008, 2009 and 2010 32bit and also 2010 64bit and each machine has come back with the same error. We don't have access to any other platforms to test it on but I'm now wondering if it is ACA specific.
mr_nick
2009-07-18, 05:19 AM
... but I'm now wondering if it is ACA specific.
To test out this theory, I just loaded ACA using a raw AutoCAD profile and sure enough, no error this time. As soon as I load the ACA profile it all goes belly-up. Looks like I need to do some fudging to get around this - at least there is a light at the end of the tunnel now!
mr_nick
2009-07-19, 09:07 AM
I did this in MEP 2010 (32-bit):
.....
No errors.
I just tried this on MEP2010 64bit and still got the same error - did you try it with the full MEP profile loaded or was it in the AutoCAD profile?
RobertB
2009-07-21, 11:11 PM
The full MEP profile.
mr_nick
2009-07-23, 09:15 AM
The full MEP profile.
Now I'm really puzzled because I just got someone in one of our other offices to try this on his MEP(32bit) and he gets the exact same error as we are seeing on all our ACA machines.
RobertB
2009-07-23, 03:57 PM
I think the clue is in the error message. It looks like you are loading an ARX that provides some LISP wrappers for functions. I'm sure that is the culprit and the difference between us. Have you tried ths in an OOTB profile, one that doesn't load any customizations?
mr_nick
2009-07-23, 04:13 PM
I have run ACA with all customisations removed and no joy. I then got the MEP from our subscription page and installed that in trial mode as a completely standard install accepting all defaults and still the same error. The only way I can get the error not to happen is to load either ACA or MEP with the AutoCAD profile and then I can use the code. It should be noted that switching from ACA to AutoCAD profile is no good as all the ACA stuff has already loaded at that point. The problem with this is that it's not feasible for me to use the AutoCAD profile and also I find that when activating certain commands thena number of the AEC arx files load up anyway and as soon as they do - BANG, it all goes belly-up. So, yes I would agree that it is linked to an arx that is being loaded up but it's not anything from a custom install viewpoint - it is something that ships as part if ACA (and MEP as it's a vertical product). The next avenue I need to explore is whether this is because I'm using the UK profile rather than the US that I'm guessing you're using - there are possibly a different set of arx's used by the different setups.
Also, can I draw your attention to this post on the Autodesk forum where I made my initial enquiry about this problem back in 2006 - a post to which you (Robert) replied and appeared to be able to replicate the problem:
http://discussion.autodesk.com/forums/thread.jspa?threadID=521128
RobertB
2009-07-23, 11:12 PM
And now I've got it cropping back up again. Opening more than just two drawings and trying a couple of times started triggering it.
So it is still a bug.
vBulletin® v3.6.7, Copyright ©2000-2010, Jelsoft Enterprises Ltd.