怪事情,哪位知道,选择集?
用下面程序,进行选择,不知道为什么,这个图形里的这几条线,居然选不中,很是不解,哪位高手帮我看看,谢谢!注意:选择裁切线要选外围的l3DPolyline白色多边形Sub Test_cut()
Dim ss As AcadSelectionSet
Dim obj As AcadEntity
Dim pArray() As Double
'Dim pArray As Variant
Dim basePnt As Variant
Dim i As Integer
'Dim groupCode As Variant, dataCode As Variant
Dim Coord As Variant
On Error Resume Next
'ThisDrawing.Utility.Prompt vbCr & "选择要裁切范围线:"
ThisDrawing.Utility.GetEntity obj, basePnt, "选择要裁切范围线:"
If Err Then
Exit Sub
Else
Do While ThisDrawing.SelectionSets.count > 0
ThisDrawing.SelectionSets.Item(0).Delete
Loop
Set ss = ThisDrawing.SelectionSets.Add("tt")
Coord = obj.Coordinates '获取顶点坐标数组
ReDim pArray(0 To UBound(Coord)) As Double
For i = 0 To UBound(Coord)
pArray(i) = Coord(i)
Next i
Call ss.SelectByPolygon(acSelectionSetFence, pArray)
If ss.count > 0 Then
Dim removeObjects(0 To 0) As AcadEntity
Set removeObjects(0) = obj
ss.RemoveItems removeObjects
For i = 0 To ss.count - 1
ss.Item(i).Highlight True
Next
End If
End If
End Sub
图形传不上去,没办法 <P>楼上的,你的程序有问题,通过坐标选择的时候应该输入三维坐标变量,由<FONT color=#0000ff>Pline的Coordinates</FONT> 属性得到是二维坐标,你改成这样就行了</P>
<P>。。。。。。</P>
<P> Set ss = ThisDrawing.SelectionSets.Add("tt")<BR> Coord = obj.Coordinates '获取顶点坐标数组<BR> ReDim pArray(0 To UBound(Coord) + (UBound(Coord) + 1) / 2) As Double<BR> Dim j As Integer<BR> For i = 0 To UBound(Coord)<BR> pArray(i) = Coord(i)<BR> Next i<BR> For i = 1 To (UBound(Coord) + 1) / 2<BR> For j = UBound(pArray) To i * 3 - 1 Step -1<BR> pArray(j) = pArray(j - 1)<BR> Next<BR> pArray(i * 3 - 1) = obj.Elevation <BR> Next<BR> Call ss.SelectByPolygon(acSelectionSetFence, pArray)</P>
<P>。。。。。。</P>
<P>这样做就是人为的增加一个Z轴坐标值。。。。。。^_^</P>
页:
[1]