Vlide not loading nested defuns properly?

Discussion in 'AutoCAD' started by Fatfreek, Sep 26, 2004.

  1. Fatfreek

    Fatfreek Guest

    I've been tearing out what little hair I have on this problem. I'm trying
    to load one of my LSP (TribInputsDCL) from the Vlide, not selecting
    anything, simply clicking the "load active edit window" pulldown. However,
    the two nested defuns (setfields and checkfields) are not getting loaded --
    unless I explicitly select them by themselves, then click "load selection"
    pulldown.

    To try the basic skeleton I edited out most of the details so I could paste
    it below. Perhaps one of you can spot something wrong? Is it the Vlide or
    my structure?

    (defun TribInputsDCL ()
    (SetFields)
    (defun SetFields ()
    (setq Filepath "c:\\SculpTextData\\")
    (CheckFields)
    )
    (defun CheckFields ()
    (setq FieldCheck
    0
    BadInputs nil
    )
    )
    )

    Len Miller
     
    Fatfreek, Sep 26, 2004
    #1
  2. Fatfreek

    Jeff Mishler Guest

    You cannot call a nested defun prior to it loading.......nested defuns only
    load when the command is run, and in the order the are found. Place the
    nested defuns at the top of the routine, then call it AFTER it has a chance
    to load.
     
    Jeff Mishler, Sep 26, 2004
    #2
  3. The definition of a nested function is not evaluated until
    the parent/containing function is called.

    Hence, to define the nested functions, the TribInputsDCL
    must be called.
     
    Tony Tanzillo, Sep 26, 2004
    #3
  4. Fatfreek

    Fatfreek Guest

    Thank, Tony,

    I moved (SetFields) to the bottom and it now works.

    (defun TribInputsDCL ()
    (defun SetFields ()
    (setq Filepath "c:\\SculpTextData\\")
    (CheckFields)
    )
    (defun CheckFields ()
    (setq FieldCheck
    0
    BadInputs nil
    )
    )
    (SetFields)
    )

     
    Fatfreek, Sep 27, 2004
    #4
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.