PDA

View Full Version : VB Button in AutoCAD 2004



PellaCAD
2007-08-15, 08:37 PM
I've just spent the past month acquainting myself with VB.NET...and XML...and Excel...and all has gone reasonably smoothly...until...

It's time to execute my program via an AutoCAD 2004 toolbar button...but I can't locate any answers regarding how to set up a toolbar button to accomplish this...

Can anyone help with this seemingly "simple" task...

I be schtuck...

Pete

bweir
2007-08-15, 10:14 PM
Can you be more specific, what is it you need to execute? If you need to run an external application (.exe) one method is the SHELL command in AutoCAD. Your button macro code might be something like SHELL^MExcelThingy.exe^M. Otherwise because you're working with VB.Net, download the AutoCAD SDK/API (http://usa.autodesk.com/adsk/servlet/index?siteID=123112&id=1911627) and create a DLL to load into AutoCAD. If you just want to start Excel you could use VBA or Lisp, both will allow you to create a reference to an ActiveX object.

zoomharis
2007-08-16, 08:41 AM
I've just spent the past month acquainting myself with VB.NET...and XML...and Excel...and all has gone reasonably smoothly...until...

It's time to execute my program via an AutoCAD 2004 toolbar button...but I can't locate any answers regarding how to set up a toolbar button to accomplish this...

Can anyone help with this seemingly "simple" task...

I be schtuck...

Pete
AutoCAD 2004 doesn't not have a .Net API. So you can not run managed DLLs inside 2004. If you are looking for a way to run an external program from an AutoCAD Tool button, the follow these steps.

1. Goto Tools Menu --> Cutomize-->Toolbar
2. Create a new toolbar and check it to make it visible
3. Goto Commands tab and select 'User Defined'
4. Drag 'User Defined Button' from the commands section and drop it inside the new toolbar
5. Click on the newly dropped button to see the button properties inside the 'Costomize' window
6. Type in your command inside the 'Macro associated with this section' and apply.

Is that what you needed?

bweir
2007-08-16, 02:43 PM
Oh yes I forgot that the .Net API didn't come out until 2005. Time to update AutoCAD, 2004 that's four releases ago :D