Author Topic: Variable setting conflict between ADT 2007 and ARCH 2008  (Read 6624 times)

0 Members and 1 Guest are viewing this topic.

Krushert

  • Seagull
  • Posts: 13679
  • FREE BEER Tomorrow!!
Variable setting conflict between ADT 2007 and ARCH 2008
« on: May 16, 2007, 09:15:26 AM »
I have this piece of code in my Acaddoc file to stop the reconsiling of layers in Arch 2008 becuase of reasons mention over here

Code: [Select]
;;;SETTING OF VARIABLES
(setvar "layereval" 0) ; Reconsiled Layers = ARCH 2008
(setvar "layernotify" 0) ; Reconsiled Layers = ARCH 2008

However I am calling this same file into ADT 2007 and ADT 2005 (haven't tested but assuming to have the same problem)  When the ADT 2007 comes to the above code it stops loading the AcadDoc file. 

Is there a way to code to see what version of cad is loading the acaddoc first then load the variables or ignore them?

I + XI = X is true ...  ... if you change your perspective.

I no longer CAD or Model, I just hang out here picking up the empties beer cans

sinc

  • Guest
Re: Variable setting conflict between ADT 2007 and ARCH 2008
« Reply #1 on: May 16, 2007, 12:11:55 PM »
Are you running them as part of the startup script?

These variables are stored in the drawing, so you must set them after the drawing is fully initialized.  That's done like this:

Code: [Select]
(defun-q MYSTARTUP ()
   ;; put your setvars in here
) ;_ defun-q
(setq S::STARTUP (append S::STARTUP MYSTARTUP))

Krushert

  • Seagull
  • Posts: 13679
  • FREE BEER Tomorrow!!
Re: Variable setting conflict between ADT 2007 and ARCH 2008
« Reply #2 on: May 16, 2007, 12:22:09 PM »
Are you running them as part of the startup script?

These variables are stored in the drawing, so you must set them after the drawing is fully initialized.  That's done like this:

Code: [Select]
(defun-q MYSTARTUP ()
   ;; put your setvars in here
) ;_ defun-q
(setq S::STARTUP (append S::STARTUP MYSTARTUP))

Sinc
I am heading out the door to see some Scientist lecture on Indoor Air Quality and I quickly look at your reponse.  No I dont have it set up like that.  What you see for Code is what I thru in the middle of the AcadDoc File.   I have some questions and will post them when I get back because now I am confused..

Thanks
I + XI = X is true ...  ... if you change your perspective.

I no longer CAD or Model, I just hang out here picking up the empties beer cans

Guest

  • Guest
Re: Variable setting conflict between ADT 2007 and ARCH 2008
« Reply #3 on: May 16, 2007, 02:18:21 PM »
I do the following to determine what vertical is running, and then based on what vertical is currently running, do something specific to that particular vertical.

Code: [Select]
(setq ACAD_ADT "Autodesk Architectural Desktop 2007")
(setq ACAD_LDT "Autodesk Land Desktop 2007")
(setq ACAD_ABS "Autodesk Building Systems 2007")
(setq ACAD_ABS71 "Autodesk Building Systems 2007.1")


(defun GetAcadVertical ( )
   (vl-load-com)
   (setq ACAD_Version (vl-registry-read (strcat "HKEY_LOCAL_MACHINE\\" (vlax-product-key)) "ProductName"))
)

(defun CheckAcad ( / )
   (cond
      ((= ACAD_ADT (GetAcadVertical))
         (alert "Do something for ADT!")
      )
      ((= ACAD_ABS (GetAcadVertical))
         (alert "Do something for ABS!")
      )
      ((= ACAD_LDT (GetAcadVertical))
         (alert "Do something for LDT!")
      )
   )
   (princ)
)

sinc

  • Guest
Re: Variable setting conflict between ADT 2007 and ARCH 2008
« Reply #4 on: May 16, 2007, 08:02:41 PM »
Sinc
I am heading out the door to see some Scientist lecture on Indoor Air Quality and I quickly look at your reponse.  No I dont have it set up like that.  What you see for Code is what I thru in the middle of the AcadDoc File.   I have some questions and will post them when I get back because now I am confused..

Thanks

It's relatively straight-forward.  The ACADDOC.LSP file gets run as a DWG file is being loaded.  The DWG is not fully-initialized at this point, so not all commands will work.

Items that need to wait until the DWG is fully-initialized can be run as part of the S::STARTUP function.  This is much like any other Lisp command, except it gets run automatically by Autocad right after the DWG initialization is completed.  (Basically, just before it gives you the command prompt, Autocad runs S::STARTUP.)

By putting the code I posted into your ACADDOC.LSP file, you are adding your own custom startup code to the overall startup suite.  Note that the code defines a function called MYSTARTUP, then appends this to the already-existing function S::STARTUP.  This makes sure you don't stomp on any startup commands added by verticals or other third-party customizations that you have installed.  If you simply redefined S::STARTUP, you might clobber special startup stuff added by other software.

Krushert

  • Seagull
  • Posts: 13679
  • FREE BEER Tomorrow!!
Re: Variable setting conflict between ADT 2007 and ARCH 2008
« Reply #5 on: May 16, 2007, 08:34:11 PM »
It's relatively straight-forward.  The ACADDOC.LSP file gets run as a DWG file is being loaded.  The DWG is not fully-initialized at this point, so not all commands will work.

Items that need to wait until the DWG is fully-initialized can be run as part of the S::STARTUP function.  This is much like any other Lisp command, except it gets run automatically by Autocad right after the DWG initialization is completed.  (Basically, just before it gives you the command prompt, Autocad runs S::STARTUP.)

By putting the code I posted into your ACADDOC.LSP file, you are adding your own custom startup code to the overall startup suite.  Note that the code defines a function called MYSTARTUP, then appends this to the already-existing function S::STARTUP.  This makes sure you don't stomp on any startup commands added by verticals or other third-party customizations that you have installed.  If you simply redefined S::STARTUP, you might clobber special startup stuff added by other software.
Okay that answered all of my questions but a couple.
Clarification question (becuase I am being numb at the moment): All of your code goes in the AcadDoc file? 

More Technical questions for my Eda-muf-ic-ation:
Actually Help File was very helpful this time   *Imagine that*

However this solves one problem but not the other.  2007 will still hang when the variables are being set becuase the variables are not there.  I think I might have a way around this and that is to check the ACAD Version variable (acadver) first.
I + XI = X is true ...  ... if you change your perspective.

I no longer CAD or Model, I just hang out here picking up the empties beer cans

sinc

  • Guest
Re: Variable setting conflict between ADT 2007 and ARCH 2008
« Reply #6 on: May 16, 2007, 09:10:28 PM »
Clarification question (becuase I am being numb at the moment): All of your code goes in the AcadDoc file? 

Yep.

While Autocad is loading your drawing, it will run the code in ACADDOC.LSP.  At this time, you define the function MYSTARTUP and append it to S::STARTUP, but the code inside of MYSTARTUP is not actually executed.  Then, after DWG initialization is complete, Autocad will run the S::STARTUP function.  That's when your SETVAR commands actually get executed.

Quote

However this solves one problem but not the other.  2007 will still hang when the variables are being set becuase the variables are not there.  I think I might have a way around this and that is to check the ACAD Version variable (acadver) first.


That should work.

Krushert

  • Seagull
  • Posts: 13679
  • FREE BEER Tomorrow!!
Re: Variable setting conflict between ADT 2007 and ARCH 2008
« Reply #7 on: May 21, 2007, 09:03:29 PM »
Just to close out this thread with what I came up with.

Code: [Select]
;;;SETTING OF VARIABLES THRU "MY START UP" FUNCTION
(defun-q MYSTARTUP ()
  (setq ARCH-08 "17.1s (LMS Tech)") ;
  (setq ARCH_Ver (getvar "acadver")) ; GETS VERSION YEAR OF ACTIVE ACAD APPLICATON.

  (if (= ARCH_Ver ARCH-08) ;TEST Condition
    (progn ;if true - then
      (setvar "layereval" 0) ; Reconsiled Layers = ARCH 2008
      (setvar "layernotify" 0) ; Reconsiled Layers = ARCH 2008
    )
    (); if not true - do nothing
  )
) ;_ defun-q

(setq S::STARTUP (append S::STARTUP MYSTARTUP))

Sinc and all the others that contributed - Thank You!  :-)
I + XI = X is true ...  ... if you change your perspective.

I no longer CAD or Model, I just hang out here picking up the empties beer cans

Guest

  • Guest
Re: Variable setting conflict between ADT 2007 and ARCH 2008
« Reply #8 on: May 22, 2007, 08:18:12 AM »
I'm just starting to get things set up in 2008 but (thinking out loud) can't you set those variables and have them in the profile (ARG) or are these set on a per drawing basis?

FYI: You can change those from the Layer Manager dialog box by clicking on the Settings button.


Krushert

  • Seagull
  • Posts: 13679
  • FREE BEER Tomorrow!!
Re: Variable setting conflict between ADT 2007 and ARCH 2008
« Reply #9 on: May 22, 2007, 10:37:50 AM »
The settings are per drawing, and are defaulted to being on.  :x  There should have been a master switch the registry but alas there is not. 
I + XI = X is true ...  ... if you change your perspective.

I no longer CAD or Model, I just hang out here picking up the empties beer cans

Guest

  • Guest
Re: Variable setting conflict between ADT 2007 and ARCH 2008
« Reply #10 on: May 22, 2007, 10:41:25 AM »
The settings are per drawing, and are defaulted to being on.  :x  There should have been a master switch the registry but alas there is not. 
Duly noted!  (glad I haven't deployed 2008 yet!)

sinc

  • Guest
Re: Variable setting conflict between ADT 2007 and ARCH 2008
« Reply #11 on: May 22, 2007, 11:37:27 AM »
It should be possible to change the settings in your drawing template.  That won't fix all your existing drawings, but it will set it correctly in all new drawings.

The problem with changing it in ACADDOC.LSP is that it prevents you from using this feature if you decide you want to.  But if you don't intend to ever use the reconciled layer feature, then it doesn't matter.

Krushert

  • Seagull
  • Posts: 13679
  • FREE BEER Tomorrow!!
Re: Variable setting conflict between ADT 2007 and ARCH 2008
« Reply #12 on: May 22, 2007, 11:38:56 AM »
The settings are per drawing, and are defaulted to being on.  :x  There should have been a master switch the registry but alas there is not. 
Duly noted!  (glad I haven't deployed 2008 yet!)
I think this is a preference, some people may like some may not.  I don't.  it is more of annoyance than benefit.  Just my Opinion
I + XI = X is true ...  ... if you change your perspective.

I no longer CAD or Model, I just hang out here picking up the empties beer cans