linheyuanpcb 发表于 2012-11-28 11:01:52

请帮忙改成文字自动放置在直线中心位上

本帖最后由 linheyuanpcb 于 2012-11-28 11:17 编辑

(defun c:TffT (/ I Ecurve tlen ss n sumlen)
(setq I 0)
(while (setq E (entsel))
    (setq E (cdr (assoc 10 (entget (car E))))
          I (1+ I)
    )
    (if (> I 1)
      (command "_non" E)
      (command "_.LINE" "_non" E)
    )
                                                          )
                                                                        (command "")
                                                                (xccc)
          (princ)
)
(defun xccc (/ curve tlen ss n sumlen)
(vl-load-com)
(setq sumlen 0)
      (setq ss (ssget "l"))
(setq n 0)
(repeat (sslength ss)
    (setq curve (vlax-ename->vla-object (ssname ss n)))
    (setq tlen (vlax-curve-getdistatparam curve (vlax-curve-getendparam curve) ) )
    (setq sumlen (+ sumlen tlen))
    (setq n (1+ n))
)
      (setq pl (getpoint "\n指定文字位置:"))
      (command "text" "j" "m" pl "2.2" "0" (strcat(rtos sumlen 2 2)) )
)
请各位帮忙优化改进一下,
改成选完两个圆事完线后就将长度标注在直线的中心上方2mm处
然后继续重复以上动作 谢谢


zyhandw 发表于 2012-11-28 11:33:45

(command "_non" E)是什么命令?能执行吗?没看明白

chenbh2 发表于 2012-11-28 13:54:43

文字按线对齐就可以了

linheyuanpcb 发表于 2012-11-28 13:57:53

chenbh2 发表于 2012-11-28 13:54 static/image/common/back.gif
文字按线对齐就可以了

同在是要指定点放文字,要对齐是不是得放置后再对齐?
这样步骤会更多了?

品茗新秀 发表于 2013-1-1 10:53:37

这个程序非常有适用性,可惜需高手优优

chenbh2 发表于 2014-9-5 15:47:47

期待高手出现呀!
页: [1]
查看完整版本: 请帮忙改成文字自动放置在直线中心位上