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