会跟园变化而变化的园中心线
加载CCEN.LSP,用命令CCEN. 加载CCEN.LSP,用命令CCEN <P>(defun C:CCEN ()<BR> <BR> ;(vl-cmdf "-linetype" "c" "mycenter" "" "user.lin" 5,-1,1,-1 "")<BR> ;(vl-cmdf "-layer" "m" "1" "l" "center" "" "c" "red" "1" "")<BR> (vl-load-com)<BR> (setq acadObject (vlax-get-acad-object))<BR> (setq acadDocument (vla-get-ActiveDocument acadObject))<BR> (setq mSpace (vla-get-ModelSpace acadDocument))<BR> (setq util (vla-get-Utility acadDocument))<BR> (setq lts (vla-get-Linetypes acadDocument))<BR> ;(setvar "CMDECHO" 0)<BR> (setq selsets (vla-get-SelectionSets acadDocument))</P><P> (setq i (vla-get-count selsets))<BR> (while (> i 0)<BR> (setq sset(vla-item selsets 0))<BR> (vla-delete sset)<BR> (setq i (- i 1))<BR> )<BR> (setq sset (vla-add selsets "sset"))<BR> (vla-SelectOnScreen sset)<BR> (setq ssetcount (vla-get-count sset))<BR> (setq obj (vla-item sset (- 1 ssetcount)))<BR> (setq objname (vla-get-objectname obj))</P>
<P><BR> (while (and (vla-get-count sset) (/= objname "AcDbCircle") )<BR> (prompt "所选图素中至少有一非圆的图元,请再试一次,或按 ESC 结束!")<BR> (vla-clear sset)<BR> (vla-SelectOnScreen sset)<BR> (setq ssetcount (vla-get-count sset))<BR> (setq obj (vla-item sset (- ssetcount 1)))<BR> (setq objname (vla-get-objectname obj))</P>
<P> )<BR> (setq circ_d (vla-get-Radius obj))<BR> (setq circ_cen (vla-get-center obj))<BR> (setq pt (vla-PolarPoint util circ_cen 0 (+ 5 circ_d)))<BR> (setq line (vla-addline mspace circ_cen pt))<BR> (load-line-types "CENTER" "acad.lin")<BR> (vla-put-Linetype line "CENTER")<BR> (setq lts (/ circ_d 5))<BR> (vla-put-LinetypeScale line lts)<BR> (setq<BR> linearray (vla-ArrayPolar line 4 (/ (* pi 2 (1- 4)) 4) circ_cen)<BR> )</P>
<P> (vla-delete sset)<BR> (setq circleReactor<BR> (VLR-Object-Reactor<BR> (list obj)<BR> "Circle Reactor"<BR> '((:VLR-modified . mark))<BR> )<BR> )</P>
<P>)<BR>(defun load-line-types (line-type file-name / tmp res)<BR> (if (and (setq tmp (vlax-get-acad-object))<BR> (setq tmp (vla-get-activedocument tmp))<BR> (setq tmp (vla-get-linetypes tmp))<BR> )<BR> (if (setq res (find-line-type line-type tmp))<BR> res<BR> (progn<BR> (vla-load tmp line-type file-name)<BR> (if (vla-item tmp line-type)<BR> (vla-item tmp line-type)<BR> nil<BR> )<BR> )<BR> )<BR> nil<BR> )<BR>)<BR>(defun find-line-type (line-type line-type-collection / res)<BR> (setq line-type (strcase line-type))<BR> (vlax-for l-obj line-type-collection<BR> (if (= (strcase (vla-get-name l-obj)) line-type)<BR> (setq res l-obj)<BR> )<BR> )<BR> res<BR>)<BR>(defun mark (notifier-object reactor-object parameter-list)<BR> (vl-load-com)</P>
<P> (setq circ_d (vla-get-Radius obj))<BR> (setq circ_cen (vla-get-center obj))<BR> (setq pt (vla-PolarPoint util circ_cen 0 (+ 5 circ_d)))<BR> (vla-delete line)<BR> (setq linesafearray (vlax-variant-value linearray))<BR> (vla-delete (vlax-safearray-get-element linesafearray 0))<BR> (vla-delete (vlax-safearray-get-element linesafearray 1))<BR> (vla-delete (vlax-safearray-get-element linesafearray 2))<BR> (setq line (vla-addline mspace circ_cen pt))<BR> (load-line-types "CENTER" "acad.lin")<BR> (vla-put-Linetype line "CENTER")<BR> (setq lts (/ circ_d 5))<BR> (vla-put-LinetypeScale line lts)<BR> (setq<BR> linearray (vla-ArrayPolar line 4 (/ (* pi 2 (1- 4)) 4) circ_cen)<BR> )<BR>)<BR></P> 不知道什么原因,文件传不上来。 压缩后上传
页:
[1]