<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Dynamo script in Revit API in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/dynamo-script-in-revit-api/m-p/9694659#M65164</link>
    <description>&lt;P&gt;&lt;SPAN&gt;Hi Klawson, I have followed this problem from a to z and I've tried to implement it into my own project. As mentioned above I'm also trying to run a dynamo script through my own button I've created in Revit. The script I am running, it's working just fine through Dynamo, but the issue is that this script starts with popping out new UI Window asking for some parameters and also to selecting some elements and by those choices it runs the script.&amp;nbsp; As I have followed your block of code you guys put there, I was able to run it, but after I click on my button, it just runs, but won't actually do anything. I have check also if the Dynamo is set in Automatic mode and it is. Is there any function, that I need to evoke first, so that UI Form from Dynamo is popped up, so I can continue and see if it's actually working?&amp;nbsp; &amp;nbsp; This is the code I had followed through this communication:&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;[Transaction(TransactionMode.Manual)]
    public class RunDynamo : IExternalCommand
    {
        public Result Execute(
          ExternalCommandData commandData,
          ref string message,
          ElementSet elements)
        {
            UIApplication uiapp = commandData.Application;
            Document doc = uiapp.ActiveUIDocument.Document;

            string Dynamo_Journal_Path = @"C:\Users\PeterMihok\AB Clausen\BIM Team - Dynamo Scripts\02 Scripts\02_01 All Scripts\ABC_Elements_SetElevation.dyn";
            DynamoRevit dynamoRevit = new DynamoRevit();

            DynamoRevitCommandData dynamoRevitCommandData = new DynamoRevitCommandData();
            dynamoRevitCommandData.Application = commandData.Application;
            IDictionary&amp;lt;string, string&amp;gt; journalData = new Dictionary&amp;lt;string, string&amp;gt;
            {
                {Dynamo.Applications.JournalKeys.ShowUiKey, false.ToString() }, // don't show DynamoUI at runtime
                {Dynamo.Applications.JournalKeys.AutomationModeKey, true.ToString() }, // run journal automatically
                {Dynamo.Applications.JournalKeys.DynPathKey, Dynamo_Journal_Path }, // run node at this file path
                {Dynamo.Applications.JournalKeys.DynPathExecuteKey, true.ToString() }, // The journal file can specify if the Dynamo workspace opened
                {Dynamo.Applications.JournalKeys.ForceManualRunKey, false.ToString() }, // don't run in manual mode
                {Dynamo.Applications.JournalKeys.ModelShutDownKey, true.ToString() },
                {Dynamo.Applications.JournalKeys.ModelNodesInfo, false.ToString() }
            };

            dynamoRevitCommandData.JournalData = journalData;
            Result externalCommandResult = dynamoRevit.ExecuteCommand(dynamoRevitCommandData);
            return externalCommandResult;
        }
    } &lt;/LI-CODE&gt;&lt;P&gt;&lt;SPAN&gt;I have tried to debug it, but I am not really a programmer so I don't really understand what should I be watching for etc...I would really like to solve this problem as this really interest me and I would like to understand more of it. Thanks in advance for your time guys and responses!&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 17 Aug 2020 08:25:52 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2020-08-17T08:25:52Z</dc:date>
    <item>
      <title>Dynamo script in Revit API</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/dynamo-script-in-revit-api/m-p/6363678#M65139</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does anyone know where I can find the code to run a dynamo script from within the Revit API ? I want to write a C# add-in that can run a dynamo script in the background. I know there is dyno browser, so there is a way to acchieve this. I just can't figure out how.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Jun 2016 06:30:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/dynamo-script-in-revit-api/m-p/6363678#M65139</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-06-03T06:30:22Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamo script in Revit API</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/dynamo-script-in-revit-api/m-p/6364817#M65140</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Dear Remy,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Thank you for your query.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;This is certainly possible, and might even be pretty easy if you have the right bits and pieces to put together.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I don't.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Basically, you can run any .NET language from within any other .NET language using the runtime language interpretation, compilation and execution facilities it provides.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;You might want to discuss this kind of topic directly with the Revit Python Shell and Dynamo communities.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;They probably have the tools you could use to implement this ready and waiting for you.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Please let us know how you end up solving this.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Thank you!&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I hope this helps.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Best regards,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Jeremy&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Jun 2016 16:28:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/dynamo-script-in-revit-api/m-p/6364817#M65140</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2016-06-03T16:28:25Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamo script in Revit API</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/dynamo-script-in-revit-api/m-p/6372798#M65141</link>
      <description>&lt;P&gt;Hmm, since Autodesk is pushing Dynamo so much, I assumed there would be code examples to do so already, byt apperently not &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ain't this a nice topic for the building coder&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Jun 2016 14:49:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/dynamo-script-in-revit-api/m-p/6372798#M65141</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-06-08T14:49:22Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamo script in Revit API</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/dynamo-script-in-revit-api/m-p/6374593#M65142</link>
      <description>&lt;P&gt;Hi Remy,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Dynamo is open source, so you could learn to interprete or execute *.dyn files by browsing the C# project:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://github.com/DynamoDS/Dynamo" target="_blank"&gt;https://github.com/DynamoDS/Dynamo&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cheers,&lt;/P&gt;
&lt;P&gt;Rudi&lt;/P&gt;</description>
      <pubDate>Thu, 09 Jun 2016 11:36:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/dynamo-script-in-revit-api/m-p/6374593#M65142</guid>
      <dc:creator>Revitalizer</dc:creator>
      <dc:date>2016-06-09T11:36:10Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamo script in Revit API</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/dynamo-script-in-revit-api/m-p/6690541#M65143</link>
      <description>&lt;P&gt;Now in Revit 2017.1 revit is equiped with a dynamo player, so apperently someone at autodesk knows how to run dynamo scripts in the revit api.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does anybody know how I can make my own button in reivt (or the ribbon) that runs a specific dynamo script.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 16 Nov 2016 11:28:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/dynamo-script-in-revit-api/m-p/6690541#M65143</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-11-16T11:28:31Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamo script in Revit API</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/dynamo-script-in-revit-api/m-p/6690847#M65144</link>
      <description>&lt;P&gt;As Rudi pointed out, anybody who takes a look at the open source repo should be able to tell you. How about taking a peek yourself? Greetings from AU!&lt;/P&gt;</description>
      <pubDate>Wed, 16 Nov 2016 14:00:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/dynamo-script-in-revit-api/m-p/6690847#M65144</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2016-11-16T14:00:46Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamo script in Revit API</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/dynamo-script-in-revit-api/m-p/6690870#M65145</link>
      <description>&lt;P&gt;Well, due too lack of time I was hoping someone had a working example by now &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 16 Nov 2016 14:08:04 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/dynamo-script-in-revit-api/m-p/6690870#M65145</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-11-16T14:08:04Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamo script in Revit API</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/dynamo-script-in-revit-api/m-p/6702507#M65146</link>
      <description>&lt;P&gt;I am too, very much looking for this (but already working on too many things at the same time to dive into it atm).&lt;/P&gt;&lt;P&gt;Please keep us updated when you find out more about this subject &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Nov 2016 14:04:01 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/dynamo-script-in-revit-api/m-p/6702507#M65146</guid>
      <dc:creator>dante.van.wettum</dc:creator>
      <dc:date>2016-11-22T14:04:01Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamo script in Revit API</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/dynamo-script-in-revit-api/m-p/7818127#M65147</link>
      <description>&lt;P&gt;@Anonymous,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have the same issue. Any updates on this topic?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;</description>
      <pubDate>Thu, 01 Mar 2018 02:59:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/dynamo-script-in-revit-api/m-p/7818127#M65147</guid>
      <dc:creator>Organon</dc:creator>
      <dc:date>2018-03-01T02:59:29Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamo script in Revit API</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/dynamo-script-in-revit-api/m-p/7818369#M65148</link>
      <description>&lt;P&gt;Yes, I provided an update on this topic in July 2017:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://forums.autodesk.com/t5/revit-api-forum/how-to-open-dynamo-file-through-revit-addin/td-p/7016648" target="_blank"&gt;https://forums.autodesk.com/t5/revit-api-forum/how-to-open-dynamo-file-through-revit-addin/td-p/7016648&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Jeremy&lt;/P&gt;</description>
      <pubDate>Thu, 01 Mar 2018 06:39:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/dynamo-script-in-revit-api/m-p/7818369#M65148</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2018-03-01T06:39:00Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamo script in Revit API</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/dynamo-script-in-revit-api/m-p/7818380#M65149</link>
      <description>&lt;P&gt;@Anonymous&amp;nbsp;did you ever end up implementing this? Do you have a sample handy? I would gladly publish it for you&amp;nbsp; &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp; Thank you! Cheers, Jeremy&lt;/P&gt;</description>
      <pubDate>Thu, 01 Mar 2018 06:45:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/dynamo-script-in-revit-api/m-p/7818380#M65149</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2018-03-01T06:45:52Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamo script in Revit API</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/dynamo-script-in-revit-api/m-p/7818529#M65150</link>
      <description>&lt;P&gt;Hi Jeremy, Due too time and other priorities I never continued with this topic. With the comming of dynamo player I was hoping the Revit API would be expanded with some related commands/methods aswell. Unfortunately it appears not to be so..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Mar 2018 08:02:41 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/dynamo-script-in-revit-api/m-p/7818529#M65150</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-03-01T08:02:41Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamo script in Revit API</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/dynamo-script-in-revit-api/m-p/7818783#M65151</link>
      <description>&lt;P&gt;@Anonymous&lt;/P&gt;&lt;P&gt;Looking at the original idea on the ideastation, i believe that was the setup of that idea.&lt;/P&gt;&lt;P&gt;Hopefully they will implement such a thing, or a new ideastation item is needed?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/413917"&gt;@jeremytammik&lt;/a&gt;&lt;/P&gt;&lt;P&gt;You mentioned to simulate a mouseclick, but i dont think this will work in combination with the dynamo player; e.g. filling in parameters and executing the right script in the list.&lt;/P&gt;</description>
      <pubDate>Thu, 01 Mar 2018 09:54:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/dynamo-script-in-revit-api/m-p/7818783#M65151</guid>
      <dc:creator>dante.van.wettum</dc:creator>
      <dc:date>2018-03-01T09:54:08Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamo script in Revit API</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/dynamo-script-in-revit-api/m-p/7820225#M65152</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/413917"&gt;@jeremytammik&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;</description>
      <pubDate>Thu, 01 Mar 2018 17:29:01 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/dynamo-script-in-revit-api/m-p/7820225#M65152</guid>
      <dc:creator>Organon</dc:creator>
      <dc:date>2018-03-01T17:29:01Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamo script in Revit API</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/dynamo-script-in-revit-api/m-p/8824125#M65153</link>
      <description>&lt;P&gt;I am now working on this. I think I've found where Dynamo runs the code, but it does not work when I replicate it. The portion I found in the Git is in the IronPythonEvaluator.cs:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;public static object EvaluateIronPythonScript(
            string code,
            IList bindingNames,
            [ArbitraryDimensionArrayImport] IList bindingValues)
{
    // TODO - it would be nice if users could modify a preference
    // setting enabling the ability to load additional paths

    // Container for paths that will be imported in the PythonEngine
    List&amp;lt;string&amp;gt; paths = new List&amp;lt;string&amp;gt;();

    // Attempt to get the Standard Python Library
    string stdLib = pythonStandardLibPath();

    if (code != prev_code)
    {
        ScriptEngine PythonEngine = Python.CreateEngine();
        if (!string.IsNullOrEmpty(stdLib))
        {
            code = "import sys" + System.Environment.NewLine + code;
            paths = PythonEngine.GetSearchPaths().ToList();
            paths.Add(stdLib);
        }

        // If any paths were successfully retrieved, append them
        if (paths.Count &amp;gt; 0)
        {
            PythonEngine.SetSearchPaths(paths);
        }

        ScriptSource script = PythonEngine.CreateScriptSourceFromString(code);
        script.Compile();
        prev_script = script;
        prev_code = code;
    }

    ScriptEngine engine = prev_script.Engine;
    ScriptScope scope = engine.CreateScope();

    int amt = Math.Min(bindingNames.Count, bindingValues.Count);

    for (int i = 0; i &amp;lt; amt; i++)
    {
        scope.SetVariable((string)bindingNames[i], InputMarshaler.Marshal(bindingValues[i]));
    }

    try
    {
        OnEvaluationBegin(engine, scope, code, bindingValues);
        prev_script.Execute(scope);
    }
    catch (Exception e)
    {
        OnEvaluationEnd(false, engine, scope, code, bindingValues);
        var eo = engine.GetService&amp;lt;ExceptionOperations&amp;gt;();
        string error = eo.FormatException(e);
        throw new Exception(error);
    }

    OnEvaluationEnd(true, engine, scope, code, bindingValues);

    var result = scope.ContainsVariable("OUT") ? scope.GetVariable("OUT") : null;

    return OutputMarshaler.Marshal(result);
}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm hitting a roadblock, though. All namespaces loaded, no compile errors or warnings. I've simplified mine to:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;[Transaction(TransactionMode.Manual)]
public class ModelCleanup : IExternalCommand
{
    public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
    {
        string code = @"|filepath|.dyn";
        ScriptEngine engine = Python.CreateEngine();
        ScriptScope scope = engine.CreateScope();
        ScriptSource script = engine.CreateScriptSourceFromFile(code);
        script.Compile();
        script.Execute(scope);

        return Result.Succeeded;
    }&lt;/PRE&gt;&lt;P&gt;I end up with the following error:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.JPG" style="width: 398px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/642418i71829C115AFE0304/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.JPG" alt="Capture.JPG" /&gt;&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;Does anyone have any insight? I am already using Dyno Browser, though I'm not 100% happy with it. I cannot decompile his DLL's to a far-enough degree to see how he's doing it, but he proves it's possible. I do not like Dynamo Player at all. I'm simply looking for a way to have C# call some .dyn files so I don't have to waste time rewriting them all.&lt;/P&gt;</description>
      <pubDate>Thu, 30 May 2019 18:25:04 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/dynamo-script-in-revit-api/m-p/8824125#M65153</guid>
      <dc:creator>LeeFried</dc:creator>
      <dc:date>2019-05-30T18:25:04Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamo script in Revit API</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/dynamo-script-in-revit-api/m-p/8824212#M65154</link>
      <description>&lt;P&gt;Full code is ("|filepath|" is a substitute):&lt;/P&gt;&lt;PRE&gt;#region Namespaces
using System.Collections.Generic;
using System.Linq;
using Autodesk.Revit.Attributes;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;
using Microsoft.Scripting.Hosting;
using IronPython.Hosting;
#endregion

namespace RATCommands
{
    [Transaction(TransactionMode.Manual)]
    public class ModelCleanup : IExternalCommand
    {
        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {
            string code = @"|filepath|.dyn";
            ScriptEngine engine = Python.CreateEngine();
            ScriptScope scope = engine.CreateScope();
            ScriptSource script = engine.CreateScriptSourceFromFile(code);
            script.Compile();
            script.Execute(scope);

            return Result.Succeeded;
        }
    }
}&lt;/PRE&gt;&lt;P&gt;I re-referenced my Microsoft.Scripting.dll to that from the ProgramData\Autodesk\Revit\ folder and now I get the following error:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.JPG" style="width: 458px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/642433i66710AA9C4EE74E0/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.JPG" alt="Capture.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 30 May 2019 18:58:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/dynamo-script-in-revit-api/m-p/8824212#M65154</guid>
      <dc:creator>LeeFried</dc:creator>
      <dc:date>2019-05-30T18:58:50Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamo script in Revit API</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/dynamo-script-in-revit-api/m-p/8824409#M65155</link>
      <description>&lt;P&gt;I've managed to get it to attempt to execute a python script...only to come to the realization that the files are .dyn and are not python scripts.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;DUH&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Back to the drawing board.&lt;/P&gt;</description>
      <pubDate>Thu, 30 May 2019 20:48:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/dynamo-script-in-revit-api/m-p/8824409#M65155</guid>
      <dc:creator>LeeFried</dc:creator>
      <dc:date>2019-05-30T20:48:24Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamo script in Revit API</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/dynamo-script-in-revit-api/m-p/8825214#M65156</link>
      <description>&lt;P&gt;Doesn't the DYN file contain the Python script as text?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You might be able to parse the DYN, extract the pure Python, and execute that as desired.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 31 May 2019 08:55:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/dynamo-script-in-revit-api/m-p/8825214#M65156</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2019-05-31T08:55:33Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamo script in Revit API</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/dynamo-script-in-revit-api/m-p/8825746#M65157</link>
      <description>&lt;P&gt;That was my first thought, so I tried&lt;/P&gt;&lt;PRE&gt;var pyCode = Path.ChangeExtension(code, ".py");
var engine = Python.CreateRuntime();
dynamic scope = engine.UseFile(pyCode);
scope.Simple()&lt;/PRE&gt;&lt;P&gt;but that didn't work either.&lt;/P&gt;</description>
      <pubDate>Fri, 31 May 2019 14:15:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/dynamo-script-in-revit-api/m-p/8825746#M65157</guid>
      <dc:creator>LeeFried</dc:creator>
      <dc:date>2019-05-31T14:15:03Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamo script in Revit API</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/dynamo-script-in-revit-api/m-p/9085917#M65158</link>
      <description>&lt;P&gt;Hi Lee,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Did you see this post: &lt;A href="https://forum.dynamobim.com/t/open-dynamo-in-background-while-c-add-in-executes/19535/5" target="_blank" rel="noopener"&gt;Open Dynamo in background while C# add-in executes&lt;/A&gt;&amp;nbsp; ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I feel like&amp;nbsp;&lt;A href="https://forum.dynamobim.com/u/hzamaniM54WP" target="_blank" rel="noopener"&gt;hzamaniM54WP&lt;/A&gt; was close with the following code, but I can't figure out what he was doing wrong either.&lt;/P&gt;&lt;PRE&gt;using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;
using Dynamo.Applications;
using Dynamo.Core;

namespace my_addin
{
    [Autodesk.Revit.Attributes.Transaction(Autodesk.Revit.Attributes.TransactionMode.Manual)]
    class DynamoTest : IExternalCommand
    {
        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {


            string Journal_Dynamo_Path = path_to_my_dyn_file;
            DynamoRevit dynamoRevit = new DynamoRevit()

            DynamoRevitCommandData dynamoRevitCommandData = new DynamoRevitCommandData();
            dynamoRevitCommandData.Application = commandData.Application;
            IDictionary&amp;lt;string, string&amp;gt; journalData = new Dictionary&amp;lt;string, string&amp;gt;
            {
                { Dynamo.Applications.JournalKeys.AutomationModeKey, true.ToString() },
                { Dynamo.Applications.JournalKeys.ShowUiKey, false.ToString() },
                { Dynamo.Applications.JournalKeys.DynPathKey, Journal_Dynamo_Path }
            };
            dynamoRevitCommandData.JournalData = journalData;       

            Result externalCommandResult = dynamoRevit.ExecuteCommand(dynamoRevitCommandData);

            return externalCommandResult;



        }
    }
}&lt;/PRE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Error.png" style="width: 410px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/687534iECD452EC19F925A9/image-size/large?v=v2&amp;amp;px=999" role="button" title="Error.png" alt="Error.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Oct 2019 19:55:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/dynamo-script-in-revit-api/m-p/9085917#M65158</guid>
      <dc:creator>Kevin.Lawson.PE</dc:creator>
      <dc:date>2019-10-14T19:55:37Z</dc:date>
    </item>
  </channel>
</rss>

