(layoutlist) fails in vlx

Discussion in 'AutoCAD' started by Jason Piercey, Jul 2, 2004.

  1. Using Vanilla 2005 here, thought some of you might
    like to know what I have found. Seems that when the
    layoutlist function has been compiled in a separate
    namespace vlx it is no longer recognized by the calling
    application. Unsure of previous version behavior.


    Take this and compile it into a seperate namespace vlx

    (defun c:test ()
    (layoutlist) )

    Command: test
    "no function definition: LAYOUTLIST"


    But when called at the command line it still works.

    Command: (layoutlist)
    ("Layout1" "Layout2")
     
    Jason Piercey, Jul 2, 2004
    #1
  2. Jason Piercey

    John Uhden Guest

    You may have to add LayoutList to those functions that need to be loaded into a
    separate namespace VLX...
    (foreach item '(ACAD_COLORDLG ACAD_STRLSORT INITDIA ACAD-POP-DBMOD
    ACAD-PUSH-DBMOD STARTAPP)
    (vl-arx-import item)
    )

    As to errors, you have to use a (vl-exit-with-error) to make them visible to the
    document namespace...
    (defun *error* (Error)
    (cond
    ((not Error))
    ((wcmatch (strcase Error) "*QUIT*,*CANCEL*")
    (vl-exit-with-error "\r ")
    )
    ((wcmatch (strcase Error) "*CANCEL*,*QUIT*")
    (vl-exit-with-error (strcat "\r*ERROR*: " Error))
    )
    )
    (princ)
    )
     
    John Uhden, Jul 2, 2004
    #2
  3. I see, thanks John. I wasn't aware that needed
    to be done. I'll have to chew on the vl-exit-with-error
    for a minute. Not something I've used before.
     
    Jason Piercey, Jul 2, 2004
    #3
  4. Just a word of advice. In the code below, using wildcard
    pattern matching on the error string is unwise and unsound.

    With the advent of ActiveX, the range of strings that can
    appear in the argument passed to the *error* function (or
    to vl-catch-all-apply) is infinite. Make no assumptions.

    ActiveX methods can raise errors with messages that contain
    anything at all (including ones that can match the pattern
    shown in that same code).

    So, I would stongly advise others to not follow this
    pattern. Use explicit string comparisons if you need to
    determine precisely what the nature of error is.

    And of course, this is merely my opinion. :)
     
    Tony Tanzillo, Jul 2, 2004
    #4
  5. Thank you for the advice.

    Why is it that some LISP functions have to be
    imported to work inside the vlx?

    Guess I just assumed that anything that is available
    in the document's namespace would also be in the
    application's namespace.
     
    Jason Piercey, Jul 2, 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.