Its good, but not new right?
Essentially, you are just demand loading whatever is needed instead of all at once.
The fact is, you are loading the main vlx at startup, so this whole subject is whether you are careful to make things
demand load or not.
The reason I say this is because many are not good at vlx, and its intimidating.
You can get the same bang by making your key-ins simply load the code needed.
by the way, I have a vlx that contains lisps with over 50,000 lines of code from dialogs and you name it. Its my own
land desktop program. That vlx loads so fast you don't notice it. So I might say it does not matter how elegent you
are, as long as you put it all in one vlx. The problem is the people that have tons of lisps, and load them all up
front.
Either way, the idea of placing all key-ins in one file, or some set of highly organized files is important. Do not
fragment your life by searching through tons of disorganized files to find what you need to. The method in Matt's post
is great.
I personally have one key-in lisp with about 130 functions defined.
That lisp loads super fast, so the only no-no here is to load a ton of full lisps, instead of just the key-in
"assignments" like (defun c:TM () (load "gtrim.lsp")(c:gtrim))
So when you do the AU class, watch out for some guy with a smile on his face and a USB key in his hand. It might be me
with my key-ins lisp that loads plenty fast and has all the advantages of compiling to vlx (except secrecy for
sure)....or it might be an AVI of my LDT replacement program.
thx
pkirill
|>You just made my weekend. That's great stuff, Matt - thanks for sharing! I
|>smell an AU class...
|>"Matt Stachoni" wrote in message
|>news:5201499@discussion.autodesk.com...
|>On Wed, 7 Jun 2006 18:09:30 +0000, pkirill
|>wrote:
|>
|>>I guess, I'm just looking for some creative ideas for minimizing startup
|>>time.
|>
|>>Also, for a while I was in the habit of grouping a bunch of similar
|>>routines
|>>into one LISP file.
|>
|>Here's my approach, which works pretty well:
|>
|>I currently have over 1,000 keyboard macors and utilities which my users use
|>on
|>a daily basis. As you can imagine, there's a lot of code that doesn't need
|>to be
|>loaded for each DWG file, so I worked to minimize code bloat.
|>
|>First, I removed almost everything from acaddoc.lsp, opting to load things
|>externally instead. This was done to more easily manage things granularly
|>than
|>have to deal with a source file that's way huge. I can also cut off the
|>loading
|>of all customization with a single comment, which is a nice little software
|>valve to have.
|>
|>Second, I created many smaller macro libraries, grouping each macro into a
|>file
|>named by starting letter, e.g., a.lsp, b.lsp, c.lsp, and so on. This made it
|>easier to work on macros files instead of having everything in one huge
|>honkin'
|>LSP file.
|>
|>To edit these easily, I have an MEDIT command, that asks for a single letter
|>character, and the appropriate macros file loads up in my text editor (I
|>don't
|>use the VLISP editor except when compiling stuff). So "medit" "m" would load
|>up
|>the "m.lsp" source file for editing.
|>
|>Thirdly, I created many small "support function" libraries, one for each
|>type of
|>work it does. For example, here's a partial list:
|>
|>corelib.lsp - Core global functions (loaded from acaddoc.lsp)
|>reglib.lsp - registry handling functions
|>blocklib.lsp - Block handling
|>entlib.lsp - entity data handling
|>annotlib.lsp - Annotation (text, dimstyle) handling
|>dialoglib.lsp - Dialog box functions
|>filelib.lsp - File handling
|>geomlib.lsp - Geometry handling
|>layerlib.lsp - Layer handling
|>
|>and so on.
|>
|>The idea here is that each macro uses (and reuses) code from one or more of
|>these function libraries, instead of having 10 macros which have the same
|>function defined in the macro code itself. This maximizes code reuse, making
|>the
|>overall footprint of the LSP files much smaller.
|>
|>In my corelib.lsp file, I created "include" functions which checks and loads
|>the
|>required function libraries.
|>
|>For example, (core:IncludeFileLib) will check to see if filelib.lsp is
|>loaded.
|>So, in a macro that is going to access files (such as a block insertion
|>command
|>macro) I have something like this
|>
|>;; Insert a file as a block
|>(defun c:IF ()
|>;; load required function libraries
|> (core:IncludeFileLib)
|> (core:IncludeBlockLib)
|>
|> (body of code here)
|> :
|> :
|> (princ)
|>)
|>
|>That way, the user only loads the support functions when they need them when
|>the
|>macro is run for the first time.
|>
|>After all of this is done, I compile all of the "macro" functions into a
|>single
|>"MACROS.VLX" file, and compile each of the smaller function libraries into
|>their
|>own VLX files. My startup code only needs to load the single "macros.vlx"
|>file;
|>all the support function files are then demand loaded.
|>
|>I use (autoload) only for some larger command utilities which have their own
|>dedicated LSP file. Because I have so many command macros, I did not want
|>the
|>overhead of a (autoload) function for each one. I would also have to track
|>thems
|>in two locations, one as I write the command function, then also create
|>another
|>(autoload) statement in the acaddoc.lsp file.
|>
|>If I could figure out a way to load a set of macros automatically just be
|>recognizing the first character, that would be cool, so I wouldn't even have
|>to
|>compile/load a macros.vlx at all - running the "IF" command would load the
|>"i.vlx" file and run the command. But that's something for the future...
|>
|>Because everything is compiled into smaller VLX files, the overhead for
|>loading
|>stuff is greatly reduced over the raw LSP code, and provides a means of
|>securing
|>the source code, as users have access to compiled VLX files - my LSP source
|>is
|>in a separate folder structure with admin-only access rights.
|>
|>Hope this gives you some ideas.
|>
|>Matt
|>mstachoni@comcast.net
|>mstachoni@bhhtait.com
|>
|>
|>
|>
|>
|>> For example we have a bunch of block insertion routines
|>>that control insertion scale, layering, insert multiple, etc. I put them
|>>all
|>>in one BlockInsertion.LSP. Some have upwards of 20 small routines in them.
|>>I
|>>think these are part of what's bogging me down and I need to harvest the
|>>C:XXXX and put those in an autoload list.
|>>
|>>
|>>"David Allen" wrote in message
|>>news:5197904@discussion.autodesk.com...
|>>Are you saying that the autoload code is slow?
|>>What I do in my shortcut key lisp and my menu's is the simple code of
|>>(defun c:G ()
|>> (ECHOOFF) (princ "\nMacro >\tGlue: ")
|>> (if (not c:glue)(load "glue.lsp")) (c:glue)
|>> (princ)
|>>)
|>>
|>>or in my menu
|>>^C^C^P(if (not c:MXREF)(load "MULT-XREF.lsp"))^P MXREF
|>>
|>>The only code I place in my .mnl is code to place the pulldown menu in the
|>>list
|>>I have an acaddoc.lsp that loads my shortcuts, variable settings, config
|>>and
|>>a few
|>>other items that have to run on every drawing.
|>>
|>>I too have 4 decipline menu's
|>>I don't load much code per decipline.
|>>
|>>Not sure what else your code could be doing
James Maeding
Civil Engineer and Programmer
jmaeding - athunsaker - com