Auto Numbering Along a Line in PTCAD (Using LISP)
When working with drawings such as layout grids, parking numbers, seat numbers, column numbering, or coordinate markers, we often need to place numbers evenly spaced along a straight line. Doing this manually can be slow and error-prone.
This simple LISP routine helps automate the process.
What This LISP Does
The command allows the user to:
-
Specify the number of texts
-
Define the starting number
-
Set the text height
-
Pick a start point and end point
The program will then:
-
Place the first number at the start point
-
Place the last number at the end point
-
Automatically divide the space evenly
-
Insert all numbers in sequence
Example result:
1 ---- 2 ---- 3 ---- 4 ---- 5
All numbers are spaced equally along the selected line.
Why This Is Useful
This tool is especially helpful for tasks such as:
-
Column numbering in structural drawings
-
Parking lot numbering
-
Seat numbering in halls or stadiums
-
Grid labeling
-
Survey or coordinate markers
-
Repetitive annotation tasks
Instead of calculating spacing manually, the LISP automatically divides the distance and places the numbers correctly.
Tips for Best Use
✔ Use Object Snap (OSNAP)
Snap precisely to the intended start and end points.
✔ Use appropriate text height
Choose a height that matches the drawing scale.
✔ Plan the numbering direction
Numbers will increase from the first picked point toward the second point.
✔ Use it with construction lines
You can draw a temporary line as a guide and erase it afterward.
✔ Works in all CAD version support LISP
Because the routine uses standard LISP (no Visual LISP functions).
Productivity Benefit
For example:
Manual work
Place text → copy → move → edit numbers → repeat
Using this LISP
Pick start → pick end → done
What might take 2–3 minutes manually can be done in just a few seconds.
Here is VDO Link
Below is source code.
Command to run is NLL
(setq n (getint "\nNumber of texts: "))
(setq startnum (getint "\nStarting number: "))
(setq hgt (getreal "\nText height: "))
(setq p1 (getpoint "\nPick start point of line: "))
(setq p2 (getpoint p1 "\nPick end point of line: "))
(setq dx (/ (- (car p2) (car p1)) (- n 1)))
(setq dy (/ (- (cadr p2) (cadr p1)) (- n 1)))
(setq i 0)
(while (< i n)
(setq px (+ (car p1) (* i dx)))
(setq py (+ (cadr p1) (* i dy)))
(command "TEXT" (list px py) hgt "0" (itoa (+ startnum i)))
(setq i (+ i 1))
)
(princ)
)