TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: hmspe on October 09, 2010, 10:17:28 AM
-
I posted in the Autocad discussion groups but I think I might have a better chance of getting a meaningful reply here.
I change OSMODE frequently using macros from toolbars and lisp from Owen Wengerd's AcadStatButton. The functions are similar to [ '_setvar;osmode 1;'_redraw ] on the toolbars or to [ (setvar "OSMODE" (boole 6 (getvar "OSMODE") 16384)) ] in AcadStatButton. I've used the exact same functions in 2010 and previous versions with no problems, and I use the same macros in Bricscad with no problems. In A2011 after an hour or so changes to OSMODE start to fail. There is notification of an error in a subroutine. After the failure mode starts no method of changing OSMODE seems to work, including the shift+right click pop-up. Closing Autocad and reopening is the only solution I've found. I'm running Win-7, 64 bit, and I have the 1.1 service pack installed. I run in SDI mode.
This seems to happen randomly. It seems to come up after an hour or so in a drawing, but some days I don't see it at all. Has anyone else seen anything like this? any suggestions?
Thanks
-
I'm a cad-manager for about 30 users and I have one user with the same problem, exept he is running AutoCAD 2010 on a Windows XP machine.
If you ever find a solution, please let me know.
- Jaco Romkes -
-
I have had this problem when running in SDI mode (I have one routine that must run in SDI mode and all sorts of problems occur if I forget to change it, including this one).
Also, I have seen blogs from AutoDesk talking about removing SDI mode in future versions, so it might be good practice to get out of the habit of using SDI Mode, just a thought.
-
It could be as simple as SDI, but I suspect it has to be something else -- 2010 on the same computer never did this, and I doubt that SDI has changed much. This looks a lot more like a memory corruption issue or a memory leak.
I don't have to run SDI, but I've found it a lot better for the way I work. I'm a PE and I get lots of calls on jobs other than what I'm currently working on. After checking drawings for those calls I tend to hit the wrong "close" button in the upper right. After losing work several times I decided SDI was a better approach for me. I could always write wrappers for open, close, etc., to emulate SDI, but I'd rather avoid that if I can.
Today, no problems. Could be that I didn't stay in one drawing long enough for the problem to appear. I'll post whatever details I can gather the next time it happens.
-
Here's the command window log for a crash from this morning:
----------------------------------------------------------------------
Command: _.copym
Select objects: Specify opposite corner: 14 found
Select objects: Specify opposite corner: 9 found, 23 total
Select objects:
Base point: '_setvar
>>Enter variable name or [?] <OSMODE>: osmode
>>Enter new value for OSMODE <16385>: 32
"a"
bad argument type: stringp #<SUBR @000000002be26570 UTILITY>; error: An error
has occurred inside the *error* functionFunction cancelled
Resuming COPYM command.
Base point: '_redraw
Resuming COPYM command.
Base point:
---------------------------------------------------------
Autocad hung and I had to ESC out. The program was locked for 20 to 30 seconds before it would respond to ESC. The "a" would be an artifact from one of the lisp routines I run -- I tend to place markers that show execution progress when I'm testing code and sometimes I miss a few. It may be in the routine that redraws the buttons on AcadStatButton. I've added a few more flags to that routine and will post after the next crash.
Thinking back I believe that crashes like this have been when changing OSMODE in the middle of a copy or copym command. The copym command is from a toolbar and runs ^C^C_.copym
-
This is an express tools command and it appears that you have used express tools with previous versions of AutoCAD, as this command isn't even on the Ribbon anymore. I would recommend checking that the express tools that are being load are the ones that come with AutoCAD 2011 and not an older version. I do know that most of the express tools were updated with 2011 because they were causing crashes and other errors. Copym still works, but you may want to make sure that it is latest version that is being loaded.
It should be calling the commands from:
C:\Program Files\Autodesk\AutoCAD 2011\Express
-
I added a few more progress flags to my start-up lisp and ran until I hit the error. Here is a command line log:
-----------------------------------------------------------------
Command: _.copy
Select objects: *Cancel*
Command:
Command: _.copym
Select objects: Specify opposite corner: 1 found
Select objects:
Base point: '_setvar
>>Enter variable name or [?] <OSMODE>: osmode
>>Enter new value for OSMODE <0>: 32
"set_buttons in"
bad argument type: stringp #<SUBR @000000002e779958 UTILITY>; error: An error
has occurred inside the *error* functionFunction cancelled
Resuming COPYM command.
Base point: '_redraw
Resuming COPYM command.
---------------------------------------------------------------------
The "set_buttons in" is from the lisp
;; defun a lisp call back function
(defun monitorSysVar (rObject vName) ; vName is the list returned by the reactor
; First parameter is a string identifying the system variable name.
; Second parameter is symbol indicating whether or not the change
; was successful (T if successful, nil if not).
(if (or (= (car vName) "OSMODE")
(= (car vName) "USERI5")
(= (car vName) "ORTHOMODE")
)
(progn
(print "set_buttons in")
(set_buttons)
(print "set_buttons out")
)
)
)
The first few lines of the set_buttons function are
(defun set_buttons ()
(if (= (getvar "ORTHOMODE") 1)
(vlax-put-property
(vl-bb-ref '*SBB:Button_ORTHO)
'Pressed
:vlax-true
)
(vlax-put-property
(vl-bb-ref '*SBB:Button_ORTHO)
'Pressed
:vlax-false
)
)
(setq aa (getvar "OSMODE"))
...
So, the reactor is firing, but the system fails on the call to the set_buttons function. In looking at the set_buttons code I noticed that local variable 'aa' was undeclared. I've fixed that, although I don't know if that will fix the crashes. If anyone sees anything else please let me know.
-
Maybe create a local error function that calls ' (vl-bt) '. That may help point out exactly where it is failing.
-
It should be calling the commands from:
C:\Program Files\Autodesk\AutoCAD 2011\Express
Thanks. I did check and the call is to the correct file. Also, I did a quick check on the copym.lsp file in 2011 and 2010 and TextPad reports the files are identical. Both have a 1999 copyright date.
-
Maybe create a local error function that calls ' (vl-bt) '. That may help point out exactly where it is failing.
Thanks. If declaring the local variable doesn't help I'll do that.