The routine below is for labelling contours.
I have tried to run the program, but it keeps
coming up with an error after the "digitize a point
to the right" command. AutoCAD returns this message
"error: bad argument type: numberp: nil". Also,
is it possible to modify the program to be able to
automatically pick the z value of the pline in stead
of manually entering the text?? Any help would be greatly appreciated!!!
Al
;*******CONTOUR ELEVATION LABELING ROUTINE******
; ENT - Contour line being labeled
; IPT - Left insertion point of label
; ANG - Insertion angle of label
; DST - Distance to break contour line
; EL - Elevation of selected contour
;-----------------------------------------------
(defun C:CTEXT (/ ENT IPT ANG DST EL)
;-----INITILAIZE PROGRAM----
(setq VARLST (list "OSMODE" "CLAYER" "TEXTSTYLE"))
(start)
(setvar "OSMODE" 512)
(setvar "FLATLAND" 0)
(setq ENT (entsel "\nDigitize the left insertion point: ") IPT (cadr ENT) ENT (car ENT)) (setvar "OSMODE" 0) ;-----GET ANGLE & ELEVATION--------- (setq ANG (getangle IPT "\nDigitize a point to the right: ") EL (rtos (cadddr (assoc 10 (entget ENT))) 2 0)) ;----BREAK THE LINE---------------- (setq DST (* SF (* (strlen EL) 0.10))) (command "break" ENT IPT (polar IPT ANG DST)) ;-----------------INSERT THE TEXT------------------------ (command "layer" "m" "TXT100" "") (command "text" "s" "VLEROY" "m" (polar IPT ANG (/ DST 2)) (* SF 0.1) (angtos ANG 0 4) EL) (done)
)
I have tried to run the program, but it keeps
coming up with an error after the "digitize a point
to the right" command. AutoCAD returns this message
"error: bad argument type: numberp: nil". Also,
is it possible to modify the program to be able to
automatically pick the z value of the pline in stead
of manually entering the text?? Any help would be greatly appreciated!!!
Al
;*******CONTOUR ELEVATION LABELING ROUTINE******
; ENT - Contour line being labeled
; IPT - Left insertion point of label
; ANG - Insertion angle of label
; DST - Distance to break contour line
; EL - Elevation of selected contour
;-----------------------------------------------
(defun C:CTEXT (/ ENT IPT ANG DST EL)
;-----INITILAIZE PROGRAM----
(setq VARLST (list "OSMODE" "CLAYER" "TEXTSTYLE"))
(start)
(setvar "OSMODE" 512)
(setvar "FLATLAND" 0)
(setq ENT (entsel "\nDigitize the left insertion point: ") IPT (cadr ENT) ENT (car ENT)) (setvar "OSMODE" 0) ;-----GET ANGLE & ELEVATION--------- (setq ANG (getangle IPT "\nDigitize a point to the right: ") EL (rtos (cadddr (assoc 10 (entget ENT))) 2 0)) ;----BREAK THE LINE---------------- (setq DST (* SF (* (strlen EL) 0.10))) (command "break" ENT IPT (polar IPT ANG DST)) ;-----------------INSERT THE TEXT------------------------ (command "layer" "m" "TXT100" "") (command "text" "s" "VLEROY" "m" (polar IPT ANG (/ DST 2)) (* SF 0.1) (angtos ANG 0 4) EL) (done)
)