Author Topic: How do you organize your lisp codes?  (Read 27567 times)

0 Members and 1 Guest are viewing this topic.

FengK

  • Guest
How do you organize your lisp codes?
« on: March 23, 2006, 12:56:20 AM »
Hello,

How do you organize your lisp codes?  Here is how I do it.
More than 90% of the codes I wrote, which are quite a lot, are in two files.  One defines all the commands, and the other contains all the subroutines.  Seems it has worked well for me.  At least it made the maintenance work must easier.  The rest codes belong to some rather bigger projects, each with a dozen or more commands.  I separated them into indidual files per project.

Thanks for your input.

Kelie

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
Re: How do you organize your lisp codes?
« Reply #1 on: March 23, 2006, 08:20:45 AM »
Small shortcut lisps (half dozen lines or less) are organized into a single file that is loaded at startup. Other larger lisp programs are written into their own file and stored in a lisp folder on the HD. The multitude of programs are set to autoload upon selection of the menu item (and I don't mean the autoload stub function defined by Autodesk) ...

Code: [Select]
(if (not c:myfunction)(load "myfunction"));myfunction
The remainder of the programs are loaded manually when I require them. This frees up memory and allows me to run a much leaner and thus faster system.
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: How do you organize your lisp codes?
« Reply #2 on: March 23, 2006, 08:31:34 AM »
Welcome to theSwamp Kelie.

Most of my lisp routines are in individual files & are on demand loaded in the following lisp
which is called by the start up lisp. As you can see near the end of this routine I load the
subroutines & set ACAD variabled.

Code: [Select]
(setq *usermode* "CAB") ; turn on debug mode
;;  See Debug.lsp for use


;;; ===============================================
;;;    Lisp Routine Loader
;;;    AUTOLOAD only loads the routine when needed
;;; ===============================================
;;;------  Lisp name -- Function name -------  Discription  -----------------------
(AUTOLOAD "AreaPrt" '("AreaPrt")) ; Print the Area of "POLYLINE"  "LWPOLYLINE" "CIRCLE" "ELLIPSE"
(AUTOLOAD "arrow line" '("arw")) ; draw a arrow line on stairs, plan view
(AUTOLOAD "Block UnmirrorCAB" '("bum")) ; Unmirror blocks picked
(AUTOLOAD "BlockDel CAB" '("BlockDel")) ; Delete ALL matching blocks & purge the DWG
(AUTOLOAD "Copyb_layouts New" '("CopyB" "DeleteB")) ; Block copy or delete on all tabs
(AUTOLOAD "BlkInsert" '("blkinsert")) ; Block Menu Insert Routine
(AUTOLOAD "BLOCK Ent List CAB" '("BlockInfo")) ; Block Info 2 File
(AUTOLOAD "BrAt" '("brat")) ; Break Line @
(AUTOLOAD "BrkDbl-cab" '("DZ")) ; Double Break Symbol
(AUTOLOAD "BrkSym" '("BRK")) ; Single Break Symbol

<more stuff>
<then this stuff i need all the time>

(load "vl-SubRoutines.lsp")
(load "SlideDisplay")
(load "ACADSet_Variables CAB") ; loads & runs

(defun C:DOB() (setq ss (ssget)) (command "DRAWORDER" ss "" "B") (princ) )
(defun C:DOF() (setq ss (ssget)) (command "DRAWORDER" ss "" "F") (princ) )
(defun C:DOA() (setq ss (ssget)) (command "DRAWORDER" ss "" "A") (princ) )
(defun C:DOU() (setq ss (ssget)) (command "DRAWORDER" ss "" "U") (princ) )
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.

CADaver

  • Guest
Re: How do you organize your lisp codes?
« Reply #3 on: March 23, 2006, 09:15:34 AM »
poorly, very poorly. :cry:

whdjr

  • Guest
Re: How do you organize your lisp codes?
« Reply #4 on: March 23, 2006, 09:25:58 AM »
I thought about making this a new thread because it is kind of a tangent but then I decided it actually was tied to this discussion pretty close.


So, how do you load your lisp files?

Keith eluded to not liking the Autodesk lisp method but did not not elaborate on his method of choice,

and

CAB uses 'autoload' to load his lisp files on demand,

and

I use a mnl file to load all my lisp files at once :oops:(I know it's not the correct way).


After researching CAB's method of using 'autoload' the Help files state that the 'autoload' command is to be used in the acad.lsp file.  Well if I was supporting a network with 10 users and I wanted to add a couple of new commands I wouldn't want to go to all 10 stations to edit their acad.lsp files.  That's why I like the mnl method where you set up each workstation initially to access that menu file and whenever you add to it the user just needs to restart AutoCad.  Wouldn't it be nice to have the best of both worlds - a mnl file that loaded on demand lisp files. :-)

Is that what you use Keith?  Did you create something that marries the two together?

If I am way off base here please speak up.  If this should be moved to its own thread that's ok.



Please comment on how you load your lisp files and why.

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
Re: How do you organize your lisp codes?
« Reply #5 on: March 23, 2006, 09:50:54 AM »
Many of the lisps are/can be loaded in the common mnl file. This is not always preferred as it really should be used exclusively for lisps that are required by the menu. All lisps not exclusively required as shortcuts are loaded in the manner I explained above ... i.e. if-not-then scenario.

Lisps that are used infrequently are manually loaded by the user. i.e. appload

Frequently used lisps that are used but not included in the startup lisp file (acad.lsp, acaddoc.lsp, menu.mnl etc..) are added to the startup suite on each of the respective stations. For me this is a simple task as I only have 6 stations to manage. At my previous place of employment I had 12 stations in 2 offices, but it was still fairly simple to manage as all I need to do is log into their system via the network and import a registry file in the respective system.

Of course this would necessitate that you have sufficient rights to do just that. I just happen to have that.

And the reason why is because with the vast amount of customization that I have, it would take a considerable amount of memory and time to load them all at startup. Consider if you had to load a hundred or more custom programs all at startup ... besides having to load your drawing, it also would have to find and load each program ... when I moved to this method about 5 years ago, it resulted in an immediate improvement on the start time of AutoCAD by about 30 seconds. (sometimes it took over a minute to load AutoCAD .. and that was without a drawing!!!!)
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

CADaver

  • Guest
Re: How do you organize your lisp codes?
« Reply #6 on: March 23, 2006, 09:56:32 AM »
Why isn't the MNL the "correct" way?  It's been working quite well for us for over a decade.

We use a combination of both the MNL and AutoLoad.  The mnl loads a few files that contain a multitude of functions that are relatively small, it also loads menu specific functions related to that clients requirements.  We also use autoload to load larger functions, or functions that we've "borrowed" from someone else.

vinnyg

  • Guest
Re: How do you organize your lisp codes?
« Reply #7 on: March 23, 2006, 10:02:58 AM »
Like CAB, I use 'autoload' but maybe not exactly the way he does?

vinnyg

GDF

  • Water Moccasin
  • Posts: 2081
Re: How do you organize your lisp codes?
« Reply #8 on: March 23, 2006, 10:13:53 AM »
That is a good question. I have gone down the dark path of creating one tied together united linked all for one program.
I call it "Arch Program" because I'm an Architect who tries to do lisp writing.<caugh>

This is my typical start up  <as seen from the command line display>
Code: [Select]
*** ---------- Begining Startup ---------- ***
*** -- Loaded Open File Command Reactor -- ***
*** New command: MSG    Arch Program© 2006 ***
*** ---- Architettura Customized File ---- ***
*** ----- Arch Program© for AutoCAD® ----- ***
*** --- Copyright 2006 - Gary D Fowler --- ***
*** ---- System Variables Initialized ---- ***
*** ---------- Mode Setup: <Ar> ---------- ***
*** ---------- Startup Complete ---------- ***

Once the program has been initilized <a one time event> these files are loaded:
;;; Key files to needed to run this program:
;;; 1. The "ACAD.lsp" file sets the path for the arch program along with the saved autocad
;;;     environment settings for a clean restore to generic autocad when the arch program
;;;     is unloaded. This is the only file that must be located at each workstation within
;;;     the autocad support directory. It only loads at AutoCAD startup.
;;; 2. The "ACADDOC.lsp" loads the "ARCH_INITIALIZE.fas" file.
;;; 3. The "ARCH_INITIALIZE.fas" initialize the setup.
;;; 4. Custom settings are controled by the "custom_xxx.lsp" file.
;;; 5. The "ARCH.mnc" loads the "ARCH.mnl" file automatically which contains many
;;;     misc functions required to operate this program.
;;; 6. The "ARCH_SUBROUTINES.fas" contains all of the subfunctions.
;;; 7. All bitmaps for the toolbars are compiled in the "ARCH.dll" which is loaded
;;;     automatically.
;;; 8. The "ARCH.dcl" file must be located in the acad support file search path
;;;     it contains all of the dialog box widgets for the arch program.
;;;     @include "..\\ARCH.dcl"

Here is a typical defun from the ARCH.mnl file:
(defun C:LFD  ()
  (if (not LFDIT)
    (ARCH:LOAD (strcat ARCH#LAYF "ARCH_LayerFiltersDelete.lsp")))
  (if LFDIT
    (LFDIT))
  (princ))

Is it organized, yes to the point being of one big headache.

Here is my startup:
Code: [Select]
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;; AutoCAD Drawing File STARTUP ;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(if (< (distof (substr (getvar "acadver") 1 4)) 15.0)
  (alert "ARCH Program no longer supports this version of AutoCAD"))
;;;
(if (>= (distof (substr (getvar "acadver") 1 4)) 15.0)
  (defun-q
    ARCH::STARUP
    ()
    (if (not ARCH#DIAP)
      (setq ARCH#DIAP '(-1 -1)))
    (if ARCH:DOSLIBLOADER (ARCH:DOSLIBLOADER))
    (if ARCH:EXPRESS-TOOLS (ARCH:EXPRESS-TOOLS))
    ;;(ARCH:LOAD (strcat ARCH#SUPF "UTIL\\" "ARCH_ICONS.lsp")) 
    (if (/= (findfile (strcat ARCH#SUPF "UTIL\\" "ARCH_ICONS.lsp")) nil)
      (load (strcat ARCH#SUPF "UTIL\\" "ARCH_ICONS.lsp"))
      (ARCH:MsgBox
        " Arch Program© : Error"
        48
        "
     Arch Icons File could not be Found.
--------------------------------------------------------------------------------------------
     This Routine could not be found on the network...
     Please notify Gary D. Fowler to correct the problem."))
    (setq ARCH#CHKV (atoms-family 1))
    ;;(gc) ;Forces a garbage collection, which frees up unused memory   
    ;;(mem) ;Displays the current state of memory in AutoLISP   
    (progn (if (= (getvar "snapunit") 0)
             (progn (command "snapunit" "0.125,0.125")
                    (princ "\n*** - Snapunit reset from 0,0 to 1/8,1/8 - ***\n")))
    ;to fix bad snapunit value 
           (if (= (getvar "dimscale") 0)
             (progn (setvar "dimscale" 1)
                    (princ "\n*** -- dimscale value reset from 0 to 1 -- ***\n")))
    ;to fix bad dimscale value 
           )
    (if ARCH:STARTUP (ARCH:STARTUP)) ;Loaded from ARCH_SUBROUTINES
    (PlaceARCHMenu) ;Loaded from ARCH_INITIALIZE
    (ARCH:MENU-STARTUP) ;grayout menu controls
    (if ARCH:RESETVARS (ARCH:RESETVARS)) ;Loaded from Custom File standard setvars
    (if ARCH:RESETENVS (ARCH:RESETENVS)) ;Loaded from Custom File standard setenvs
    (if ARCH:CUSTOMIZED_HKEY-STARTUP (ARCH:CUSTOMIZED_HKEY-STARTUP)) ;Loaded from Custom File HKEY variables that must be set!
    ;;(ARCH:F_S-VAR) ;Loaded from ARCH_SUBROUTINES recording setvars to reset
    ;;(ARCH:COMMANDS) ;to record commands   
    ;;(ARCH:RECORDS)
    (C:MODE) ;modemacro line info
    (if (/= (findfile "C:\\Arch_Custom\\Support\\ARCH_DoubleClick.ini") nil)
      (progn
        (if (/= (findfile (strcat ARCH#UTIF "ARCH_DoubleClick.lsp")) nil)
          (load (strcat ARCH#UTIF "ARCH_DoubleClick.lsp"))
          (ARCH:MsgBox
            " Arch Program© : Error"
            48
            "
     DoubleClick File could not be Found.
--------------------------------------------------------------------------------------------
     This Routine could not be found on the network...
     Please notify Gary D. Fowler to correct the problem."))))
    ;;(ARCH:LOAD (strcat ARCH#UTIF "ARCH_SaveVariable.lsp"))
    (if (/= (findfile (strcat ARCH#UTIF "ARCH_SaveVariable.lsp")) nil)
      (load (strcat ARCH#UTIF "ARCH_SaveVariable.lsp"))
      (ARCH:MsgBox
        " Arch Program© : Error"
        48
        "
     SaveVariable File could not be Found.
--------------------------------------------------------------------------------------------
     This Routine could not be found on the network...
     Please notify Gary D. Fowler to correct the problem."))
    (ARCH:AxAcadStatusBarButton)
    ;;(ARCH:LOAD (strcat ARCH#SUPF "UTIL\\" "ARCH_AcadStatusBarButton45.lsp"))
    (if (/= (findfile (strcat ARCH#SUPF "UTIL\\" "ARCH_AcadStatusBarButton45.lsp"))
            nil)
      (load (strcat ARCH#SUPF "UTIL\\" "ARCH_AcadStatusBarButton45.lsp"))
      (ARCH:MsgBox
        " Arch Program© : Error"
        48
        "
     AcadStatusBarButton45 File could not be Found.
--------------------------------------------------------------------------------------------
     This Routine could not be found on the network...
     Please notify Gary D. Fowler to correct the problem."))
    ;;(ARCH:LOAD (strcat ARCH#SUPF "UTIL\\" "ARCH_AcadStatusBarButton111.lsp"))
    (if (/= (findfile (strcat ARCH#SUPF "UTIL\\" "ARCH_AcadStatusBarButton111.lsp"))
            nil)
      (load (strcat ARCH#SUPF "UTIL\\" "ARCH_AcadStatusBarButton111.lsp"))
      (ARCH:MsgBox
        " Arch Program© : Error"
        48
        "
     AcadStatusBarButton111 File could not be Found.
--------------------------------------------------------------------------------------------
     This Routine could not be found on the network...
     Please notify Gary D. Fowler to correct the problem."))
    ;;testing out ltscale reactor and layout update fix
    (if (not *LayoutLTS*)
      (setq *LayoutLTS*
             (VLR-Miscellaneous-Reactor
               nil
               '((:VLR-layoutSwitched . ARCH:ChangedLayout)))))
    (if (/= (findfile (strcat ARCH#CUSF "LAYS\\" "ARCH_LockDown.lsp")) nil)
      (load (strcat ARCH#CUSF "LAYS\\" "ARCH_LockDown.lsp"))
      (ARCH:MsgBox
        " Arch Program© : Error"
        48
        "
     ARCH_LockDown File could not be Found.
--------------------------------------------------------------------------------------------
     This Routine could not be found on the network...
     Please notify Gary D. Fowler to correct the problem."))
    (cond ((or (/= (getvar "loginname") "CAD_11")
               (/= (getvar "loginname") "cad_11"))
           (ARCH:SBBLOADER)))
    ;;(if (menugroup "EXPRESS")(ARCH:ExpressARXload))   
    (if (not ARCH:Rcmd-Enable)
      (ARCH:LOAD (strcat ARCH#DIMF "ARCH_StickTo-Dim.lsp")))
    (if ARCH:Rcmd-Enable
      (ARCH:Rcmd-Enable))
    (princ "\n*** ---------- Startup Complete ---------- ***")
    ;;(ARCH:endTimer)   
    (princ)))
(setq S::Startup (append S::Startup ARCH::STARUP))

Gary






« Last Edit: March 23, 2006, 10:34:09 AM by Gary Fowler »
Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64

nivuahc

  • Guest
Re: How do you organize your lisp codes?
« Reply #9 on: March 23, 2006, 10:41:55 AM »
I have a personal LISP routine (Chuck.lsp) that autoloads on startup that's filled up like this:

Code: [Select]
(defun C:AT      () (command "-attedit" "" "" "" "" ))
(defun C:AR      () (command "-attedit" "N" "" "" "" "" ))
(defun C:CASE    () (prompt "\nLoading...") (load"C:/CLC/LISP/CASE")    (prompt "\nloaded.")(C:CASE))
(defun C:CL      () (prompt "\nLoading...") (load"C:/CLC/LISP/CL")      (prompt "\nloaded.")(C:CL))
(defun C:CLT     () (prompt "\nLoading...") (load"C:/CLC/LISP/CLT")     (prompt "\nloaded.")(C:CLT))
(defun C:CS      () (prompt "\nLoading...") (load"C:/CLC/LISP/CS")      (prompt "\nloaded.")(C:CS))
(defun C:CST     () (prompt "\nLoading...") (load"C:/CLC/LISP/CST")     (prompt "\nloaded.")(C:CST))
etc.....

That's how I've done it for years and don't see a reason to change. It works. My routines are loaded on demand. Also a handy place to put my little shortcuts.

GDF

  • Water Moccasin
  • Posts: 2081
Re: How do you organize your lisp codes?
« Reply #10 on: March 23, 2006, 10:51:23 AM »
One thing I have learned is to be sure you don't have conflicks between your lisp command names and AutoCAD's pgp file.
And the one thing I haven't learned is KISS <Keep It Simple Stupid>...

Gary
Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64

whdjr

  • Guest
Re: How do you organize your lisp codes?
« Reply #11 on: March 23, 2006, 10:59:00 AM »
Keith can you elaborate on your method of "customizing" each workstation?  I know with XP you have the option of utilizing 'Remote Desktop' to manually update the computer.  What is your prefered method?


What are other peoples methods?  What about an 'installation program' like AcadInstall...?  Anyone ever use something like that?

whdjr

  • Guest
Re: How do you organize your lisp codes?
« Reply #12 on: March 23, 2006, 11:02:13 AM »
CADAver,

How do you  use both mnl files and autoload togethor?

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
Re: How do you organize your lisp codes?
« Reply #13 on: March 23, 2006, 11:26:25 AM »
Keith can you elaborate on your method of "customizing" each workstation? I know with XP you have the option of utilizing 'Remote Desktop' to manually update the computer. What is your prefered method?


What are other peoples methods? What about an 'installation program' like AcadInstall...? Anyone ever use something like that?

I generally just connect to the computer as needed through the computer management console and make any changes there. The trick is that AutoCAD stores the startup suite in the HKCU section of the registry and it is not accessable unless you actually log in as the current user of the machine. It is somewhat inefficient, but it works .. and I don't generally have to leave my desk.

I have used AcadInstall for deployment of some applications and I find it very capable for most things. There were some glitches when I deployed an application that was designed for A2k6 and some vertical applications, but I think AcadInstall has been updated to deal with those, particularly AutoCAD not being able to find the acaddoc.lsp after installing a product using it.

As far as any more elaboration on my methods, I can't really explain it any better except that when I am working on the remote computer it is "almost" like I am sitting there.
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: How do you organize your lisp codes?
« Reply #14 on: March 23, 2006, 11:29:07 AM »
And why not use this in the mnl file to run or load then run the lisp?

Code: [Select]
^C^C(if (not c:myfunction)(load "myfunction"));myfunction
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.

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
Re: How do you organize your lisp codes?
« Reply #15 on: March 23, 2006, 11:34:07 AM »
Cab, that is exactly what I do, except I use it in the menu, not the mnl ... for example, if I have a menu item that draws a widget and that widget is drawn using a lisp program, I will use exactly that scenario .. instead of just putting the command on the menu item, I put the lisp call there to load the lisp if it is not already loaded.
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

CADaver

  • Guest
Re: How do you organize your lisp codes?
« Reply #16 on: March 23, 2006, 11:34:21 AM »
The MNL loads several lisp routines that contain dozens of functions that are menu/client specific.  One of these files also contain several lines of AUTOLOAD functions that will demand load those functions when needed.

Example:  This code fragment is in the MNL
Code: [Select]
(if (not (load "e:/programs/ac2002/menus/csa/sh2002C.lsp" nil))
  (progn
    (princ "loading error.")
    (princ "\nSH2002C.lsp not found.  Rel. 2002C Shorthand Commands are not enabled.  ")
  )
)

In addition to several dozen functions, that lisp routine (SH2002C) has the following lines (plus several dozen more):
Code: [Select]
(autoload "e:/programs/ac2002/menus/csa/PLOTTABS.lsp" '("PLOTTABS"))
(autoload "e:/programs/ac2002/menus/csa/lisp/tagarea.lsp" '("tagarea"))
(autoload "e:/programs/ac2002/menus/csa/lisp/solvol.lsp" '("solvol"))
(autoload "e:/programs/ac2002/menus/csa/lisp/xtools.lsp" '("xtools" "xo" "xa" "xow" "xox" "xoy" "xoz" "xaw" "xax" "xay" "xaz" "xon" "xan"))
(autoload "e:/programs/ac2002/menus/csa/lisp/dsclp.lsp" '("dsclp"))

That way the usual functions are fully loaded, but larger functions (tagarea, solvol) or functions that were "borrowed" from someone else (plottabs, xtools) are only loaded when needed.

Slim©

  • Needs a day job
  • Posts: 6566
  • The Dude Abides...
Re: How do you organize your lisp codes?
« Reply #17 on: March 23, 2006, 11:35:48 AM »
CADaver, I have mine setup similar to yours.
I drink beer and I know things....

CADaver

  • Guest
Re: How do you organize your lisp codes?
« Reply #18 on: March 23, 2006, 11:44:51 AM »
One thing I have learned is to be sure you don't have conflicks between your lisp command names and AutoCAD's pgp file.
Once you understand that the last one loaded wins the conflict can even be useful.  As you may have noticed from the PGP I posted in another thread, we have nearly every command and setvar covered with an alias in the pgp.  The PGP loads first, then MNL, then startup suite.  

Knowing that I can redefine a particular alias with a lisp function for testing from my startup suite without affecting the other users in the system.  The once the function is perfected, I can add it to the MNL loaded routines and make the change global and relatively transparent to the users.  They are already using the PGP alias (longhand command version) and next time they enter the same command it will be the newer streamlined custom function.  Every now and then I'll get a "What the Heck??", but most folks are getting used to the dynamic nature of our customizations.

CADaver

  • Guest
Re: How do you organize your lisp codes?
« Reply #19 on: March 23, 2006, 11:45:34 AM »
CADaver, I have mine setup similar to yours.
That may not be a good thing to admit around here.....   :angel:

Slim©

  • Needs a day job
  • Posts: 6566
  • The Dude Abides...
Re: How do you organize your lisp codes?
« Reply #20 on: March 23, 2006, 11:55:16 AM »
I know that... but it's true. ;-)

Do you have a Revision log file as well as revision info in the header?
For example:

Code: [Select]
01-DEC-2004 lpickens grd.lsp Fixed C:GR to work with X_FG3A, X_FG3B, X_FG4A, and X_FG4B
28-DEC-2004 lpickens OvrXref.lsp Checks for underscore in Xref name

Our ITwit, demanded that I have one, even though he knows nothing about CAD, and that I have an agreement with the President of the company that all LISP, etc. that I write are owned by me, not the company. The company employees that wish to use my routine are welcome to, with the understanding that they are AS IS.
I drink beer and I know things....

CADaver

  • Guest
Re: How do you organize your lisp codes?
« Reply #21 on: March 23, 2006, 12:07:56 PM »
I keep a revision line in the footer actually.  Dunno why there, just got in that habit a very long time ago.  I even have it print the last revised date to the screen while loading.  While at a different machine, I tell at a glance if they are working with our stock, or have tried some type of circumvention.  If it's the later, some type of ventilation results.

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
Re: How do you organize your lisp codes?
« Reply #22 on: March 23, 2006, 12:12:20 PM »
... some type of ventilation results.

I certainly hope it isn't of the methane variety .. that get nasty ... really nasty

nothing to see here folks .. move along now ...
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: How do you organize your lisp codes?
« Reply #23 on: March 23, 2006, 01:00:42 PM »
For what it's worth ...

Edit: Modified to accept a single string (a folder name) or a list of strings (folder names, each successively nested).

Code: [Select]
;;=====================================================================
;;
;;  LoadSupport.lsp © 2005-2006 Michael Puckett. All Rights Reserved.
;;
;;---------------------------------------------------------------------
;;
;;  In short, <safe> load each LISP (lsp|fas|vlx) file found in a flat
;;  or succesively nested folder branch.
;;
;;=====================================================================

(defun LoadSupport

    ;;=================================================================
    ;;
    ;;  Typical folder structures and function calls
    ;;
    ;;-----------------------------------------------------------------
    ;;
    ;;  NESTED FOLDER STRUCTURES
    ;;
    ;;  For a huge operation that is split over multiple cities and
    ;;  multiple disciplines, each with specilized requirements, the
    ;;  LISP files might be distributed in a hiearchy like this --
    ;;
    ;;      k:\CAD\LISP\Common  ;; Company's main LISP library
    ;;          |               ;;
    ;;          +-- Calgary     ;;      LISP specific to Calgary
    ;;          |   |           ;;
    ;;          |   +-- Civil   ;;          LISP specific to Civil
    ;;          |   |           ;;
    ;;          |   +-- Elec    ;;          LISP specific to Elec
    ;;          |   |           ;;
    ;;          |   +-- Piping  ;;          LISP specific to Piping
    ;;          |               ;;
    ;;          +-- Toronto     ;;      LISP specific to Toronto
    ;;          |   |           ;;
    ;;          |   +-- Civil   ;;          LISP specific to Civil
    ;;          |   |           ;;
    ;;          |   +-- Elec    ;;          LISP specific to Elec
    ;;          |   |           ;;
    ;;          |   +-- Piping  ;;          LISP specific to Piping
    ;;          |               ;;
    ;;          +-- Vancouver   ;;      LISP specific to Vancouver
    ;;              |           ;;
    ;;              +-- Civil   ;;          LISP specific to Civil
    ;;              |           ;;
    ;;              +-- Elec    ;;          LISP specific to Elec
    ;;              |           ;;
    ;;              +-- Piping  ;;          LISP specific to Piping
    ;;
    ;;  Corresponding function call for a Calgary PC, Electrical
    ;;  discipline --   
    ;;
    ;;      (LoadSupport filename
    ;;         '(
    ;;              "K:\\CAD\\LISP\\Common"
    ;;              "Calgary"
    ;;              "Elec"
    ;;          )
    ;;      )
    ;;
    ;;      Loading K:\CAD\LISP\Common ...
    ;;
    ;;         common1.lsp ... loaded
    ;;         common2.lsp ... loaded
    ;;         common3.lsp ... loaded
    ;;
    ;;      Loading K:\CAD\LISP\Common\Calgary ...
    ;;
    ;;         Calgary.lsp ... loaded
    ;;
    ;;      Loading K:\CAD\LISP\Common\Calgary\Elec ...
    ;;
    ;;         grounding.lsp ... loaded
    ;;         raceway.lsp   ... loaded
    ;;
    ;;  Please note that the function is not hard coded to a specific
    ;;  number of nested folders. Maybe you decide this suits you
    ;;  better --
    ;;
    ;;      k:\CAD\LISP\Common      ;; common support lisp
    ;;          |                   ;;
    ;;          +-- Civil           ;; lisp specific to Civil
    ;;          |                   ;;
    ;;          +-- Elec            ;; lisp specific to Elec
    ;;          |                   ;;
    ;;          +-- Piping          ;; lisp specific to Piping
    ;;
    ;;  Corresponding function call for a Piper's CADD Machine --   
    ;;
    ;;      (LoadSupport filename
    ;;         '(
    ;;              "K:\\CAD\\LISP\\Common"
    ;;              "Piping"
    ;;          )
    ;;      )
    ;;
    ;;      Loading K:\CAD\LISP\Common ...
    ;;
    ;;         common1.lsp ... loaded
    ;;         common2.lsp ... loaded
    ;;         common3.lsp ... loaded
    ;;
    ;;      Loading K:\CAD\LISP\Common\Piping ...
    ;;
    ;;         isogen.lsp  ... loaded
    ;;         routing.lsp ... loaded
    ;;
    ;;  Note that each tier in the folder structure may | may not have
    ;;  LISP files. That is, it is not mandatory for each tier to have
    ;;  LISP files. The program will report what files are loaded as
    ;;  they are loaded.
    ;;
    ;;  Also, this means you can have other related files reside in each
    ;;  tier, perhaps text files that host info related to the files
    ;;  but not appropriate to reside in the actual LISP source code.
    ;;
    ;;  Or maybe you have nothing but compiled vlx files in the
    ;;  structure with some accompanying text files, keeping the
    ;;  original source code safe in another location.
    ;; 
    ;;  Because each successive folder depth represents increased
    ;;  specalization, said folders tend to contain less and less. To
    ;;  me, drilling down thru a directory structure to find and edit
    ;;  a LISP file is faster and more organized than piling hundreds
    ;;  of LISP files into one flat directory structure, the impetus
    ;;  for authoring this beast.
    ;;
    ;;  FLAT FOLDER STRUCTURE.
    ;;
    ;;  Maybe you decide, meh, all this nested folder nonesence is
    ;;  well, just overkill, but you like the idea of having a function
    ;;  that will load all LISP files in a specific folder. Simple --
    ;;
    ;;      (LoadSupport "K:\\CAD\\LISP\\Common")
    ;;
    ;;      Loading K:\CAD\LISP\Common ...
    ;;
    ;;         common1.lsp ... loaded
    ;;         common2.lsp ... loaded
    ;;         common3.lsp ... loaded
    ;;
    ;;  The function has been coded to accept a single string (a folder
    ;;  name) or a list of folders, each successivly nested (as
    ;;  previously mentioned).
    ;;
    ;;  ERROR HANDLING
    ;;
    ;;  The actual LISP loader is error trapped, so if an error is
    ;;  encountered during the loading of a LISP file it will attempt
    ;;  to report the loading error AND then continue loading the
    ;;  balance of the files. For example --
    ;;
    ;;      (loadsupport
    ;;         '(       
    ;;              "K:\\CAD\\LISP\\Common"
    ;;              "Calgary"
    ;;              "Elec"
    ;;          )
    ;;      )
    ;;
    ;;      Loading K:\CAD\LISP\Common ...
    ;;
    ;;         common1.lsp ... loaded
    ;;         common2.lsp ... failed <divide by zero>
    ;;         common3.lsp ... loaded
    ;;
    ;;      Loading K:\CAD\LISP\Common\Calgary ...
    ;;
    ;;         Calgary.lsp ... loaded
    ;;
    ;;      Loading K:\CAD\LISP\Common\Calgary\Elec ...
    ;;
    ;;         grounding.lsp ... loaded
    ;;         raceway.lsp   ... loaded
    ;;
    ;;  OTHER MINUTIA / NOTES / SEWERAGE
    ;;
    ;;  At this point you may be thinking, why not just use a recursive
    ;;  function that loads every LISP file found in a directory tree?
    ;;  Well thats not what I want, even though that's easier to code.
    ;;
    ;;  Allow me to illuminate. I want to load all LISP files in a
    ;;  specific branch of a directory structure --
    ;;
    ;;       Only
    ;;
    ;;          K:\CAD\LISP\Common\                 *.lsp|fas|vlx
    ;;          K:\CAD\LISP\Common\Calgary\         *.lsp|fas|vlx
    ;;          K:\CAD\LISP\Common\Calgary\Elec\    *.lsp|fas|vlx
    ;;
    ;;       NOT
    ;;
    ;;          K:\CAD\LISP\Common\                 *.lsp|fas|vlx
    ;;          K:\CAD\LISP\Common\Calgary\         *.lsp|fas|vlx
    ;;          K:\CAD\LISP\Common\Calgary\Elec\    *.lsp|fas|vlx
    ;;          K:\CAD\LISP\Common\Calgary\Civil\   *.lsp|fas|vlx
    ;;          K:\CAD\LISP\Common\Calgary\Piping\  *.lsp|fas|vlx   
    ;;          K:\CAD\LISP\Common\Toronto\         *.lsp|fas|vlx
    ;;          K:\CAD\LISP\Common\Toronto\Elec\    *.lsp|fas|vlx
    ;;          K:\CAD\LISP\Common\Toronto\Civil\   *.lsp|fas|vlx
    ;;          K:\CAD\LISP\Common\Toronto\Piping\  *.lsp|fas|vlx   
    ;;          ...
    ;;
    ;;  Ahh you say, why not recursively load starting at the deepest
    ;;  node working your way all the way to the parent? The problem
    ;;  with that approach is that the parent is likely not what I
    ;;  consider the parent. For example, using the sample data above
    ;;  the recursively determined parent would be K:\ or perhaps
    ;;  K:\CAD, whereas in reality I don't wish to load any files above
    ;;  the K:\CAD\COMMON folder.   
    ;;
    ;;-----------------------------------------------------------------
    ;;
    ;;  Yeah, I don't sleep much.
    ;;
    ;;=================================================================

    (
        folderlist

        /

        _StripPath
        _GetLispFiles
        _SafeLoad
        _LoadFolder
        _LoadFolders
        _Main
    )

    ;;=================================================================
    ;;
    ;;  (_StripPath filename)
    ;;
    ;;-----------------------------------------------------------------
    ;;
    ;;  strip the path from a filename,
    ;;
    ;;  e.g c:\folder\filename.lsp => filename.lsp
    ;;
    ;;=================================================================

    (defun _StripPath ( filename )
        (strcat
            (vl-filename-base filename)
            (vl-filename-extension filename)
        )
    )

    ;;=================================================================
    ;;
    ;;  (_GetLispFiles path)
    ;;
    ;;-----------------------------------------------------------------
    ;;
    ;;  get all lsp/fas/vlx files for path, return sorted by group
    ;;
    ;;=================================================================

    (defun _GetLispFiles ( path / result )
        (apply 'append
            (mapcar
               '(lambda (filter)
                    (vl-sort
                        (vl-directory-files
                            path
                            filter
                            1
                        )
                       '<
                    )
                )
               '("*.lsp" "*.fas" "*.vlx")
            )
        )
    )

    ;;=================================================================
    ;;
    ;;  (_SafeLoad filename)
    ;;
    ;;-----------------------------------------------------------------
    ;;
    ;;  safely load a lsp/fas/vlx etc. Print any error message
    ;;  generated if the load is unsuccessful and an associated error
    ;;  msg captured
    ;;
    ;;=================================================================

    (defun _SafeLoad ( filename / filepath failed loaded error )

        (cond

            (   (setq filepath (findfile filename))

                (princ
                    (strcat
                        "\t\t"
                        (_StripPath filePath)
                        " ... "
                    )
                )

                (setq error
                    (vl-catch-all-apply
                       '(lambda ( )
                            (load filepath)
                            (setq loaded
                                (null failed)
                            )
                        )
                    )
                )

                (princ
                    (strcat
                        (if loaded
                            "loaded"
                            (strcat
                                "failed"
                                (if (vl-catch-all-error-p error)
                                    (strcat
                                        " <"
                                        (vl-catch-all-error-message error)
                                        ">"
                                    )
                                    " <no error description>"
                                )
                            )
                        )
                        "\n"
                    )
                )

                loaded

            )

            (   (princ
                    (strcat
                        "\t\t"
                        "File <"
                        filename
                        "> not found.\n"
                    )
                )

                nil

            )
        )
    )

    ;;=================================================================
    ;;
    ;;  (_LoadFolder folder)
    ;;
    ;;-----------------------------------------------------------------
    ;;
    ;;  safely load all lisp / fas / vlx files found in path
    ;;
    ;;=================================================================

    (defun _LoadFolder ( folder / lispFiles )

        (cond

            (   (vl-file-directory-p folder)

                (princ
                    (strcat
                        "\nLoading "
                        folder
                        " ...\n\n"
                    )
                )

                (foreach lispFile
                    (setq lispFiles (_GetLispFiles folder))
                    (_SafeLoad (strcat folder "\\" lispFile))
                )

                (if (null lispFiles)
                    (princ "\t\t<none found>\n")
                )
            )

            (

                (princ
                    (strcat
                        "\nInvalid path <"
                        folder
                        "> ignored ...\n\n"
                    )
                )
            )

        )
    )

    ;;=================================================================
    ;;
    ;;  (_LoadFolders '("K:\\CAD\\LISP" "Calgary" "Elec" ... ))
    ;;
    ;;-----------------------------------------------------------------
    ;;
    ;;  Try to load a tree of support files, where each node (folder)
    ;;  is a child of the preceeding folder and may or may not have
    ;;  lisp files (*.lsp|fas|vlx) and / or child folders.
    ;;
    ;;  K:\\CAD\\LISP\               ;; *.lsp|fas|vlx
    ;;                               ;;
    ;;  K:\\CAD\\LISP\Calgary\       ;; *.lsp|fas|vlx
    ;;                               ;;
    ;;  K:\\CAD\\LISP\Calgary\Elec   ;; *.lsp|fas|vlx
    ;;
    ;;  ...
    ;;
    ;;=================================================================

    (defun _LoadFolders ( folderList / currentFolder )
        (foreach folder folderList
            (if (eq 'str (type folder))
                (_LoadFolder
                     (setq currentFolder
                         (if currentFolder
                             (strcat currentFolder "\\" folder)
                             folder
                         )
                     )
                )
            )
        )
    )

    ;;=================================================================
    ;;
    ;;  (_Main folderList )
    ;;
    ;;-----------------------------------------------------------------
    ;;
    ;;  wrap all functionality defined herein, ergo: 'the solution'
    ;;
    ;;=================================================================

    (defun _Main ( folderList )
        (_LoadFolders folderList)
        (princ)
    )

    ;;=================================================================
    ;;
    ;;  helper functions defined, party on dude -> invoke _Main
    ;;
    ;;-----------------------------------------------------------------
    ;;
    ;;  (Pre) handle a single string (a folder name) or a list of
    ;;  strings (folder names, each successively nested).
    ;;
    ;;=================================================================

    (_Main
        (cond
            (   (listp folderList)
                folderList
            )   
            (   (eq 'str (type folderList))
                (list folderList)
            )
            (   (princ
                    (strcat
                        "Error. Invalid input: (LoadSupport "
                        (vl-princ-to-string folderList)
                        ").\n"
                        "Syntax: (LoadSupport \"x:\\Path\") or "
                        "(LoadSupport '(\"x:\\Path\" \"subfolder\"))"
                    )
                )
                nil
            )   
        )
    )
   
)

;;=====================================================================
;;
;;  end LoadSupport.lsp
;;
;;=====================================================================

:ugly:
« Last Edit: March 23, 2006, 03:46:57 PM by MP »
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

CADaver

  • Guest
Re: How do you organize your lisp codes?
« Reply #24 on: March 23, 2006, 01:32:22 PM »
I certainly hope it isn't of the methane variety ..
nope, 12ga. variety. :pissed:

CADaver

  • Guest
Re: How do you organize your lisp codes?
« Reply #25 on: March 23, 2006, 01:33:36 PM »
Michael,
  You know they have some really good medications these days.  You and SE7EN ought to go in halvers.

GDF

  • Water Moccasin
  • Posts: 2081
Re: How do you organize your lisp codes?
« Reply #26 on: March 23, 2006, 02:33:43 PM »
Here some more jibberish.......

;;; Note: If the user-defined function S::STARTUP is included in the acad.lsp or
;;; acaddoc.lsp file or a MNL file, the function is called when you enter a new
;;; drawing or open an existing drawing. Thus, you can include a definition of
;;; S::STARTUP in the LISP startup file to perform any setup operations. For more
;;; information about the s::startup function, refer to the Customization Guide.
;;;
;;; It should be noted that Autodesk's website is misleading about the load order.
;;; The menus load in the order they were initially loaded in, and *not* always
;;; the user menu first. The only way the user menu loads first is if all menus
;;; were removed and the user's menu was loaded first, then the other menus
;;; subsequently. In most cases people tend to leave Acad's menu there, then
;;; Express Tools (if installed), and then finally the user's menu.
;;; This can be verified by watching the menu load prompts:
;;; AutoCAD menu utilities loaded.

;;; Express Tools (if installed), and then finally the user's menu.
;;; This can be verified by watching the menu load prompts:
;;; AutoCAD menu utilities loaded.

;;; General Rule is to NOT edit the acad200Xdoc.lsp file because it is an Autocad file
;;; that CAN and WILL be replaced if you install patches. I would suggest using the
;;; acaddoc.lsp for the code. Following is a list of AutoCAD, Express Tools, and
;;; user-defined files in the order they are loaded when you first start the program.
;;;
;;; File         For use by:   
;;; acad200X.lsp AutoCAD   
;;; acad.rx         User   
;;; acad.lsp User   
;;; acad200Xdoc.lsp AutoCAD   
;;; acetutil.fas Express Tools   
;;; acaddoc.lsp User   
;;; mymenu.mnc User   
;;; mymenu.mnl User   
;;; acad.mnc AutoCAD   
;;; acad.mnl AutoCAD   
;;; acetmain.mnc Express Tools   
;;; acetmain.mnl Express Tools   
;;; s::startup User
;;;
;;; To make sure you are pulling the correct acaddoc.lsp copy and paste the following
;;; line to the command line (findfile "acaddoc.lsp") You should get the path returned
;;; and if it is not where you think the file is installed you have more than one file.


This is from my Information file in UTIL <dialog box> on how my program loads:
Code: [Select]
(defun SFSP-KEY-2005  ()
  (ARCH:ALERT-I
    "MsgBox \"
      Support File Search Path 2005:
--------------------------------------------------------------------------------------------
      Note: drive x is user defined

      C:\\Arch_Custom\\Support
      x:\\ARCH\\Support
      x:\\ARCH\\Support\\V_16
      x:\\ARCH\\Fonts
      x:\\ARCH\\Patterns
      C:\\~2005\\Support
      C:\\~2005\\UserDataCache\\Support
      C:\\~2005\\Fonts
      C:\\~2205\\Help
      C:\\~2005\\Support\\Color
      \""))

(defun SFSP-KEY-2006  ()
  (ARCH:ALERT-I
    "MsgBox \"
      Support File Search Path 2006:
--------------------------------------------------------------------------------------------
      Note: drive x is user defined

      C:\\Arch_Custom\\Support
      x:\\ARCH\\Support
      x:\\ARCH\\Support\\V_16
      x:\\ARCH\\Fonts
      x:\\ARCH\\Patterns
      C:\\~2006\\Support
      C:\\~2006\\UserDataCache\\Support
      C:\\~2006\\Fonts
      C:\\~2206\\Help
      C:\\~2006\\Support\\Color
      \""))

Gary
« Last Edit: March 23, 2006, 02:41:51 PM by Gary Fowler »
Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64

uncoolperson

  • Guest
Re: How do you organize your lisp codes?
« Reply #27 on: March 23, 2006, 02:46:11 PM »
I keep a revision line in the footer actually.  Dunno why there, just got in that habit a very long time ago.  I even have it print the last revised date to the screen while loading.  While at a different machine, I tell at a glance if they are working with our stock, or have tried some type of circumvention.  If it's the later, some type of ventilation results.

so by stock you mean up to date... check this out, it could probably be prettier, but i still like it

my first post

CADaver

  • Guest
Re: How do you organize your lisp codes?
« Reply #28 on: March 23, 2006, 03:17:24 PM »
so by stock you mean up to date...
By stock, I mean the company standard proggies.

uncoolperson

  • Guest
Re: How do you organize your lisp codes?
« Reply #29 on: March 23, 2006, 03:26:47 PM »
so by stock you mean up to date...
By stock, I mean the company standard proggies.

ohh.... i saw the whole revised date thing and got all excited...

CADaver

  • Guest
Re: How do you organize your lisp codes?
« Reply #30 on: March 23, 2006, 03:51:02 PM »
Down boy, I'll turn the garden hose on ya'.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: How do you organize your lisp codes?
« Reply #31 on: March 23, 2006, 04:20:45 PM »
Randy we've missed you around here.   :-)
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.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: How do you organize your lisp codes?
« Reply #32 on: March 23, 2006, 05:48:06 PM »
Hello,

How do you organize your lisp codes?   ..................
Kelie

Shared Library Helper Routines : distributed as one VLX compiled from 17 files each containing similar class of code. ... multiple defuns per file .ie List stuff, string stuff, xdata stuff etc. Files kept in Library Folder

Simple command Shortcuts etc : Left as open LSP. Multiple defuns in one file.

Simple Routines : compiled from {inumerable} individual files into several VLX files. Try to keep single global defuns {and helpers} per file. One folder for each VLX project.

Applications : One folder for each VLX project. Try to keep single global defuns {and helpers} per file.




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.

hudster

  • Gator
  • Posts: 2848
Re: How do you organize your lisp codes?
« Reply #33 on: March 24, 2006, 03:20:33 AM »
Randy we've missed you around here.   :-)

I was thinking the same thing, it's just not been the same. Now all you and Keith need to do is start a "debate". :-D
Revit BDS 2017, 2016, 2015, 2014, AutoCAD 2017, 2016, Navisworks 2017, 2016, BIM360 Glue

CADaver

  • Guest
Re: How do you organize your lisp codes?
« Reply #34 on: March 24, 2006, 08:19:08 AM »
well the company I'm working for relented somewhat on their earlier hasty descision.  I think my boss just got tired of me asking him to do my inet searches for me, then standing behind him telling him how to do it.

whdjr

  • Guest
Re: How do you organize your lisp codes?
« Reply #35 on: March 24, 2006, 08:39:31 AM »
well the company I'm working for relented somewhat on their earlier hasty descision.  I think my boss just got tired of me asking him to do my inet searches for me, then standing behind him telling him how to do it.

That'll do it everytime.  Welcome back Randy. :-)

whdjr

  • Guest
Re: How do you organize your lisp codes?
« Reply #36 on: March 24, 2006, 08:42:26 AM »
Hello,

How do you organize your lisp codes?   ..................
Kelie

Shared Library Helper Routines : distributed as one VLX compiled from 17 files each containing similar class of code. ... multiple defuns per file .ie List stuff, string stuff, xdata stuff etc. Files kept in Library Folder

Simple command Shortcuts etc : Left as open LSP. Multiple defuns in one file.

Simple Routines : compiled from {inumerable} individual files into several VLX files. Try to keep single global defuns {and helpers} per file. One folder for each VLX project.

Applications : One folder for each VLX project. Try to keep single global defuns {and helpers} per file.






Kerry,
I thought the question was how to organize your lisp files.   :evil:
Your method looks pretty far out there(or maybe it's the way you explained it).

Care to elaborate any more for those of us that can't quite visualize your method?

 :-)

Didge

  • Bull Frog
  • Posts: 211
Re: How do you organize your lisp codes?
« Reply #37 on: March 24, 2006, 08:46:36 AM »
I'd previously thought I was well organised, having read through the above posts however I'm now beginning to believe I'm the most dis-organised swampee :-(

My coding tends to get thrown together until it works, at which point I should add extensive comments and generally tidy them up. Sadly, I never seem to get the time for the tidying so much of my coding remains "thrown together".

Some of the above posts and Kelie's code snippet in the "usage of global variables" thread have  given me some interesting ideas about standardising my coding so things are looking promising.  
Think Slow......

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
Re: How do you organize your lisp codes?
« Reply #38 on: March 24, 2006, 08:49:16 AM »
Didge, that is what we do here ... we throw out ideas, ask questions, and debate the nuances of one scheme over another .. in the end I believe we all end up with something positive that we can take from it.
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

whdjr

  • Guest
Re: How do you organize your lisp codes?
« Reply #39 on: March 24, 2006, 09:10:01 AM »
Well said Keith, well said.  :wink:

Jürg Menzi

  • Swamp Rat
  • Posts: 599
  • Oberegg, Switzerland
Re: How do you organize your lisp codes?
« Reply #40 on: March 24, 2006, 09:25:30 AM »
Because I've to maintain a lot of different app's, I use this kind of structure (most of you know my prog headers):

A computer's human touch is its unscrupulousness!
MENZI ENGINEERING GmbH
Current A2k16... A2k24 - Start R2.18

RbtDanforth

  • Guest
Re: How do you organize your lisp codes?
« Reply #41 on: March 29, 2006, 09:41:43 AM »
Gee I feel all simple minded, I have mostly done the Rent-a-Tech shuffle, and only rarely worked where there was anyone with the slightest lisp capability. I have also worked in several disciplines, as, in the old days, all they cared about was your ability to make Autocad work and they would teach about the discipline.

The resulting compilation is that most focus on geometry issues rather than say doors (though I did do a whole raft of doors) and each is self sufficient, no crossrefing functions, and are designed to work in any type work environment , from "we don't do blocks or polylines" to some very sophisticated and regimented offices. They are also by necessity small, as most were written on the fly, and I personally prefer a "one job one lisp" idiots are on their own approach.

Occasionally I am the cad manager, sometimes the cad guru, sometimes the Leper :ugly:

When I have been the cad manager I have set the other folks options to point at a directory on the server where I managed the lisp directory so everyone loaded the same (simplified) Acad.lsp and any special rarely used functions they would drag and drop. Before that was possible, I had a lisp routine that was similar to appload in the acad lisp. (I still do, and in general use it, rather than appload out of habit)

 Doing Autocad on the old 8088, every move had to have an eye to the time issues for the computer, when even a redraw was a coffee break, and a regen was lunch. But now even an old 500mhz with a "paltry"  :lmao:  526 meg of ram is only rarely inconvenienced enough to notice. And with a decent, hot, dualchipper, even a huge drawing works faster than fingers can go across the keyboard. So using up computer memory is not the concern it used to be.