Blockreference insertion point in current drawing

Blockreference insertion point in current drawing

Anonymous
Not applicable
370 Views
3 Replies
Message 1 of 4

Blockreference insertion point in current drawing

Anonymous
Not applicable
Hi everyone! I'm trying to extract the insertion point of a block in an open drawing. However the insertion point that is returned is the origin of the drawing in which the block was designed. What i'd like to return is something useful like the blockcenter or lowerleft corner of the block in the current drawings coordinate system. My code is:

If TypeOf ent Is AcadBlockReference Then
Set Block = ent
startpuntWCS = Block.insertionpoint


'this is something i've been looking into but it still returns thesame 'values:
startpuntUCS = Thisdrawing.Utility.TranslateCoordinates(startpuntWCS, acWorld, acUCS, False)

x = startpuntUCS(0)
y = startpuntUCS(1)

End If

thnx a bunch you guys
0 Likes
371 Views
3 Replies
Replies (3)
Message 2 of 4

Anonymous
Not applicable
this returns the correct value when i tested it.

Public Sub GetBlockInsertionPoint()
Dim oEntity As AcadEntity
Dim oBlockRef As AcadBlockReference
Dim vPoint As Variant
Dim vInsertionPoint As Variant

ThisDrawing.Utility.GetEntity oEntity, vPoint, "Select block ..."

If TypeOf oEntity Is AcadBlockReference Then
Set oBlockRef = oEntity
vInsertionPoint = oBlockRef.InsertionPoint
Debug.Print vInsertionPoint(0) & ", " & vInsertionPoint(1) & ", " &
vInsertionPoint(2)
End If
End Sub

there is no error checking obviously.




wrote in message news:5821721@discussion.autodesk.com...
Hi everyone! I'm trying to extract the insertion point of a block in an open
drawing. However the insertion point that is returned is the origin of the
drawing in which the block was designed. What i'd like to return is
something useful like the blockcenter or lowerleft corner of the block in
the current drawings coordinate system. My code is:

If TypeOf ent Is AcadBlockReference Then
Set Block = ent
startpuntWCS = Block.insertionpoint


'this is something i've been looking into but it still returns thesame
'values:
startpuntUCS = Thisdrawing.Utility.TranslateCoordinates(startpuntWCS,
acWorld, acUCS, False)

x = startpuntUCS(0)
y = startpuntUCS(1)

End If

thnx a bunch you guys
0 Likes
Message 3 of 4

Anonymous
Not applicable
Other then the debug.print command I can't really see a difference in our codes. My problem is not that the insertion point is not returned because it does that perfectly. But when the block was inserted it took the origin of the drawing where the block was defined as the insertionpoint. if i adjust the basepoint when inserting the block it changes my insertionpoint on the block but when i pull the insertion point in VB it still returns my original insertionpoint.
0 Likes
Message 4 of 4

Anonymous
Not applicable
Never mind. I found a way to work around my problem so i'd like to thank you for your help anyway.

I'm going to take the insertion point and then have my VBapplication look at the Blockfile and add the coordinates of the entities in the block to the insertion point. returning the correct values in the coordinate system of the parent drawing.

have a nice day!
0 Likes