Message 1 of 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello everyone,
I have an add-in that is producing an error.
The Add-In in question is trying to execute a .dyn file when executed.
Here is the code in "Command.cs":
#region Namespaces
using Autodesk.Revit.ApplicationServices;
using Autodesk.Revit.Attributes;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;
using Autodesk.Revit.UI.Selection;
using Dynamo.Applications;
using System;
using System.Collections.Generic;
using System.Diagnostics;
#endregion
namespace DynamoAddin
{
[Transaction(TransactionMode.Manual)]
[Regeneration(RegenerationOption.Manual)]
public class RunDynamo : IExternalCommand
{
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
{
//Get application and documnet objects and start transaction
UIApplication uiapp = commandData.Application;
Document doc = uiapp.ActiveUIDocument.Document;
string Journal_Dynamo_Path = @"C:\Users\JoãoMoço\Documents\Dynamo\structure.dyn";
DynamoRevit dynamoRevit = new DynamoRevit();
DynamoRevitCommandData dynamoRevitCommandData = new DynamoRevitCommandData();
dynamoRevitCommandData.Application = commandData.Application;
IDictionary<string, string> journalData = new Dictionary<string, string>
{
{ 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, Journal_Dynamo_Path }, //run node at this file path
{ Dynamo.Applications.JournalKeys.DynPathExecuteKey, true.ToString() }, // The journal file can specify if the Dynamo workspace opened from DynPathKey will be executed or not. If we are in automation mode the workspace will be executed regardless of this key.
{ 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;
}
}
}
I have followed the solution here:
Run a.dyn from a Revit add-in? - Dynamo (dynamobim.com)
However, the .dyn script doesn't run when I execute the add-in and I get this error message:
I have tried to implement the solutions on the thread. Why is this happening?
The files are attached bellow.
Any help is appreciated.
Solved! Go to Solution.