• Hello PDMS masters.
    I have a class in my Addin called PointE3D and wish to initialise it, but I dont want to import any dll to do it, because its already in my Addin code.
    [FONT=Verdana]namespace GB_Addin
    {
       [PMLNetCallable()]
       public class PointE3D
       {
           [PMLNetCallable()]
           public PointE3D()
           {[/FONT]
    [FONT=Verdana]        }
           [PMLNetCallable()]
           public PointE3D(string Test)
           {
               MessageBox.Show(Test);
           }
       }
    }
    [/FONT]


    But at pdms, when I try to initialise it

    !test = object [COLOR=#222222][FONT=Verdana]PointE3D[/FONT][/COLOR]()

    I get the following error:

    [FONT=Verdana](47,15)   CP: Syntax error
    In line 5 of Command/Form Input

    Can I get some help in understanding where Im doing something wrong or even if is this possible?


    Thanks!
    [/FONT]
  • Hello Gelson,

    First of all, you should avoid numbers in your classes/objects names !

    Then, even if your dll is already loaded, you need to specify the namespace in your PML code before trying to create an instance of your C# object:


    using namespace 'YourNamespace'


    Also, your C# code need an Assign method, like this:


    [COLOR=#000000][FONT=&][PMLNetCallable()][/FONT][/COLOR]
    [COLOR=#000000][FONT=&][COLOR=#0000FF]public[/COLOR] [COLOR=#0000FF]void[/COLOR] Assign(PointE3D that)[/FONT][/COLOR]
    [COLOR=#000000][FONT=&]{[/FONT][/COLOR]
    [COLOR=#000000][FONT=&]}[/FONT][/COLOR]
  • Hi L
    I tried what you said, put the assign method and also started with 'using namespace...' before my command, but my result was the message: "PML: Object definition for POINTETD could not be found"
    I Have changed my class name from PointE3D to POINTETD.

    [assembly:PMLNetCallable()]
    namespace GB_Addin
    {

       [PMLNetCallable()]
       public class POINTETD
       {
           [PMLNetCallable()]
           public POINTETD()
           {
           }
         
           [PMLNetCallable()]
           public void Assign(POINTETD that)
           {
         
           }
           [PMLNetCallable()]
           private static bool Init()
           {
               return true;
           }
       }
    ...
    }


    Am I missing something else? I have tried changing the class to the same file as the main Addin class, with no success.

    Aidez-moi s'il vous pla?t!

    Merci!
  • Could you try the following PML Code ?


    import 'YourDllPath'
    HANDLE(1000,0)
    ENDHANDLE

    using namespace 'YourNamespace'
    !pointETD = OBJECT POINTETD()


    You can also try the import command in the Command Window to make sure it works.
  • Thanks L, it worked.
    I made the Addin import itself on load and then the classes got available.
    Thanks for the help!