26 | 02 | 2017

Insert Block using Users Input

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 test()


'Sub to test the function
Insertblock "C:\block.dwg"
End Sub

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:")

End Function


 


Login

Sign up now and upload your code to the website.

Help us to continue.....
Statistics
Articles View Hits
2179681
Latest Articles