invoke lisp while command is active...

invoke lisp while command is active...

JamesMaeding
Advisor Advisor
889 Views
3 Replies
Message 1 of 4

invoke lisp while command is active...

JamesMaeding
Advisor
Advisor

I have commmands defined in .net, that draw things using lisp functions.

But I never have called those commands using lisp like (command "mydotnetcmd1" "string1" "value2"...).

 

It turns out I do have the need to allow users to call like that in scripts and other lisps.

When I do call them using (command "whatever...), the part of the code that runs a lisp function to draw stuff, does nothing.

It does not throw an error, I used a try-catch to see. It simply returns a resultbuffer of null.

 

I have to think this is because autocad thinks its still in another lisp function - the (command...), so will not allow a second one to run.

But that honestly does not make sense to me as that is allowed in every other situation.

I guess i do not understand why calling using (command... is different, from .net's point of view.

I tried various commandflags and it did not help.

 

My thought to work around this is make a lispfunction in .net, instead of a commmand, for times when the user wants to run on command line.

Then .net thinks its already in a lisp function, and that has worked in the past I recall.

I just do not like not understanding what is going on.

Any help appreciated.

 


internal protected virtual unsafe Human() : mostlyHarmless
I'm just here for the Shelties

0 Likes
Accepted solutions (1)
890 Views
3 Replies
Replies (3)
Message 2 of 4

Balaji_Ram
Alumni
Alumni
Accepted solution

Hi James,

 

Sorry for the delay.

 

Have you tried using (command-s) to invoke the Lispfunctions in your .Net module ?

 

If that does not help, can you please let me know what the LispFunction does ?

It could be specific to what the .Net code is doing and the context in which it gets called when invoked from Lisp.

 

Regards,

Balaji



Balaji
Developer Technical Services
Autodesk Developer Network

Message 3 of 4

JamesMaeding
Advisor
Advisor

Hi Balaji,

That works.

I am completely confused on why, as I thought command-s only helped when you were calling a lisp function that issued commands, from .net.

Having tried it though, it seems like command-s changes the "status" of the command line having focus (in loose terms).

Can you explain why it works, this might help others too.

thanks


internal protected virtual unsafe Human() : mostlyHarmless
I'm just here for the Shelties

0 Likes
Message 4 of 4

Balaji_Ram
Alumni
Alumni

Hi James,

 

In a white paper on migrating applications to work inside AutoCAD after fibers had been removed, a senior member of our engineering team, had this to say about (command-s)

 

----

The (command-s) function is a new variation of the (command) function which has some restrictions on command token content, but is both faster than (command) and can be used in *error* handlers where the (command) function cannot be used when running fiberless, due to internal logic differences.

The "-s" suffix stands for "subroutine" execution of the supplied tokens.  Although it does effectively the same thing as the (command) function, the internal interaction with AutoCAD is very different.

----

 

The way i see it is that when you have all the tokens that are required by AutoCAD to complete the command in one go,

I would use command-s, regardless of whether (command) works in that case. This is because, as mentioned in the above note

the internal implementation and interaction inside AutoCAD is quite different for both of these and (command-s) handles

fiberless operations and in such cases the use of (command) would fail. 

 

Regards,

Balaji

 

 

 

 



Balaji
Developer Technical Services
Autodesk Developer Network

0 Likes