luntan624 发表于 2011-1-10 09:28:52

曲线上图块距离的标注,有瑕疵,请帮忙

有的想法是:标注能沿曲线偏离一定的数值且对齐,可是我这个不能实现对齐,请高手帮忙解决哦,谢谢!
如果再能实现图块编号就更好了?顺便帮个忙吧。
(Defun c:qxbz(/ en enobj ss add_h iaaapaaa ptaaa dist1 list1 list1_indx j k ccc pt_ccc ddd pt_ddd dist_span span_label_middle span_label )
   (SETVAR "DIMZIN" 8)
   (setq en (car (entsel "\n选择基线:")))
(setq enobj (vlax-ename->vla-object en))
(setq ss (ssget));;;
;;;(setq label_point(getpoint "选择标注方向"))
(setq add_h(getreal "标注偏移量<15>"))
;;;(if (= add_h "")
   ;;;   (setq add_h 15)
;;;);;;if
(setq i 0)

(while (< i (sslength ss))
(progn
(setq aaa (ssname ss i))
(setq paaa (cdr (assoc 10 (entget aaa))))
(setq ptaaa (vlax-curve-getClosestPointTo enobj paaa))
(setq dist1 (vlax-curve-getDistAtPoint enobj ptaaa))
(setq list1 (cons dist1 list1))
(setq i (+ i 1))
)
);;;while
(setq list1_indx (vl-sort-i list1 '<))

(setq j 0)
(while (< j (length list1_indx))
(progn
(setq k (+ j 1))

(setq ccc (nth (nth j list1_indx ) list1 )
      pt_ccc (vlax-curve-getPointAtDist enobj ccc)
      ddd (nth (nth k list1_indx ) list1 )
      pt_ddd (vlax-curve-getPointAtDist enobj ddd)
      dist_span(rtos (- ddd ccc) 2 2)
      ;;;span_label_middle(vlax-curve-getPointAtDist enobj (+ ccc (/ (atof dist_span) 2)))
      ;;;span_label (list (- (car span_label_middle) (* add_h (cos (angle pt_ccc pt_ddd))))(+ (cadr span_label_middle) (* add_h (sin (angle pt_ccc pt_ddd)))) )
      span_label (list (car pt_ccc) (+ (cadr pt_ddd) add_h))
)
(command "_dimaligned" pt_ccc pt_ddd "T" dist_spanspan_label)      

(setq j (+ j 1))
)
);;;while

页: [1]
查看完整版本: 曲线上图块距离的标注,有瑕疵,请帮忙