#1
|
|||
|
|||
Invoking lisp code from a .NET add-in
Hi,
is there anybody who's experienced in using the COM and .NET API? I am going to write a customization for Modeling and I am considering the option of using this API instead of (or togheter with) the lisp IKit, as I think that for this particular task, writing a .NET program could have some advantages. In particular, do you know if there's a way to invoke a lisp command from a .NET addin? In the documentation I found an example of a lisp dialog calling a .NET function that returns a value back to the lisp code... but I could not find any reference to .NET code invoking a lisp function or dialog. Thank you in advance, Fabrizio Last edited by fabrizio; 10-04-2013 at 01:19 AM. |
#2
|
|||
|
|||
Re: Invoking lisp code with .NET API
After digging deeper into the .NET API doc, I have found a method in the Application class that does exactly what I was looking for. The method is:
Code:
public virtual object SendCommand(string str); Code:
app.SendCommand("(delete_3d :all_at_top)"); Does anyone have an idea (or maybe just a hint) for the reason of this strange behavior? |
#3
|
|||
|
|||
Re: Invoking lisp code with .NET API
Quote:
Code:
app.SendCommand("(oli:sd-put-buffer "")"); I hope this helps! andy
__________________
Andy Poulsen AI MAXTools: Dream. Design. Done. It's that easy! Add-ins bringing new functionality and speed to Creo Elements/Direct and CoCreate products. Now available for v17-v20+! See them in action at www.ai-maxtools.com and then try them for yourself -- FREE! |
#4
|
|||
|
|||
Re: Invoking lisp code with .NET API
Hello Andy,
thank you for your kind reply. As you suggested, I have tried to send an empty string to the command buffer after the execution of the delete_3d command. This actually causes the viewport and the browser to update. But there's another problem with this technique: after the UI is updated, the confirm and cancel icons appear in the upper-left corner of the viewport (with Modeling 18.1). In other words, a command apparently remains "pending" after the execution of this code. So I came up to this solution (C#) that executes the command, updates the UI and doesn't leave any open command in the end: Code:
app.SendCommand("(progn (delete_3d :all_at_top) (oli:sd-put-buffer \"complete\"))"); Fabrizio |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|