Jump to content

lsp help for loading & unloading arx file from specified folder!


jamesfui

Recommended Posts

hi.. need help on creating lsp that can:

 

> load & unload *.arx file which is located on specified folder!

 

example;

```````

[size=2](defun c:arxload()[/size]
[size=2](command "load" "[/size][size=2]c:\documents & settings\user\addons\mditab17.arx[/size][size=2]")(princ))[/size]

 

[size=2](defun c:arxunload()[/size]
[size=2](command "unload" "[/size][size=2]c:\documents & settings\user\addons\mditab17.arx[/size][size=2]")(princ))[/size]

 

thanks 8)

Edited by SLW210
Link to comment
Share on other sites

Welcome to CADTutor!

 

First, I'd suggest that you NOT define custom commands using the same name as that of a protected symbol (LISP function).

 

Second, give this a try:

 

(defun c:MDITAB  ()
 ((lambda (arxList mdi path)
    (princ
      (strcat "\rMDITAB: "
              (cond ((member mdi arxList)
                     (arxunload mdi)
                     "UNLOADED ")
                    ((arxload (strcat path mdi))
                     "LOADED ")))))
   (arx)
   "mditab17.arx"
   "c:\\documents & settings\\user\\addons\\")
 (princ))

Link to comment
Share on other sites

wow!!! :shock:

i can't believe that it is you (Lee Mac) who is the first one to reply my first post!!! :D it sure is my pleasure!!

i was so happy, cz i'm currently using your created lsp to help on my drafting work... and it really is very very handy/useful!

that save time & effort too.... thks a lot

 

Actually i got plenty of issue(post) on autolisp since i started it when i feel the power lsp routines can do so much for me in autocad.

that's why i join this forum just today to seek more understanding/experience on autolisp!

 

Will sure try it out asap when i go back to office! 8) thanks again!!!! hAPPy

Link to comment
Share on other sites

thanks for the welcome!

Feel really great to get another suggestion from you! :lol:

i'm new to autolisp but it sure gives me the interest to learn deeper in it...

Will sure try it out!!!

thanks a lot Mr. RenderMan 8)

Link to comment
Share on other sites

wow!!! :shock:

i can't believe that it is you (Lee Mac) who is the first one to reply my first post!!! :D it sure is my pleasure!!

i was so happy, cz i'm currently using your created lsp to help on my drafting work... and it really is very very handy/useful!

that save time & effort too.... thks a lot

 

Thanks - I'm flattered that my reputation precedes me. o:) Thanks for using my programs, I hope they can assist you in your work.

 

First, I'd suggest that you NOT define custom commands using the same name as that of a protected symbol (LISP function).

 

A good point to raise, however for clarification, note that the defined symbol in this case is "c:arxload", not the protected arxload symbol :thumbsup:

Link to comment
Share on other sites

A good point to raise, however for clarification, note that the defined symbol in this case is "c:arxload", not the protected arxload symbol :thumbsup:

 

Cheers, Lee - on both counts! LoL :beer:

Link to comment
Share on other sites

Well... I think you've long overtaken me with your .NET studies :thumbsup:

 

That is kind of you to say, my friend. :oops:

 

It's funny you mention .NET as I've just written a LispFunction Method "NETLOAD" for LISP that accepts a single argument, a valid file path to DLL, as String (just for fun). :geek: LoL

Link to comment
Share on other sites

Welcome to CADTutor!

 

First, I'd suggest that you NOT define custom commands using the same name as that of a protected symbol (LISP function).

 

Second, give this a try:

 

FWIW -

 

I keep both the 32-Bit, and 64-Bit MDITAB .ARX files in the same directory (I just renamed the ones for 64-Bit as noted in the code below), and use this **shell to filter for which one to load across multiple AutoCAD versions, and operating systems:

 

** I actually do not use this command, rather I use a System Variable Reactor to perform the same function automagically.

 

[color=black]
[/color](defun c:MdiTab  (/ 64Bit-p)
   ;; © RenderMan, 2011
   (vl-load-com)
 
   (defun 64Bit-p ()
   ;; © RenderMan, 2011
   ;; Returns T if version is 64-Bit
   ;; Example: (64bit-p)
   (if (vl-string-search "64" (getenv "PROCESSOR_ARCHITECTURE"))
     T
     nil))
 
   ((lambda (key sdi / mditab flag)
      (if (and
            sdi
            (setq mditab
                   (cond
                     ((vl-string-search "17" key)                        ; 2007, 2008, 2009
                      (if (64Bit-p)
                        "mditab17x64.arx"
                        "mditab17.arx"))
                     ((vl-string-search "18" key)                        ; 2010, 2011, 2012
                      (if (64Bit-p)
                        "mditab18x64.arx"
                        "mditab18.arx"))))
            (setq flag (findfile mditab))
            (not (vl-position mditab (arx))))
        (and (arxload mditab) (princ "\rMDITAB: LOADED "))
        (cond
          (flag (and (arxunload mditab) (princ "\rMDITAB: UNLOADED ")))
          (mditabs
           (prompt (strcat "\n** \"" mditab "\" cannot be found ** ")))
          (sdi (prompt "\n** This AutoCAD version not supported ** "))
          ((prompt "\n** Command not allowed in SDI mode ** ")))))
     (vlax-product-key)
     (= 0 (getvar 'sdi)))
   (princ))

 

HTH

Link to comment
Share on other sites

  • 10 months later...

Hey boys, not sure how old this thread is, dates not showing up ... BUT I just ran this (32 vs 64 code) and I get the incompatable string in my face?

Im running 2010 Cad, Win7 64

 

am i not doing something here?

Link to comment
Share on other sites

Hey boys, not sure how old this thread is, dates not showing up ... BUT I just ran this (32 vs 64 code) and I get the incompatable string in my face?

Im running 2010 Cad, Win7 64

 

am i not doing something here?

 

Which code specifically?

 

Also, if you're able to determine... What line throws the error when you step through in VLIDE?

Link to comment
Share on other sites

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