See the top rated post in this thread. Click here

Results 1 to 6 of 6

Thread: error: no function definition: AUTOLOAD

  1. #1
    Woo! Hoo! my 1st post
    Join Date
    2003-12
    Posts
    1
    Login to Give a bone
    0

    Default error: no function definition: AUTOLOAD

    Is anyone less getting this error? error: no function definition: AUTOLOAD
    It only happens when you start AutoCAD 20 /13/14/15. After that you never see it again.

    It only happen in my first call to "Autoload" in my custom lisp. I have determined that the Acad20XXdoc.lsp is not being load first. (which is where the AutoLoad function is). The fun thing is it looks like the menu files are being loaded twice. and the second time it works. see:

    Customization file loaded successfully. Customization Group: UTILITY2013
    Regenerating model.

    ACAD.mnl Loaded
    ... My Menu loading ...

    ... Program ; error: no function definition: AUTOLOAD

    AutoCAD menu utilities
    *Acad2014doc loaded*

    ACAD.mnl Loaded
    ... My Menu loading ...

    ... Program 1
    ... My Menu loaded ...

    Command:


    Is there a way to control the order in which menus load?

  2. #2
    I could stop if I wanted to
    Join Date
    2015-10
    Location
    Colorado Springs, CO
    Posts
    369
    Login to Give a bone
    0

    Default Re: error: no function definition: AUTOLOAD

    To start with... are you adding custom code to the acad20XXdoc.lsp? In general that's a no-no. Your autoload should be in your acaddoc.lsp.

    I don't push custom menu's with lisp, but my first guess is that your CUI is loading the menu and then your lisp is loading it also.

  3. #3
    The Silent Type RobertB's Avatar
    Join Date
    2000-01
    Location
    Seattle WA USA
    Posts
    5,859
    Login to Give a bone
    0

    Default Re: error: no function definition: AUTOLOAD

    I don't think Ldill is editing Acad20xxDoc.lsp to add the autoload function... that function comes from Autodesk and is part of Acad20xxDoc.lsp.

    Ldill, Looking at the error, it looks to me like you are using the autoload function in your MNL, but because the MNL is loading before Acad20xxDoc.lsp, the function has not been defined yet.

    There are several approaches you can take.

    1. Move most of your code from the MNL to AcadDoc.lsp. This is a user-created file that loads after Acad20xxDoc.lsp. I load in the MNL only functions that are directly used by the CUI elements, and not my C: functions or toolbox functions.
    2. Copy the autoload function into your MNL (I discourage this, functions should never be defined in more than one location).
    3. Create your own autoload function and stop using Autodesk's. I took this approach too, because Autodesk's autoload has some significant shortcomings.
    R. Robert Bell
    Design Technology Manager
    Stantec
    Opinions expressed are mine alone and do not reflect the views of Stantec.

  4. #4
    Administrator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,719
    Login to Give a bone
    0

    Default Re: error: no function definition: AUTOLOAD

    A couple more options, to accomplish same:

    Modify your CUI item's macro to provide the 'if not defined load the .LSP and then call the command' (I haven't used this in years personally):

    Code:
    ^C^C^P(if (not c:FOO) (load "foo.lsp"));FOO;^P


    ... Or, you could just use an Autoloader .bundle to load your components; making sure to specify a given Command XmlNode and the applicable LoadOnCommandInvocation="True" XmlAttribute and value respectively.

    [Edit] - PackageContents.xml snippet:

    Code:
    <!--snip-->
    
      <Components>
        <RuntimeRequirements OS="Win32|Win64" Platform="AutoCAD*" SeriesMax="R20.0" SeriesMin="R18.2" SupportPath="./Contents/Support" />
        <ComponentEntry AppDescription="FOO for AutoCAD® does BAR" AppName="FOO" LoadOnCommandInvocation="True" ModuleName="./Contents/Support/foo.lsp" PerDocument="False" >
          <Commands GroupName="FOO">
            <Command Local="FOO" Global="FOO" />
          </Commands>
        </ComponentEntry>
      </Components>
    
    <!--snip-->


    Cheers
    Last edited by BlackBox; 2014-07-24 at 03:05 PM.
    "How we think determines what we do, and what we do determines what we get."

    Sincpac C3D ~ Autodesk Exchange Apps

    Computer Specs:
    Dell Precision 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000

  5. #5
    Certifiable AUGI Addict
    Join Date
    2001-03
    Location
    Tallahassee, FL USA
    Posts
    3,667
    Login to Give a bone
    0

    Default Re: error: no function definition: AUTOLOAD

    Quote Originally Posted by BlackBox View Post
    A couple more options, to accomplish same:

    Modify your CUI item's macro to provide the 'if not defined load the .LSP and then call the command' (I haven't used this in years personally):

    Code:
    ^C^C^P(if (not c:FOO) (load "foo.lsp"));FOO;^P
    Cheers
    That's pretty much how I've always done it.

    Code:
    ^C^C^P(or c:FOO (load "foo.lsp"));FOO;^P
    80% of these are used no more than once a week, no point in having them loaded all the time. I have a few functions in acaddoc.bat that are used all the time. I've seen a few autoloaders provided by AutoCAD, two in Express Tools. The code above doesn't require any of them to work.

  6. #6
    The Silent Type RobertB's Avatar
    Join Date
    2000-01
    Location
    Seattle WA USA
    Posts
    5,859
    Login to Give a bone
    1

    Default Re: error: no function definition: AUTOLOAD

    Quote Originally Posted by Tom Beauford View Post
    80% of these are used no more than once a week, no point in having them loaded all the time. I have a few functions in acaddoc.bat that are used all the time. I've seen a few autoloaders provided by AutoCAD, two in Express Tools. The code above doesn't require any of them to work.
    Getting off track a bit, but...
    I wrote my own autoloader, not to support C: functions, but to support my toolbox functions (years before Autodesk got around to the new packaging). I have functions that are related to each other stored in common library LSP files and needed a reliable way to autoload those functions. Autodesk's autoloader does not handle that, nor did I want to add explicit loads in every top-level application.
    R. Robert Bell
    Design Technology Manager
    Stantec
    Opinions expressed are mine alone and do not reflect the views of Stantec.

Similar Threads

  1. Express Tools - error: no function definition: ACET-AUTOLOAD
    By Bear31831 in forum AutoCAD General
    Replies: 5
    Last Post: 2007-06-05, 12:02 AM
  2. error: no function definition: AUTOLOAD - in ADT 2007
    By james.emoore in forum AutoLISP
    Replies: 1
    Last Post: 2006-09-15, 08:34 PM
  3. error: no function definition: ACET-AUTOLOAD
    By psukphisit in forum ACA General
    Replies: 4
    Last Post: 2005-11-03, 07:04 PM
  4. ; error: no function definition: ACET-ERROR-INIT
    By gab.83408 in forum AutoCAD Customization
    Replies: 1
    Last Post: 2005-03-01, 12:19 AM
  5. error: no function definition: AUTOLOAD
    By dalej_k in forum AutoLISP
    Replies: 4
    Last Post: 2004-08-11, 11:58 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •