Results 1 to 5 of 5

Thread: Looking at user reactors for dtext

  1. #1
    Certifiable AUGI Addict Robert.Hall's Avatar
    Join Date
    2004-07
    Location
    Detroit Michigan
    Posts
    2,510

    Question Looking at user reactors for dtext

    I am looking at user reactors for dtext.

    How would I setup a reactor that changes the dtext height when a
    partiular dimstyle has been selected?

  2. #2
    AUGI Addict
    Join Date
    2005-08
    Posts
    1,043

    Default Re: Looking at user reactors for dtext

    I don't think it would be to hard to do, but you have to do this one correctly since you are going to be watching the system variable changed event, and then changing a system variable. You can't use commands in reactors (FYI). I would just make sure to check for that one system variable that you want to watch, and put everything in an if statement. I think it should work, but I haven't not done any reactors on system variables.

  3. #3
    100 Club pnorman's Avatar
    Join Date
    2005-02
    Location
    Calgary
    Posts
    179

    Default Re: Looking at user reactors for dtext

    Hi Robert,

    I had a quick play with the following. It seems ot do what you want using the dimscale. I tried using "dimstyle" as a triger but for various reasons that didn't work. Dimscale seemed to give better results. I haven't tested it for all situations or cad versions. I ahve ADT 2005.

    Put the code in your acaddoc.lsp or as I do it save to a file called reactors.lsp and use (load "reactors.lsp") in your acaddoc....


    Code:
    ;;;----------------------------------------------- ---------------
    (if (not *ppn:vlr_dimdtext*)
      (setq *ppn:vlr_dimdtext* (vlr-sysvar-reactor nil '((:vlr-sysvarchanged . PPN_REACTOR_DTEXT))))
    )
    ;;;----------------------------------------------------- ---------
    (defun PPN_REACTOR_DTEXT (ppn_reactor_name ppn_sysvar_name)
      (if (= (car ppn_sysvar_name) "DIMSCALE")
    	(progn
    	  (setvar "TEXTSIZE" (* (getvar "DIMSCALE") (/ 3.0 32)))
    	)
      )
    )
    Regards
    Phill

  4. #4
    AUGI Addict kennet.sjoberg's Avatar
    Join Date
    2002-05
    Posts
    1,706

    Default Re: Looking at user reactors for dtext

    Quote Originally Posted by Robert.Hall
    . . . changes the dtext height when a partiular dimstyle has been selected?
    Hi Robert, you can play with this
    Code:
    ;;; The trigger
    (setq SysVarChangeReactor (vlr-sysvar-reactor nil '((:vlr-sysVarChanged . SysVarChangeReactorFunction ))) )
    
    ;;; The function
    (defun SysVarChangeReactorFunction (ObjReactor Responce / )
      (if (= (car Responce ) "DIMSTYLE" )
        (progn
          (cond
            ((= (getvar "DIMSTYLE" ) "MyDimStyle_1" ) (setvar "TEXTSIZE"  1.0 ) ) ;; or whatever
            ((= (getvar "DIMSTYLE" ) "MyDimStyle_2" ) (setvar "TEXTSIZE" 10.0 ) )
            ((= (getvar "DIMSTYLE" ) "MyDimStyle_3" ) (setvar "TEXTSIZE" 20.0 ) )
            ((= (getvar "DIMSTYLE" ) "MyDimStyle_4" ) (setvar "TEXTSIZE" 50.0 ) )
            (T (setvar "TEXTSIZE" 1.0 ) ) ;; else
          )
        )
        ( )
      )
    )
    
    ;;; The regret
    ;;; (vlr-remove SysVarChangeReactor ) ;; Remove the reactor
    ;;; (setq SysVarChangeReactorFunction nil SysVarChangeReactor nil ) ;; Clear the function and the reactor
    : ) Happy Computing !

    kennet

  5. #5
    100 Club pnorman's Avatar
    Join Date
    2005-02
    Location
    Calgary
    Posts
    179

    Default Re: Looking at user reactors for dtext

    Use Kennet's method. I tried "dimstyle" again as the trigger and it seems to be working ok now.

Similar Threads

  1. need some help with reactors
    By darren_lambett in forum AutoLISP
    Replies: 1
    Last Post: 2009-04-20, 12:31 PM
  2. Replies: 2
    Last Post: 2006-10-02, 10:02 PM
  3. Reactors????
    By LLAW3224 in forum AutoLISP
    Replies: 2
    Last Post: 2005-03-04, 11:44 AM
  4. Reactors
    By rad.77676 in forum ATP Course Wishlist
    Replies: 3
    Last Post: 2004-12-09, 08:44 PM
  5. Can this be done with reactors?
    By kieren in forum AutoLISP
    Replies: 5
    Last Post: 2004-10-06, 03:43 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
  •