An Automated Guiding System for Newcomers Using AutoCAD VBA and Microsoft Speech
An Automated Guiding System for Newcomers Using AutoCAD VBA and Microsoft Speech
Have you found the title a little bit confusing? Let me elaborate it. What we are going to see is a simple event oriented AutoCAD VBA program to guide newcomers in a company through proper way until they get familiar with Dos and Donts as well as company standards. The program given below is pretty simple and is only intented to show how the system can be implemented. It requires Microsoft Speech (Text-to-speech) to be available in your system. If you wish to implement a comprehensive system, you would better write your code in class modules. Again, this system is not recommended for experienced users as it will definitely check their patience. Here goes the code.
Private Sub AcadDocument_BeginCommand(ByVal CommandName As String)
On Error Resume Next
Dim objSSV As Object
Set objSSV = CreateObject("Sapi.SpVoice")
With objSSV
Select Case CommandName
Case "SAVEAS", "QSAVE", "SAVE"
.speak "Please make sure that the saved drawing version is as per client standard"
Case "BLOCK", "WBLOCK"
.speak "All blocks shall be made in zero layer"
Case "LAYER"
.speak "Please refer CAD manual for standard layering system"
Case "EXPLODE"
.speak "No standard blocks shall be exploded for editing"
Case "REFEDIT", "BEDIT"
.speak "Please contact CAD support before editing any standard blocks"
End Select
End With
Set objSSV = Nothing
End Sub
Keep the above code inside the ThisDrawing section of Visual Basic Editor (for testing purpose) and turn the speakers on. Run any of the fore-mentioned commands inside AutoCAD. You will hear instructions based on the commands. Hope this system will help senior guys to avoid running behind the newcomers for correction and teaching purposes.