AutoCAD Electrical Forum
Welcome to Autodesk’s AutoCAD Electrical Forums. Share your knowledge, ask questions, and explore popular AutoCAD Electrical topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

.NET command called by LISP

2 REPLIES 2
Reply
Message 1 of 3
klonbeck
438 Views, 2 Replies

.NET command called by LISP

 

I have a .NET app that calls wd_proj_wdp_data LISP API through a result buffer. If the app is called on the command line using the .NET defined command name everything works fine. I would like to the option to start my app by using the LISP command call, (command "commandname").

 

When I use the LISP command call the result buffer returns null. I don't know why it is returning null.

 

Why would the LISP command call prevent the result buffer from returning a value?

 

I am running AutoCAD Electrical 2016 on Windows 7

 

Tags (2)
2 REPLIES 2
Message 2 of 3

Hi,

 

are you using "LispFunction" ? if not, please try using LispFunction,

 

[LispFunction("MyLispFunction", "MyLispFunctionLocal")]
public int MyLispFunction(ResultBuffer args) // This method can have any name
{
          
    return 1;
}


Virupaksha Aithal KM
Developer Technical Services
Autodesk Developer Network

Message 3 of 3
felix.corre
in reply to: klonbeck

Hi,

I have the same problem whith the following VB.NET app. When i call the command "felixMV3" on the command line everything works fine but when i want start my app by using the LISP command call (command "felixMV3") AUTOCAD crash.

 <Autodesk.AutoCAD.Runtime.CommandMethod("felixMV3", "felixMV3", Autodesk.AutoCAD.Runtime.CommandFlags.Modal)>
    Public Sub felixMV3()

        Dim ed As Editor = Application.DocumentManager.MdiActiveDocument.Editor
        Dim acDoc As Document = Autodesk.AutoCAD.ApplicationServices.Core.Application.DocumentManager.MdiActiveDocument
        Dim ReturnBlkvalue As String = Lispfunction("C:ReturnBlk")
    End Sub
#End Region


    Public Function Lispfunction(varlisp As String) As String
        Dim ed As Editor = Application.DocumentManager.MdiActiveDocument.Editor
        Dim arg As New TypedValue(CInt(LispDataType.Text), varlisp)
        Dim arginv As New ResultBuffer(arg)
        Dim resbuf As ResultBuffer = Application.Invoke(arginv)
        Dim values = resbuf.AsArray()
        Dim value As String = values(0).Value
        Dim blkname As String = value
        Return value
    End Function

Anyone can help me please?

Félix.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report