Can i use external application (form zero touch nodes) in the generative design?

I create zero touch nodes by using C# to run external application (sofistick) but i have a warning at this node when i try to create Generative solution.
Can i use external application (form zero touch nodes) in the generative design?

I add my C# code for run sofistick as an Example of my code.

    [MultiReturn(new[] { "Run", "Cdb_FilePath" })] // DesignScript.Runtime   
    public static Dictionary<string, object> Run_Teddy(string filePath)
    {

        bool Run;
        string Cdb_FilePath;
    string SOFiSTiKPath_SPS = @"C:\Program Files\SOFiSTiK\2018\SOFiSTiK 2018\sps.exe";

        try
        {

         //   Process.Start(SOFiSTiKPath_SPS, filePath);
            using (Process exeProcess = Process.Start(SOFiSTiKPath_SPS, filePath))
            {
                 exeProcess.WaitForExit();

                // Retrieve the app's exit code
             int   exitCode = exeProcess.ExitCode;
                if (exitCode >= 0)
                {
                     Run=true;
                    Cdb_FilePath = filePath.Substring(0, filePath.Length - 3) + "cdb";
                }
                else
                {
                     Run=false;
                    Cdb_FilePath = "null";
                }

                
            }
               
        }
        catch (Exception)
        {

            throw;
        }

        return new Dictionary<string, object>
                                {

                                { "Run", Run },
                                { "Cdb_FilePath", Cdb_FilePath },
                              
                                };

    }

Can’t see what your error is - what is the translated text on the ‘problem’ tab indicating?

Not that GD will attempt to launch 6 con current instances of the application when you run your study, and sofistick will not permit that, or could report data back to Dynamo out of sequence.

1 Like

The error is (These blocks are dependant on Revit, therefore they have to be saved in between. The blocks that have to be saved in between cannot be placed in an evaluation loop (after an input block and before an output block).

Yes my dll file access to the revit API but it is not used in the dynamo in this script.
I solve it by generate a separate pakedge to access only to the sofistik software. The GD work as i expect. @jacob.small thank you for you quick reply :grinning::grinning:.

@jacob.small
I am trying to do a similar job in Revit Dynamo but I want to run Autodesk Robot.
In my zero-touch, I have referenced RobotOM.tlb but I seem to miss the correct syntax for launching Robot. I have looked at Robot API tutorial (below) but that does not seem to be the right syntax since there is no reference to an address for e.g. robot.exe. Could you guide me on this?
(I know the code below is in VB. My zero-touch is in C#)

Last I knew Robot has a significant limitation in the context of Generative Design, as there are licensing limitations around externally launching the tool. Moving to the 2023 product line may make the interop easier, how ever you’ll still be blocked from using the application in the context of Generative Design as you cannot run 6 concurrent instances of the tool (which is what Generative Design will do by default). I believe the capability to remove concurrency was also removed from GD, which means there is no work-around at this time.

If you are just trying to load Robot into a zero touch node in the context of Dynamo (not Generative Design) it’d be best to start a new topic for input and we can try and pull in a developer as this is one area I have no experience with.

If you do want to leverage this application generative design, I recommend the alternative of don’t. Instead of moving to a full evaluation tool (what robot is) you should look to do ‘guideline sizing’ of the elements and connections, to get a few optimal solutions in that context, and move one (or a few) of those into Robot for the finite analysis.

1 Like

Hi Jacob,
I checked Robot for multiple instances and it seems to work fine.
I got a response for running Robot from a zero-touch node, here:
How to start the a Robot Structural application through API
I will go and use this in Revit Dynamo GD and will give an update here. :slight_smile:

1 Like

Hello again,

I tried this and it seems Robot crashes. Is there a way to force Dynamo GD to use one thread all along?
I found a topic from a few years ago: Generative Design in Structural Analysis / How to handle connections / Multithreading? - Generative Design - Dynamo (dynamobim.com)