![]() |
桩号标注的疑惑
桩号标注的疑惑
www.dimcax.com 桩号标注的疑惑 请高手研究下这段程序,在曲线上标注桩号时,怎样控制标注的方向,很多时候自动标注出来的方向同要求的方向相反. (defun c:bz () (if (= (tblsearch "layer" "道路中心线") nil) (command "layer" "m" "道路中心线" "c" 1 "道路中心线" "") ) (if (= (tblsearch "layer" "道路桩号") nil) (command "layer" "m" "道路桩号" "c" 7 "道路桩号" "") (command "layer" "s" "道路桩号" "") ) (setvar "cmdecho" 0) (setq os (getvar "osmode")) (setvar "osmode" 0) (setq str_2 (strcat "\n给定文字高度<" (rtos (getvar "textsize") 2) ">:")) (setq th (getreal str_2)) (if (= th nil) (setq th (getvar "textsize"))) (setq zk (getreal "\n给定文字宽度比例:<0.67>")) (if (= zk nil) (setq zk 0.67)) (command "-style" "道路桩号" "仿宋" "" zk "" "n" "n") (if (= nil (setq dist (getreal "\n给定间距<20m>:"))) (setq dist 20.0)) (if (setq en (car (entsel "\n选择路径曲线:"))) (redraw en 3) (*error* "\n没有选到曲线!") ) (command "change" en "" "p" "la" "道路中心线" "") ;;删除原来标注 (command "layer" "f" "*" "") (command "erase" "all" "") (command "layer" "t" "*" "") ;;标注桩号间距 (setq nn 0) (while (setq pt1 (vlax-curve-getpointatdist en (* nn dist))) (setq zhz (* nn dist)) (setq nn1 (fix (/ zhz 1000.0))) (setq nn2 (- zhz (* 1000.0 nn1))) (if (= nn2 0.0) (setq str_1 "+000")) (if (and (> nn2 0.0) (< nn2 100.0)) (setq str_1 (strcat "+0" (rtos nn2 2 3) ))) (if (>= nn2 100.0) (setq str_1 (strcat "+" (rtos nn2 2 3) ))) (if (= (fix (/ nn2 100.0)) (/ nn2 100.0)) (setq str_1 (strcat (rtos nn1 2) str_1 )) ) (setq ang (a-get-angle en pt1)) (setq pt2 (polar pt1 (+ (/ pi 2) ang) (* th 0.5))) (setq pt3 (polar pt1 (+ (* pi 1.5) ang) (* th 0.5))) (if (= (fix (/ nn2 100.0)) (/ nn2 100.0)) (setq pt4 (polar pt1 (+ (* pi 1.5) ang) (* th (* 1.65406 zk)))) (setq pt4 (polar pt1 (+ (* pi 1.5) ang) (* th (* 1.3582 zk)))) ) ;;; (command "pline" p3 w "" 0.25 "" 0.25 "" pt2) (command "line" pt3 pt2 "") (setq ang2 (angtos (angle pt1 pt2)0 4) ) (command "text" pt4 th ang2 str_1 ) (setq nn (1+ nn)) ) (redraw en 4) (setvar "osmode" os) (princ) ) ;切线角度pt-ang (defun a-get-angle(ename point / p1 v1 pt-ang) (setq v1 (vlax-curve-getfirstderiv ename (vlax-curve-getparamatpoint ename point)) p1 (mapcar '+ point v1) pt-ang (angle point p1)) pt-ang ) d 已解决,呵呵! d 这个程序怎么不能用啊? d |
所有的时间均为北京时间。 现在的时间是 10:49 AM. |