yuangw1234 发表于 2006-4-8 17:35:00

大师们请看看

<P>本人编了下面一个程式,就是选择很多物体一起偏移并删除以前的东西,但是会出现有些是内偏,而有些外偏,而如果是一个一个选,则都会外偏,请大师们过目并指教</P>
<P>Public Sub ttu()<BR>Dim ssetobj1 As AcadSelectionSet<BR>Dim icount1 As Integer</P>
<P>icount1 = ThisDrawing.SelectionSets.Count<BR>While (icount1 &gt; 0)<BR>&nbsp;&nbsp;&nbsp; If ThisDrawing.SelectionSets.Item(icount1 - 1).Name = "yuan" Then<BR>&nbsp;&nbsp;&nbsp; ThisDrawing.SelectionSets.Item(icount1 - 1).Delete<BR>&nbsp;&nbsp;&nbsp; End If<BR>&nbsp;&nbsp;&nbsp; icount1 = icount1 - 1<BR>&nbsp;&nbsp;&nbsp; Wend<BR>&nbsp;&nbsp;&nbsp; Set ssetobj1 = ThisDrawing.SelectionSets.Add("yuan")<BR>&nbsp;&nbsp;&nbsp; ThisDrawing.Utility.Prompt "please select object"<BR>&nbsp;&nbsp;&nbsp; ssetobj1.SelectOnScreen<BR>&nbsp;&nbsp; Dim i1 As Integer<BR>&nbsp;&nbsp; Dim selobj1 As Variant<BR>&nbsp;&nbsp; Dim shuz As Double<BR>&nbsp;&nbsp; shuz = ThisDrawing.Utility.GetReal("请输入偏移量 :")</P>
<P>&nbsp; For i1 = 0 To ssetobj1.Count - 1<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Set selobj1 = ssetobj1.Item(i1)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Dim ofselobj1 As Variant<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp; selobj1.Offset (shuz)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; selobj1.Delete</P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Next</P>
<P>End Sub</P>
<P><BR>&nbsp;</P>

雪山飞狐_lzh 发表于 2006-4-10 11:18:00

http://www.mccad.net/object/acad2004/idh_offset.htm
页: [1]
查看完整版本: 大师们请看看