1 Attachment(s)
TIP: VBA command wrappers for lisp
I have a menu which includes providing wrapper functions for many vba routines. The attached code is not a complete lisp function, but a portion of an mnl that automates creating "C:" style defuns for my vba routines. When I add a new vba sub, all I have to do is add the text name to an array.
The mnl uses (vl-vbaload) to load the dvb containing the subs. The RunMacro method is used rather than (vla-runmacro) because many of my subs make use of the PickfirstSelectionSet, which gets cleared when called from lisp. You can change the consctuctor to utilize vbarun if you wish. The main point here is to minimize maintenance so as not to have dozens of defun's.
RE: TIP: VBA command wrappers for lisp
RE: TIP: VBA command wrappers for lisp
Quote:
Originally Posted by brett.burling
sweet! Great tip.
Agreed, very nice one
~'J'~
RE: TIP: VBA command wrappers for lisp
Just got upgraded to AutoCAD 2008 and the "wrapper" doesn't seem to work anymore. Anyone else had troubles??
RE: TIP: VBA command wrappers for lisp
Quote:
Originally Posted by brett.burling
Just got upgraded to AutoCAD 2008 and the "wrapper" doesn't seem to work anymore. Anyone else had troubles??
There's nothing in there that should be specific to a version. Check your installation, i.e. support paths, cui, etc. Make sure everythings getting loaded properly.
1 Attachment(s)
RE: TIP: VBA command wrappers for lisp
Umm..
Checked the CUI and the lisp file is definitely being loaded, still no luck.
If i open the lisp file and change the wrapper to the"old way" of doing things....
Quote:
(defun c:BGESECTIONMARK()
(vl-load-com)(vla-runmacro (vlax-get-acad-object) "BGESECTIONMARK")
)
(defun c:BGESECTIONTITLE()
(vl-load-com)(vla-runmacro (vlax-get-acad-object) "BGESECTIONTITLE")
)
It works fine. My wrapper code is attached...
RE: TIP: VBA command wrappers for lisp
Thanks for the code, Ed Jobe. It's really helpful for me as I use so many macros in my application. By the way, I would like to use command alias differently from the command name. For example, I normally use a command alias 'ALT' for the macro 'AlignText'. How to incorporate this in your program?. I am sorry. I know only a few things in lisp.