A好的
通过将ent=设置为sset,我可以看到这一点;这是一个非常好的主意
我试了一下,但还是没有得到我想要的结果
你知道我做错了什么吗
CADR
- Sub MovefromMidPntofSsetBB()
- Dim objEnt As AcadEntity
- Dim objSS As AcadSelectionSet
- Dim varMinBound As Variant
- Dim varMaxBound As Variant
- Dim minX As Double, maxX As Double
- Dim minY As Double, maxY As Double
- On Error Resume Next
- ThisDrawing.SelectionSets.Item("GetEnt").Delete
- Set objSS = ThisDrawing.SelectionSets.Add("GetEnt")
- objSS.SelectOnScreen
- Set objEnt = objSS(0)
- objEnt.GetBoundingBox varMinBound, varMaxBound
- minX = varMinBound(0): maxX = varMaxBound(0)
- minY = varMinBound(1): maxY = varMaxBound(1)
- For Each objEnt In objSS
- objEnt.GetBoundingBox varMinBound, varMaxBound
- If varMinBound(0) < minX Then minX = varMinBound(0)
- If varMinBound(1) < minY Then minY = varMinBound(1)
- If varMaxBound(0) < maxX Then maxX = varMaxBound(0)
- If varMaxBound(1) < maxY Then maxY = varMaxBound(1)
- 'Get midpt of Sset
- Dim Midpnt(2) As Double
- Midpnt(0) = (minX + maxX) / 2
- Midpnt(1) = (minY + maxY) / 2
- Dim MoveTopnt As Variant
- MoveTopnt = ThisDrawing.Utility.GetPoint(, "Select Destination Point: ")
- objEnt.Move Midpnt, MoveTopnt
- Next objEnt
- objSS.Delete
- 'Debug.Print "varMinBound(0) = " & varMinBound(0) & " / " & "varMaxBound(1) = " & varMaxBound(1)
- 'Debug.Print "minX = " & minX & " / " & "maxX = " & maxX
- End Sub
|