Author Topic: LoadOpenDcl.lsp ...  (Read 4923 times)

0 Members and 1 Guest are viewing this topic.

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
LoadOpenDcl.lsp ...
« on: June 07, 2007, 10:56:59 AM »
Cool. I looked at ObjectDCL many times over the years and though it was a cool product but I couldn't get myself to use it because (A) I replicate same using visual lisp with activex dlls and (B) I was always worried that the product support might crater {whistling icon goes here}.

Well, since Owen and crew have taken up the good fight I have little reason not to learn how to use this great tool.

So my first task was to look at the loading etc. and dern it if I couldn't stop myself from abusing one of the very first files I encountered. With apologies to Kerry and crew ...

Code: [Select]
(or

    ;;==========================================================================
    ;;
    ;;  LoadOpenDcl.lsp (abused variant of OpenDCL_ARXLoader.LSP)
    ;;
    ;;--------------------------------------------------------------------------
    ;;
    ;;  2007/06/07  Michael Puckett (modified | abused a variant originally
    ;;              penned by Kerry Brown). Why? Attempt to (A) Make more
    ;;              efficient on 'already loaded' scenario, and (B) Be more
    ;;              helpful on failure: 'Was the arx not found or did it bomb
    ;;              the arxload attempt'.
    ;;
    ;;              Sorry KB, I just can't help myself. :D
    ;;
    ;;==========================================================================

    ;;  Already loaded, no need to do anything else.

    odcl_getversionex

    ;;  Not loaded, let's attempt to load her up ...

    (   (lambda ( / proc_arch arxname arxpath )

            ;;  Determine the appropriate arx module for
            ;;  the processor and the AutoCAD version.

            (setq arxname
                (strcat "OpenDCL"
                    (if
                        (and
                            (setq proc_arch (getenv "PROCESSOR_ARCHITECTURE"))
                            (< 1 (strlen proc_arch))
                            (eq "64" (substr proc_arch (1- (strlen proc_arch))))
                        )
                        ".x64."
                        "."
                    )
                    (substr (getvar "acadver") 1 2)
                    ".arx"
                )
            )
           
            ;;  Alert the user of a failure to:
            ;;
            ;;      (A) Find the arxfile, or
            ;;      (B) Load the arxfile.
            ;;
            ;;      and return nil.
            ;;
            ;;  Otherwise just quietly return t.
           
            (cond
                (   (null (setq arxpath (findfile arxname)))
                    (alert (strcat "Couldn't find " arxname "."))
                )
                (   (null (arxload arxpath 'nil))
                    (alert (strcat "Failed to load " arxname "."))
                )
                (   t   )
            )
        )
    )
)

A mighty kudos to Owen Wengerd, David Robison, David White, Kerry Brown, James Maeding et al ... for resurrecting this mighty fine tool. Oh the possibilities ...

:)
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: LoadOpenDcl.lsp ...
« Reply #1 on: June 07, 2007, 05:48:55 PM »
Hi Michael,

I'm of the belief that the load code will hardly ever be loaded into memory .. or thats the way it's designed at least.

If you have a look at the calling code for the loader a test is performed to determine if the loader needs calling.

ie'
Code: [Select]
    ;; Ensure the OpenDCL.##.ARX is loaded.
    (OR (VL-SYMBOL-VALUE 'ODCL_GETVERSIONEX)
        (AND (SETQ fn (FINDFILE "OpenDCL_ARXLoader.LSP"))
             (LOAD fn (STRCAT "Failed to load :- " fn))
        )
        (ALERT (STRCAT "Failed to load OpenDCL_ARXLoader.LSP"))
        (EXIT)
    )


In the samples, for safety sake, this code block is in each routine .. It could have been added at the top of each file to run when the file loaded. Personally I dont use it because I load OpenDCL at startup via a call from a partial menu MNL.


I'm looking forward to seeing some of your creations with OpenDCL.
« Last Edit: June 07, 2007, 05:49:58 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.

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: LoadOpenDcl.lsp ...
« Reply #2 on: June 07, 2007, 07:44:57 PM »
I hear what you're saying Kerry, my code abuse was more an observation that this code (in OpenDCL_ARXLoader.LSP) --

Code: [Select]
         ...

         ;;  Calculate the appropriate ARX module base filename

         (SETQ pa (GETENV "PROCESSOR_ARCHITECTURE"))

         (SETQ fnbase
             (STRCAT "OpenDCL."
                     (IF (AND pa (>= (STRLEN pa) 2) (= "64" (SUBSTR pa (1- (STRLEN pa)))))
                         "x64."
                         ""
                     )
                     (SUBSTR (GETVAR "acadver") 1 2)
                     ".arx"
             )
        )

        ...

... was being executed before the (VL-SYMBOL-VALUE 'ODCL_GETVERSIONEX) statement, which in my mind was backwards, since there's no reason to perform said code if GETVERSIONEX is not nil. I realize I'm splitting hairs because any performance gains won't be realized, but it's very difficult for me to let it go, despite it's triviality. I'll see a therapist one of these days.

re: "... some of my creations ..." -- don't know if I'll have time to learn ODCL and put together a worthy entry for the contest, but I will say I'm surely intrigued by ODCL. Abundant thanks for your collective work on it.

:)
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: LoadOpenDcl.lsp ...
« Reply #3 on: June 07, 2007, 07:54:19 PM »
............... I realize I'm splitting hairs ..........  I'll see a therapist one of these days.

:)
:-) Good luck with that, It hasn't helped me any. I'm resolved to the fact that splitting hairs is an occupational hazzard.

..................  put together a worthy entry for the contest, but I will say I'm surely intrigued by ODCL. .....
hehehe .. I don't see the contest as the goal :-)




..................   Abundant thanks for your collective work on it.
:)
Most of the people involved visit here and I'm sure they will appreciate the comment.
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: LoadOpenDcl.lsp ...
« Reply #4 on: June 07, 2007, 08:10:54 PM »
Michael,

I'll see that the code is modified.  The recent changes < inclusion of the 64bit test> has changed the logic a little, and resulted in the (VL-SYMBOL-VALUE test in that block of code being out of sequence. ... good pickup !

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.

owenwengerd

  • Bull Frog
  • Posts: 451
Re: LoadOpenDcl.lsp ...
« Reply #5 on: June 07, 2007, 08:22:00 PM »
I hear what you're saying Kerry, my code abuse was more an observation that this code (in OpenDCL_ARXLoader.LSP) --

Code: [Select]
...
... was being executed before the (VL-SYMBOL-VALUE 'ODCL_GETVERSIONEX) statement, which in my mind was backwards, since there's no reason to perform said code if GETVERSIONEX is not nil.

  I'll take responsibility for that.  I rearranged the code because the module name was needed in two places (when loading, and when reporting a load error), and I wanted to make sure it is calculated only once, so I moved the module name logic to a point earlier in the function.  Good catch MP. :)

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: LoadOpenDcl.lsp ...
« Reply #6 on: June 07, 2007, 10:33:45 PM »
Owen (and supporting cast) -- you folks have WAY bigger fish to fry than piddly little things like this loader lisp. It's my pleasure if I can flag the odd thing here and there -- just don't let my noise derail you from more important tasks.

PS: I'm happy to see you found your way to the swamp -- the very best folks hang their hats here -- and you fit right in.

:)
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst