Today’s featured routine is an example from a book about Visual Lisp Programming and was an example that we learned from as an example in class when I was in school.
It is a simple routine that lets you incrementally array a row of numbers. This might be helpful for creating numbered lists or placing numbers along a line…
Lee-Mac has made some pretty powerful numbering routines that can do a lot more than this routine does. These routines can be found here:
http://lee-mac.com/incrementalarray.html
http://lee-mac.com/numinc.html
Here’s how:
- NUMROW <enter>
- Specify the first text location – this will be # zero
- Specify the distance – either by picking 2 points on screen or by entering the distance in the command line
- Specify the angle – either by picking 2 points on screen or by entering the angle in the command line
- Specify the ending number of the array
~enjoy
; Example from book: Visual Lisp Programming ; NumRow.lsp by Cal Clater ; ; 1/12/xx ; ; Purpose: To create an evenly spaced row of incrementally increasing numbers, ; such as might be required for a chart or graph. The beginning number is zero ; and the last number is as specified. ; (defun C:NumRow (/ PT1 DST DIR NN HN) (setvar "CMDECHO" 0) (setvar "BLIPMODE" 0) (princ "\nText will be center justified.") (setq PT1 (getpoint "\nstart point of number row: ") DST (getdist "\nDistance between number: ") DIR (getorient "\nAngle: ") NN 0 HN (getint "\nNumber sequence to be 0 through: ") ) (command "TEXT" "C" PT1 "" "" "0") (repeat HN (setq PT1 (polar PT1 DIR DST)) (command "TEXT" "C" PT1 "" "" (itoa (setq NN (+ NN 1)))) ) )
some modifications to allow an increment, setting the initial number and height of the text
; Example from book: Visual Lisp Programming
; NumRow.lsp by Cal Clater
;
; 1/12/xx
;
; Purpose: To create an evenly spaced row of incrementally increasing numbers,
; such as might be required for a chart or graph. The beginning number is zero
; and the last number is as specified.
;
(defun C:NumRow (/ PT1 DST DIR NN HN INC TH)
(setvar “CMDECHO” 0) (setvar “BLIPMODE” 0)
(princ “\nText will be center justified.”)
(setq PT1 (getpoint “\nstart point of number row: “)
DST (getdist “\nDistance between number: “)
DIR (getorient “\nAngle: “)
NN (getint “\nStart number: “)
INC (getint “\nIncrement number: “)
HN (getint “\nFinish number: “)
HN (- HN 1)
TH (getreal “\nText height: “)
)
(command “TEXT” “C” PT1 TH “” (itoa NN ))
(repeat HN
(setq PT1 (polar PT1 DIR DST))
(command “TEXT” “C” PT1 “” “” (itoa (setq NN (+ NN INC))))
)
)
Cool – Thanks for the updated code
~Greg
Ask about custom Incremental Array
——————————————–
Hello Experts ^^
I was poor foreign language, so I’ll be brief
Auto Lisp in Links http://lee-mac.com/incrementalarray.html
How can you help me add custom increment increase
Increments will be 2, 3 or more, not 1 as default
Please mail me back in Lisp mail huaductiep3990hp@gmail.com
Thank you very much experts!