Airworks Posted July 6, 2019 Posted July 6, 2019 I have a list routine that adds the bearing and distance on a specific layer to a line, however, I want the bearing to display with the degrees symbol not the letter d. I'm not sure if I can use the (vl-string-subst "%%d" "d" feature with a get selection or where to put this in my routine?) The lisp routine is below defun c:lbl(/ oldlay part theight scaleget la_text laname) ; ADDS LENGTH AND BEARING TO LINE (command "ucs""w") (setq Surv-text_layer_name "SurvTXT") (setq Surv-text_layer_colour 7) (setup_layers) (SETQ PORTVAL (GETVAR "CVPORT")) (setq part (getvar "dimscale")) (setq theight (* part 3)) (setq oldlay (getvar "clayer")) (command ".LAYER" "m" Surv-text_layer_name "C" Surv-text_layer_colour "" "") ; IF PAPERSPACE DONT MULTIPLY TEXT HEIGHT BY DIMSCALE (IF (= PORTVAL 1) (command ".DTEXT" "S" "STANDARD" pause 3 PAUSE) ) (IF (> PORTVAL 1) (PROGN (setq scaleget (getvar "dimscale")) (if (< scaleget 2.0)s (progn (setq scaleget (* scaleget 1000)) );end progn );endif (setq la_text (itoa (fix scaleget))) (setq laname (strcat Surv-text_layer_name "_1-" la_text)) (command "layer" "m" laname "c" Surv-text_layer_colour "" "") );END PROGN ) (prompt "\nSelect lines to label: ") (setq ls (ssget) len (sslength ls) ctr 0) (while (< ctr len) (setq lin (ssname ls ctr) p1 (cdr (assoc 10 (entget lin))) p2 (cdr (assoc 11 (entget lin))) p3 (polar p1 (angle p1 p2) (/ (distance p1 p2) 2)) p4 (polar p3 (+ (angle p1 p2) (/ pi 2)) (/ 0.01 (getvar "CANNOSCALEVALUE"))) p5 (polar p3 (- (angle p1 p2) (/ pi 2)) (/ 0.01 (getvar "CANNOSCALEVALUE"))) ) (setq dir (angtos (angle p1 p2) 1 4) dis (rtos (distance p1 p2) 2 3) tang (angtos (angle p1 p2) 2 4) ) (command "text" "j" "bc" p4 theight tang dir) (command "text" "j" "tc" p5 theight tang dis) (command ".rotate" pause pause pause p3 "180") (setq ctr (1+ ctr)) (command "ucs""v") (command ".layer" "s" oldlay "") );end while (princ) );end function Quote
Emmanuel Delay Posted July 8, 2019 Posted July 8, 2019 Like this ... (setq dir (angtos (angle p1 p2) 1 4) dis (rtos (distance p1 p2) 2 3) tang (angtos (angle p1 p2) 2 4) ) (setq dir (vl-string-subst "%%d" "d" dir)) ;; display with the degrees symbol not the letter d. (command "text" "j" "bc" p4 theight tang dir) (command "text" "j" "tc" p5 theight tang dis) (command ".rotate" pause pause pause p3 "180") ... 1 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.