run method created in lisp con c#.net

run method created in lisp con c#.net

Anonymous
Not applicable
1,755 Views
2 Replies
Message 1 of 3

run method created in lisp con c#.net

Anonymous
Not applicable

Hello everyone
I have created many method in lisp. And I'm trying to run a method that has as parameters 2 points and a string

 

c1.png

I am trying to run the function (loaded in autocad) with code in .net

c2.png

And I couldn't load the run to the method . I can only run create method for me that don't need parameters.

 

question:


1)Can I call routines with parameters created by me using c # .net code?

2)What would be the correct way to call?

regards

 

0 Likes
Accepted solutions (1)
1,756 Views
2 Replies
Replies (2)
Message 2 of 3

_gile
Consultant
Consultant
Accepted solution

hi,

 

You have to use the Application.Invoke() method. See these topics:

https://forums.autodesk.com/t5/net/unable-to-find-an-entry-point-in-dll-acad-exe/m-p/5527242/highlig...

https://forums.autodesk.com/t5/net/how-to-pass-selection-set-to-lisp-command/m-p/8760502#M62469

 

In you case:

            var args = new ResultBuffer(
                new TypedValue((int)LispDataType.Text, "c:wrapper_draw_pl"),
                new TypedValue((int)LispDataType.Point3d, new Point3d(-11452.0, 3197.0, 0.0)),
                new TypedValue((int)LispDataType.Point3d, new Point3d(-11452.0, 3297.0, 0.0)),
                new TypedValue((int)LispDataType.Text, "A"));
            Application.Invoke(args);

But attentively read @dgorsman 's advice here:

https://forums.autodesk.com/t5/net/call-autolisp-function-from-c-code/td-p/5521845



Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

Message 3 of 3

Anonymous
Not applicable
Thank you very much for the code and the links.
 
 
 
 
 
 
 
It is what I was looking for.
 
 
regards
0 Likes