How to get Block Extent (lower left & Upper right)- please please help

How to get Block Extent (lower left & Upper right)- please please help

Anonymous
Not applicable
1,112 Views
3 Replies
Message 1 of 4

How to get Block Extent (lower left & Upper right)- please please help

Anonymous
Not applicable
Dear All,

I'm trying to get the boundingbox of existing blocks in the drawing
I have many of blocks within drawing and going one by one, found the one which I want

Now, I want to get the extent (lower left, upper right) of the block (my block is rectanglar title block)
I tried with origin, but it's giving me inside the rectangular block, but I want extreme lower left & upper right corner nothing
but boundingbox. This bounding box works only if newly inserted blocks but not for already inserted block.

So, please please share your ideas with me ... I'm disperately searching in discussion groups but not getting the right one I wanted
please help!!!

Many thanks in advance
Bassya
0 Likes
1,113 Views
3 Replies
Replies (3)
Message 2 of 4

Anonymous
Not applicable
>>I want extreme lower left & upper right corner nothing but boundingbox.
>>This bounding box works only if newly inserted blocks but not for already inserted block.

I didnt seem to have any trouble.. inserted a couple of blocks, changed the XScale on one of them, and the following quick snippet seemed to work just fine reporting each of their different sizes:

' ---- snip ----------------------------

Sub main()
Dim BlockRef As AcadBlockReference
Dim ent As AcadObject
Dim minExt As Variant, maxExt As Variant


For Each ent In ThisDrawing.ModelSpace
If ent.ObjectName = "AcDbBlockReference" Then
Set BlockRef = ent
Debug.Print BlockRef.Name,
BlockRef.GetBoundingBox minExt, maxExt
Debug.Print "X"; minExt(0); " Y"; minExt(1); " - X"; maxExt(0); " Y"; maxExt(1)
End If
Next ent

End Sub
0 Likes
Message 3 of 4

Anonymous
Not applicable
Hi Rocheey,

Many many thanks rocheey, it's really saved lot's of time, some times simple things don' t flash to mind.
I was trying on xref blocks, thus the confusion was..., I think we need to first bind it then find bounding box...right ?

Another query, Debug.print is not working for me, I'm always using msgbox...do u know why my Debug.print not working ? any setting ?

Thanks very much

Bassy
0 Likes
Message 4 of 4

Anonymous
Not applicable
debug.print doesnt pop up a box like msgbox does.. it simply prints to the "Immediate" window.
In VBA, click "View", "Immediate Window"... the output from debug.print is there.
0 Likes