XREF / Block properties

XREF / Block properties

Anonymous
Not applicable
225 Views
2 Replies
Message 1 of 3

XREF / Block properties

Anonymous
Not applicable
Gentlemen, I have got a question:
I would like to get the position and size (or LeftTop, LeftBottom; RightTop, RightBottom) of each XREF or Block in my drawing.
It would be nice to have some VBA source as I am quite new to ACAD-VBA....
Thanks in advance
0 Likes
226 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable
Boundingbox maybe what you want, the points exposed do not factor clipping

Sub Blockbox()
Dim B As AcadBlockReference
Dim E As AcadEntity
Dim min, max, LeftTop(2) As Double
For Each E In ThisDrawing.ModelSpace
If TypeOf E Is AcadBlockReference Then
Set B = E
B.GetBoundingBox min, max
ThisDrawing.ModelSpace.AddPoint min
ThisDrawing.ModelSpace.AddPoint max
LeftTop(0) = min(0)
LeftTop(1) = max(1)
ThisDrawing.ModelSpace.AddPoint LeftTop
End If
Next
End Sub
0 Likes
Message 3 of 3

Anonymous
Not applicable
Great !
That is exactly what I was searching for.

Thanks a lot
0 Likes