Results 1 to 5 of 5

Thread: Request lisp Help

  1. #1
    Member
    Join Date
    2008-11
    Posts
    3

    Default Request lisp Help

    Hello Everyone,

    I have done simple lisp before but I think I stepped in over my head with this one.

    I want to change to correct layer, attach xref, change back to previous layer then zoom extents. I got the following code:

    ; This function attaches xref on correct layer
    ;
    ( DEFUN C:XRA ()
    ;(SETQ CURRENTLAYER (GETVAR "CLAYER"))
    (SETVAR "CLAYER" "g-anno-refr")
    (initdia)
    (command "._xref")
    (princ)
    ;(SETVAR "CLAYER" CURRENTLAYER)
    )

    setting the layer is not setup to function because it wasn't working.

    I had some other code in but it wasn't working at all, so I removed it.

    Any help greatly appreciated.

    Jim C.
    AutoCad Civil 3D 2011

  2. #2
    100 Club
    Join Date
    2002-08
    Posts
    101

    Default Re: Request lisp Help

    Hello,

    You must achieve the command before to continue (not necessary if the command is the last call of the code)
    For this use the status of the variable CMDACTIVE is the best.

    For exemple change:
    (command "._xref")
    to:
    (command "_.xref"
    (while (not (zerop (getvar "cmdactive")))
    (command pause)
    )
    )

  3. #3
    Member
    Join Date
    2008-11
    Posts
    3

    Default Re: Request lisp Help

    Here is what I tried and still not working....

    (DEFUN C:XRAt ()
    (SETQ CURRENTLAYER (GETVAR "CLAYER"))
    (SETVAR "CLAYER" "g-anno-refr")
    (initdia)
    (command "_.xref"
    (while (not (zerop (getvar "cmdactive")))
    (command pause)
    )
    )
    (princ)
    (SETVAR "CLAYER" CURRENTLAYER)
    )

    Thanks Bruno for the help....

    Jim

  4. #4
    Administrator Opie's Avatar
    Join Date
    2002-01
    Location
    jUSt Here (a lot)
    Posts
    6,836

    Default Re: Request lisp Help

    Quote Originally Posted by jwchambers View Post
    Here is what I tried and still not working....

    (DEFUN C:XRAt ()
    (SETQ CURRENTLAYER (GETVAR "CLAYER"))
    (SETVAR "CLAYER" "g-anno-refr")
    (initdia)
    (command "_.xref"
    (while (not (zerop (getvar "cmdactive")))
    (command pause)
    )
    )
    (princ)
    (SETVAR "CLAYER" CURRENTLAYER)
    )

    Thanks Bruno for the help....

    Jim
    I know it may be a bit complex, but I would recommend using Command Reactors for this task. You can look at this example.
    If you have a technical question, please find the appropriate forum and ask it there.
    You will get a quicker response from your fellow AUGI members than if you sent it to me via a PM or email.
    jUSt

  5. #5
    Member
    Join Date
    2008-11
    Posts
    3

    Default Re: Request lisp Help

    Thanks Opie. That is way over my head at this point. Will have a go when I get some free time.


    Jim

Similar Threads

  1. Request for a Lisp Routine
    By sorman in forum AutoLISP
    Replies: 10
    Last Post: 2010-01-04, 07:18 PM
  2. Lisp Request
    By sadikozer34 in forum AutoLISP
    Replies: 0
    Last Post: 2009-09-06, 08:49 AM
  3. Layer display lisp request..........
    By dave3409 in forum AutoLISP
    Replies: 12
    Last Post: 2007-10-01, 03:25 PM
  4. Request for a simple lisp routine
    By BM75 in forum AutoLISP
    Replies: 5
    Last Post: 2005-11-23, 09:27 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
  •