AfraLisp Blog

The AutoLisp/Visual Lisp/VBA Resource Website

AfraLisp Blog

Home Newsletter Utter Rubbish Coding Tips AutoCAD Tips Contact Downloads WAUN

Would you like to use AutoCAD commands from Visual Basic or VBA?
Use the SendCommand method on the document object.
This example sends a command to the AutoCAD command line of a particular drawing for evaluation. We will create a Circle in the active drawing and will zoom to display the entire circle

'CODING STARTS HERE
Sub Example_SendCommand()

ThisDrawing.SendCommand "_Circle" & vbCr & "2,2,0" & vbCr & "4" & vbCr
ThisDrawing.SendCommand "_zoom" & vbCr & "a" & vbCr
ThisDrawing.Regen acAllViewports
MsgBox "A circle command has been sent to the command line of the current drawing."
End Sub
'CODING ENDS HERE

The AutoLisp/Visual Lisp/VBA Resource Website

Copyright 1999-Perpetuity by AfraLisp

All rights reserved.
Information in this document is subject to change without notice.
Site created and maintained by Kenny Ramage

The AutoLisp/Visual Lisp/VBA Resource Website