Autolay

Discussion in 'AutoCAD' started by scatman99, Aug 13, 2004.

  1. scatman99

    scatman99 Guest

    Hi all,
    I am using autolay lisp, its great!
    But i have a small lisp programme that inserts text onto a non printing layer, for personnel notes etc.
    Unfortunatley now it only inserts txt on the layer specified by the Autolay programme. Here's the programme, any ideas please would be greatly appreciated.
    Cheers.

    (defun c:txtlayer (/ clayer)
    (setq Clayer (getvar "clayer"))
    (command "layer" "m" "ZZZ-CONSTRUCTION" "c" 7 "" "")
    (initdia)
    (command "_mtext")
    (while (eq 1 (logand 1 (getvar "CMDACTIVE")))(command pause))
    (setvar "clayer" clayer)
    )
     
    scatman99, Aug 13, 2004
    #1
  2. You probably need to turn it off before starting your command, as autolay uses reactors that fire
    when the mtext command is started, making it autoswitch to the autolay's assumed layer. Something
    like this might work:
    (setq alflag autolay autolay nil)
    (setq autolay alflag)
     
    Allen Johnson, Aug 13, 2004
    #2
  3. scatman99

    scatman99 Guest

    Thanks for your time, but it still doesn't seem to work,
     
    scatman99, Aug 13, 2004
    #3
  4. scatman99

    Doug Broad Guest

    The command Autolay can be used to toggle Autolayering on or off
    as the comments in the source file clearly explain.

    Since Autolay is basically a command tracking reactor, you should
    be able to avoid its execution by using ActiveX to add mtext rather
    than using the mtext command.

    The toggle approach would be
    (defun autolayoff ()
    (if
    (vl-registry-read "HKEY_CURRENT_USER\\SOFTWARE\\AutoLay" "AutoLay")
    (c:autolay)))

    Then to toggle it back on, use (c:autolay)

    Regards,
    Doug

    BTW: Please avoid double posting the same topic in two threads with
    different subject lines.


    Here's the programme, any ideas please would be greatly appreciated.
     
    Doug Broad, Aug 13, 2004
    #4
  5. It worked for me, though I only have AutoLay 2.0.
    Check the AutoLay code for the flag that determines whether it is active or not.
    In version 2.0 it is the variable autolay:

    ;;;Main body - tests the command name, textsize, dimtext size etc.
    ;;;to determine if action needs to be taken. This is where the layer name
    ;;;comes from and where the conditions under which to act under are set up.
    (defun al:autolay (reactor info / cmd dsc dst dtx tst tsz)
    (if autolay
    <<<<------ Autolay flag is here
    (progn
    (setq cmd (strcase (car info));get command name
    dsc (vlax-variant-value (vla-getvariable doc "dimscale"));get scale
    dst (strcase (vla-get-name (vla-get-activedimstyle doc)));get dimstyle
    dtx (vlax-variant-value (vla-getvariable doc "dimtxt"));get dimtxt size
    tst (strcase (vla-get-name (vla-get-activetextstyle doc)));get textstyle
    tsz (vlax-variant-value (vla-getvariable doc "textsize"));get text size
    );end setq
    (cond
     
    Allen Johnson, Aug 13, 2004
    #5
  6. scatman99

    scatman99 Guest

    Cheers, managed to sort it out.
     
    scatman99, Aug 13, 2004
    #6
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Similar Threads
Loading...