LISP Routine
LISP Routine
(OP)
Hi.
I use AutoCAD on daily bases where I draw a mass quantity of lines that represent piping networks. I am counting the total individual length pretty much by hand. I have been doing this for a while ever since I got out of college.
I need LISP routine that labels length of individual lines by selecting them preferably in mass quantity.
For examples, 1 ft 1 inches to 1-1, etc.
If anyone out there who reads this message, please help me find the LISP routine. I will be very appreciated.
,nathan
I use AutoCAD on daily bases where I draw a mass quantity of lines that represent piping networks. I am counting the total individual length pretty much by hand. I have been doing this for a while ever since I got out of college.
I need LISP routine that labels length of individual lines by selecting them preferably in mass quantity.
For examples, 1 ft 1 inches to 1-1, etc.
If anyone out there who reads this message, please help me find the LISP routine. I will be very appreciated.
,nathan





RE: LISP Routine
(DEFUN C:LL2 ()
(setq osm (getvar "osmode"))
(setvar "osmode" 0)
(prompt "\nSelect all objects to measure: ")
(setq ss (ssget))
(while (> (sslength ss) 0)
(setq en (ssname ss 0)
ed (entget en)
et (cdr (assoc '0 ed))
)
(cond
((= et "LINE") (ShowLength))
((or
(/= et "LINE")
)
(ssdel en ss)
)
)
)
(setvar "osmode" osm)
(princ)
)
(defun ShowLength ()
(setq pt1 (cdr (assoc '10 ed))
pt2 (cdr (assoc '11 ed))
Pt3 (List (/ (+ (Car pt1) (Car pt2)) 2.0) (/ (+ (Cadr Pt1) (Cadr pt2)) 2.0))
Llen (distance pt1 pt2)
Lang (angle pt1 pt2)
)
(COMMAND "Text" "BC" pt3 "" Lang (rtos Llen))
(ssdel en ss)
)
RE: LISP Routine
and download Paul Turvill's TLEN.LSP
Tracy Lincoln, TLConsulting http://tlconsulting.blogspot.com
RE: LISP Routine
I loaded IFR's code and ran it on my AutoCad 2004 and windowed all lines that I wanted length to be labled. I noticed I wasn't able to aline direction of length label to vertical lines, although the routine worked great in labeling horizontal ones. IFRs, another question I have is due to complexity of drawings that I deal with, can LISP routine be written to strip the ft and inch marks from labels. In other word,(1'-1") to (1-1), etc.
Other than that, the routine is great!
,nathan
RE: LISP Routine