Insert Block using Users Input
Published on Wednesday, 06 February 2008 19:33
This peace of code may seem like the insert block code however there are some usefull features in this peace. With this function you are able to ask users input for Block Insertion point and Rotation angle. To test this sample create a block called BLOCK and save it to your C:\ drive.
'Sub to test the function
Function Insertblock(ByVal blockname As String)
Dim pnt, pnt2 As Variant
prompt1 = vbCrLf & "Enter block insert point: "
'Get the first point without entering a base point
pnt = ThisDrawing.Utility.GetPoint(, prompt1)
'Insert the block
Set blockRefObj = ThisDrawing.ModelSpace.Insertblock(pnt, blockname, 1#, 1#, 1#, 0)
On Error Resume Next
'Specify rotation angle on screen
blockRefObj.Rotate pnt, ThisDrawing.Utility.GetAngle(pnt, "Select Rotation Angle:")