See the top rated post in this thread. Click here

Results 1 to 5 of 5

Thread: doit.lsp

  1. #1
    Member
    Join Date
    2004-10
    Posts
    12
    Login to Give a bone
    1

    Default doit.lsp

    hi There

    This is my 1st Post in the autolisp forum area
    i hope That This is somewhat useful, i use This daily

    Code:
    ;;;**********************************************
    
    ;;;<This routine sets the Layer and the Entity Name Command current>
    
    ;;;**********************************************
    
    ;;; original code by randy l. sanders c 1995
    ;;; a simple idea that could be expanded upon
    
    ;;;**********************************************
    
    ;;;  select an Item, Entity on The Screen 
    ;;;  This not only sets That Entities Layer current
    ;;;  but also sets That Entities Name-Command current
    
    ;;; select a Block and then the Block's Insertion Layer is set current
    ;;; and you are in the Insert command with that Block being inserted into the dwg
    
    ;;; ok, select a piece of Text, 
    ;;; you go to that Text's Layer
    ;;; and you are in the Text Command,
    
    ;;; There is a Pattern forming here
    ;;; hey add your own Ideas <shown below>
    
    ;;;**********************************************
    
    (defun c:doit (/ ec cm bk la x41 y42 z43 )
      (setq EC (entsel "Entity to match Command: "))
      (setq CM  (cdr (assoc 0   (entget (car EC)))))
      (setq BK  (cdr (assoc 2   (entget (car EC)))))
      (setq LA  (cdr (assoc 8   (entget (car EC)))))
      (setq x41 (cdr (assoc 41  (entget (car EC)))))
      (setq y42 (cdr (assoc 42  (entget (car EC)))))
      (command "layer" "s" LA "")
      (prompt (strcat "\nCommand Set to: Command: " CM ", Layer: " LA " :"))
      (cond
           ((eq CM "DIMENSION")    (command ".dim"))
           ((eq CM "VIEWPORT")     (command ".mview"))
           ((eq CM "HATCH")            (command ".bhatch" "p" bk x41 "" pause))
           ((eq CM "INSERT")           (command ".insert" bk pause x41 y42))
           ((eq CM "LWPOLYLINE")  (command ".pline"))
           ((eq CM "3DSOLID")         (command ".box"))
           ((eq CM "AEC_WALL")     (command "_AecWallAdd"))
          
    ;;;; This is where you can add your own Ideas <right here>
    ;;;; ((eq CM "GO-FOR-IT")     (command "go-for-it"))
    
           (T                     (command cm))
      )
      (princ)
    );eof
    Last edited by Glenn Pope; 2005-01-11 at 01:34 AM. Reason: Placed routine in code tags

  2. #2
    AUGI Addict kennet.sjoberg's Avatar
    Join Date
    2002-05
    Posts
    1,707
    Login to Give a bone
    0

    Default Re: doit.lsp

    Welcome randy, You and I "emits a bright aura"

    that is safe to know ; )

    : ) Happy Computing !

    kennet
    Last edited by kennet.sjoberg; 2005-01-10 at 11:02 PM.

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

    Wink Re: doit.lsp

    Quote Originally Posted by randy.77505
    ((eq CM "INSERT") (command ".insert" bk pause x41 y42))
    It was nice of you to post something like that. I still use something similar that I wrote 15 years (gasp!) ago.

    Might I suggest the following change to the line quoted?
    ((eq CM "INSERT") (command "._insert" bk "_s" x41))

    That gives you the block scaled while dragging for the insertion and, really, how often do we need different X/Y scaled blocks?

  4. #4
    Member
    Join Date
    2004-10
    Posts
    12
    Login to Give a bone
    0

    Default Re: doit.lsp

    hi There

    RobertB

    Thanks for the comment and useul suggestion
    i am sure That is an improvement to the code

    16 years ?? how sweet it is

    ;;;

    Thanks

    Randy

  5. #5
    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: doit.lsp

    I couldn't believe it, when I looked at the header for my file. I could have sworn it was only 10 years ago. BwaHaHa!!!

Posting Permissions

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