Use function from other LISP file doesn't work

Use function from other LISP file doesn't work

martin.mardikas
Enthusiast Enthusiast
445 Views
5 Replies
Message 1 of 6

Use function from other LISP file doesn't work

martin.mardikas
Enthusiast
Enthusiast

Hi!

I'm using a custom lisp command(x). This command uses function, which is located in other .lsp file(y). So it can be used in multiple commands.

So I loaded this y file to startup suite content  and also added to support file search path. 

Capture4.PNG

But it keeps giving me error, that it doesn't find that function

Capture5.PNG

I use ACAD2019

 

0 Likes
Accepted solutions (1)
446 Views
5 Replies
Replies (5)
Message 2 of 6

ВeekeeCZ
Consultant
Consultant
Accepted solution

Placing the lsp to the start-up suite is enough to be loaded.

 

The thing is, how do you call it.

 

If the lisp func is (defun c:Myfunc () ...), then you call it by Myfunc from AutoCAD command line or (c:myfunc) from another lisp file.

It the function is without c:... as (defun MyFunc () ...) then call it by (MyFunc) in both cases.

0 Likes
Message 3 of 6

Kent1Cooper
Consultant
Consultant

@martin.mardikas wrote:

.... I loaded this y file to startup suite content  .....


As described in Help, the Startup Suite runs when AutoCAD starts up, but that doesn't necessarily mean what's in it gets into every subsequent drawing you create or open.  Does what you want work in the first drawing upon opening AutoCAD, but not subsequent drawings?  It's not quite clear to me -- some kinds of things do seem to remain in effect in subsequent drawings, too, but I haven't experimented extensively.  In any case, if you load it via acaddoc.lsp instead of the Startup Suite, it will be loaded in every drawing.

Kent Cooper, AIA
0 Likes
Message 4 of 6

martin.mardikas
Enthusiast
Enthusiast

I can add these functions to acaddoc.lsp file? Without it will mess up everything else?

 

0 Likes
Message 5 of 6

Kent1Cooper
Consultant
Consultant

@martin.mardikas wrote:

I can add these functions to acaddoc.lsp file? Without it will mess up everything else?


Yes, either by including the function definitions themselves directly in it, or if you want those to remain as separate files, including (load) or (autoload) functions in it.

Kent Cooper, AIA
0 Likes
Message 6 of 6

Sea-Haven
Mentor
Mentor

Been using startup suite for years and never had a problem of lisps not being loaded when do new dwg, so multiple dwg's open. 8 users and read from server not local.

0 Likes