autoloader displays nil with a lisp routine

autoloader displays nil with a lisp routine

Anonymous
Not applicable
590 Views
7 Replies
Message 1 of 8

autoloader displays nil with a lisp routine

Anonymous
Not applicable

Hi everyone, AutoCAD 2016, Windows 7, I've been using the autoloader mechanism to load a dll, works as expected  

 

I've just added a lisp routine to be called on command invocation    
this is PackageContents.xml:

<Components>
    <ComponentEntry
        AppName="pp3"
        ModuleName="./contents/windows/pp3.dll"
        LoadOnCommandInvocation="True">
        <Commands>
            <Command Global="pp3" />
        </Commands>
    </ComponentEntry>
    <ComponentEntry
        AppName="pp4"
        ModuleName="./contents/windows/pp4.lsp"
        LoadOnCommandInvocation="True">
        <Commands>
            <Command Global="pp4" />
        </Commands>
    </ComponentEntry>
</Components>



It works except for an unwanted "nil" display when opening every dwg:


Regenerating model.
AutoCAD menu utilities loaded.*Cancel*
 nil

Command:
Command:
Command:



if I remove the component entry relative to pp4.lsp from PackageContents.xml, there is no "nil" message:

Regenerating model.
AutoCAD menu utilities loaded.*Cancel*

Command:
Command:
Command:

 

I tried to bundle just the lisp command, same issue  

0 Likes
591 Views
7 Replies
Replies (7)
Message 2 of 8

hmsilva
Mentor
Mentor

@jf wrote:

Hi everyone, AutoCAD 2016, Windows 7, I've been using the autoloader mechanism to load a dll, works as expected  

 

I've just added a lisp routine to be called on command invocation    
this is PackageContents.xml:

...
It works except for an unwanted "nil" display when opening every dwg:

...


Hello Jf and welcome to the Autodesk Community!

 

Probably the.lsp file on load will evaluate some expression and the nil is the evaluate result, try to add a (princ) at the .lsp file end...

Without seeing the lisp code, just guessing...

 

Hope this helps,
Henrique

EESignature

0 Likes
Message 3 of 8

Anonymous
Not applicable

Hello Henrique, thank you   

the lisp file is intended to be loaded only on command invocation, and it is, I checked  
What it contains shouldn't cause this problem  

In any event here is the lisp code:    

 

 

(defun c:pp4()
  (setq pp4-loaded t) ;exposed
  (print "pp4: done")
  (princ)
)
(princ)

 

0 Likes
Message 4 of 8

Anonymous
Not applicable

sorry the lisp routine shoud read:

 

(setq pp4-loaded t)
(defun c:pp4()
  (print "pp4: done")
  (princ)
)
(princ)

(not that it changes anything to the problem at hand)  

0 Likes
Message 5 of 8

hmsilva
Mentor
Mentor

Hi Jf,

I do not see anything to cause the 'nil'... 😞

 

Henrique

EESignature

0 Likes
Message 6 of 8

Anonymous
Not applicable

I hope this thread will not stop at that       

 

I made a test with LoadOnAutoCADStartup="True" in PackageContents and no nil shows up with this setting      

It seems like there is a problem with LoadOnCommandInvocation="True"

 

I also tried on a fresh install of AutoCAD 2015, same problem   

0 Likes
Message 7 of 8

hmsilva
Mentor
Mentor

@jf wrote:

I hope this thread will not stop at that       

...


I hope so too!

 

But, unfortunately, I am abroad and I don't have AutoCAD in this old laptop...

Hopefully someone else can step in and assist better.

 

Henrique

EESignature

0 Likes
Message 8 of 8

Anonymous
Not applicable

Thank you Henrique

0 Likes