Getting AutoCAD to talk

Getting AutoCAD to talk

Dave_S
Advocate Advocate
371 Views
4 Replies
Message 1 of 5

Getting AutoCAD to talk

Dave_S
Advocate
Advocate

Okay, I managed to get AutoCAD to greet me verbally when I open a new drawing. That works fine, although it took me a while to change the gender of the voice, using Windows 11. I did this on a whimsy. Being a little more whimsical, I attempted to let it tell me what command I was using when I started one. Also if I cancelled a command it would apologize to me. Finally when I ended the command it would tell me the command was completed. The trouble with this part of my exercise was, it told me twice in a row before I could continue. Would anyone know why it would repeat itself? Also if I load it as an .lsp file and then load it again, every time I load it, it adds another iteration.

Dave_S

0 Likes
372 Views
4 Replies
Replies (4)
Message 2 of 5

anton_chmidt
Advocate
Advocate
Hi, I think you forgot to attach the .lsp file you were mentioning
0 Likes
Message 3 of 5

Sea-Haven
Mentor
Mentor

Poor work colleagues when they open Acad and talks to them saying "Hi xxx I am ready to work now" Changed the message a couple of times as was on a server. 

 

Yes have played with speech recognition and Autocad interesting result when you have say TV going in background. Of course @#$%^ has a equivalent command in ACAD.

 

Post code interested to look at have something that records all commands used into text file it may have something useful.

 

Speech example 

(defun SpeakSapi ( s / sapi )
(if (eq (type s) 'STR) 
(progn 
(setq sapi (vlax-create-object "Sapi.SpVoice"))
(vlax-put sapi 'SynchronousSpeakTimeout 1)
(vlax-invoke-method sapi 'WaitUntilDone 0)
(vlax-invoke sapi "Speak" s 0)
(vlax-release-object sapi)
)))
(speaksapi "Thank you from A H Consulting  for your on-going help")

 

 

0 Likes
Message 4 of 5

Dave_S
Advocate
Advocate

Yes I started out using something very similar to that and placed it in my acaddoc.lsp file. Then I said to myself HEY! why don't I create a routine that captures the user starting a command, via keyboard, menu, tool bar, ribbon etc. and read it back to the user. It works very well, but maybe too well. It doesn't want to shut up after capturing a command to read. I haven't gone thru it with the troubleshooter line by line to see what's happening. One thing I just noticed now is my statement "(vlax-invoke sapi "GetVoices" str 1)" has a 1 where yours has a 0. Mine did a have a 0 and I changed it to 1 when I was trying to figure out how to change the gender of the voice. I figured out how to do that (nothing to do with the 0). I forgot to set it back to 0. I will set it back and let you know. I used code from another routine I wrote that automatically adjusts the text size so that no matter the scale of the viewport you are in, it will always be the right size for your notes.

0 Likes
Message 5 of 5

vladimir_michl
Advisor
Advisor

You can look at the Speak.LSP file at www.cadforum.cz - it illustrates some examples of using the Sapi.SpVoice object and AutoCAD reactors. But no voice recognition there.

 

Vladimir Michl, www.arkance-systems.cz  -  www.cadforum.cz