View Full Version : 2009 startup is different
abuchan
2009-03-19, 02:13 PM
Hi, the following code, which is in acaddoc.lsp, works fine in AutoCAD 2006 and 2007, i.e. when I open a drawing which does contain that block, I'll get ".....DWG is Setup !!!" at the command line, and this works if the drawing opens in model space or paper space, however, in AutoCAD 2009, it fails if the drawing is opened in paper space. If I call (findit) it works, so it just fails at startup, has anyone else encountered this or have any suggestions as to how I can work round this?
(defun findit (/ ss)
(if (setq
ss (ssget "X"
'((0 . "INSERT") (410 . "MODEL") (2 . "esa_DWG_Data"))
)
)
(princ ".....DWG is Setup !!!")
(princ ".....DWG is Not Setup !!!")
)
)
(defun S::startup ()
(findit)
)
Acad 2006:
Opening an AutoCAD 2004 format file.
Regenerating model.
Loading Modeler DLLs.
AutoCAD Express Tools Copyright © 2002-2004 Autodesk, Inc.
AutoCAD menu utilities loaded......DWG is Setup !!!
Command: 'VLIDE
Acad 2009:
Regenerating layout.
Regenerating model.
AutoCAD Express Tools Copyright © 2002-2004 Autodesk, Inc.
AutoCAD menu utilities loaded......DWG is Not Setup !!!
Autodesk DWG. This file is a TrustedDWG last saved by an Autodesk application
or Autodesk licensed application.
Command: vlide
It seems that S::STARTUP is not the last thing which happens at startup in 2009...
rkmcswain
2009-03-19, 02:43 PM
It works fine here in 2009, with or without the use of S::STARTUP.
On another note, when posting code, it will be more readable if you will enclose it with CODE tags like this...
(defun findit (/ ss)
(if (setq
ss (ssget "X"....
....
....
Then it will look like this.
(defun findit (/ ss)
(if (setq
ss (ssget "X"....
....
....
abuchan
2009-03-19, 03:22 PM
Thanks for the format tip, and for looking into this, however, with nothing but the following code in accaddoc.lsp:
(defun findit (/ ss)
(if (setq
ss (ssget "X"
'((0 . "INSERT") (410 . "MODEL") (2 . "esa_DWG_Data"))
)
)
(princ "\n.....DWG is Setup !!!")
(princ "\n.....DWG is Not Setup !!!")
)
(princ)
)
(findit)
I still get this when I startup the drawing , (also shows what happens when I manually call (findit) once the drawing is open ) . Remember this is only when the drawing was saved, and hence opened, looking at paper space, and the block we are looking for is in model space.
> command line:
Opening an AutoCAD 2004/LT 2004 format file.
Regenerating layout.
Regenerating model.
AutoCAD Express Tools Copyright © 2002-2004 Autodesk, Inc.
AutoCAD menu utilities loaded.
.....DWG is Not Setup !!!
Autodesk DWG. This file is a TrustedDWG last saved by an Autodesk application
or Autodesk licensed application.
Command: (findit)
.....DWG is Setup !!!
Could we have different system variables?
ccowgill
2009-03-19, 04:15 PM
Hi, the following code, which is in acaddoc.lsp, works fine in AutoCAD 2006 and 2007, i.e. when I open a drawing which does contain that block, I'll get ".....DWG is Setup !!!" at the command line, and this works if the drawing opens in model space or paper space, however, in AutoCAD 2009, it fails if the drawing is opened in paper space. If I call (findit) it works, so it just fails at startup, has anyone else encountered this or have any suggestions as to how I can work round this?
(defun-q findit (/ ss)
(if (setq
ss (ssget "X"
'((0 . "INSERT") (410 . "MODEL") (2 . "esa_DWG_Data"))
)
)
(princ ".....DWG is Setup !!!")
(princ ".....DWG is Not Setup !!!")
)
)
(setq S::startup (append s::startup findit)
Acad 2006:
Opening an AutoCAD 2004 format file.
Regenerating model.
Loading Modeler DLLs.
AutoCAD Express Tools Copyright © 2002-2004 Autodesk, Inc.
AutoCAD menu utilities loaded......DWG is Setup !!!
Command: 'VLIDE
Acad 2009:
Regenerating layout.
Regenerating model.
AutoCAD Express Tools Copyright © 2002-2004 Autodesk, Inc.
AutoCAD menu utilities loaded......DWG is Not Setup !!!
Autodesk DWG. This file is a TrustedDWG last saved by an Autodesk application
or Autodesk licensed application.
Command: vlide
It seems that S::STARTUP is not the last thing which happens at startup in 2009...
try the changes in red, no guarantees.
abuchan
2009-03-19, 05:10 PM
Thanks for the suggestion, but I had tried that one too, still with the same result...
Its i
(defun-q findit (/ ss)
(if (setq
ss (ssget "X"
'((0 . "INSERT") (410 . "MODEL") (2 . "esa_DWG_Data"))
)
)
(princ "\n.....DWG is Setup !!!")
(princ "\n.....DWG is Not Setup !!!")
)
(princ)
)
(defun S::startup ()
(princ "\n.....S:Startup called")
)
(findit)
Acad 2006 command line:
Opening an AutoCAD 2004 format file.
Regenerating model.
Loading Modeler DLLs.
AutoCAD Express Tools Copyright © 2002-2004 Autodesk, Inc.
.....DWG is Setup !!!
AutoCAD menu utilities loaded.
.....S:Startup called
Acad2009 command line:
Opening an AutoCAD 2004/LT 2004 format file.
Regenerating layout.
Regenerating model.
AutoCAD Express Tools Copyright © 2002-2004 Autodesk, Inc.
AutoCAD menu utilities loaded.
.....DWG is Not Setup !!!
.....S:Startup called
Autodesk DWG. This file is a TrustedDWG last saved by an Autodesk application
or Autodesk licensed application.
It interesting to note that any direct statements in acaddoc.lsp are interpreted before s::startup is. This still doesn't help me, and embedding the call (finit) inside my own definition of s::startup doesn't do it either.
rkmcswain
2009-03-19, 05:15 PM
It interesting to note that any direct statements in acaddoc.lsp are interpreted before s::startup is.This is by design. S::Startup is executed last, after the drawing is initialized.
abuchan
2009-03-19, 05:43 PM
"This is by design. S::Startup is executed last, after the drawing is initialized."
Right enough, i knew that at the beginning, not sure why I all of a sudden thought this was interesting... need to wake up a bit.
Anyway, one solution seems to be using reactors, which I've used before, but I've never used any which catch the drawing opening... I've tried :vlr-dwgFileOpened and :vlr-endDwgOpen, and have tried in acad.lsp and accaddo.lsp, but I can't seem to get the event to fire...
I would ideally not have to resort to reactors for a startup check, but am not sure what else I can do.
Would anyone know of any reason why this is not firing? I get "reactor loaded successfully" at command, but nothing more.
(defun testr (reactorobj datalist / )
(alert "opened")
)
(vl-load-com)
(if (setq OpenDwgReactor (vlr-dwg-reactor
nil
'((:vlr-dwgFileOpened . testr )) )
)
(princ "\nreactor loaded successfully")
(princ "\nreactor not loaded...")
)
vBulletin® v3.6.7, Copyright ©2000-2009, Jelsoft Enterprises Ltd.