自贡黄明儒 发表于 2010-11-13 19:17:00

弧长标注、直线标注、样条曲线长度标注.....

我使用的autoCAD2004,09太慢了。<br/>我自己为2004编写了一个标注,在09下也可用

apricot125 发表于 2018-5-1 22:35:50

学习了,modemacro用法,LT:还不懂

创意年华 发表于 2018-4-24 17:38:51

不错啊!支持一下

461045462 发表于 2010-11-13 23:38:00

<p>收藏了</p>
<p>享受一下楼主的分享</p>
<p>请问:不知弧长标注时能否做到没有圆心的一个小点?</p>
<p>望指教</p>
<p>谢谢楼主</p>

自贡黄明儒 发表于 2010-11-14 15:43:00

本程序只是调用了<font face="Verdana">_dimaligned和<font face="Verdana">&nbsp;_dimangular</font>,然后计算两点间长度,至于你说的那个小点,可能是存在的</font>

461045462 发表于 2010-11-14 19:17:00

<p>&nbsp;</p>
<p>谢谢楼主</p>
<p>感觉还好用</p>
<p>&nbsp;</p>

lrd1861 发表于 2010-11-16 11:55:00

收藏了 感谢分享

明_明 发表于 2010-11-16 12:57:00

"样条曲线长度标注",太感谢了

zgssd 发表于 2010-11-18 10:25:00

<img alt="" src="http://bbs.mjtd.com/Skins/default/topicface/face1.gif"/>试了一下,提示选择直线、圆弧、圆标注,不能标注样条曲线

自贡黄明儒 发表于 2010-11-19 20:17:00

本帖最后由 自贡黄明儒 于 2010-12-9 19:30 编辑 <br /><br /><P>对于样条曲线相交的两条线,如果不平行,则调用<FONT face=Verdana>&nbsp;_dimangular</FONT>,是可以显示两交点之间距离的</P>
<P>;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;弧长标注<BR>(defun C:CC ()<BR>&nbsp; (setvar "modemacro" "自贡运机集团")<BR>&nbsp; (lt:error-init (list nil 0 nil))<BR>&nbsp; (HH:cc)<BR>&nbsp; (lt:error-restore)<BR>&nbsp; (gc)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;;释放内存<BR>&nbsp; (princ<BR>&nbsp;&nbsp;&nbsp; "\n自贡运机集团 黄明儒:We must do the best with what God gave us!"<BR>&nbsp; )<BR>&nbsp; (princ)<BR>)</P>
<P>;;;;;;;;;;;;;;;;;;;弧长标注<BR>(defun HH:cc ( / ANG1 ANG2 BOOL DXF ENT1 NEW OBJ PARAM POINT1 POINT2 VAR1 VAR2)</P>
<P>&nbsp; (setvar "cmdecho" 0)&nbsp;&nbsp;&nbsp;;不显示命令提示<BR>&nbsp; (setq var1 (getvar "osmode"))<BR>&nbsp; (setq var2 (getvar "autosnap"))<BR>&nbsp; (setvar "autosnap" 39)<BR>&nbsp; (vl-load-com)<BR>&nbsp; (setq bool T)<BR>&nbsp; (while bool<BR>&nbsp;&nbsp;&nbsp; (setq ent1 (entsel "\n&gt;点击欲标注长度的曲线:"))<BR>&nbsp;&nbsp;&nbsp; (if&nbsp;ent1<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (setq bool nil)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (princ "\n你点击的不是曲线,请点击曲线:")<BR>&nbsp;&nbsp;&nbsp; )<BR>&nbsp; )<BR>&nbsp; (setq obj (car ent1))<BR>&nbsp; (setq obj (vlax-ename-&gt;vla-object obj))</P>
<P>&nbsp; (setvar "osmode" 33)&nbsp;&nbsp;&nbsp;;交点或者端点<BR>&nbsp; (setq point1 (getpoint "\n&gt;&gt;取得标注的第1个交点:"))<BR>&nbsp; (setq param (vlax-curve-getParamAtPoint obj point1))<BR>&nbsp; (setq&nbsp;ang1<BR>&nbsp; (angle&nbsp;(setq point1 (vlax-curve-getpointatparam obj param))<BR>&nbsp;&nbsp;(mapcar '+ point1 (vlax-curve-getFirstDeriv obj param))<BR>&nbsp; )<BR>&nbsp; )<BR>&nbsp; (setq point2 (getpoint "\n&gt;&gt;&gt;取得标注的第2个交点:"))<BR>&nbsp; (setq param (vlax-curve-getParamAtPoint obj point2))<BR>&nbsp; (setq&nbsp;ang2<BR>&nbsp; (angle&nbsp;(setq point2 (vlax-curve-getpointatparam obj param))<BR>&nbsp;&nbsp;(mapcar '+ point2 (vlax-curve-getFirstDeriv obj param))<BR>&nbsp; )<BR>&nbsp; )<BR>&nbsp; (princ "\n&gt;&gt;&gt;&gt;标注放置点:")<BR>&nbsp; (setq bool (= ang1 ang2))<BR>&nbsp; (if bool<BR>&nbsp;&nbsp;&nbsp; (command "dimaligned"<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; point1<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; point2<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; pause<BR>&nbsp;&nbsp;&nbsp; )<BR>&nbsp;&nbsp;&nbsp; (command "dimangular"<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; point1<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; point2<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; pause<BR>&nbsp;&nbsp;&nbsp; )<BR>&nbsp; )<BR>&nbsp; (setq dxf (entget (entlast)))<BR>&nbsp; (setq&nbsp;new (- (vlax-curve-getDistAtPoint obj point1)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (vlax-curve-getDistAtPoint obj point2)<BR>&nbsp;&nbsp;&nbsp;&nbsp; )<BR>&nbsp; )<BR>&nbsp; (setq new (abs new))<BR>&nbsp; (if (&lt;= (abs (- (cdr (assoc 42 dxf)) new)) 0.001)<BR>&nbsp;&nbsp;&nbsp; (setq bool t)<BR>&nbsp;&nbsp;&nbsp; (setq bool nil)<BR>&nbsp; )<BR>&nbsp; (setq new (rtos new 2 (getvar "dimdec")))<BR>&nbsp; (if bool<BR>&nbsp;&nbsp;&nbsp; (setq new (strcat "{\\fSimSun|b0|i0|c134|p2;}" new))<BR>&nbsp;&nbsp;&nbsp; (setq new (strcat "{\\Fgdt.shx;^}\\P" new))<BR>&nbsp; )<BR>&nbsp; (setq dxf (subst (cons 1 new) (assoc 42 dxf) dxf))<BR>&nbsp; (entmod dxf)</P>
<P>&nbsp; (setvar "autosnap" var2)<BR>&nbsp; (setvar "osmode" var1)</P>
<P>)<BR>;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;弧长标注</P>

自贡黄明儒 发表于 2010-12-9 19:31:05

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;弧长标注
(defun C:CC ()
(setvar "modemacro" "自贡运机集团")
(lt:error-init (list nil 0 nil))
(HH:cc)
(lt:error-restore)
(gc)                                        ;释放内存
(princ
    "\n自贡运机集团 黄明儒:We must do the best with what God gave us!"
)
(princ)
)

;;;;;;;;;;;;;;;;;;;弧长标注
(defun HH:cc (/             ANG1   ANG2   BOOL          DXF       E        E1   ENTS
              H             N          NEW           OBJ          P1       P3        PARAMPAUSE
              POINT1 POINT2 STD1   VAR1          VAR2
             )

(setvar "cmdecho" 0)                        ;不显示命令提示
(setq var1 (getvar "osmode"))
(setq var2 (getvar "autosnap"))
(setvar "autosnap" 39)
(setvar "osmode" 33)                        ;交点或者端点
(vl-load-com)

(setq std1 (list ()))                        ;空表
(setq point1 (getpoint "\n>取得标注的第1个交点:"))
(setq        h (* (/ (getvar "viewsize") (cadr (getvar "screensize")))
             (getvar "pickbox")
          )
)
(setq        p1 (mapcar '- point1 (list h h 0.))
        p3 (mapcar '+ point1 (list h h 0.))
)
(setq        ents (ssget "C" p1 p3)
        n    0
)
(repeat (sslength ents)
    (setq e (ssname ents n))
    (setq e1 (entget e))
    (if        (not (= "DIMENSION" (cdr (assoc 0 e1))))
      (setq std1 (append std1 (list e)))
    )
    (setq n (1+ n))
)
(setq point2 (getpoint "\n >>取得标注的第2个交点:"))
(setq        p1 (mapcar '- point2 (list h h 0.))
        p3 (mapcar '+ point2 (list h h 0.))
)
(setq        ents (ssget "C" p1 p3)
        n    0
)
(setq bool T)
(while bool
    (setq obj (ssname ents n))
    (if        (setq new (member obj std1))
      (setq bool nil)
    )
    (setq n (1+ n))
)
(setq obj (vlax-ename->vla-object obj))
(setq param (vlax-curve-getParamAtPoint obj point1))
(setq        ang1
       (angle        (setq point1 (vlax-curve-getpointatparam obj param))
                (mapcar '+ point1 (vlax-curve-getFirstDeriv obj param))
       )
)

(setq param (vlax-curve-getParamAtPoint obj point2))
(setq        ang2
       (angle        (setq point2 (vlax-curve-getpointatparam obj param))
                (mapcar '+ point2 (vlax-curve-getFirstDeriv obj param))
       )
)
                                        ;(princ "\n>>>>标注放置点:")
(setvar "autosnap" var2)
(setvar "osmode" var1)
(setq bool (getpoint "\n>>>>标注尺寸放置点:"))
(if (= ang1 ang2)
    (command "dimaligned" point1 point2 bool)
    (command "dimangular" point1 point2 bool)
)
(setq dxf (entget (entlast)))
(setq        new (- (vlax-curve-getDistAtPoint obj point1)
             (vlax-curve-getDistAtPoint obj point2)
          )
)
(setq new (abs new))
(if (<= (abs (- (cdr (assoc 42 dxf)) new)) 0.001)
    (setq bool t)
    (setq bool nil)
)
(setq new (rtos new 2 (getvar "dimdec")))
(if bool
    (setq new (strcat "{\\fSimSun|b0|i0|c134|p2;}" new))
    (setq new (strcat "{\\Fgdt.shx;^}\\P" new))
)
(setq dxf (subst (cons 1 new) (assoc 42 dxf) dxf))
(entmod dxf)

)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;弧长标注

轮廓线 发表于 2010-12-10 17:26:37

请问楼主CC命令可否标注一段整体弧长中的两点间的距离
页: [1] 2 3 4
查看完整版本: 弧长标注、直线标注、样条曲线长度标注.....