'Option Explicit
Sub test()
Dim blkDef As AcadBlock
Dim objEnt As AcadEntity
Dim center As Variant
Dim InsPnt As Variant
Set blkDef = ThisDrawing.Blocks("haha")
For Each objEnt In blkDef
If objEnt.ObjectName = "AcDbCircle" Then
center = objEnt.center
xc = center(0): yc = center(1)
End If
Next
For Each objEnt In ThisDrawing.ModelSpace
If objEnt.ObjectName = "AcDbBlockReference" Then
If objEnt.Name = "haha" Then
InsPnt = objEnt.InsertionPoint
rot = objEnt.Rotation
x_scale = objEnt.XScaleFactor
y_scale = objEnt.YScaleFactor
new_x = Cos(rot) * x_scale * xc - Sin(rot) * y_scale * yc + InsPnt(0)
new_y = Sin(rot) * x_scale * xc + Cos(rot) * y_scale * yc + InsPnt(1)
MsgBox new_x & ", " & new_y
End If
End If
Next
非常感谢版主!问题解决了!
页:
1
[2]