- (defun c:DDD ( / a_lst b_lst obj len pt idx mtxt)(setq a_lst (list "PIPE" "PP 20*2.3" "PP 25*2.5" "PP 32*3.0" "PP 40*3.7" "PP 50*4.6" "PP 63*5.8" "1 1/2" "2" "3" "4" "5"))(setq b_lst (list "PP 20*2.3" "PP 25*2.5" "PP 32*3.0" "PP 40*3.7" "PP 50*4.6" "1 1#4" "1 1#2" "2" "3" "4" "5"))(setq obj (vlax-ename->vla-object (car (entsel "\nSelect Line : "))) len (rtos (vlax-get-property obj 'length) 2 0))(setq pt (mapcar '(lambda (x y) (/ (+ x y) 2.0)) (vlax-get obj 'startpoint) (vlax-get obj 'endpoint)))(setq idx (ah:butts 1 "v" a_lst)) (cond ( (setq mtxt (strcat "L=" len "\\P" (nth idx b_lst) )) (vl-position idx '(0 1 2 3)) ) ( (setq mtxt (strcat (substr "L=" len "\\P" (nth idx b_lst) 1 1) (substr (nth idx b_lst) 3) )) (vl-position idx '(5 6)) ) (t (setq mtxt (strcat "L=" len "\\P" (nth idx b_lst) ))))(command "_mleader" pt pause mtxt))
我需要帮助。我想在最后四舍五入。例如,如果行长为 173,最接近 175,则结果为 175。如果行长为 178,则结果为 180。 |