源码
本帖最后由 作者 于 2005-9-15 20:44:52 编辑 <br /><br /> <P> 回复七楼:</P><P>忘记加载我的通用函数;</P>
<P>我又传一个。你再试一下。</P>
<P>不支持中文图层</P> <P>小兄弟,你用的图层有点象 富金的图层似的</P> <P>请<A name=56959><FONT color=#000066><B>yedajiang</B></FONT></A>兄指点</P>
<P>(defun c:test (/ lst)<BR> (vl-load-com)<BR> (if (ssget '((0 . "circle")))<BR> (progn<BR> (setq *AcadDocument* (vla-Get-ActiveDocument (vlax-Get-Acad-Object)))<BR> (vla-StartUndoMark *AcadDocument*)<BR> (if (setq lst (GetLst))<BR> (Display lst)<BR> )<BR> (vla-EndUndoMark *AcadDocument*)<BR> )<BR> )<BR>)<BR>;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;<BR>(defun Display (lst / TextPt i pt Text StrDia Dia)<BR> (while (not (setq TextPt (Getpoint "\nPlease Specify a point : "))))<BR> (setq old_cmdecho (getvar "cmdecho")<BR> old_osmode (getvar "osmode")<BR> )<BR> (setvar "cmdecho" 0)<BR> (setvar "osmode" 0)<BR> (setq i 0)<BR> (foreach en lst<BR> (setq pt (vlax-safearray->list<BR> (vlax-variant-value (vla-get-center (vlax-ename->vla-object (handent (cadr en)))))<BR> )<BR> i (1+ i)<BR> Text (strcat "No" (itoa i))<BR> )<BR> (command "text" pt 3.5 0 Text)<BR> (setq StrDia "")<BR> (foreach hn (cdr en)<BR> (setq Dia (vla-Get-Diameter (vlax-ename->vla-object (handent hn)))<BR> StrDia (strcat strDia " " (rtos Dia 2 2))<BR> )<BR> )<BR> (setq StrDia (strcat Text " " (rtos (car pt) 2 2) " " (rtos (cadr pt) 2 2) " " strDia))<BR> (setq TextPt (list (car TextPt) (- (cadr TextPt) 6)))<BR> (command "text" TextPt 3.5 0 StrDia)<BR> )<BR> (setvar "cmdecho" old_cmdecho)<BR> (setvar "osmode" old_osmode)<BR>)<BR>;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;<BR>(defun GetLst (/ ss pt hand lst)<BR> (setq ss (vla-Get-ActiveSelectionset *AcadDocument*))<BR> (setq lst '())<BR> (vlax-for en ss<BR> (setq pt (vlax-safearray->list (vlax-variant-value (vla-get-center en)))<BR> hand (vla-get-handle en)<BR> )<BR> (if (assoc pt lst)<BR> (setq lst (subst (append (assoc pt lst) (list hand)) (assoc pt lst) lst))<BR> (setq lst (append lst (list (list pt hand))))<BR> )<BR> )<BR> lst<BR>)</P> HuaiYu发表于2005-9-16 23:09:00static/image/common/back.gif
请yedajiang兄指点
(defun c:test (/ lst)(vl-load-com)(if (...
后天就要出差了,可能没有空详细去理解你程序。十月份回来后一定给你提些建议。请你自己也多关注。<BR>