Author Topic: DEMANDLOAD VLX  (Read 3790 times)

0 Members and 1 Guest are viewing this topic.

Fred Tomke

  • Newt
  • Posts: 38
  • [ Mr. Bad Guy ]
DEMANDLOAD VLX
« on: December 21, 2009, 10:56:40 AM »
Hello,

how can I load a VLX using DEMANDLOAD like it is possible with ARX files?

I've tried this but without success:

Code: [Select]
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Autodesk\AutoCAD\R17.2\ACAD-7000:407\Applications\LVMAN]
"Loader"="C:\\Programme\\LVMAN\\LVMAN.vlx"
"Description"="LVMAN"
"LoadCtrls"=dword:0000000c

[HKEY_LOCAL_MACHINE\SOFTWARE\Autodesk\AutoCAD\R17.2\ACAD-7000:407\Applications\LVMAN\Commands]
"LVMAN"="LVMAN"

Fred
Fred Tomke
Dipl.-Ing. (FH) Landespflege

[ landscaper - landscape developer - digital landscape and urban design]

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: DEMANDLOAD VLX
« Reply #1 on: December 21, 2009, 11:19:34 AM »
Welcome to the Swamp...

I thought AutoLoad would handle that?

I'll go look it up.
« Last Edit: December 21, 2009, 11:24:10 AM by CAB »
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

Fred Tomke

  • Newt
  • Posts: 38
  • [ Mr. Bad Guy ]
Re: DEMANDLOAD VLX
« Reply #2 on: December 21, 2009, 02:35:30 PM »
Hi, CAB, thanks for replying.

As far as I understood AUTOLOAD is that I have to start a lisp (in each drawing?) where the AUTOLOAD-expression has to be started. But I may be wrong.
The problem is that the path of the VLX is not an AutoCAD supportpath. I read it from the registry first. Where shall I start the lisp file with the AUTOLOAD-expressions, when I did not use the AutoCAD-supportpaths?

The advantage of such a registry key (like in my initial posting) is that I can set it during installation of the application. Then I have the installation path and I can loop through all the installed AutoCAD-installations.

Thank you for further hints or corrections.

Fred
Fred Tomke
Dipl.-Ing. (FH) Landespflege

[ landscaper - landscape developer - digital landscape and urban design]

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: DEMANDLOAD VLX
« Reply #3 on: December 21, 2009, 03:52:30 PM »

Morning Fred, Welcome !
Have a look around, stay awhile :)


I'm sure that Owen has an app/method on his site to allow demand loading of VLX.

kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: DEMANDLOAD VLX
« Reply #4 on: December 21, 2009, 04:22:41 PM »
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Fred Tomke

  • Newt
  • Posts: 38
  • [ Mr. Bad Guy ]
Re: DEMANDLOAD VLX
« Reply #5 on: December 21, 2009, 04:54:26 PM »
Thanks Kerry, I'll try it out.

Fred
Fred Tomke
Dipl.-Ing. (FH) Landespflege

[ landscaper - landscape developer - digital landscape and urban design]

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: DEMANDLOAD VLX
« Reply #6 on: December 21, 2009, 08:37:37 PM »


Here's a way to do it with a modified Autoload, 'cause the AutoCAD autoload doesn't like qualified pathing

First:
copy these to a file that loads into autoCAD at startup and into each Document ; either a MNL file or one of the ACADxxxxxx.lsp files.
I use a .MNL to a do-nothing .MNU file.


Code: [Select]
(vl-load-com)
(defun _FredsAutoAppload (app_name cmdlist / qapp initstring)
  (setq qapp       (vl-prin1-to-string app_name)
        initstring "\nInitializing..."
  )
  (mapcar '(lambda (cmd / cmd_name)
             (progn (setq cmd_name (strcat "C:" cmd))
                    (if (not (eval (read cmd_name)))
                      (eval (read (strcat "(defun "               cmd_name
                                          "( / rtn)"              "(setq m:err *error* *error* *merrmsg*)"
                                          "(if (findfile "        qapp
                                          ")"                     "(progn (princ initstring)"
                                          "(load "                qapp
                                          ") (setq rtn ("         cmd_name
                                          ")))"                   "(ai_nofile "
                                          qapp                    "))"
                                          "(setq *error* m:err m:err nil)"
                                          "rtn)"
                                         )
                            )
                      )
                    )
             )
           )
          cmdlist
  )
  nil
)

;;-----------------------------------------------------------------------------
(setq FredsSpecialAppPath "K:/KDUBPro2010/TestLoad/")
       
(_FredsAutoAppload  (strcat FredsSpecialAppPath "testload_01.lsp") '("testload_01"))
(_FredsAutoAppload  (strcat FredsSpecialAppPath "Application2/testload_02.lsp") '("testload_02"))
;;-----------------------------------------------------------------------------


Then change the Pathing to suit your app location.

K:/KDUBPro2010/TestLoad/  is my app root path ( not on the ACAD PATH)
K:/KDUBPro2010/TestLoad/Application2/ is the folder for one of my apps


NOW :
when you start an AutoCAD drawing the placeholder command for each of your APPS is defined.
When you run the command at the commandline the app is loaded ( if not already loaded) and runs.

let us know how you get on

Code: [Select]
(defun c:testload_01 () (alert "We're inside TestLoad_01") (princ))
(princ)

Code: [Select]
(defun c:testload_02 () (alert "We're inside TestLoad_02") (princ))
(princ)
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: DEMANDLOAD VLX
« Reply #7 on: December 21, 2009, 08:46:20 PM »
So, using your initial post,
your AppName would be
"C:\\Programme\\LVMAN\\LVMAN.vlx"

and your command would be "LVMAN"

so the placeholder definition call would/could be

(_FredsAutoAppload "C:\\Programme\\LVMAN\\LVMAN.vlx"  '(  "LVMAN"))
« Last Edit: December 21, 2009, 08:50:36 PM by Kerry Brown »
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: DEMANDLOAD VLX
« Reply #8 on: December 21, 2009, 08:54:54 PM »


just an additional note

When you install your app you could save the appPath into the Registry ; then recall it to a Global variable into each document ... that way any support files can be found via the global variable for each applcation path.
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Fred Tomke

  • Newt
  • Posts: 38
  • [ Mr. Bad Guy ]
Re: DEMANDLOAD VLX
« Reply #9 on: December 21, 2009, 09:01:48 PM »
Kerry, thank you so much!

Meanwhile I got Owen's code working for me and I created some ARX-files for DEMANDLOAD. Works very well.
The only thing I have to solve is how to load the lisp once for the first time to load the menu automatically.

I will also have a test with your samples. Looks very easy so I'm thinking about removing Owen's VLXLoader to use your way.

However, I will add both ways to the OpenDCL-FAQ for loading the functions.

I wish all of you and your families a Merry Christmas, and industrious Santa Claus, restful holidays and a good start to a healthy and successful new decade.

Regards,
Fred
Fred Tomke
Dipl.-Ing. (FH) Landespflege

[ landscaper - landscape developer - digital landscape and urban design]

Fred Tomke

  • Newt
  • Posts: 38
  • [ Mr. Bad Guy ]
Re: DEMANDLOAD VLX
« Reply #10 on: December 21, 2009, 09:15:08 PM »
Kerry, call me stupid, but may I ask you a question?

When I have a mnl-file which is automatically loaded when the menu is loaded - which advantage could exist to work with autoload instead of loading the vlx from the mnl directly (except keeping the memory clear if the command is not needed)?

This was my MNL before I had started with Owens VLXLoader...

Code: [Select]
(if (not vlax-get-acad-object) (vl-load-com))
(defun c:sc_lvman_load (/ strFile strPath strRegPath)
  (if (not c:sc_lvman)
    (progn
      (if (not (= (getenv "PROCESSOR_ARCHITECTURE") "x86"))
(setq strReg "SOFTWARE\\Wow6432Node\\euroGIS\\LVMan\\LVMan")
(setq strReg "SOFTWARE\\euroGIS\\LVMan\\LVMan")
      ); if
      (if (setq strRegPath (vl-registry-read (strcat "HKEY_LOCAL_MACHINE\\" strReg) "InstDir"))
(if (= (substr strRegPath (strlen strRegPath)) "\\")
  (setq strPath strRegPath)
  (setq strPath (strcat strRegPath "\\"))
); if
(progn
  (princ "\nAn important registry key is missing. Please install LVMAN anew!\n")
  (setq strPath "C:\\Programme\\euroGIS\\LVMan\\")
); progn
      ); if
      (if (setq strFile (findfile (strcat strPath "lvman.vlx")))
(vl-load-all strFile)
        (alert "\nCannot find the file LVMAN.VLX. Please install LVMAN anew!\n")
      ); if
    ); progn
  ); if
  (princ)
); c:sc_lvman_load
(c:sc_lvman_load)

Fred
Fred Tomke
Dipl.-Ing. (FH) Landespflege

[ landscaper - landscape developer - digital landscape and urban design]

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: DEMANDLOAD VLX
« Reply #11 on: December 21, 2009, 09:19:10 PM »
Fred, I AutoLOAD purely to save the startup time and memory if the app is not needed immediately  .... think about batch processing etc :)



added:
and NO, I won't call you stupid 'cause I know you're NOT   :-D
« Last Edit: December 21, 2009, 09:22:18 PM by Kerry Brown »
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Fred Tomke

  • Newt
  • Posts: 38
  • [ Mr. Bad Guy ]
Re: DEMANDLOAD VLX
« Reply #12 on: December 21, 2009, 09:29:39 PM »
Quote
save the startup time

Yes, that's a good argument. But in this special case I should add another condition: the LVMAN is a palette containing document related information. I should add a condition for the case the palette is already loaded (then the VLX must be loaded immediately, to update the content) or - if not - to set the AUTOLOAD option like you did.

It's 3:30 in the night. It's time to go on thinking about it in bed...  :wink:

Fred
Fred Tomke
Dipl.-Ing. (FH) Landespflege

[ landscaper - landscape developer - digital landscape and urban design]

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: DEMANDLOAD VLX
« Reply #13 on: December 21, 2009, 09:34:11 PM »

sweet dreams   :lol:
If you're like me you'll wake up in 2 hours with the solution    :wink:
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: DEMANDLOAD VLX
« Reply #14 on: December 21, 2009, 09:41:23 PM »

For when you wake up.

Could you set a variable to the blackboard when you initially start your app.

Then, when you start a new document, if the variable has the correct value you could run the initialisation/EventTrap  code for the palette/modeless dialog.
This could be run in-line from the .MNL after you've defined the AutoStart stub.

kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.