Skip to content

Commit dc951f6

Browse files
committed
Add hardcoded outputs folder (#3305)
Please Note: 1. Before submitting the PR, please review [How to Contribute to Dynamo](https://github.com/DynamoDS/Dynamo/blob/master/CONTRIBUTING.md) 2. Dynamo Team will meet 1x a month to review PRs found on Github (Issues will be handled separately) 3. PRs will be reviewed from oldest to newest 4. If a reviewed PR requires changes by the owner, the owner of the PR has 30 days to respond. If the PR has seen no activity by the next session, it will be either closed by the team or depending on its utility will be taken over by someone on the team 5. PRs should use either Dynamo's default PR template or [one of these other template options](https://github.com/DynamoDS/Dynamo/wiki/Choosing-a-Pull-Request-Template) in order to be considered for review. 6. PRs that do not have one of the Dynamo PR templates completely filled out with all declarations satisfied will not be reviewed by the Dynamo team. 7. PRs made to the `DynamoRevit` repo will need to be cherry-picked into all the DynamoRevit Release branches that Dynamo supports. Contributors will be responsible for cherry-picking their reviewed commits to the other branches after a `LGTM` label is added to the PR. (FILL ME IN) This section describes why this PR is here. Usually it would include a reference to the tracking task that it is part or all of the solution for. Check these if you believe they are true - [ ] The code base is in a better state after this PR - [ ] Is documented according to the [standards](https://github.com/DynamoDS/Dynamo/wiki/Coding-Standards) - [ ] The level of testing this PR includes is appropriate - [ ] User facing strings, if any, are extracted into `*.resx` files - [ ] Snapshot of UI changes, if any. (FILL ME IN) Reviewer 1 (If possible, assign the Reviewer for the PR) (FILL ME IN, optional) Any additional notes to reviewers or testers. (FILL ME IN, Optional) Names of anyone else you wish to be notified of
1 parent bfbf45c commit dc951f6

1 file changed

Lines changed: 25 additions & 16 deletions

File tree

src/DADynamoApp/DAEntrypoint.cs

Lines changed: 25 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,21 @@
1-
using Autodesk.DataManagement;
2-
using Autodesk.DataManagement.Model;
3-
using Autodesk.Revit.ApplicationServices;
1+
using Autodesk.Revit.ApplicationServices;
42
using Autodesk.Revit.DB;
53
using DesignAutomationFramework;
64
using DSCPython;
75
using Dynamo.Applications;
86
using Dynamo.Graph.Nodes;
97
using Dynamo.Graph.Workspaces;
10-
using Dynamo.Migration;
118
using Dynamo.Models;
129
using Dynamo.PythonServices;
1310
using Dynamo.Scheduler;
1411
using DynamoPlayer;
1512
using Greg.AuthProviders;
1613
using Newtonsoft.Json;
1714
using Newtonsoft.Json.Linq;
18-
using ProtoCore.DesignScriptParser;
1915
using RevitServices.Elements;
2016
using RevitServices.Persistence;
21-
using System.Diagnostics;
2217
using System.Reflection;
23-
using System.Runtime.Loader;
2418
using System.Text.RegularExpressions;
25-
using System.Windows.Controls;
2619
using static Dynamo.Models.DynamoModel;
2720

2821
namespace DADynamoApp
@@ -243,6 +236,20 @@ public void HandleDesignAutomationReadyEvent(object sender, DesignAutomationRead
243236
}
244237
}
245238

239+
// Ensure we have a pre-built graph output folder.
240+
try
241+
{
242+
var graphOutputFolder = "output";
243+
if (!Directory.Exists(graphOutputFolder))
244+
{
245+
Directory.CreateDirectory(graphOutputFolder);
246+
}
247+
}
248+
catch (Exception ex)
249+
{
250+
Console.WriteLine($"Failed to create output folder. {ex.Message}");
251+
}
252+
246253
Document? doc = null;
247254
var cModel = setupReq?.OpenCloudModelLocation;
248255
if (cModel != null)
@@ -284,7 +291,7 @@ public void HandleDesignAutomationReadyEvent(object sender, DesignAutomationRead
284291
if (doc == null) throw new InvalidOperationException("Could not open revit document.");
285292

286293
var hostloc = typeof(Autodesk.Revit.ApplicationServices.Application).Assembly.Location;
287-
var asmLocation = Path.GetDirectoryName(hostloc);
294+
var asmLocation = controlledApplication.SharedComponentsLocation;
288295
Console.WriteLine($"using asm at location {asmLocation}");
289296
Console.WriteLine($"Is Loaded {LoadMessage}");
290297

@@ -294,11 +301,10 @@ public void HandleDesignAutomationReadyEvent(object sender, DesignAutomationRead
294301

295302
DocumentManager.Instance.PrepareForDesignAutomation(app);
296303

297-
// Local Change
298-
//var geometryFactoryPath = @"C:\\Program Files\\Autodesk\\Revit 2025";
299-
300-
var loadedLibGVersion = ASMPrealoaderUtils.PreloadAsmFromRevit(controlledApplication.SharedComponentsLocation, DynamoPath);
304+
var loadedLibGVersion = ASMPrealoaderUtils.PreloadAsmFromRevit(asmLocation, DynamoPath);
305+
Console.WriteLine($"{loadedLibGVersion}");
301306
var geometryFactoryPath = ASMPrealoaderUtils.GetGeometryFactoryPath(DynamoPath, loadedLibGVersion);
307+
Console.WriteLine($"{geometryFactoryPath}");
302308

303309
PreInstallPythonDependencies();
304310

@@ -367,9 +373,12 @@ public void HandleDesignAutomationReadyEvent(object sender, DesignAutomationRead
367373
{
368374
Console.WriteLine("Document is C4R.");
369375
// Syncronize with central
370-
SynchronizeWithCentralOptions swc = new SynchronizeWithCentralOptions();
371-
swc.SetRelinquishOptions(new RelinquishOptions(/*relinquishAll*/true));// Should this be configurable?
372-
doc.SynchronizeWithCentral(new TransactWithCentralOptions(), swc);
376+
//SynchronizeWithCentralOptions swc = new SynchronizeWithCentralOptions();
377+
//swc.SetRelinquishOptions(new RelinquishOptions(/*relinquishAll*/true));// Should this be configurable?
378+
//doc.SynchronizeWithCentral(new TransactWithCentralOptions(), swc);
379+
380+
// Save the project locally (this will detach the model from the cloud, but we will re-upload at a new location)
381+
doc.SaveAs(Path.Combine(WorkItemFolder, setupReq.LocalModelFileName));
373382
}
374383
else
375384
{// Single user cloud model

0 commit comments

Comments
 (0)