+ Reply to Thread
Results 1 to 3 of 3
  1. #1
    Junior Member
    Using
    AutoCAD 2004
    Join Date
    Aug 2007
    Posts
    16

    Default New to lisp commands

    Registered forum members do not see this ad.

    Hello

    I am new to lisp files and can't find what I'm looking for anywhere else. I have an OFFSET TO LAYER lisp file that works, but after one use requires wont repeat like most commands. What do I need to add to the code below to make it repeat untill told not to?

    Thanks

    (defun Ctl()
    (setvar "cmdecho" 0)
    (setq c_layer (getvar "clayer")
    last (getvar "offsetdist"))
    (prompt "\nOffset distance or through" )
    (setq dist (getdist))
    (if (or (= dist nil)(= dist ""))
    (setq dist last)
    )
    (setq obj (entsel "\nSelect object to offset:"))
    (setq pick_pt (car(cdr obj)))
    (setq ent (car obj))
    (setq side_pt (getpoint "\nside to offset"))
    (command "offset" dist pick_pt side_pt "")
    (setq ent1 (entlast))
    (setq ptlst (entget ent1)
    b (assoc 8 ptlst)
    c (cons 8 c_layer)
    d (subst c b ptlst))
    (entmod d)
    (princ)
    )
    Last edited by Dan5; 26th May 2008 at 05:27 pm. Reason: um, emoticon appearing in my code...

  2. #2
    Junior Member
    Using
    AutoCAD 2004
    Join Date
    May 2008
    Posts
    17

    Default

    two subjects below your post is advanced offset. Does exactly what you're looking for & more.

    http://www.cadtutor.net/forum/showthread.php?t=23277

  3. #3
    Forum Deity
    Using
    not specified
    Join Date
    Jul 2004
    Location
    Anchorage, Alaska
    Posts
    2,074

    Default

    Registered forum members do not see this ad.

    Not sure what section of code you want to repeat, guessed it was picking other objects to offset once:

    Code:
    (defun c:otl ()
       (setvar "cmdecho" 0)
       (setq c_layer (getvar "clayer")
               last (getvar "offsetdist"))
       (prompt "\nOffset distance or through" )
       (setq dist (getdist))
       (if (or (= dist nil)(= dist ""))
           (setq dist last)
       )
       (while  ;; ** while loop to repeat until user hits 'enter' (nil)
          (setq obj (entsel "\nSelect object to offset:")) 
          (setq pick_pt (car(cdr obj)))
          (setq ent (car obj))
          (setq side_pt (getpoint "\nside to offset"))
          (command "offset" dist pick_pt side_pt "")
          (setq ent1 (entlast))
          (setq ptlst (entget ent1)
                b (assoc 8 ptlst)
                c (cons 8 c_layer)
                d (subst c b ptlst))
          (entmod d)
       );; **end of while loop
       (princ)
    )

Similar Threads

  1. Loading LISP Commands
    By samanisc in forum AutoCAD General
    Replies: 8
    Last Post: 21st Aug 2007, 02:12 pm
  2. **HELP**me with my commands
    By Paul Davis in forum AutoCAD General
    Replies: 14
    Last Post: 6th Aug 2007, 03:15 pm
  3. Undo multiple commands in lisp as one
    By gman in forum AutoLISP, Visual LISP & DCL
    Replies: 2
    Last Post: 9th Jun 2006, 05:57 pm
  4. Lisp for a sequence of commands...
    By Joro-- in forum AutoLISP, Visual LISP & DCL
    Replies: 3
    Last Post: 13th Feb 2006, 08:30 pm
  5. Commands
    By DPATTERSON23 in forum AutoCAD Drawing Management & Output
    Replies: 5
    Last Post: 22nd Dec 2005, 11:14 pm

Bookmarks

Posting Permissions

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