- 康康map
-
程序太乱了,你试下我写的这个吧,功能应该是你要的。
(defun $Vp->Lp ( opt )
(if (= (type opt) "variant) (Vlax-SafeArray->List (Vlax-Variant-Value opt)) (Vlax-3d-Point opt) )
)
(defun $Len->Vob ( obj )
(if (= (type obj) "vla-object) (Vlax-Vla-Object->Ename obj) (Vlax-Ename->Vla-Object obj) )
)
(defun c:qxc ( / &doc &mod &sel #cm #os &ob #si #sn @pl )
(if (null vlax-dump-object) (vl-load-com) )
(setq &doc (vla-get-activedocument (vlax-get-acad-object)) &mod (vla-get-modelspace &doc))
(if (setq &sel (ssget "((-4 . "<OR") (0 . "POLYLINE") (0 . "LWPOLYLINE") (0 . "LINE") (-4 . "OR>"))))
(progn
(if (null #oth) (setq #oth (getvar "textsize")) )
(if (setq #th (getreal (strcat " 请输入字高: <" (rtos #oth) "> "))) (setq #oth #th) (setq #th #oth) )
(if (null #oof) (setq #oof 0.2) )
(if (setq #of (getreal (strcat " 请输入间距: <" (rtos #oof) "> "))) (setq #oof #of) (setq #of #oof) )
(setq #cm (getvar "cmdecho") #os (getvar "osmode")) (setvar "cmdecho" 0) (setvar "osmode" 0)
(repeat (setq @pl "() #si 0 #sn (sslength &sel))
(setq &ob ($Len->Vob (ssname &sel #si)) #si (1+ #si))
(cond
((= (vla-get-objectname &ob) "AcDbLine") ($lxc-addline &ob) )
((= (vla-get-objectname &ob) "AcDbPolyline") ($lxc-addpolyline &ob) )
)
)
($lxc-writetext @pl) (setvar "osmode" #os) (setvar "cmdecho" #cm)
)
(princ " 未选择对象,程序退出!")
)
(princ)
)
(defun $lxc-writetext ( @pl / &tx @p1 @p2 @p3 #an #ds )
(foreach @cp @pl
(setq @p1 (nth 0 @cp) @p2 (nth 1 @cp) #an (angle @p1 @p2) #ds (distance @p1 @p2))
(setq @p3 (polar (polar @p1 #an (/ #ds 2.0)) (+ #an (/ pi 2)) (+ #of (/ #th 2.0))))
(setq &tx (vla-addtext &mod (rtos #ds) ($vp->lp @p3) #th))
(vla-put-alignment &tx 4) (vla-put-rotation &tx #an)
(vla-put-textalignmentpoint &tx ($vp->lp @p3))
)
)
(defun $lxc-addline ( &ob / )
(setq @pl (cons (list ($Vp->Lp (vla-get-startpoint &ob)) ($Vp->lp (vla-get-endpoint &ob))) @pl))
)
(defun $lxc-addpolyline ( &ob / )
(foreach ob ($vp->lp (vla-explode &ob))
(if (= (vla-get-objectname ob) "AcDbLine") ($lxc-addline ob) )
(vla-erase ob)
)
)
命令是qxc
- LuckySXyd
-
程序太长,建议自己用CAD自动的编辑器调试下
- meira
-
试着给你看了下,因为你这个程序不完整,无法给你解决