Getting a insertion point by selecting on screen...

Getting a insertion point by selecting on screen...

Anonymous
Not applicable
661 Views
1 Reply
Message 1 of 2

Getting a insertion point by selecting on screen...

Anonymous
Not applicable
I am trying to insert a block into a drawing at a insertion point that the
user selects on screen. I have seen posts on this topic before but I don't
remember how it was done. The block will insert just fine if I tell it where
to insert it but I would like to ask the user to select the insertion point
of the block. Can someone provide a snippet of code to get me where I need
to go. Thanks for the help in advanced.

Bryan
0 Likes
662 Views
1 Reply
Reply (1)
Message 2 of 2

Anonymous
Not applicable
Hi Bryan,
Here is some sample code:
- Watch out for word wrap. 🙂

'============================================
Public Sub InsertBlock()

Dim blkRef As AcadBlockReference
Dim varP1 As Variant
Dim dblRotation As Double

'select the insertion point
varP1 = ThisDrawing.Utility.GetPoint(, "Select Insertion Point: ")
'insert the block
Set blkRef = ThisDrawing.ModelSpace.InsertBlock(varP1, "YOURBLOCKNAME",
1, 1, 0)
'get the rotation
dblRotation = ThisDrawing.Utility.GetAngle(varP1, "Rotation Angle: ")
'set the block's rotation
blkRef.rotation = dblRotation
'update the entity on the screen
blkRef.Update

End Sub
'============================================

Hope this helps,

- Adam <><

--
Enum SystemInfo
Cad_Software = "AutoCAD 14.01"
VB_Product = "VBA / VB6"
Platform = "WinNT4 SP5"
End Enum

"Bryan" wrote in message
news:5B7BCE841F7C4BF1D1581DFA0CD42D16@in.WebX.SaUCah8kaAW...
> I am trying to insert a block into a drawing at a insertion point that the
> user selects on screen. I have seen posts on this topic before but I don't
> remember how it was done. The block will insert just fine if I tell it
where
> to insert it but I would like to ask the user to select the insertion
point
> of the block. Can someone provide a snippet of code to get me where I need
> to go. Thanks for the help in advanced.
>
> Bryan
>
0 Likes