Automation Error No Database

Discussion in 'AutoCAD' started by MaineArt, May 27, 2004.

  1. MaineArt

    MaineArt Guest

    I get the error on one of my machines whenever I run Vlax commands.

    Specific code is:

    (vlax_prop entitee propertee)

    where

    (defun vlax_prop (entitee propertee)
    (vl-load-com)
    (setq poActDoc (vla-get-ActiveDocument (vlax-get-acad-object)))
    (setq mSpace (vlax-get-property poActDoc 'Modelspace))
    (vlax-get-property (vlax-ename->vla-object entitee) propertee)
    )

    example is (vlax_prop entity 'Length) for a line

    Any ideas? Thanks!
     
    MaineArt, May 27, 2004
    #1
  2. Don't know that this has anything to do with your problem, but the
    (vl-load-com) statement should not be inside a function.

    (vl-load-com) loads the ActiveX support for Lisp. It probably should not be
    within a Defun. The recommendation is to put vl-load-com at the top of the
    file before any functions are defined so that the ActiveX subsystem is
    loaded before the functions are used.
     
    Rick Francken, May 27, 2004
    #2
  3. MaineArt

    ECCAD Guest

    According to Help:
    ""If ActiveX support is not yet available, executing vl-load-com initializes the AutoLISP ActiveX environment. If ActiveX is already loaded, vl-load-com does nothing. ""
    .........
    Is probably a good idea just to (vl-load-com) in your acaddoc.lsp. This way, you don't have to worry about it,
    and 'muss' up your defun's.
    ........

    Bob
     
    ECCAD, May 27, 2004
    #3
  4. Along with the documentation that Bob brought out... including it within a
    (defun) insures that the code is portable. IOW, if you give it to someone
    else, or post it, you don't have to mention, "Oh BTW, you need to use
    (vl-load-com) at least once before you use this function."

    --
    R. Robert Bell


    Don't know that this has anything to do with your problem, but the
    (vl-load-com) statement should not be inside a function.

    (vl-load-com) loads the ActiveX support for Lisp. It probably should not be
    within a Defun. The recommendation is to put vl-load-com at the top of the
    file before any functions are defined so that the ActiveX subsystem is
    loaded before the functions are used.
     
    R. Robert Bell, May 27, 2004
    #4
  5. MaineArt

    ECCAD Guest

    Point taken. Good advice.
    Bob
     
    ECCAD, May 27, 2004
    #5
  6. PMJI, where in the docs does it say this?

    AFAIK, it can be anywhere. If the ActiveX module is already
    loaded, it is a 'no-op'.
    I must have missed that one.

    In some cases, I deliberately defer loading of ActiveX support
    until it is actually required, and if no code that requires it
    is ever called or used, ActiveX support is not loaded.

    IOW, it works exactly the same way that AutoCAD's solid modeler
    support works (called demand loading). It is only loaded if and
    when required, and not until then.

    Nothing wrong with that. If you are reasonably sure that it
    will be required, then of course, you can call it at load-time,
    but if there's a reasonable chance that a user may not use any
    code that requires it, calling it at runtime from dependent
    code, is perfectly acceptable.
     
    Tony Tanzillo, May 27, 2004
    #6
  7. I stand corrected. I was sure I had read that in the Help, but I went back
    through both the 2000 and 2004 Help, and could not find anything that backed
    me up. Sorry for the inaccuracy.

    -Rick Francken
     
    Rick Francken, May 28, 2004
    #7
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.