.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

C3D 2022, No Function Definition with LispFunction

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
CodeDing
469 Views, 4 Replies

C3D 2022, No Function Definition with LispFunction

Hey All,

 

I'm hoping this can be an easy fix for some of you experts. I'm by no means totally proficient with C#/.NET/Visual Studio yet. Trying to get better. Anyways...

 

In short.. Trying to create a Lisp Function via .NET (C#). I've created some Lisp Functions via this API in the past, but now that I've switched over to Civil 3D I can't seem to get something right?

 

I have a SIMPLE method / function:

using System;
using System.Windows;

using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.Runtime;

namespace Test
{
    public class Testing
    {

        [LispFunction("test")]
        public static void RunTest(ResultBuffer rbArgs)
        {
            Autodesk.AutoCAD.ApplicationServices.Application.ShowAlertDialog("Hello World!");
        }
    }
}

 

There are no build errors:

image.png

 

I believe I have all the correct dependencies referenced:

image.png

 

Yet, when I run the function, it does not exist:

image.png

 

Please can I get some advice to get over this hurdle?

...About:

image.png

 

Best,

~DD

 


Need AutoLisp help? Try my custom GPT 'AutoLISP Ace':
https://chat.openai.com/g/g-Zt0xFNpOH-autolisp-ace
4 REPLIES 4
Message 2 of 5
_gile
in reply to: CodeDing

Hi,

Is Copy Local property equal to False for each AutoCAD reference ?



Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

Message 3 of 5
CodeDing
in reply to: _gile

Correct, they are all set to "No".

image.png


Need AutoLisp help? Try my custom GPT 'AutoLISP Ace':
https://chat.openai.com/g/g-Zt0xFNpOH-autolisp-ace
Message 4 of 5
norman.yuan
in reply to: CodeDing

@CodeDing ,

 

I think you started a wrong project type with your Visual Studio (2022, it looks to me). I tell this from 2 pictures you attached in your post. 

 

1. The picture in your first post showing the references, it shows as "Dependencies", rather than "References" a it is supposed to be;

2. The picture attached to your reply to @_gile shows "Copy Local" to "No", rather "False" as it is supposed to be.

 

These 2 things indicate that you have chosen the project as .NET Core (.NET5/6), rather than .NET framework (4.7x/8). AutoCAD .NET API CAN ONLY work with .NET Framework, not .NET Core/5/6. You need to recreate your class library project as .NET Framework class library.

 

Norman Yuan

Drive CAD With Code

EESignature

Message 5 of 5
CodeDing
in reply to: norman.yuan

@norman.yuan ,

 

You are exactly correct. I did not know that. Thank you very much!

 

Best,

~DD


Need AutoLisp help? Try my custom GPT 'AutoLISP Ace':
https://chat.openai.com/g/g-Zt0xFNpOH-autolisp-ace

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

Post to forums  

AutoCAD Inside the Factory


Autodesk Design & Make Report