C# and Maxscript -- Communication


#1

Hi Folks ,

I tried to find a post which heps me go on in my problem but i didnt directly find it (Links appreciated). Im new to dotNet and tried to build a KeyListener for any input on WIndows in Maxscript. Due to limitations i decided to build the Key Listener in C# (Visual Studio) build it and combine it with Maxscript. And here my Problem starts: I can load my compiled .dll but im not able to acess the methods of the dotNet Object i create through:

dotnet.loadAssembly(“C:\blabla\ClassLibary1.dll”)
myTestObject = dotNetObject “namespace.ClassWhichINeedObjectForm”
print (myTestObject.GetLongName())

print(showProperties myTestObject )
print( showMethods myTestObject )
print(showProperties myTestObject )
print(showEvents myTestObject )
print(dotNet.showConstructors myTestObject )

This code kinda gives no usefull real results but the Listener also returns not a lot errors so i guess the Objects is not undefinded (Only error: Object has no getlongName()).

So to come to the point: How do i create Instances from my Class and Acess its Methods in Maxscript. My class is writen in C# and compiled as an .dll which uses the correct .Net Version.

Hope i didnt overlook any other posts (I found some related to the topic but couldnt wrap my head around) and hope the format of the post is correct. Any Help is appreciated (Pla mind that im new to dotNet if any termiology is uncorrect).

Greetings e


#2

Are you sure that the methods of your class are public?


#3
public class MyClass
{
    public char someObjectValue = 'x';

    public MyClass() --Constructor
    {

    } 

    public void activateKeyboard()
    {
        OtherClass.DoSomething(this);
    }

 }

yes im sure that how my main class looks like (I simpliifed it a little)


#4

Ok, check this thread maybe it could help you.


#5

http://www.mrbluesummers.com/1392/3d-tutorials/c-sharp-to-maxscript


#6

OKay thanks a lot guys. I will check the Links and give an update about hows it going :wink:


#7

Make your functions “static”.