Mayby我写的一些代码中的一个例子可以帮助你找到你的问题......
对不起,我已经用我的母语评论了它。
看着代码,我似乎记得我不得不使用变体,因为在涉及Getboundingbox
- Function LimitsSelSet(Selset As AcadSelectionSet) As Variant
- Dim Ent As AcadEntity
- Dim LL As Variant
- Dim UR As Variant
- Dim Limits(0 To 1, 0 To 2) As Double
- Limits(0, 0) = -0.0000000000001
- For Each Ent In Selset
- If Left$(Ent.ObjectName, 7) "AcDbDim" And Ent.ObjectName "AcDbAttributeDefinition" _
- And Ent.ObjectName "AcDBText" Then 'negeer dimensies attributen en texten
-
- Ent.GetBoundingBox LL, UR
- If Limits(0, 0) = -0.0000000000001 Then 'init upperleft, lowerright
- Limits(0, 0) = LL(0): Limits(0, 1) = LL(1): Limits(0, 2) = LL(2)
- Limits(1, 0) = UR(0): Limits(1, 1) = UR(1): Limits(1, 2) = UR(2)
- Else 'get boundingbox selectionset
- If Limits(0, 0) > LL(0) Then Limits(0, 0) = LL(0)
- If Limits(0, 1) > LL(1) Then Limits(0, 1) = LL(1)
- If Limits(0, 2) > LL(2) Then Limits(0, 2) = LL(2)
- If Limits(1, 0) 5 Then
- StartPtd(0) = intPointsNew(0) - 10
- StartPtd(1) = intPointsNew(1)
- StartPtd(2) = intPointsNew(2)
- EndPtD(0) = intPointsNew(3) - 10
- EndPtD(1) = intPointsNew(4)
- EndPtD(2) = intPointsNew(5)
- End If
- End If
- End Sub
|