Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: TIP: VBA command wrappers for lisp

  1. #1
    Administrator Ed Jobe's Avatar
    Join Date
    2000-11
    Location
    Turlock, CA
    Posts
    6,397
    Login to Give a bone
    0

    Default 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.
    Attached Files Attached Files
    C:> ED WORKING....

  2. #2
    Member
    Join Date
    2015-08
    Posts
    16
    Login to Give a bone
    0

    Default Re: TIP: VBA command wrappers for lisp

    sweet! Great tip.

  3. #3
    Administrator Ed Jobe's Avatar
    Join Date
    2000-11
    Location
    Turlock, CA
    Posts
    6,397
    Login to Give a bone
    0

    Default Re: TIP: VBA command wrappers for lisp

    Thank you.
    C:> ED WORKING....

  4. #4
    AUGI Addict fixo's Avatar
    Join Date
    2005-05
    Location
    Pietari, Venäjä
    Posts
    1,269
    Login to Give a bone
    0

    Default Re: TIP: VBA command wrappers for lisp

    Quote Originally Posted by brett.burling
    sweet! Great tip.
    Agreed, very nice one

    ~'J'~

  5. #5
    Member
    Join Date
    2015-08
    Posts
    16
    Login to Give a bone
    0

    Default 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??

  6. #6
    Administrator Ed Jobe's Avatar
    Join Date
    2000-11
    Location
    Turlock, CA
    Posts
    6,397
    Login to Give a bone
    0

    Default 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.
    C:> ED WORKING....

  7. #7
    Member
    Join Date
    2015-08
    Posts
    16
    Login to Give a bone
    0

    Default 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....

    (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...
    Attached Files Attached Files

  8. #8
    Administrator Ed Jobe's Avatar
    Join Date
    2000-11
    Location
    Turlock, CA
    Posts
    6,397
    Login to Give a bone
    0

    Default Re: TIP: VBA command wrappers for lisp

    I noticed you added (vl-load-com) to each of your commands, but its not in the attached lisp.
    C:> ED WORKING....

  9. #9
    Administrator Ed Jobe's Avatar
    Join Date
    2000-11
    Location
    Turlock, CA
    Posts
    6,397
    Login to Give a bone
    0

    Default Re: TIP: VBA command wrappers for lisp

    I also, should mention that using this tip executed the macro in the document context, whereas vl-vbarun and VBARUN run the macro in the application context. The result is that you may run into a problem if the macro needs to hide the a modal form to get user input. Since the macro is running in the document context, the application cannot respond to mouse events, i.e. the cursor dissapears.
    C:> ED WORKING....

  10. #10
    All AUGI, all the time zoomharis's Avatar
    Join Date
    2005-02
    Location
    Abu Dhabi (Native-India)
    Posts
    506
    Login to Give a bone
    0

    Default 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.

Page 1 of 2 12 LastLast

Similar Threads

  1. Replies: 3
    Last Post: 2009-10-22, 10:19 PM
  2. Mtext Command in Lisp
    By bowtle in forum AutoLISP
    Replies: 12
    Last Post: 2009-01-12, 05:47 PM
  3. TableStyle command in lisp
    By am4soft in forum AutoLISP
    Replies: 6
    Last Post: 2009-01-11, 02:28 PM
  4. torient command in lisp
    By mbergink in forum AutoLISP
    Replies: 3
    Last Post: 2008-12-24, 04:15 AM
  5. Help starting a LISP command
    By gurudas.ku in forum AutoLISP
    Replies: 5
    Last Post: 2006-12-15, 05:00 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •