assing 发表于 2006-8-22 20:59:00

二次开发教程例子:VB进行修剪(trim)的问题

本帖最后由 作者 于 2006-8-24 9:36:16 编辑 <br /><br /> <P>&nbsp;vb6的程序过程:已经画了几个圆,现在画条直线,然后作该直线的偏移阵列,最后用sendcommand命令修剪圆外的直线,只留圆内的直线。</P>
<P>问题:见附件,无论怎么改程序,蓝色虚线的部分无法剪切掉。圆的下部的也剪切不掉。请高手指点。<IMG title=em04 style="CURSOR: pointer" onclick="'putEmot(&quot;em04&quot;);'" src="Skins/Default/emot/em04.gif">cad2002图</P>
<P>Dim Copyline As AcadLine<BR>&nbsp;&nbsp;&nbsp; Dim spoint(0 To 2) As Double, epoint(0 To 2) As Double<BR>&nbsp;&nbsp;&nbsp; Dim Rectangularline() As Object<BR>&nbsp;&nbsp;&nbsp; dim i as integer<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; spoint(0) = -3 * hjw / 2: spoint(1) = R: spoint(2) = 0<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; epoint(0) = -3 * hjw / 2: epoint(1) = -R: epoint(2) = 0<BR>&nbsp;&nbsp;&nbsp; Set Copyline = AcadDoc.ModelSpace.AddLine(spoint, epoint)</P>
<P>NumberOfRows = 1: NumberOfColumns = 0.5 * (hjks + 1) + 2: NumberOfLevels =1<BR>DistBetweenRows = 1: DistBetweenColumns = hjw: DistBetweenLevels = 0<BR>Rectangularline = Copyline.ArrayRectangular(NumberOfRows, NumberOfColumns,&nbsp; NumberOfLevels, DistBetweenRows, DistBetweenColumns, DistBetweenLevels)</P>
<P>For i = LBound(Rectangularline, 1) To UBound(Rectangularline, 1)&nbsp; '阵列产生对象数组&nbsp;<BR>Rectangularline(i).Layer = "主体"<BR>Next i<BR>&nbsp;&nbsp;&nbsp; &nbsp;Dim det1 As String&nbsp;&nbsp;&nbsp; <BR>&nbsp;Dim det2 As String'不希望与cad互动,直接自己画图,剪切。&nbsp;&nbsp;&nbsp; <BR>For i = LBound(Rectangularline, 1) To UBound(Rectangularline, 1)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <BR>&nbsp;det1 = axEnt2lspEnt(objcir2)'objcir2是个圆&nbsp;&nbsp;&nbsp;&nbsp; <BR>&nbsp;det2 = GetDoubleEntTable(Rectangularline(i), Rectangularline(i).StartPoint)&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;<BR>AcadDoc.SendCommand "_trim" &amp; vbCr &amp; det1 &amp; vbCr &amp; vbCr &amp; det2 &amp; vbCr &amp; vbCr&nbsp;&nbsp;&nbsp; <BR>Next i<BR>以下是子函数:是autocad vba 二次开发教程上的。<BR>Public Function GetDoubleEntTable(ByVal entObj As Object, ByVal Pnt As Variant) As String&nbsp;&nbsp; <BR>&nbsp;Dim entHandle As String&nbsp;&nbsp;&nbsp; <BR>&nbsp;entHandle = entObj.Handle&nbsp;&nbsp;&nbsp; <BR>&nbsp;GetDoubleEntTable = "(list(handent " &amp; Chr(34) &amp; entHandle &amp; Chr(34) &amp; _<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ")(list " &amp; Str(Pnt(0)) &amp; Str(Pnt(1)) &amp; Str(Pnt(2)) &amp; "))"<BR>End Function</P>
<P>Public Function axEnt2lspEnt(ByVal entObj As Object) As String<BR>&nbsp;&nbsp;&nbsp; Dim entHandle As String<BR>&nbsp;&nbsp;&nbsp; entHandle = entObj.Handle<BR>&nbsp;&nbsp;&nbsp; axEnt2lspEnt = "(handent " &amp; Chr(34) &amp; entHandle &amp; Chr(34) &amp; ")"<BR>End Function<BR></P>
<P></P>

assing 发表于 2006-8-23 10:22:00

那位大虾给看看阿。谢谢了。
页: [1]
查看完整版本: 二次开发教程例子:VB进行修剪(trim)的问题