Checkload

Discussion in 'AutoCAD' started by Marcel Janmaat, Nov 17, 2004.

  1. I have loade the following applications at startup from acad.lsp

    (arxload "AcadXTabs.arx")
    (arxload "RMA-DocUtilities.arx")

    But what happens is, this has to be done only once. Everytime I startup
    autocad it replies with "already loaded". How can i check the existence of
    the applications so i can build-in an if-statement.

    The reason I want this, is beceause I want this to be automated for other
    users.

    Regards MJ
     
    Marcel Janmaat, Nov 17, 2004
    #1
  2. Two ways...

    You mention that those two statements are in Acad.lsp, not AcadDoc.lsp. When
    the system variable AcadLspAsDoc is set to 0, Acad.lsp only runs once per
    AutoCAD session. So place all the code you *do* want to run every time a
    drawing opens in AcadDoc.lsp and set the system variable back to the default
    of 0.

    Or, you could use (member) against the (arx) function.

    --
    R. Robert Bell


    I have loade the following applications at startup from acad.lsp

    (arxload "AcadXTabs.arx")
    (arxload "RMA-DocUtilities.arx")

    But what happens is, this has to be done only once. Everytime I startup
    autocad it replies with "already loaded". How can i check the existence of
    the applications so i can build-in an if-statement.

    The reason I want this, is beceause I want this to be automated for other
    users.

    Regards MJ
     
    R. Robert Bell, Nov 17, 2004
    #2
  3. Marcel Janmaat

    Jimmy D Guest

    Hi Marcel,

    This is how Autocad does it (acad2000doc.lsp)

    ;; EXTACTED FROM ACAD2000DOC.lsp
    ;; determines if a given application is loaded...
    ;; general purpose: can ostensibly be used for appsets (arx) or (ads) or....
    ;;
    ;; app is the filename of the application to check (extension is required)
    ;; appset is a list of applications, (such as (arx) or (ads)
    ;;
    ;; returns T or nil, depending on whether app is present in the appset
    ;; indicated. Case is ignored in comparison, so "foo.arx" matches "FOO.ARX"
    ;; Also, if appset contains members that contain paths, app will right-match
    ;; against these members, so "bar.arx" matches "c:\\path\\bar.arx"; note that
    ;; "bar.arx" will *not* match "c:\\path\\foobar.arx."
    (defun loadedp (app appset)
    (cond (appset (or
    ;; exactly equal? (ignoring case)
    (= (strcase (car appset))
    (strcase app))
    ;; right-matching? (ignoring case, but assuming that
    ;; it's a complete filename (with a backslash before it)
    (and
    (> (strlen (car appset)) (strlen app))
    (= (strcase (substr (car appset)
    (- (strlen (car appset))
    (strlen app)
    )
    )
    )
    (strcase (strcat "\\" app))
    )
    )
    ;; no match for this entry in appset, try next one....
    (loadedp app (cdr appset)) )))
    )

    ;; Loads the indicated ARX app if it isn't already loaded
    ;; returns nil if no load was necessary, else returns the
    ;; app name if a load occurred.
    (defun verify_arxapp_loaded (app)
    (if (not (loadedp app (arx)))
    (arxload app f)
    )
    )


    Jimmy
     
    Jimmy D, Nov 17, 2004
    #3
  4. Use the (arx-load) function below, instead of
    the built-in (arxload) function.

    (defun arx-load (file)
    (if (not (member (strcase file t) (arx)))
    (arxload file)
    )
    )

    ;; e.g.:

    (arx-load "acadxtabs.arx")
     
    Tony Tanzillo, Nov 17, 2004
    #4
  5. Marcel Janmaat

    Josh Guest

    create a txt file in your support path with the name ACAD.RX and put the arx
    filenames in it (one per line).

    Look ACAD.RX in help and you'll find several options...
     
    Josh, Nov 17, 2004
    #5
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Similar Threads
There are no similar threads yet.
Loading...