Nate Holt's Blog

August 24, 2010

Add sounds to your too-quiet AutoLisp utility

Filed under: Tips — nateholt @ 8:09 pm

Add audible feedback “sounds” to brighten your AutoLISP functions

Pretty much the totality of my AutoLISP customization has been mute. Last week I decided that it was time to make a little noise.

For example, if my function failed for some reason (operator input error or premature program exit), I wanted the tool to not just issue a little message to the command window… I wanted it to be accompanied with a clundge sound.

(acet-sys-beep …)

A search turned up a couple methods to embed some simple sounds into an AutoLISP function. The one way that seemed to work for me was using a call to “acet-sys-beep”  and this only after I installed the “Express tool” option that comes on the AutoCAD install CD.

But once in place, there were three different sounds I could generate from this call. If you want to experiment, type each of these at the “Command:” prompt (if you don’t hear a thing, you may need to check for existence of the AutoCAD “EXPRESSTOOLS” on your machine):

  • (acet-sys-beep 16) [Enter]
  • (acet-sys-beep 48) [Enter]
  • (acet-sys-beep 64) [Enter]

Sample Utility that invokes a couple different sounds

Here’s an example function showing how two different sounds can be tied into success and failure of a function. This tool just swaps tag-ID values between two picked AutoCAD Electrical components. If the components are different types, then an error dialog is accompanied by a bad sound. If success, then a more happy sound.

This is not rocket-science. But it makes my mundane utility just a bit more interesting.

The two places where the sound is invoked is highlighted below. Just to be safe, in both places there is a call to confirm that function (acet-sys-beep…) exists… before trying to call it.

About these ads

4 Comments »

  1. You can also use (vlr-beep-reaction).
    It does not allow to set the pitch but you will not depend on Express Tools.

    Comment by Vladimir Michl — August 26, 2010 @ 2:37 am

    • Hi Vladimir,
      I tried to use (vlr-beep-reaction) but I could not get it to work. I must be doing something wrong? How would it be implemented in the sample utility?
      Nate.

      Comment by Nate Holt — August 26, 2010 @ 7:26 am

  2. We are using it quite often, just by invoking “(vlr-beep-reaction)”. It might be neccessary to call (vl-load-com) first.

    Comment by Vladimir Michl — August 26, 2010 @ 7:48 am

  3. […] Add sounds to your too-quiet AutoLisp utility Updating drawings from scratch database edits Tutorial – Using Excel with AutoCAD Electrical (Part 4 – Wire numbers) Tutorial – Using Excel with AutoCAD Electrical (Part 3) Tutorial – Using Excel with AutoCAD Electrical (Part 2) Tutorial – Using Excel with AutoCAD Electrical (Part 1) Adding custom option to Insert WBlock Circuit command […]

    Pingback by Index of AutoCAD Electrical Utilities – April 2006 through August 2010 « AutoCAD Electrical Etcetera — September 1, 2010 @ 3:49 pm


RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

The Shocking Blue Green Theme. Blog at WordPress.com.

Follow

Get every new post delivered to your Inbox.

Join 25 other followers

%d bloggers like this: