Results 1 to 7 of 7

Thread: Numbering lisp routine

  1. #1
    Active Member Heather_W's Avatar
    Join Date
    2007-01
    Posts
    75
    Login to Give a bone
    0

    Default Numbering lisp routine

    I have a routine that will number in numerical order or in increments. I love this routine. I want another routine that will do the same but this time add a shape around the number. circle, box, triangle....Is this possible? I don't know how to add that to my current lisp.

    this is the routine I have now.


    Code:
    (defun C:NN (/ r pt i j n)
     (tem)
     (setq size (txtsz)
        r (rtd (getvar "SNAPANG"))
        i (getint "\nStarting Number <1>: ")
        j (getint "\nIncrement For Numbers <1>: ")
        i (if (= i nil) 1 i)
        j (if (= j nil) 1 j)
     )
     (setvar "HIGHLIGHT" 1)
     (graphscr)(prompt "\nPut Number: ")
     (while (setq pt (getpoint))
      (setq n (itoa i) i (+ i j))
      (putmsg "M" pt r n)
      (prompt (strcat n ","))
     )
     (setvar "HIGHLIGHT" 1)
     (rep)
    ) ;end defun
    Last edited by Ed Jobe; 2019-07-25 at 10:03 PM. Reason: Added CODE tags

  2. #2
    All AUGI, all the time
    Join Date
    2010-06
    Posts
    962
    Login to Give a bone
    0

    Default Re: Numbering lisp routine

    Hi,
    If you have the Express Tools installed with your CAD version then you can use the command: Tcircle and that should fulfill your needs I believe.

    Your posted codes are not complete so there are a few functions used in your routine and not posted along with the codes.

  3. #3
    Active Member Heather_W's Avatar
    Join Date
    2007-01
    Posts
    75
    Login to Give a bone
    0

    Default Re: Numbering lisp routine

    Thank you! I was hoping to alleviate that step. Add number and shape all in one command. I know, wishful thinking. this will work. Thanks!

  4. #4
    All AUGI, all the time
    Join Date
    2010-06
    Posts
    962
    Login to Give a bone
    0

    Default Re: Numbering lisp routine

    No worries,
    You're welcome anytime.

  5. #5
    Administrator rkmcswain's Avatar
    Join Date
    2004-09
    Location
    Earth
    Posts
    9,805
    Login to Give a bone
    0

    Default Re: Numbering lisp routine

    Heather, I think this lisp routine will do what you want: http://lee-mac.com/numinc.html
    R.K. McSwain | CAD Panacea |

  6. #6
    All AUGI, all the time
    Join Date
    2003-07
    Posts
    561
    Login to Give a bone
    0

    Default Re: Numbering lisp routine

    This does circle or sq and numbers or alpha A B C etc

    Code:
    ; bubble pt num
    ; BY ALAN H AUG 2014
    
    (defun make_circle ()
      (entmake (list (cons 0 "CIRCLE")
    	 (cons 8 "0")
    	 (cons 10 (list 0 0 0))
    	 (cons 40 3.25)		; rad
    	 (cons 210 (list 0 0 1))
    	 (cons 62 256)
    	 (cons 39 0)
    	 (cons 6 "BYLAYER")
       )
      )
    )					; DEFUN
    
    (defun make_sq ()
      (setq	vertexList
      (list
      (list -3.25 -3.25 0.)
      (list 3.25 -3.25 0.)
      (list 3.25 3.25 0.)
      (list -3.25 3.25 0.)
      ))
      (entmake
        (append 
        (list '(0 . "LWPOLYLINE")
        '(100 . "AcDbEntity")
        '(100 . "AcDbPolyline")
        (cons 90 (length vertexList))
        (cons 70 1)			; 1 closed : 0 open
        (cons 8 "0")
        (cons 38 0.0)
        (cons 210 (list 0.0 0.0 1.0))
        )
        (mapcar '(lambda (pt) (cons 10 pt)) vertexList)
        )
      )
    )					; defun
    
    (defun Make_bubble ( )
    
      (entmake (list (cons 0 "BLOCK")
        (cons 2 Blkname)
        (cons 70 2)
        (cons 10 (list 0 0 0))
        (CONS 8 "0")
      ))
    
      (if (= resp "C")
      (make_circle)
      (make_sq)
      )
    
      (entmake (list (cons 0 "ATTDEF")
           (cons 8 "0")
           (cons 10 (list 0 0 0))
           (cons 1 "1")		; default value
           (cons 2 blkname)		; nblock name
           (cons 3 "Ptnum")		; tag name
           (cons 6 "BYLAYER")
           (cons 7 "STANDARD")	;text style
           (cons 8 "0")		; layer
           (cons 11 (list 0.0 0.0 0.0)) ; text insert pt
           (cons 39 0)
           (cons 40 3.5)		; text height
           (cons 41 1)		; X scale
           (cons 50 0)		; Text rotation
           (cons 51 0)		; Oblique angle
           (cons 62 256)		; by layer color 
           (cons 70 0)
           (cons 71 0)		;Text gen flag
           (cons 72 1)		; Text Justify hor 1 center
           (cons 73 0)		; field length
           (cons 74 2)		; Text Justify ver 2 center
           (cons 210 (list 0 0 1))
      ))
    
      (entmake (list (cons 0 "ENDBLK")))
      (princ)
     
    )
    
    (defun C:AHbub (/ ptnum ptnumb pt pt2 oldsnap chrnum sc curspace)
      (if (or (/= 1 (getvar 'cvport))(= "Model" (getvar 'ctab)))
        (setq sc (/ (getreal "\nEnter plotting scale") 1000.0 ))
        (setq sc 1.0)
      )
    
      (setq oldsnap (getvar "osmode"))
      (setvar "textstyle" "standard")
    
    (if (not AH:getvalsm)(load "Multi Getvals.lsp"))
    (setq ptnum (nth 0  (AH:getvalsm (list "Enter Pt Number or alpha" "eg 1 a A " 5 4 "11"))))
    
    
      (setq chrnum (ascii (substr ptnum 1 1))) ; 1st character is number
      (if (< chrnum 58)
      (setq ptnumb (atof ptnum))		;convert back to a number 
      )
    
      (while (setq pt (getpoint "\Pick end of line or Enter to exit"))
        (setq pt2 (polar pt (/ pi 2.0) 3.25))
        (setvar "osmode" 0)
    
        (if	(< chrnum 58)
          (progn
    	(command "-insert"
    		 blkname
    		 pt
    		 sc
    		 ""
    		 0
    		 (rtos ptnumb 2 0)
    	)
    	(setq ptnumb (+ ptnumb 1))
          )
          (progn
    	(command "-insert"
    		 blkname
    		 pt
    		 sc
    		 ""
    		 0
    		 (chr chrnum)
    	)
    	(setq chrnum (+ chrnum 1))
          )
        )
        (command "move" "L" "" pt pt2)
        (setvar "osmode" 1)
      )
    
      (setvar "osmode" oldsnap)
      (princ)
    )					; end defun
    
    ;;;;;; 
    ; program starts here checking 
    
    
    
    (alert "Type AHBub to repeat\n\nYou can do alpha's or numbers\n\nSquare or circles")
    
    (if (not AH:Butts)(load "Multi Radio buttons.lsp"))
    (if (= ahbut nil)(setq ahbut 1))
    (setq resp (ah:butts ahbut "h"  '("Do you want Circle  or square " "C" "S")))
    
    (if (or (= resp "C") (= resp nil))
      (setq blkname "SETOUT_POINT_NO")
      (setq blkname "SETOUT_POINT_NOSQ")
    )
    
    (setq att (getvar 'attdia))
    (setvar 'attdia 0)
    (if (/= (tblsearch "BLOCK" blkname) NIL)
    (PRINC "FOUND")			; block exists
    (Make_bubble)
    )
    
    (C:AHBUB)
    Attached Files Attached Files

  7. #7
    Member
    Join Date
    2013-11
    Posts
    36
    Login to Give a bone
    0

    Default Re: Numbering lisp routine

    Another approach would be to have the code insert a block with attributes and supply the incremental value. I handle lot numbering that way. Just a thought.

Similar Threads

  1. Replies: 3
    Last Post: 2017-11-17, 06:06 PM
  2. Lisp routine in a Lisp routine
    By jayhay35365091 in forum AutoLISP
    Replies: 8
    Last Post: 2013-10-09, 02:30 PM
  3. Run Lisp Routine From Another Lisp Routine
    By mwilson in forum AutoLISP
    Replies: 7
    Last Post: 2013-07-25, 02:46 PM
  4. Combine three lisp routine into one routine.
    By BrianTFC in forum AutoLISP
    Replies: 1
    Last Post: 2012-02-08, 12:14 PM
  5. Door Numbering based on Room Numbering
    By heather.leibman in forum Revit Architecture - General
    Replies: 5
    Last Post: 2011-12-05, 07:59 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
  •