[求助]blockref 与 getboundingbox 的问题
代码如下:Dim BlkRef As AcadBlockReference
Dim SelSet As AcadSelectionSet
Set SelSet = AcadDoc.SelectionSets.Add("SelSet1")
Dim aaa(0) As Integer 'Select 条件1:选择类型
Dim aaa1(0) As Variant'select 条件2:选择图元
Dim maxPoint As Variant
Dim minPoint As Variant
aaa(0) = 0 '图元类型
aaa1(0) = "INSERT" '图块
SelSet.Select acSelectionSetAll, , , aaa, aaa1 '选择所有图块
For Each BlkRef In SelSet
Debug.Print BlkRef.Name
BlkRef.GetBoundingBox minPoint, maxPoint
Next
这段程序用来得到所有块的BoundingBox的,但是,得到的minPoint和maxPoint 都是Empty。 怎么回事呢?
程序确确实实能够选择所有的块,而且名字也都是正常的,但是只要调用getboundingbox方法,要么为空,要么
就直接退出当前函数了,
请大侠们指教
该程序正常的啊,不知你是否有SelSet.Delete语句 在我这里可以得到的
Dim BlkRef As AcadBlockReference
Dim SelSet As AcadSelectionSet
Set SelSet = ThisDrawing.SelectionSets.Add("SelSet1")
Dim aaa(0) As Integer 'Select 条件1:选择类型
Dim aaa1(0) As Variant'select 条件2:选择图元
Dim maxPoint As Variant
Dim minPoint As Variant
aaa(0) = 0 '图元类型
aaa1(0) = "INSERT" '图块
SelSet.Select acSelectionSetAll, , , aaa, aaa1 '选择所有图块
For Each BlkRef In SelSet
MsgBox BlkRef.Name
BlkRef.GetBoundingBox minPoint, maxPoint
Next
If Not SelSet Is Nothing Then SelSet.Delete 我把我的图纸上传下,大侠们棒棒忙看下,谢谢 对的啊Sub test()
Dim BlkRef As AcadBlockReference
Dim SelSet As AcadSelectionSet
Set SelSet = ThisDrawing.SelectionSets.Add("SelSet0")
Dim aaa(0) As Integer 'Select 条件1:选择类型
Dim aaa1(0) As Variant'select 条件2:选择图元
Dim maxPoint As Variant
Dim minPoint As Variant
aaa(0) = 0 '图元类型
aaa1(0) = "INSERT" '图块
SelSet.Select acSelectionSetAll, , , aaa, aaa1 '选择所有图块
For Each BlkRef In SelSet
BlkRef.GetBoundingBox minPoint, maxPoint
MsgBox maxPoint(0)
Next
SelSet.Delete
End Sub
页:
[1]