tags:

views:

83

answers:

1

i try to get the coordinates of a autocad blockreference. with the code below i can pick a block-reference in autocad, but it always display (0,0,0) as insertionpoint... isnt the insertionpoint the actual coords of a block?

Sub GetInsertpoint()
    Dim oEnt As AcadEntity
    Dim varPick As Variant
    Dim brBref As AcadBlockReference
    Dim arAttR As AcadAttributeReference
    Dim varAt As Variant
    Dim i As Double

    ThisDrawing.Utility.GetEntity oEnt, varPick, vbCr & "Get the block"
    If TypeOf oEnt Is AcadBlockReference Then
        MsgBox "Thank you, very nice!"
        Set brBref = oEnt
        MsgBox brBref.InsertionPoint(0) & brBref.InsertionPoint(1) & brBref.InsertionPoint(2)
    Else
        MsgBox "Not a block reference!"
        Exit Sub
    End If

End Sub
+1  A: 

At first: which version of AutoCAD are you using?

At tried your code on a german AutoCAD 2008. I created some simple blocks from polygons and inserted them into a new drawing.

When I execute your code above and select one of those blocks, I always get valid coordinates. So this might be an issue, how you created the block?

Maybe you created a block and left the "Select insertion point from screen" blank. So ACAD took the default value: (0,0,0). That would be an explanation, why you always get those coordinates.

WizzardsApprentice