Insertionpoint through handle

Insertionpoint through handle

nucliabrasil
Advocate Advocate
1,077 Views
2 Replies
Message 1 of 3

Insertionpoint through handle

nucliabrasil
Advocate
Advocate

Hello guys!

How do I get the x and y coordinates of an "AcDbBlockReference" from its handle with vb6.
Thankful.

0 Likes
1,078 Views
2 Replies
Replies (2)
Message 2 of 3

norman.yuan
Mentor
Mentor

If you know an AcadEntity's handle, you can call AcadDocument.HandleToObject() to get an AcadObject. Something like:

 

Private Function GetInsertionPointByHandle(handleVal As string) As Variant

    Dim obj As AcadObject

    Dim blk As AcadBlockReference

    Dim pt As Variant

    '' If your code is BV6, not VBA in AutoCAD, you need to

    '' obtain your own "ThisDrawing" object 

    Set obj = ThisDrawing.HandleToObject(handleVal)

    If TypeOf obj Is AcadBlockReference Then

        Set blk = obj

        pt=blk.InsertionPoint

    End If

    GetInsertionPointByHandle = pt

End Function

Norman Yuan

Drive CAD With Code

EESignature

0 Likes
Message 3 of 3

nucliabrasil
Advocate
Advocate

Thanks Noman Yuan!

0 Likes