See the top rated post in this thread. Click here

Page 1 of 3 123 LastLast
Results 1 to 10 of 23

Thread: SysVar or Object Modified Reactor - Drawing Setup (Horizontal Scale)

  1. #1
    Administrator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,714
    Login to Give a bone
    0

    Exclamation SysVar or Object Modified Reactor - Drawing Setup (Horizontal Scale)

    :: DISCLAIMER ::
    Being new to forums, I've gathered that it is very helpful to state the goals clearly up front... I'll try to be brief.

    I've only been speaking with a LISP for three months, and am self taught. Mistakes abound, so be brutally blunt. I’m a quick learner, but may have many questions… please bear with me.

    :: ORIGINAL ISSUE ::
    Using AutoCAD 2009 Civil 3D Land Desktop Companion (LDC), and LDC Enabled Map (MAP), the Drawing Setup (Horizontal Scale only) would mysteriously change in drawings.

    As these drawing(s) are our project master drawings (Plan, Profile, Cross Sections) I am encountering incorrectly scaled section plots, listed elevations, etc. Only after fixing the Drawing Setup (horizontal scale only) are my issue(s) no longer a concern.

    Unfortunately, fixing this once is non-sustaining. Something is continually, and intermittently, changing this setting.

    :: INITIAL SOLUTION ::
    Stage 1 - I suspected it was a LISP routine I executed while working in the drawings that would make said change. So I attempted to work in the drawings without my custom routines; removing everything from ACADDOC.lsp, (comment out using “ ; “) – the problem persisted.

    Stage 2 - I wrote a LISP routine that works great for checking some system variables, and if the setting is incorrect, I am prompted to fix [Yes/No], then an error log is generated. All of which takes place when a drawing is first opened.

    Code snippet:
    (Full routine lengthy, attached for download)

    Code:
    ;;;--------------------------------------------------------------------;
    ;;;  DimChk.lsp, 2010-02-23, M.Kirkland                                ;
    ;;;--------------------------------------------------------------------;
    ;;;  Description: At drawing open...                                   ;
    ;;;                                                                    ;
    ;;;             1. Check for master transportation drawing             ;
    ;;;                                                                    ;
    ;;;             2. Check for master type:                              ;
    ;;;                 C = Cross Section                                  ;
    ;;;                 M = Master Line Work                               ;
    ;;;                 P = Profile                                        ;
    ;;;                                                                    ;
    ;;;             3. If scale is incorrect, present option to fix        ;
    ;;;                                                                    ;
    ;;;             4. Append log entry for error reporting                ;
    ;;;--------------------------------------------------------------------;
     
    ;;;********************************************************************;
    ;;;  Description: Check for infrastructure, or transportation drawing, ;
    ;;;               then check to see if that file is a master file at   ;
    ;;;               drawing open.                                        ;
    ;;;********************************************************************;
     
    ;; Load message
    (prompt "\nDimChk.lsp Loading... © 2010, by Mathew Kirkland, WM ")
     
    ;; Silent start
    (setvar "cmdecho" 0)
     
    ;; If drawing is named, verify if master file
    (if
      (= 1 (getvar "dwgtitled"))
      (progn
        (if
          ;; IF drawing is a master, check for IF & TR
          (= "Masters" (substr (findfile (getvar "dwgname")) 25 7))
          (cond
            (
             ;; Infrastructure drawing
             (= "IF" (substr (getvar "dwgname") 1 2))
             (progn
               (setq BUTYP "IF")
               (f:IFCHK)
             ) ;_end progn
            )
           (
            ;; Transportation drawing
            (= "TR" (substr (getvar "dwgname") 1 2))
            (progn
              (setq BUTYP "TR")
              (f:TRCHK)
             ) ;_end progn
            )
           (
            (or (/= "IF" (substr (getvar "dwgname") 1 2))(/= "TR" (substr (getvar "dwgname") 1 2)))
            (prompt "Drawing Not Associated With An IF or TR Project... ")
           )
          ) ;_end cond
        ) ;_end if
      ) ;_end progn
    ) ;_end if
    (setvar "cmdecho" 1)
    (princ)
    :: CURRENT SITUATION ::
    However, after using this routine, I’ve been able to determine whatever “event” is changing the Drawing Setup (Horizontal Scale only) is not limited to part of my company’s startup, and must also be taking place during my working in the drawing. (More than one cause?)

    :: GOAL ::
    Stage 3 - I need a routine that will continuously monitor this variable (Drawing Setup, Horizontal Scale only), and take action (see attached LISP) when the change occurs.

    Enter Visual LISP (vlr-sysvar-reactor data callbacks)… this is where I turn to you for help.

    Thanks for you time and effort in advance!
    Attached Files Attached Files
    "How we think determines what we do, and what we do determines what we get."

    Sincpac C3D ~ Autodesk Exchange Apps

    Computer Specs:
    Dell Precision 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000

  2. #2
    Administrator rkmcswain's Avatar
    Join Date
    2004-09
    Location
    Earth
    Posts
    9,803
    Login to Give a bone
    0

    Default Re: SysVar or Object Modified Reactor - Drawing Setup (Horizontal Scale)

    Quote Originally Posted by mat.kirkland View Post
    GOAL...I need a routine that will continuously monitor this variable (Drawing Setup, Horizontal Scale only), and take action (see attached LISP) when the change occurs.
    The code found here will monitor an AutoCAD system variable.

    http://cadpanacea.com/node/53
    R.K. McSwain | CAD Panacea |

  3. #3
    Administrator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,714
    Login to Give a bone
    0

    Default Re: SysVar or Object Modified Reactor - Drawing Setup (Horizontal Scale)

    Quote Originally Posted by rkmcswain View Post
    The code found here will monitor an AutoCAD system variable.

    http://cadpanacea.com/node/53
    This seems like an excellent foundation for what I was looking for.

    Thanks for pointing me in the right direction, have a great weekend!
    "How we think determines what we do, and what we do determines what we get."

    Sincpac C3D ~ Autodesk Exchange Apps

    Computer Specs:
    Dell Precision 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000

  4. #4
    The Silent Type RobertB's Avatar
    Join Date
    2000-01
    Location
    Seattle WA USA
    Posts
    5,859
    Login to Give a bone
    0

    Default Re: SysVar or Object Modified Reactor - Drawing Setup (Horizontal Scale)

    Quote Originally Posted by rkmcswain View Post
    The code found here will monitor an AutoCAD system variable.

    http://cadpanacea.com/node/53
    R.K. I don't think the OP got the bit about "an AutoCAD system variable".

    Since I'm not running that vertical I don't know if the horizontal scale is a system variable. I suspect its buried in the NOD along with the rest of the AEC variables.
    R. Robert Bell
    Design Technology Manager
    Stantec
    Opinions expressed are mine alone and do not reflect the views of Stantec.

  5. #5
    Administrator rkmcswain's Avatar
    Join Date
    2004-09
    Location
    Earth
    Posts
    9,803
    Login to Give a bone
    0

    Exclamation Re: SysVar or Object Modified Reactor - Drawing Setup (Horizontal Scale)

    Quote Originally Posted by RobertB View Post
    R.K. I don't think the OP got the bit about "an AutoCAD system variable".

    Since I'm not running that vertical I don't know if the horizontal scale is a system variable. I suspect its buried in the NOD along with the rest of the AEC variables.
    That is kind of what I was thinking also (hence the italics), and now after doing some checking (because I actually forgot....) - I believe those settings are stored in xdata in the block named ADCADD_ZZ - which of course means you will need some different code to monitor that data... and something to trigger the check...
    R.K. McSwain | CAD Panacea |

  6. #6
    Administrator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,714
    Login to Give a bone
    0

    Default Re: SysVar or Object Modified Reactor - Drawing Setup (Horizontal Scale)

    I should also add that the original "solution" attempted was to delete the DFM file from the project, and then reattach the drawing to the project, as the Drawing Setup is saved to the drawing, and not the project DB. This did not resolve the issue.

    Quote Originally Posted by RobertB View Post
    ... the bit about "an AutoCAD system variable".
    I noticed that as well, but was hoping that replacing VLR-EDITOR-REACTOR, with VLR-SYSVAR-REACTOR would work. (wishful thinking on my part?)

    When the Drawing Setup's Horizontal Scale is changed, the DIMSCALE does too. However, as I'm sure you already know, changing the DIMSCALE variable does not change the Drawing Setup's Horizontal Scale in kind.

    Using my LISP (attached in original post) I've been checking the DIMSCALE as a litmus test, but do not know a way to programmatically monitor the source variable/xdata that is changed to move the first domino.

    I am having trouble finding the specific variable to react to... This may explain why:

    Quote Originally Posted by rkmcswain View Post
    I believe those settings are stored in xdata in the block named ADCADD_ZZ - which of course means you will need some different code to monitor that data... and something to trigger the check...
    I am hoping that Visual LISP provides a means for both of these? If not, should I be looking into VBA?
    "How we think determines what we do, and what we do determines what we get."

    Sincpac C3D ~ Autodesk Exchange Apps

    Computer Specs:
    Dell Precision 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000

  7. #7
    Certifiable AUGI Addict ccowgill's Avatar
    Join Date
    2004-08
    Location
    Iron Station, NC
    Posts
    3,198
    Login to Give a bone
    0

    Default Re: SysVar or Object Modified Reactor - Drawing Setup (Horizontal Scale)

    Quote Originally Posted by mat.kirkland View Post
    I am hoping that Visual LISP provides a means for both of these? If not, should I be looking into VBA?
    Definitely dont look into VBA, it's on its way out, it would be a waste of time. A lot of people are migrating to VB.net or even C#.net

  8. #8
    The Silent Type RobertB's Avatar
    Join Date
    2000-01
    Location
    Seattle WA USA
    Posts
    5,859
    Login to Give a bone
    0

    Default Re: SysVar or Object Modified Reactor - Drawing Setup (Horizontal Scale)

    Quote Originally Posted by mat.kirkland View Post
    ...Using my LISP (attached in original post) I've been checking the DIMSCALE as a litmus test, but do not know a way to programmatically monitor the source variable/xdata that is changed to move the first domino.

    I am having trouble finding the specific variable to react to...

    I am hoping that Visual LISP provides a means for both of these? If not, should I be looking into VBA?
    You can create an object reactor for that block. The help files give you an example of an object reactor in Visual LISP. Might that be enough of a hint?
    R. Robert Bell
    Design Technology Manager
    Stantec
    Opinions expressed are mine alone and do not reflect the views of Stantec.

  9. #9
    Administrator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,714
    Login to Give a bone
    0

    Default Re: SysVar or Object Modified Reactor - Drawing Setup (Horizontal Scale)

    Quote Originally Posted by RobertB View Post
    You can create an object reactor for that block. The help files give you an example of an object reactor in Visual LISP.
    Thanks, for pointing me in the right direction.

    Quote Originally Posted by RobertB View Post
    Might that be enough of a hint?
    Time will tell....
    "How we think determines what we do, and what we do determines what we get."

    Sincpac C3D ~ Autodesk Exchange Apps

    Computer Specs:
    Dell Precision 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000

  10. #10
    Administrator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,714
    Login to Give a bone
    0

    Default Re: SysVar or Object Modified Reactor - Drawing Setup (Horizontal Scale)

    Time is not my friend at the moment. Sadly, the help file was not as helpful as I had hoped.

    I wrote a TEST routine, and the object reactor appears to load successfully (see code below).

    However, I keep getting an error at the command line, when attempting to test my reactor.
    (I manually change the Drawing Setup Horizontal Scale, PROJECTS > DRAWING SETUP)

    Attempts to replace My_Data with Nil simply vary in the number of times "too many arguments" is repeated.

    Code:
    Command: test
    #<VLR-Object-Reactor>
    Command:
    too many arguments
    Command:  too many argumentstoo many arguments
    I suspect that the trouble I am experiencing lies with my callback function? Hopefully there is something that stands out to you as being an obvious error on my part.

    Here is my TEST routine:

    Code:
    ;;;--------------------------------------------------------------------;
    ;;;  Z_Test.lsp, 2010-03-09, © 2010, by Mathew Kirkland, WM            ;
    ;;;--------------------------------------------------------------------;
     
    ;;;--------------------------------------------------------------------;
    ;;;     Function: c:STOP                                               ;
    ;;;--------------------------------------------------------------------;
    ;;;  Description: Stop all reactors.                                   ;
    ;;;--------------------------------------------------------------------;
     
    (defun c:STOP ()
     
      (vlr-remove-all)
      (prompt "\n...All Reactors Have Been Removed. ")
      (princ)
     
    ) ;_end defun
     
    ;;;--------------------------------------------------------------------;
    ;;;     Function: My_Function                                          ;
    ;;;--------------------------------------------------------------------;
    ;;;  Description: Callback function for reactor statement.             ;
    ;;;--------------------------------------------------------------------;
     
    (defun My_Function ()
     
      (prompt "\nACADD_ZZ Block Has Changed, Check Drawing Setup.")
      (princ)
     
    ) ;_end defun
     
    ;;;********************************************************************;
    ;;;     Function: c:TEST                                               ;
    ;;;********************************************************************;
    ;;;  Description: Test object reactor, to monitor changes in           ;
    ;;;               ADCADD_ZZ block.                                     ;
    ;;;********************************************************************;
     
    (defun c:TEST (/ ENAME My_Object VERT HORZ My_Data My_Reactor )
     
      ;; Load visual lisp command extensions
      (vl-load-com)
     
      ;; Reset all current reactors
      (if *commandReactor*
        (progn
          (setq *commandReactor* nil)
          (vlr-remove-all :VLR-Command-Reactor)
        ) ;_end progn
      ) ;_end if
     
      ;; Name of block to monitor
      (setq ENAME (ssname (ssget "x" '((2 . "adcadd_zz"))) 0))
      (setq My_Object (vlax-ename->vla-object ENAME))
     
      ;; Object data to be associated with the reactor object
      (setq VERT (rtos (zz_getxd 341) 2 2))
      (setq HORZ (rtos (zz_getxd 342) 2 2))
      (setq My_Data (list VERT HORZ))
     
      ;; Object Reactor
      (setq My_Reactor
      (vlr-object-reactor (list My_Object) My_Data '((:vlr-modifiedXData . My_Function)))
      ) ;_end setq
     
    ) ;_end defun
     
    (c:TEST)
    "How we think determines what we do, and what we do determines what we get."

    Sincpac C3D ~ Autodesk Exchange Apps

    Computer Specs:
    Dell Precision 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000

Page 1 of 3 123 LastLast

Similar Threads

  1. Modified Object Reactor
    By bweir in forum AutoLISP
    Replies: 5
    Last Post: 2017-03-25, 03:04 PM
  2. Replies: 4
    Last Post: 2013-08-31, 01:22 PM
  3. sysvar changed reactor
    By peter in forum Dot Net API
    Replies: 45
    Last Post: 2010-06-02, 12:39 AM
  4. Cannot change drawing scale - in drawing setup
    By cdoucet in forum ACA General
    Replies: 2
    Last Post: 2009-07-20, 08:11 PM
  5. vlr-sysvar-reactor doesn't fire
    By pnorman in forum AutoLISP
    Replies: 1
    Last Post: 2005-04-12, 03:19 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •