Author Topic: How to load .vlx files  (Read 9598 times)

0 Members and 1 Guest are viewing this topic.

MUQTAR

  • Guest
How to load .vlx files
« on: March 23, 2012, 04:59:55 PM »
i have some .vlx files when i need them every time drawing those file in current drawing. there any way load them permanently

thanking you,


BlackBox

  • King Gator
  • Posts: 3770
Re: How to load .vlx files
« Reply #1 on: March 23, 2012, 07:07:05 PM »
For our .VLX, I use an IF statement to demand load. Here's a simple example for macro:

Code: [Select]
^C^C^P(if (not _YourCommandName)(load "YourVlxFile")) _YourCommandName ^P

** Writing from memory on iPhone, sorry for any typos.

HTH
"How we think determines what we do, and what we do determines what we get."

Lee Mac

  • Seagull
  • Posts: 12906
  • London, England
Re: How to load .vlx files
« Reply #2 on: March 24, 2012, 08:36:07 AM »
You can load VLX applications in the same way as you would load LISP files, either using the Startup-Suite within AppLoad, or a call to the load function in the ACADDOC.lsp file, e.g.:

Code - Auto/Visual Lisp: [Select]
  1. (load "YourVLX" "Unable to Load VLX File")

irneb

  • Water Moccasin
  • Posts: 1794
  • ACad R9-2016, Revit Arch 6-2016
Re: How to load .vlx files
« Reply #3 on: March 25, 2012, 07:07:43 AM »
Yep, LSP/FAS/VLX loads in the same way. You either use appload, it's built-in startup suite, load statements in acaddoc.lsp/mnl, autoload statements in acaddoc.lsp/mnl, or many other methods. You can even add vl-load-all in acad.lsp (instead of load in acaddoc.lsp) if you think that would make it more efficient, but I doubt if you'd notice much difference.

Just note: the load & autoload statements check for the filename. If not found then checks for the filename with a VLX extension, then FAS then LSP. So say you've got a MyFuncs.VLX., you would get the same result with both of the following lines:
Code: [Select]
(load "MyFuncs.VLX")
(load "MyFuncs")
Though the 2nd line is slightly less efficient, I prefer it since it allows for more options.

Say you're working on your codes and they're still in LSP files because you're editing them. Once you are finished you can simply compile your LSP into FAS or VLX and it would work as before, just using the compiled versions instead. If you added the 1st type of line however, you'd need to modify to now use the VLX instead of the LSP - otherwise the LSP would still be loaded and you'd not benefit from the compiling optimizations.

So if I could give you advise: use the load or autoload idea in either your acaddoc.lsp (a file you probably need to create yourself) or in a MNL file named the same as your own CUI - it would load each time your own menu setup is loaded. AFAICT it is the easiest way to ensure the correct stuff loads, even on new installations and other PCs. The Appload suite is a bit more tricky to setup for multiple places, making it difficult to administer.
Common sense - the curse in disguise. Because if you have it, you have to live with those that don't.

irneb

  • Water Moccasin
  • Posts: 1794
  • ACad R9-2016, Revit Arch 6-2016
Re: How to load .vlx files
« Reply #4 on: March 25, 2012, 07:13:22 AM »
Oh yes, and as for the difference between load and autoload. It's a question of do you need this code to be loaded all the time, or only when used?

E.g. say your code loads a reactor which fires each time a command is started. In this case you'd need to use the load statement since the code has to be loaded to catch the reactor.

If your code only has a few new commands, then perhaps the autoload would be preferable. I.e. the file (VLX/FAS/LSP) will only be loaded the first time you issue one of those commands.
Common sense - the curse in disguise. Because if you have it, you have to live with those that don't.

MUQTAR

  • Guest
Re: How to load .vlx files
« Reply #5 on: March 25, 2012, 12:52:11 PM »
Thanks for information, its done now,