How to use custom Output classes with Zerotouch-Nodes

Hello community,

I’am totally new to the Dynamo and its developing. My main goal is to create a connection between a third party software and Dynamo in order to do parametric design. My first attempt to establish this is to create a package containing zerotouch nodes. If there are better way to accomplish that please feel free to mention that.

My Question: warning

using System.Runtime.InteropServices;
using thirdParty.FEM;
using Autodesk.DesignScript.Runtime;
using Autodesk.DesignScript.Interfaces;
using Autodesk.DesignScript.Geometry;

namespace Integration
{
   public class Parametric
    {   //Construtor
        private Parametric() {}

        public static IApplication establishSession()
        {
            IApplication app = null;

            try
            {
                app = Marshal.GetActiveObject("Application") as IApplication;
                app.LockLicense();
                
            }
            catch(Exception ex)
            {
                throw new Exception(ex.Message,ex.InnerException);
            }

            
            return app;
        }
}

In order to work with the session i need it as an output. But as you can see there is a warning i dont understand. Hope you can help me with some advice.

greetings
MasyMo

this may be an issue with interfaces - I’m not sure without having the .sln and all references.
Can you try using the concrete type instead?

Where is IApplication defined?

Thanks for your help. There are no more references than shown in the example. And the class IApplication is an interface for transfering data with the third party FEM application which is stored in a referenced dll-file.

But in general its possible to achive sending an import-class from an .dll as an output?
If it is like that i can shrink the solutionarea.

best regards

Hi hi,

i found a solution for my problem. Like:

said it is an issue with the interface IApplication I used. My workaround is to build my own class implementing is.

public class MyApplication : IApplication
{

    private IApplication app;

    public MyApplication()
    {
        app = Marshal.GetActiveObject("Application") as IApplication;
    }

With this public constructor i am able to get my desired output through my new class MyApplication. Thanks @Michael_Kirschner2

Greetings :slight_smile:

1 Like