Jump to content

Create new command and its options


Recommended Posts

Posted (edited)

Hello everyone,

 

I create VBA macros and I'd like to know if there's any way to create new command as lisp.

ex.: (defun c:new-command())
If so, can "drop down menu" like other natives commands (see picture below) be created ?

If not, do I need to create a lisp program to create commands only ? does this lisp program can create those options (as picture below) ?

 

capture-commande.PNG

Edited by gdanielo
  • gdanielo changed the title to Create new command and its options
Posted

In VBA you make Sub routines so these can be called from within the master VBA program. The VBA program would use say a Form for selection. I dabble at the edges of VBA need to open a 15 year old VBA I have to see how I did it.

 

  • 4 weeks later...
Posted

You can create an AutoLISP command wrapper to run your VBA Macro. Try this example to create AutoCAD commands:

(defun c:MyCommand (/ fil mac) ;; Replace "MyCommand" with the command name of your preference.
   (vl-load-com)
   (setq fil "myfile.dvb" ;; Replace with the name of your DVB file
         mac "MyMacroSub" ;; Replace with the name of your main sub to fun the program.  
   )
   (vl-vbarun (strcat fil "!" mac))
   (princ)
)

 

Posted

Another example this is a line in a POP menu.

 

[Drainage schedule]^C^C(vl-vbaload "P:/AutoDESK/VBA/Drainage.dvb") (vl-vbarun "Drainage")

 

 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...