From 4c571dfd91b6432a8d91d2d086269f9464fef02b Mon Sep 17 00:00:00 2001 From: Ashish Aggarwal Date: Fri, 12 Jan 2024 08:15:03 -0500 Subject: [PATCH 01/70] updated GregRevitAuth (#3027) --- .version | 2 +- CHANGELOG.md | 3 +++ src/Config/packages.aget | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.version b/.version index 2db101c8b1..4ab9bf23eb 100644 --- a/.version +++ b/.version @@ -1 +1 @@ -0.5.23 \ No newline at end of file +0.5.24 \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index ab4dc36aae..9ac51c72b0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## 0.5.24 +* Update GregRevitAuth to 2.0.8776.26607 + ## 0.5.23 * RC for Revit2025 * Removed configuration for .NET 7 diff --git a/src/Config/packages.aget b/src/Config/packages.aget index 141b619483..900f3a96b7 100644 --- a/src/Config/packages.aget +++ b/src/Config/packages.aget @@ -10,7 +10,7 @@ "DynamoVisualProgramming.ZeroTouchLibrary": "3.0.0.7190", "DynamoVisualProgramming.DynamoSamples": "3.0.0.7190", "Greg": "3.0.0.3175", - "GregRevitAuth": "2.0.8718.22924", + "GregRevitAuth": "2.0.8776.26607", "pythonnet_py38_win": "2.5.1", "Newtonsoft.Json": "13.0.1", "NUnit": "3.13.3", From 160168ec033dfe427eaed339f059622bbc2d3b60 Mon Sep 17 00:00:00 2001 From: Vlad Pavel Date: Wed, 17 Jan 2024 16:59:06 +0200 Subject: [PATCH 02/70] fix two failed tests --- .version | 2 +- CHANGELOG.md | 3 +++ .../RevitIntegrationTests/Application/FamilyDocumentTests.cs | 2 +- test/Libraries/RevitIntegrationTests/ElementBindingTests.cs | 4 ++-- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.version b/.version index 4ab9bf23eb..42db9a2252 100644 --- a/.version +++ b/.version @@ -1 +1 @@ -0.5.24 \ No newline at end of file +0.5.25 \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 9ac51c72b0..59b38f14f5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## 0.5.25 +* Fix two failed tests + ## 0.5.24 * Update GregRevitAuth to 2.0.8776.26607 diff --git a/test/Libraries/RevitIntegrationTests/Application/FamilyDocumentTests.cs b/test/Libraries/RevitIntegrationTests/Application/FamilyDocumentTests.cs index da515ed5f7..d7797efb45 100644 --- a/test/Libraries/RevitIntegrationTests/Application/FamilyDocumentTests.cs +++ b/test/Libraries/RevitIntegrationTests/Application/FamilyDocumentTests.cs @@ -46,7 +46,7 @@ public void CanGetFamilyDocumentParameters() string testPath = Path.GetFullPath(samplePath); var expectedOutputType = typeof(Revit.Elements.FamilyParameter); - var expectedParameterCount = 17; + var expectedParameterCount = 19; // Act ViewModel.OpenCommand.Execute(testPath); diff --git a/test/Libraries/RevitIntegrationTests/ElementBindingTests.cs b/test/Libraries/RevitIntegrationTests/ElementBindingTests.cs index cdcfca3bff..cc0f4ed0b3 100644 --- a/test/Libraries/RevitIntegrationTests/ElementBindingTests.cs +++ b/test/Libraries/RevitIntegrationTests/ElementBindingTests.cs @@ -571,7 +571,7 @@ public void Rebinding_ExceptionIsThrown() //Check the number of the family instances var instances = TestUtils.GetAllFamilyInstances(); - Assert.AreEqual(8, instances.Count); + Assert.AreEqual(4, instances.Count); var model = ViewModel.Model; var selNodes = model.CurrentWorkspace.Nodes.Where(x => string.Equals(x.GUID.ToString(), "2411be0e-abff-4d32-804c-5e5025a92257")); @@ -593,7 +593,7 @@ public void Rebinding_ExceptionIsThrown() //Check the number of family instances instances = TestUtils.GetAllFamilyInstances(); - Assert.AreEqual(8, instances.Count); + Assert.AreEqual(4, instances.Count); } [Test] From 7ca1f68392c4061d55fc79bdfa8919326f5fb72b Mon Sep 17 00:00:00 2001 From: Vlad Catalina Date: Tue, 23 Jan 2024 18:09:18 +0200 Subject: [PATCH 03/70] bumpup version to make build with signed binaries --- .version | 2 +- CHANGELOG.md | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.version b/.version index 42db9a2252..28b9abf894 100644 --- a/.version +++ b/.version @@ -1 +1 @@ -0.5.25 \ No newline at end of file +0.5.26 \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 59b38f14f5..3ec10976be 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## 0.5.26 +* Build with signed binaries + ## 0.5.25 * Fix two failed tests From 2701ba0cf57984d502fa69d3de48250dd8cc839f Mon Sep 17 00:00:00 2001 From: Vlad Catalina Date: Tue, 23 Jan 2024 20:38:01 +0200 Subject: [PATCH 04/70] bump up version to publish --- .version | 2 +- CHANGELOG.md | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.version b/.version index 28b9abf894..82591dbcb7 100644 --- a/.version +++ b/.version @@ -1 +1 @@ -0.5.26 \ No newline at end of file +0.5.27 \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 3ec10976be..97e61841f9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## 0.5.27 +* Build with signed binaries (including for addin) + ## 0.5.26 * Build with signed binaries From d35fb7e40ca1f41fdb5f915b5f85dc84ebfe0378 Mon Sep 17 00:00:00 2001 From: aparajit-pratap Date: Thu, 25 Jan 2024 02:51:23 -0500 Subject: [PATCH 05/70] Update DynamoRevit.cs (#3033) OnRequestsCrashPrompt function --- src/DynamoRevit/DynamoRevit.cs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/DynamoRevit/DynamoRevit.cs b/src/DynamoRevit/DynamoRevit.cs index c2bc4f12c4..103ff8d8ca 100644 --- a/src/DynamoRevit/DynamoRevit.cs +++ b/src/DynamoRevit/DynamoRevit.cs @@ -1053,9 +1053,7 @@ private static void Dispatcher_UnhandledException( try { DynamoModel.IsCrashing = true; - RevitDynamoModel.OnRequestsCrashPrompt( - RevitDynamoModel, - new CrashPromptArgs(args.Exception.Message + "\n\n" + args.Exception.StackTrace)); + RevitDynamoModel.OnRequestsCrashPrompt(new CrashErrorReportArgs(args.Exception)); RevitDynamoViewModel.Exit(false); // don't allow cancellation } catch { } @@ -1223,4 +1221,4 @@ internal static IEnumerable GetLayoutSpecsFiles() return ParseinternalPackageFiles(internalPackageFiles).Select(pkg => pkg.LayoutSpecsPath); } } -} \ No newline at end of file +} From 2ee6da74fb11420a2a94574fbd849295667144ac Mon Sep 17 00:00:00 2001 From: Vlad Catalina Date: Thu, 25 Jan 2024 10:45:54 +0200 Subject: [PATCH 06/70] Update Dynamo Core to 3.0.2.7476 --- .version | 2 +- CHANGELOG.md | 3 +++ src/Config/packages.aget | 14 +++++++------- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/.version b/.version index 82591dbcb7..dc2c2a78b6 100644 --- a/.version +++ b/.version @@ -1 +1 @@ -0.5.27 \ No newline at end of file +0.5.28 \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 97e61841f9..150cc42bf9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## 0.5.28 +* Update Dynamo Core to 3.0.2.7476 + ## 0.5.27 * Build with signed binaries (including for addin) diff --git a/src/Config/packages.aget b/src/Config/packages.aget index 900f3a96b7..7d3ad2cd57 100644 --- a/src/Config/packages.aget +++ b/src/Config/packages.aget @@ -2,13 +2,13 @@ "nuget": { "references": { "DynamicLanguageRuntime": "1.2.2", - "DynamoVisualProgramming.Core": "3.0.0.7190", - "DynamoVisualProgramming.DynamoCoreNodes": "3.0.0.7190", - "DynamoVisualProgramming.DynamoServices": "3.0.0.7190", - "DynamoVisualProgramming.Tests": "3.0.0.7190", - "DynamoVisualProgramming.WpfUILibrary": "3.0.0.7190", - "DynamoVisualProgramming.ZeroTouchLibrary": "3.0.0.7190", - "DynamoVisualProgramming.DynamoSamples": "3.0.0.7190", + "DynamoVisualProgramming.Core": "3.0.2.7476", + "DynamoVisualProgramming.DynamoCoreNodes": "3.0.2.7476", + "DynamoVisualProgramming.DynamoServices": "3.0.2.7476", + "DynamoVisualProgramming.Tests": "3.0.2.7476", + "DynamoVisualProgramming.WpfUILibrary": "3.0.2.7476", + "DynamoVisualProgramming.ZeroTouchLibrary": "3.0.2.7476", + "DynamoVisualProgramming.DynamoSamples": "3.0.2.7476", "Greg": "3.0.0.3175", "GregRevitAuth": "2.0.8776.26607", "pythonnet_py38_win": "2.5.1", From cc2123fa8c9b4b353c07ae21993745a183fe00ae Mon Sep 17 00:00:00 2001 From: Vlad Catalina Date: Fri, 26 Jan 2024 11:26:35 +0200 Subject: [PATCH 07/70] Update DynamoRevit versioning to 3.0.2 to align with DynamoCore --- .version | 2 +- CHANGELOG.md | 3 +++ src/AssemblySharedInfoGenerator/AssemblySharedInfo.tt | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.version b/.version index dc2c2a78b6..aa0ea79c6c 100644 --- a/.version +++ b/.version @@ -1 +1 @@ -0.5.28 \ No newline at end of file +0.5.29 \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 150cc42bf9..b16607be31 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## 0.5.29 +* Update DynamoRevit versioning to 3.0.2 + ## 0.5.28 * Update Dynamo Core to 3.0.2.7476 diff --git a/src/AssemblySharedInfoGenerator/AssemblySharedInfo.tt b/src/AssemblySharedInfoGenerator/AssemblySharedInfo.tt index cf9307a054..e1565908f4 100644 --- a/src/AssemblySharedInfoGenerator/AssemblySharedInfo.tt +++ b/src/AssemblySharedInfoGenerator/AssemblySharedInfo.tt @@ -69,6 +69,6 @@ using System.Runtime.InteropServices; <#+ int MajorVersion = 3; int MinorVersion = 0; -int BuildNumber = 0; +int BuildNumber = 2; int RevisionNumber = ((int)(DateTime.UtcNow - new DateTime(2023,1,1)).TotalDays)*10+((int)DateTime.UtcNow.Hour)/3; #> From e19d8ed85062b76ead424f60a7b6942704c1b96e Mon Sep 17 00:00:00 2001 From: Vlad Catalina Date: Fri, 26 Jan 2024 17:27:45 +0200 Subject: [PATCH 08/70] Fix a couple of Regression tests --- .version | 2 +- CHANGELOG.md | 3 +++ test/Libraries/RevitIntegrationTests/CoreTests.cs | 1 + test/Libraries/RevitIntegrationTests/ElementBindingTests.cs | 4 ++-- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.version b/.version index aa0ea79c6c..5767123695 100644 --- a/.version +++ b/.version @@ -1 +1 @@ -0.5.29 \ No newline at end of file +0.5.30 \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index b16607be31..c51a1c4ed7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## 0.5.30 +* Fix a couple of regression tests + ## 0.5.29 * Update DynamoRevit versioning to 3.0.2 diff --git a/test/Libraries/RevitIntegrationTests/CoreTests.cs b/test/Libraries/RevitIntegrationTests/CoreTests.cs index 92ad467021..500cb9e198 100644 --- a/test/Libraries/RevitIntegrationTests/CoreTests.cs +++ b/test/Libraries/RevitIntegrationTests/CoreTests.cs @@ -48,6 +48,7 @@ public override void Setup() { WrapOf(s_initedInstance); CreateTemporaryFolder(); + ViewModel.Model.ResetEngine(); // This is needed because TearDown will clear the Model, and TearDown // is needed in order to clear the dependencyGraph, otherwise adding diff --git a/test/Libraries/RevitIntegrationTests/ElementBindingTests.cs b/test/Libraries/RevitIntegrationTests/ElementBindingTests.cs index cc0f4ed0b3..cdcfca3bff 100644 --- a/test/Libraries/RevitIntegrationTests/ElementBindingTests.cs +++ b/test/Libraries/RevitIntegrationTests/ElementBindingTests.cs @@ -571,7 +571,7 @@ public void Rebinding_ExceptionIsThrown() //Check the number of the family instances var instances = TestUtils.GetAllFamilyInstances(); - Assert.AreEqual(4, instances.Count); + Assert.AreEqual(8, instances.Count); var model = ViewModel.Model; var selNodes = model.CurrentWorkspace.Nodes.Where(x => string.Equals(x.GUID.ToString(), "2411be0e-abff-4d32-804c-5e5025a92257")); @@ -593,7 +593,7 @@ public void Rebinding_ExceptionIsThrown() //Check the number of family instances instances = TestUtils.GetAllFamilyInstances(); - Assert.AreEqual(4, instances.Count); + Assert.AreEqual(8, instances.Count); } [Test] From eecab07f8f2ff3638e59d45f70d2c33521cbd5cc Mon Sep 17 00:00:00 2001 From: Vlad Catalina Date: Wed, 31 Jan 2024 10:25:29 +0200 Subject: [PATCH 09/70] Update Dynamo Core to 3.0.3.7597 --- .version | 2 +- CHANGELOG.md | 3 +++ src/Config/packages.aget | 14 +++++++------- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/.version b/.version index 5767123695..23811e27b0 100644 --- a/.version +++ b/.version @@ -1 +1 @@ -0.5.30 \ No newline at end of file +0.5.31 \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index c51a1c4ed7..3654a251b4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## 0.5.31 +* Update Dynamo Core to 3.0.3.7597 + ## 0.5.30 * Fix a couple of regression tests diff --git a/src/Config/packages.aget b/src/Config/packages.aget index 7d3ad2cd57..928bfe7906 100644 --- a/src/Config/packages.aget +++ b/src/Config/packages.aget @@ -2,13 +2,13 @@ "nuget": { "references": { "DynamicLanguageRuntime": "1.2.2", - "DynamoVisualProgramming.Core": "3.0.2.7476", - "DynamoVisualProgramming.DynamoCoreNodes": "3.0.2.7476", - "DynamoVisualProgramming.DynamoServices": "3.0.2.7476", - "DynamoVisualProgramming.Tests": "3.0.2.7476", - "DynamoVisualProgramming.WpfUILibrary": "3.0.2.7476", - "DynamoVisualProgramming.ZeroTouchLibrary": "3.0.2.7476", - "DynamoVisualProgramming.DynamoSamples": "3.0.2.7476", + "DynamoVisualProgramming.Core": "3.0.3.7597", + "DynamoVisualProgramming.DynamoCoreNodes": "3.0.3.7597", + "DynamoVisualProgramming.DynamoServices": "3.0.3.7597", + "DynamoVisualProgramming.Tests": "3.0.3.7597", + "DynamoVisualProgramming.WpfUILibrary": "3.0.3.7597", + "DynamoVisualProgramming.ZeroTouchLibrary": "3.0.3.7597", + "DynamoVisualProgramming.DynamoSamples": "3.0.3.7597", "Greg": "3.0.0.3175", "GregRevitAuth": "2.0.8776.26607", "pythonnet_py38_win": "2.5.1", From ab901bca1d71b298c26f1b96635a88892447c27c Mon Sep 17 00:00:00 2001 From: Vlad Catalina Date: Wed, 31 Jan 2024 10:37:28 +0200 Subject: [PATCH 10/70] Update DynamoRevit versioning to 3.0.3 --- .version | 2 +- CHANGELOG.md | 3 +++ src/AssemblySharedInfoGenerator/AssemblySharedInfo.tt | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.version b/.version index 23811e27b0..55f4ee207c 100644 --- a/.version +++ b/.version @@ -1 +1 @@ -0.5.31 \ No newline at end of file +0.5.32 \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 3654a251b4..26f175b10f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## 0.5.32 +* Update DynamoRevit versioning to 3.0.3 + ## 0.5.31 * Update Dynamo Core to 3.0.3.7597 diff --git a/src/AssemblySharedInfoGenerator/AssemblySharedInfo.tt b/src/AssemblySharedInfoGenerator/AssemblySharedInfo.tt index e1565908f4..9dbe53f1f8 100644 --- a/src/AssemblySharedInfoGenerator/AssemblySharedInfo.tt +++ b/src/AssemblySharedInfoGenerator/AssemblySharedInfo.tt @@ -69,6 +69,6 @@ using System.Runtime.InteropServices; <#+ int MajorVersion = 3; int MinorVersion = 0; -int BuildNumber = 2; +int BuildNumber = 3; int RevisionNumber = ((int)(DateTime.UtcNow - new DateTime(2023,1,1)).TotalDays)*10+((int)DateTime.UtcNow.Hour)/3; #> From 3c29dbb287ce95380d691c7540c5335703d14769 Mon Sep 17 00:00:00 2001 From: Vlad Catalina Date: Fri, 5 Apr 2024 13:34:06 +0300 Subject: [PATCH 11/70] Version *.customization.dll files with number from other output binary --- .version | 2 +- CHANGELOG.md | 3 +++ src/DynamoRevit.All.sln | 3 +++ src/DynamoRevitIcons/DynamoRevitIcons.csproj | 10 ++++++++-- 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/.version b/.version index 55f4ee207c..924b649c53 100644 --- a/.version +++ b/.version @@ -1 +1 @@ -0.5.32 \ No newline at end of file +0.5.33 \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 26f175b10f..9f69f4ab1d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## 0.5.33 +* Version *.customization.dll files with number from other output binary + ## 0.5.32 * Update DynamoRevit versioning to 3.0.3 diff --git a/src/DynamoRevit.All.sln b/src/DynamoRevit.All.sln index d30e315fa3..04c5a8760a 100644 --- a/src/DynamoRevit.All.sln +++ b/src/DynamoRevit.All.sln @@ -58,6 +58,9 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution EndProjectSection EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DynamoRevitIcons", "DynamoRevitIcons\DynamoRevitIcons.csproj", "{A31E274C-524A-40CA-85FF-595D3DB53777}" + ProjectSection(ProjectDependencies) = postProject + {92A46535-D870-4E1A-AED0-7492789E9C4A} = {92A46535-D870-4E1A-AED0-7492789E9C4A} + EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tools", "Tools", "{821DE75A-8C7C-4747-B838-BA0354B15592}" EndProject diff --git a/src/DynamoRevitIcons/DynamoRevitIcons.csproj b/src/DynamoRevitIcons/DynamoRevitIcons.csproj index 1538f405a6..007acda54f 100644 --- a/src/DynamoRevitIcons/DynamoRevitIcons.csproj +++ b/src/DynamoRevitIcons/DynamoRevitIcons.csproj @@ -27,10 +27,16 @@ + + + - + - + From 5e55ee91c6a255acdfaffb02de970483834e3458 Mon Sep 17 00:00:00 2001 From: Craig Long Date: Tue, 30 Apr 2024 18:27:21 -0400 Subject: [PATCH 12/70] Fix regression in familytype.bygeometry (#3066) --- .version | 2 +- CHANGELOG.md | 3 +++ .../RevitNodes/GeometryConversion/ProtoToRevitSolid.cs | 2 ++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.version b/.version index 924b649c53..16bff4b4b7 100644 --- a/.version +++ b/.version @@ -1 +1 @@ -0.5.33 \ No newline at end of file +0.5.35 \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 9f69f4ab1d..63962f4805 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## 0.5.35 +* Fix regression on FamilyInstance.ByGeometry node + ## 0.5.33 * Version *.customization.dll files with number from other output binary diff --git a/src/Libraries/RevitNodes/GeometryConversion/ProtoToRevitSolid.cs b/src/Libraries/RevitNodes/GeometryConversion/ProtoToRevitSolid.cs index 9880da4e82..ea7e4d33e5 100644 --- a/src/Libraries/RevitNodes/GeometryConversion/ProtoToRevitSolid.cs +++ b/src/Libraries/RevitNodes/GeometryConversion/ProtoToRevitSolid.cs @@ -176,6 +176,8 @@ public static Autodesk.Revit.DB.FamilySymbol ToRevitFamilyType( var solids = GetSolidsFromElement(familyDocument.GetElement(importedElementId)); // delete imported sat + // first unpin the element to avoid an exception when deleting the SAT import + familyDocument.GetElement(importedElementId).Pinned = false; familyDocument.Delete(importedElementId); System.IO.File.Delete(tempFile); From 944c23e54fa9806a03038bcdf1413eb695b9661e Mon Sep 17 00:00:00 2001 From: Vlad Catalina Date: Thu, 23 May 2024 16:40:45 +0300 Subject: [PATCH 13/70] Integrate Dynamo Core 3.1 in Revit 2025.2 --- .version | 2 +- CHANGELOG.md | 3 +++ src/Config/packages.aget | 14 +++++++------- src/DynamoRevitIcons/DynamoRevitIcons.csproj | 2 +- 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/.version b/.version index 16bff4b4b7..0aa6e4f8d0 100644 --- a/.version +++ b/.version @@ -1 +1 @@ -0.5.35 \ No newline at end of file +0.5.36 \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 63962f4805..f18f33c382 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## 0.5.36 +* Integrate Dynamo Core 3.1 in Revit 2025.2 + ## 0.5.35 * Fix regression on FamilyInstance.ByGeometry node diff --git a/src/Config/packages.aget b/src/Config/packages.aget index 928bfe7906..23c1950f61 100644 --- a/src/Config/packages.aget +++ b/src/Config/packages.aget @@ -2,13 +2,13 @@ "nuget": { "references": { "DynamicLanguageRuntime": "1.2.2", - "DynamoVisualProgramming.Core": "3.0.3.7597", - "DynamoVisualProgramming.DynamoCoreNodes": "3.0.3.7597", - "DynamoVisualProgramming.DynamoServices": "3.0.3.7597", - "DynamoVisualProgramming.Tests": "3.0.3.7597", - "DynamoVisualProgramming.WpfUILibrary": "3.0.3.7597", - "DynamoVisualProgramming.ZeroTouchLibrary": "3.0.3.7597", - "DynamoVisualProgramming.DynamoSamples": "3.0.3.7597", + "DynamoVisualProgramming.Core": "3.1.0.4724", + "DynamoVisualProgramming.DynamoCoreNodes": "3.1.0.4724", + "DynamoVisualProgramming.DynamoServices": "3.1.0.4724", + "DynamoVisualProgramming.Tests": "3.1.0.4724", + "DynamoVisualProgramming.WpfUILibrary": "3.1.0.4724", + "DynamoVisualProgramming.ZeroTouchLibrary": "3.1.0.4724", + "DynamoVisualProgramming.DynamoSamples": "3.1.0.4724", "Greg": "3.0.0.3175", "GregRevitAuth": "2.0.8776.26607", "pythonnet_py38_win": "2.5.1", diff --git a/src/DynamoRevitIcons/DynamoRevitIcons.csproj b/src/DynamoRevitIcons/DynamoRevitIcons.csproj index 007acda54f..0938829678 100644 --- a/src/DynamoRevitIcons/DynamoRevitIcons.csproj +++ b/src/DynamoRevitIcons/DynamoRevitIcons.csproj @@ -28,7 +28,7 @@ + AssemblyFiles="$(OutputPath)AssemblyInfoGenerator.dll"> From b5a20fbc98eee045901f8195728f72638a851799 Mon Sep 17 00:00:00 2001 From: Vlad Catalina Date: Mon, 27 May 2024 17:53:08 +0300 Subject: [PATCH 14/70] Update D4R minor version to 3.1.0 --- .version | 2 +- CHANGELOG.md | 3 +++ src/AssemblySharedInfoGenerator/AssemblySharedInfo.tt | 4 ++-- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.version b/.version index 0aa6e4f8d0..af83650e30 100644 --- a/.version +++ b/.version @@ -1 +1 @@ -0.5.36 \ No newline at end of file +0.5.37 \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index f18f33c382..3beb262988 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## 0.5.37 +* Update D4R minor version to 3.1 + ## 0.5.36 * Integrate Dynamo Core 3.1 in Revit 2025.2 diff --git a/src/AssemblySharedInfoGenerator/AssemblySharedInfo.tt b/src/AssemblySharedInfoGenerator/AssemblySharedInfo.tt index 9dbe53f1f8..003a36d7be 100644 --- a/src/AssemblySharedInfoGenerator/AssemblySharedInfo.tt +++ b/src/AssemblySharedInfoGenerator/AssemblySharedInfo.tt @@ -68,7 +68,7 @@ using System.Runtime.InteropServices; [assembly: AssemblyFileVersion("<#= this.MajorVersion #>.<#= this.MinorVersion #>.<#= this.BuildNumber #>.<#= this.RevisionNumber #>")] <#+ int MajorVersion = 3; -int MinorVersion = 0; -int BuildNumber = 3; +int MinorVersion = 1; +int BuildNumber = 0; int RevisionNumber = ((int)(DateTime.UtcNow - new DateTime(2023,1,1)).TotalDays)*10+((int)DateTime.UtcNow.Hour)/3; #> From 23533ffa83ac9753dfccbb8911d648526df7d059 Mon Sep 17 00:00:00 2001 From: Vlad Catalina Date: Thu, 6 Jun 2024 18:11:53 +0300 Subject: [PATCH 15/70] Update Dynamo to 3.2.0 Update Greg to 3.0.1 --- .version | 2 +- CHANGELOG.md | 4 ++++ src/AssemblySharedInfoGenerator/AssemblyInfoGenerator.csproj | 3 +++ src/AssemblySharedInfoGenerator/AssemblySharedInfo.tt | 2 +- src/Config/packages.aget | 2 +- src/DynamoRevit/DynamoRevit.csproj | 2 +- 6 files changed, 11 insertions(+), 4 deletions(-) diff --git a/.version b/.version index af83650e30..e0d422dc3d 100644 --- a/.version +++ b/.version @@ -1 +1 @@ -0.5.37 \ No newline at end of file +0.5.38 \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 3beb262988..8125aeb6a4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.5.38 +* Update D4R to 3.2.0 +* Update Greg to 2.0.1 + ## 0.5.37 * Update D4R minor version to 3.1 diff --git a/src/AssemblySharedInfoGenerator/AssemblyInfoGenerator.csproj b/src/AssemblySharedInfoGenerator/AssemblyInfoGenerator.csproj index 3eb0c66e79..0e1f57dec2 100644 --- a/src/AssemblySharedInfoGenerator/AssemblyInfoGenerator.csproj +++ b/src/AssemblySharedInfoGenerator/AssemblyInfoGenerator.csproj @@ -35,6 +35,9 @@ AssemblySharedInfo.tt + + + diff --git a/src/AssemblySharedInfoGenerator/AssemblySharedInfo.tt b/src/AssemblySharedInfoGenerator/AssemblySharedInfo.tt index 003a36d7be..0ae5611a3e 100644 --- a/src/AssemblySharedInfoGenerator/AssemblySharedInfo.tt +++ b/src/AssemblySharedInfoGenerator/AssemblySharedInfo.tt @@ -68,7 +68,7 @@ using System.Runtime.InteropServices; [assembly: AssemblyFileVersion("<#= this.MajorVersion #>.<#= this.MinorVersion #>.<#= this.BuildNumber #>.<#= this.RevisionNumber #>")] <#+ int MajorVersion = 3; -int MinorVersion = 1; +int MinorVersion = 2; int BuildNumber = 0; int RevisionNumber = ((int)(DateTime.UtcNow - new DateTime(2023,1,1)).TotalDays)*10+((int)DateTime.UtcNow.Hour)/3; #> diff --git a/src/Config/packages.aget b/src/Config/packages.aget index 23c1950f61..2a50c928eb 100644 --- a/src/Config/packages.aget +++ b/src/Config/packages.aget @@ -9,7 +9,7 @@ "DynamoVisualProgramming.WpfUILibrary": "3.1.0.4724", "DynamoVisualProgramming.ZeroTouchLibrary": "3.1.0.4724", "DynamoVisualProgramming.DynamoSamples": "3.1.0.4724", - "Greg": "3.0.0.3175", + "Greg": "3.0.1.4707", "GregRevitAuth": "2.0.8776.26607", "pythonnet_py38_win": "2.5.1", "Newtonsoft.Json": "13.0.1", diff --git a/src/DynamoRevit/DynamoRevit.csproj b/src/DynamoRevit/DynamoRevit.csproj index 875f77397f..663d213649 100644 --- a/src/DynamoRevit/DynamoRevit.csproj +++ b/src/DynamoRevit/DynamoRevit.csproj @@ -61,7 +61,7 @@ False - $(PACKAGESPATH)\Greg\lib\net6.0\Greg.dll + $(PACKAGESPATH)\Greg\lib\net8.0\Greg.dll False From 11e40762236632771a21a7db218214ef4e07b7c3 Mon Sep 17 00:00:00 2001 From: Vlad Catalina Date: Thu, 6 Jun 2024 18:11:53 +0300 Subject: [PATCH 16/70] Update Dynamo to 3.2.0 Update Greg to 3.0.1 --- .version | 2 +- CHANGELOG.md | 4 ++++ .../AssemblyInfoGenerator.csproj | 3 +++ .../AssemblySharedInfo.tt | 2 +- src/Config/packages.aget | 16 ++++++++-------- src/DynamoRevit/DynamoRevit.csproj | 2 +- 6 files changed, 18 insertions(+), 11 deletions(-) diff --git a/.version b/.version index af83650e30..e0d422dc3d 100644 --- a/.version +++ b/.version @@ -1 +1 @@ -0.5.37 \ No newline at end of file +0.5.38 \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 3beb262988..8125aeb6a4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.5.38 +* Update D4R to 3.2.0 +* Update Greg to 2.0.1 + ## 0.5.37 * Update D4R minor version to 3.1 diff --git a/src/AssemblySharedInfoGenerator/AssemblyInfoGenerator.csproj b/src/AssemblySharedInfoGenerator/AssemblyInfoGenerator.csproj index 3eb0c66e79..0e1f57dec2 100644 --- a/src/AssemblySharedInfoGenerator/AssemblyInfoGenerator.csproj +++ b/src/AssemblySharedInfoGenerator/AssemblyInfoGenerator.csproj @@ -35,6 +35,9 @@ AssemblySharedInfo.tt + + + diff --git a/src/AssemblySharedInfoGenerator/AssemblySharedInfo.tt b/src/AssemblySharedInfoGenerator/AssemblySharedInfo.tt index 003a36d7be..0ae5611a3e 100644 --- a/src/AssemblySharedInfoGenerator/AssemblySharedInfo.tt +++ b/src/AssemblySharedInfoGenerator/AssemblySharedInfo.tt @@ -68,7 +68,7 @@ using System.Runtime.InteropServices; [assembly: AssemblyFileVersion("<#= this.MajorVersion #>.<#= this.MinorVersion #>.<#= this.BuildNumber #>.<#= this.RevisionNumber #>")] <#+ int MajorVersion = 3; -int MinorVersion = 1; +int MinorVersion = 2; int BuildNumber = 0; int RevisionNumber = ((int)(DateTime.UtcNow - new DateTime(2023,1,1)).TotalDays)*10+((int)DateTime.UtcNow.Hour)/3; #> diff --git a/src/Config/packages.aget b/src/Config/packages.aget index 23c1950f61..337b45056b 100644 --- a/src/Config/packages.aget +++ b/src/Config/packages.aget @@ -2,14 +2,14 @@ "nuget": { "references": { "DynamicLanguageRuntime": "1.2.2", - "DynamoVisualProgramming.Core": "3.1.0.4724", - "DynamoVisualProgramming.DynamoCoreNodes": "3.1.0.4724", - "DynamoVisualProgramming.DynamoServices": "3.1.0.4724", - "DynamoVisualProgramming.Tests": "3.1.0.4724", - "DynamoVisualProgramming.WpfUILibrary": "3.1.0.4724", - "DynamoVisualProgramming.ZeroTouchLibrary": "3.1.0.4724", - "DynamoVisualProgramming.DynamoSamples": "3.1.0.4724", - "Greg": "3.0.0.3175", + "DynamoVisualProgramming.Core": "3.2.0.5210", + "DynamoVisualProgramming.DynamoCoreNodes": "3.2.0.5210", + "DynamoVisualProgramming.DynamoServices": "3.2.0.5210", + "DynamoVisualProgramming.Tests": "3.2.0.5210", + "DynamoVisualProgramming.WpfUILibrary": "3.2.0.5210", + "DynamoVisualProgramming.ZeroTouchLibrary": "3.2.0.5210", + "DynamoVisualProgramming.DynamoSamples": "3.2.0.5210", + "Greg": "3.0.1.4707", "GregRevitAuth": "2.0.8776.26607", "pythonnet_py38_win": "2.5.1", "Newtonsoft.Json": "13.0.1", diff --git a/src/DynamoRevit/DynamoRevit.csproj b/src/DynamoRevit/DynamoRevit.csproj index 875f77397f..663d213649 100644 --- a/src/DynamoRevit/DynamoRevit.csproj +++ b/src/DynamoRevit/DynamoRevit.csproj @@ -61,7 +61,7 @@ False - $(PACKAGESPATH)\Greg\lib\net6.0\Greg.dll + $(PACKAGESPATH)\Greg\lib\net8.0\Greg.dll False From 3a22623297788fcfb6940eb4163e4678b2d912ea Mon Sep 17 00:00:00 2001 From: Vlad Catalina Date: Wed, 19 Jun 2024 23:51:04 +0300 Subject: [PATCH 17/70] * update Dynamo Core to 3.2.1 * update GregRevitAuth to 3.0.8935.26399 --- src/Config/packages.aget | 16 ++++++++-------- src/DynamoRevit/DynamoRevit.csproj | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/Config/packages.aget b/src/Config/packages.aget index 337b45056b..1853b981ed 100644 --- a/src/Config/packages.aget +++ b/src/Config/packages.aget @@ -2,15 +2,15 @@ "nuget": { "references": { "DynamicLanguageRuntime": "1.2.2", - "DynamoVisualProgramming.Core": "3.2.0.5210", - "DynamoVisualProgramming.DynamoCoreNodes": "3.2.0.5210", - "DynamoVisualProgramming.DynamoServices": "3.2.0.5210", - "DynamoVisualProgramming.Tests": "3.2.0.5210", - "DynamoVisualProgramming.WpfUILibrary": "3.2.0.5210", - "DynamoVisualProgramming.ZeroTouchLibrary": "3.2.0.5210", - "DynamoVisualProgramming.DynamoSamples": "3.2.0.5210", + "DynamoVisualProgramming.Core": "3.2.1.5347", + "DynamoVisualProgramming.DynamoCoreNodes": "3.2.1.5347", + "DynamoVisualProgramming.DynamoServices": "3.2.1.5347", + "DynamoVisualProgramming.Tests": "3.2.1.5347", + "DynamoVisualProgramming.WpfUILibrary": "3.2.1.5347", + "DynamoVisualProgramming.ZeroTouchLibrary": "3.2.1.5347", + "DynamoVisualProgramming.DynamoSamples": "3.2.1.5347", "Greg": "3.0.1.4707", - "GregRevitAuth": "2.0.8776.26607", + "GregRevitAuth": "3.0.8935.26399", "pythonnet_py38_win": "2.5.1", "Newtonsoft.Json": "13.0.1", "NUnit": "3.13.3", diff --git a/src/DynamoRevit/DynamoRevit.csproj b/src/DynamoRevit/DynamoRevit.csproj index 663d213649..42a2ab0793 100644 --- a/src/DynamoRevit/DynamoRevit.csproj +++ b/src/DynamoRevit/DynamoRevit.csproj @@ -65,7 +65,7 @@ False - $(PACKAGESPATH)\GregRevitAuth\lib\net6.0\GregRevitAuth.dll + $(PACKAGESPATH)\GregRevitAuth\lib\net8.0\GregRevitAuth.dll True From 4836afdc6ec6e52165de7f8d040ffcdf16e35e02 Mon Sep 17 00:00:00 2001 From: Vlad Catalina Date: Wed, 19 Jun 2024 23:51:04 +0300 Subject: [PATCH 18/70] * update Dynamo Core to 3.2.1 * update GregRevitAuth to 3.0.8935.26399 --- .version | 2 +- CHANGELOG.md | 4 ++++ src/Config/packages.aget | 16 ++++++++-------- src/DynamoRevit/DynamoRevit.csproj | 2 +- 4 files changed, 14 insertions(+), 10 deletions(-) diff --git a/.version b/.version index e0d422dc3d..c72f2c5431 100644 --- a/.version +++ b/.version @@ -1 +1 @@ -0.5.38 \ No newline at end of file +0.5.39 \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 8125aeb6a4..bd8312d8b9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.5.39 +* Update Dynamo to 3.2.1 +* Update RevitGregAuth + ## 0.5.38 * Update D4R to 3.2.0 * Update Greg to 2.0.1 diff --git a/src/Config/packages.aget b/src/Config/packages.aget index 337b45056b..1853b981ed 100644 --- a/src/Config/packages.aget +++ b/src/Config/packages.aget @@ -2,15 +2,15 @@ "nuget": { "references": { "DynamicLanguageRuntime": "1.2.2", - "DynamoVisualProgramming.Core": "3.2.0.5210", - "DynamoVisualProgramming.DynamoCoreNodes": "3.2.0.5210", - "DynamoVisualProgramming.DynamoServices": "3.2.0.5210", - "DynamoVisualProgramming.Tests": "3.2.0.5210", - "DynamoVisualProgramming.WpfUILibrary": "3.2.0.5210", - "DynamoVisualProgramming.ZeroTouchLibrary": "3.2.0.5210", - "DynamoVisualProgramming.DynamoSamples": "3.2.0.5210", + "DynamoVisualProgramming.Core": "3.2.1.5347", + "DynamoVisualProgramming.DynamoCoreNodes": "3.2.1.5347", + "DynamoVisualProgramming.DynamoServices": "3.2.1.5347", + "DynamoVisualProgramming.Tests": "3.2.1.5347", + "DynamoVisualProgramming.WpfUILibrary": "3.2.1.5347", + "DynamoVisualProgramming.ZeroTouchLibrary": "3.2.1.5347", + "DynamoVisualProgramming.DynamoSamples": "3.2.1.5347", "Greg": "3.0.1.4707", - "GregRevitAuth": "2.0.8776.26607", + "GregRevitAuth": "3.0.8935.26399", "pythonnet_py38_win": "2.5.1", "Newtonsoft.Json": "13.0.1", "NUnit": "3.13.3", diff --git a/src/DynamoRevit/DynamoRevit.csproj b/src/DynamoRevit/DynamoRevit.csproj index 663d213649..42a2ab0793 100644 --- a/src/DynamoRevit/DynamoRevit.csproj +++ b/src/DynamoRevit/DynamoRevit.csproj @@ -65,7 +65,7 @@ False - $(PACKAGESPATH)\GregRevitAuth\lib\net6.0\GregRevitAuth.dll + $(PACKAGESPATH)\GregRevitAuth\lib\net8.0\GregRevitAuth.dll True From cce1a9652040d8ea608211e1102a4a1b581cce3b Mon Sep 17 00:00:00 2001 From: Vlad Catalina Date: Fri, 21 Jun 2024 11:53:16 +0300 Subject: [PATCH 19/70] REVIT-222587 * add OOTB templates * update Dynamo Core build to 3.2.1.5366 --- .version | 2 +- CHANGELOG.md | 4 + .../CollectAllElementsOfCategory.dyn | 258 ++++++++++++ ...tAllElementsOfCategoryAndGetParameters.dyn | 323 ++++++++++++++ doc/distrib/Templates/ExportDataToExcel.dyn | 302 +++++++++++++ .../GetGeometryForAllElementsOfCategory.dyn | 257 +++++++++++ doc/distrib/Templates/ImportDataFromExcel.dyn | 398 ++++++++++++++++++ doc/distrib/Templates/ReadImageFromFile.dyn | 323 ++++++++++++++ src/Config/packages.aget | 14 +- 9 files changed, 1873 insertions(+), 8 deletions(-) create mode 100644 doc/distrib/Templates/CollectAllElementsOfCategory.dyn create mode 100644 doc/distrib/Templates/CollectAllElementsOfCategoryAndGetParameters.dyn create mode 100644 doc/distrib/Templates/ExportDataToExcel.dyn create mode 100644 doc/distrib/Templates/GetGeometryForAllElementsOfCategory.dyn create mode 100644 doc/distrib/Templates/ImportDataFromExcel.dyn create mode 100644 doc/distrib/Templates/ReadImageFromFile.dyn diff --git a/.version b/.version index c72f2c5431..841aff5958 100644 --- a/.version +++ b/.version @@ -1 +1 @@ -0.5.39 \ No newline at end of file +0.5.40 \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index bd8312d8b9..fd8d671c1f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.5.40 +* update Dynamo to published 3.2.1.5366 +* add Sample Template files + ## 0.5.39 * Update Dynamo to 3.2.1 * Update RevitGregAuth diff --git a/doc/distrib/Templates/CollectAllElementsOfCategory.dyn b/doc/distrib/Templates/CollectAllElementsOfCategory.dyn new file mode 100644 index 0000000000..a09890493c --- /dev/null +++ b/doc/distrib/Templates/CollectAllElementsOfCategory.dyn @@ -0,0 +1,258 @@ +{ + "Uuid": "f36fba0c-8a97-4fef-b3dc-6f0d4d61aafa", + "IsCustomNode": false, + "Description": "Collect all elements of a chosen category (Defaulting to Rooms)", + "Name": "CollectAllElementsOfCategory", + "ElementResolver": { + "ResolutionMap": {} + }, + "Inputs": [], + "Outputs": [], + "Nodes": [ + { + "ConcreteType": "DSRevitNodesUI.Categories, DSRevitNodesUI", + "SelectedIndex": 507, + "SelectedString": "OST_Rooms", + "Id": "1400fd6298f44dfbb91bb11505c879f5", + "NodeType": "ExtensionNode", + "Inputs": [], + "Outputs": [ + { + "Id": "ca529bd2c6784809b882c1cda2584135", + "Name": "Category", + "Description": "The selected Category.", + "UsingDefaultValue": false, + "Level": 2, + "UseLevels": false, + "KeepListStructure": false + } + ], + "Replication": "Disabled", + "Description": "All built-in categories." + }, + { + "ConcreteType": "DSRevitNodesUI.ElementsOfCategory, DSRevitNodesUI", + "Id": "59f1256567874cfb855f5354eb87646f", + "NodeType": "ExtensionNode", + "Inputs": [ + { + "Id": "9747105e6ec74aa59a9478911c780165", + "Name": "Category", + "Description": "The Category", + "UsingDefaultValue": false, + "Level": 2, + "UseLevels": false, + "KeepListStructure": false + } + ], + "Outputs": [ + { + "Id": "ee4a35b876d6409cbe8d34b67945d69c", + "Name": "Elements", + "Description": "An element class.", + "UsingDefaultValue": false, + "Level": 2, + "UseLevels": false, + "KeepListStructure": false + } + ], + "Replication": "Disabled", + "Description": "Get all elements of the specified category from the model." + }, + { + "ConcreteType": "CoreNodeModels.Watch, CoreNodeModels", + "WatchWidth": 50.0, + "WatchHeight": 38.0, + "Id": "f7a0ba86dc714b328564f6390b1ffa92", + "NodeType": "ExtensionNode", + "Inputs": [ + { + "Id": "a41994fd9039439da30bbd9e37f15df2", + "Name": "", + "Description": "Node to show output from", + "UsingDefaultValue": false, + "Level": 2, + "UseLevels": false, + "KeepListStructure": false + } + ], + "Outputs": [ + { + "Id": "6589178d81c64f0ebe7a71eee07c5333", + "Name": "", + "Description": "Node output", + "UsingDefaultValue": false, + "Level": 2, + "UseLevels": false, + "KeepListStructure": false + } + ], + "Replication": "Disabled", + "Description": "Visualizes a node's output" + } + ], + "Connectors": [ + { + "Start": "ca529bd2c6784809b882c1cda2584135", + "End": "9747105e6ec74aa59a9478911c780165", + "Id": "7cac21d0b5fa4589ab93e035fbc94b98", + "IsHidden": "False" + }, + { + "Start": "ee4a35b876d6409cbe8d34b67945d69c", + "End": "a41994fd9039439da30bbd9e37f15df2", + "Id": "beb2bfe394284d458668b2e4cefadc8f", + "IsHidden": "False" + } + ], + "Dependencies": [], + "NodeLibraryDependencies": [], + "EnableLegacyPolyCurveBehavior": true, + "Thumbnail": "", + "GraphDocumentationURL": null, + "ExtensionWorkspaceData": [ + { + "ExtensionGuid": "28992e1d-abb9-417f-8b1b-05e053bee670", + "Name": "Properties", + "Version": "3.0", + "Data": {} + }, + { + "ExtensionGuid": "DFBD9CC0-DB40-457A-939E-8C8555555A9D", + "Name": "Generative Design", + "Version": "7.1", + "Data": {} + } + ], + "Author": "Autodesk", + "Linting": { + "activeLinter": "None", + "activeLinterId": "7b75fb44-43fd-4631-a878-29f4d5d8399a", + "warningCount": 0, + "errorCount": 0 + }, + "Bindings": [], + "View": { + "Dynamo": { + "ScaleFactor": 1.0, + "HasRunWithoutCrash": true, + "IsVisibleInDynamoLibrary": true, + "Version": "3.0.3.7597", + "RunType": "Automatic", + "RunPeriod": "1000" + }, + "Camera": { + "Name": "_Background Preview", + "EyeX": -17.0, + "EyeY": 24.0, + "EyeZ": 50.0, + "LookX": 12.0, + "LookY": -13.0, + "LookZ": -58.0, + "UpX": 0.0, + "UpY": 1.0, + "UpZ": 0.0 + }, + "ConnectorPins": [], + "NodeViews": [ + { + "Id": "1400fd6298f44dfbb91bb11505c879f5", + "Name": "Categories", + "IsSetAsInput": false, + "IsSetAsOutput": false, + "Excluded": false, + "ShowGeometry": true, + "X": 89870.21477205436, + "Y": -4247.693497007918 + }, + { + "Id": "59f1256567874cfb855f5354eb87646f", + "Name": "All Elements of Category", + "IsSetAsInput": false, + "IsSetAsOutput": false, + "Excluded": false, + "ShowGeometry": true, + "X": 90206.21477205436, + "Y": -4247.693497007918 + }, + { + "Id": "f7a0ba86dc714b328564f6390b1ffa92", + "Name": "Watch", + "IsSetAsInput": false, + "IsSetAsOutput": false, + "Excluded": false, + "ShowGeometry": true, + "X": 90563.21477205436, + "Y": -4247.693497007918 + } + ], + "Annotations": [ + { + "Id": "0d323631560047b5a5f69d0e63a173fc", + "Title": "Select Revit Category", + "DescriptionText": null, + "IsExpanded": true, + "WidthAdjustment": 0.0, + "HeightAdjustment": 0.0, + "Nodes": [], + "HasNestedGroups": false, + "Left": 89920.21477205436, + "Top": -4297.693497007918, + "Width": 0.0, + "Height": 0.0, + "FontSize": 36.0, + "GroupStyleId": "00000000-0000-0000-0000-000000000000", + "InitialTop": 0.0, + "InitialHeight": 0.0, + "TextblockHeight": 0.0, + "Background": "#FFC1D676", + "PinnedNode": "1400fd6298f44dfbb91bb11505c879f5" + }, + { + "Id": "cf7dcb56bee2467882c6a3715c0b459f", + "Title": "Collect all elements of that selected Category", + "DescriptionText": null, + "IsExpanded": true, + "WidthAdjustment": 0.0, + "HeightAdjustment": 0.0, + "Nodes": [], + "HasNestedGroups": false, + "Left": 90203.21477205436, + "Top": -4297.693497007918, + "Width": 0.0, + "Height": 0.0, + "FontSize": 36.0, + "GroupStyleId": "00000000-0000-0000-0000-000000000000", + "InitialTop": 0.0, + "InitialHeight": 0.0, + "TextblockHeight": 0.0, + "Background": "#FFC1D676", + "PinnedNode": "59f1256567874cfb855f5354eb87646f" + }, + { + "Id": "bd0885cebce64783be7ce4b6a6284bd4", + "Title": "Watch results of collecting every element of a chosen category", + "DescriptionText": null, + "IsExpanded": true, + "WidthAdjustment": 0.0, + "HeightAdjustment": 0.0, + "Nodes": [], + "HasNestedGroups": false, + "Left": 90494.21477205436, + "Top": -4312.693497007918, + "Width": 0.0, + "Height": 0.0, + "FontSize": 36.0, + "GroupStyleId": "00000000-0000-0000-0000-000000000000", + "InitialTop": 0.0, + "InitialHeight": 0.0, + "TextblockHeight": 0.0, + "Background": "#FFC1D676", + "PinnedNode": "f7a0ba86dc714b328564f6390b1ffa92" + } + ], + "X": -93439.47156922061, + "Y": 4723.485874233058, + "Zoom": 1.0427979036983706 + } +} \ No newline at end of file diff --git a/doc/distrib/Templates/CollectAllElementsOfCategoryAndGetParameters.dyn b/doc/distrib/Templates/CollectAllElementsOfCategoryAndGetParameters.dyn new file mode 100644 index 0000000000..8ce21d8f56 --- /dev/null +++ b/doc/distrib/Templates/CollectAllElementsOfCategoryAndGetParameters.dyn @@ -0,0 +1,323 @@ +{ + "Uuid": "b3342583-c831-4c51-800a-ffbe4db82efa", + "IsCustomNode": false, + "Description": "Collect all elements of a chosen category (Defaulting to Rooms) and getting each elements Room Area", + "Name": "CollectAllElementsOfCategoryAndGetParameters", + "ElementResolver": { + "ResolutionMap": {} + }, + "Inputs": [], + "Outputs": [], + "Nodes": [ + { + "ConcreteType": "DSRevitNodesUI.Categories, DSRevitNodesUI", + "SelectedIndex": 507, + "SelectedString": "OST_Rooms", + "Id": "ed17aaffa2cc456890f43f91d6307693", + "NodeType": "ExtensionNode", + "Inputs": [], + "Outputs": [ + { + "Id": "34705ee8b2f946a2aa58a222acf21623", + "Name": "Category", + "Description": "The selected Category.", + "UsingDefaultValue": false, + "Level": 2, + "UseLevels": false, + "KeepListStructure": false + } + ], + "Replication": "Disabled", + "Description": "All built-in categories." + }, + { + "ConcreteType": "DSRevitNodesUI.ElementsOfCategory, DSRevitNodesUI", + "Id": "c3baf69e99244c09883314344f09230a", + "NodeType": "ExtensionNode", + "Inputs": [ + { + "Id": "ee6f864350fd45efa292b7ed0b6c4005", + "Name": "Category", + "Description": "The Category", + "UsingDefaultValue": false, + "Level": 2, + "UseLevels": false, + "KeepListStructure": false + } + ], + "Outputs": [ + { + "Id": "9636b76d7fea47c7b6c9c8a2fc917646", + "Name": "Elements", + "Description": "An element class.", + "UsingDefaultValue": false, + "Level": 2, + "UseLevels": false, + "KeepListStructure": false + } + ], + "Replication": "Disabled", + "Description": "Get all elements of the specified category from the model." + }, + { + "ConcreteType": "Dynamo.Graph.Nodes.ZeroTouch.DSFunction, DynamoCore", + "Id": "ac5cca7b2ea54fc9b01ee0f8aa2bf111", + "NodeType": "FunctionNode", + "Inputs": [ + { + "Id": "7f24488c689540da931ecf8e66297039", + "Name": "element", + "Description": "Revit.Elements.Element", + "UsingDefaultValue": false, + "Level": 2, + "UseLevels": false, + "KeepListStructure": false + }, + { + "Id": "f8e752733b37486b8b3a75b32605d4dd", + "Name": "parameterName", + "Description": "The name of the parameter whose value you want to obtain.\n\nstring", + "UsingDefaultValue": false, + "Level": 2, + "UseLevels": false, + "KeepListStructure": false + } + ], + "Outputs": [ + { + "Id": "5138e0135c444a949fa971333222030b", + "Name": "var[]..[]", + "Description": "var[]..[]", + "UsingDefaultValue": false, + "Level": 2, + "UseLevels": false, + "KeepListStructure": false + } + ], + "FunctionSignature": "Revit.Elements.Element.GetParameterValueByName@string", + "Replication": "Auto", + "Description": "Get the value of one of the element's parameters.\n\nElement.GetParameterValueByName (parameterName: string): var[]..[]" + }, + { + "ConcreteType": "CoreNodeModels.Input.StringInput, CoreNodeModels", + "Id": "8191910e638249e5a3a2fb85b9d563cb", + "NodeType": "StringInputNode", + "Inputs": [], + "Outputs": [ + { + "Id": "4eb48f9dc024487286a1c3beba048dc8", + "Name": "", + "Description": "String", + "UsingDefaultValue": false, + "Level": 2, + "UseLevels": false, + "KeepListStructure": false + } + ], + "Replication": "Disabled", + "Description": "Creates a string", + "InputValue": "Area" + } + ], + "Connectors": [ + { + "Start": "34705ee8b2f946a2aa58a222acf21623", + "End": "ee6f864350fd45efa292b7ed0b6c4005", + "Id": "5055c2abf7ac4e08a0fb2792bfffb480", + "IsHidden": "False" + }, + { + "Start": "9636b76d7fea47c7b6c9c8a2fc917646", + "End": "7f24488c689540da931ecf8e66297039", + "Id": "ea5f0cf77f804c8c854070034a3a6364", + "IsHidden": "False" + }, + { + "Start": "4eb48f9dc024487286a1c3beba048dc8", + "End": "f8e752733b37486b8b3a75b32605d4dd", + "Id": "52e19a722d7e4cd79a12a89fcea6d077", + "IsHidden": "False" + } + ], + "Dependencies": [], + "NodeLibraryDependencies": [], + "EnableLegacyPolyCurveBehavior": true, + "Thumbnail": "", + "GraphDocumentationURL": null, + "ExtensionWorkspaceData": [ + { + "ExtensionGuid": "28992e1d-abb9-417f-8b1b-05e053bee670", + "Name": "Properties", + "Version": "3.0", + "Data": {} + }, + { + "ExtensionGuid": "DFBD9CC0-DB40-457A-939E-8C8555555A9D", + "Name": "Generative Design", + "Version": "7.1", + "Data": {} + } + ], + "Author": "Autodesk", + "Linting": { + "activeLinter": "None", + "activeLinterId": "7b75fb44-43fd-4631-a878-29f4d5d8399a", + "warningCount": 0, + "errorCount": 0 + }, + "Bindings": [], + "View": { + "Dynamo": { + "ScaleFactor": 1.0, + "HasRunWithoutCrash": true, + "IsVisibleInDynamoLibrary": true, + "Version": "3.0.3.7597", + "RunType": "Automatic", + "RunPeriod": "1000" + }, + "Camera": { + "Name": "_Background Preview", + "EyeX": -17.0, + "EyeY": 24.0, + "EyeZ": 50.0, + "LookX": 12.0, + "LookY": -13.0, + "LookZ": -58.0, + "UpX": 0.0, + "UpY": 1.0, + "UpZ": 0.0 + }, + "ConnectorPins": [], + "NodeViews": [ + { + "Id": "ed17aaffa2cc456890f43f91d6307693", + "Name": "Categories", + "IsSetAsInput": false, + "IsSetAsOutput": false, + "Excluded": false, + "ShowGeometry": true, + "X": 89870.21477205436, + "Y": -4247.693497007918 + }, + { + "Id": "c3baf69e99244c09883314344f09230a", + "Name": "All Elements of Category", + "IsSetAsInput": false, + "IsSetAsOutput": false, + "Excluded": false, + "ShowGeometry": true, + "X": 90209.21477205436, + "Y": -4247.693497007918 + }, + { + "Id": "ac5cca7b2ea54fc9b01ee0f8aa2bf111", + "Name": "Element.GetParameterValueByName", + "IsSetAsInput": false, + "IsSetAsOutput": false, + "Excluded": false, + "ShowGeometry": true, + "X": 90569.21477205436, + "Y": -4247.693497007918 + }, + { + "Id": "8191910e638249e5a3a2fb85b9d563cb", + "Name": "String", + "IsSetAsInput": false, + "IsSetAsOutput": false, + "Excluded": false, + "ShowGeometry": true, + "X": 90318.21477205436, + "Y": -3977.9057569773872 + } + ], + "Annotations": [ + { + "Id": "413e32392339406dbcc552c6bd8449d9", + "Title": "Select Revit Category", + "DescriptionText": null, + "IsExpanded": true, + "WidthAdjustment": 0.0, + "HeightAdjustment": 0.0, + "Nodes": [], + "HasNestedGroups": false, + "Left": 89920.21477205436, + "Top": -4297.693497007918, + "Width": 0.0, + "Height": 0.0, + "FontSize": 36.0, + "GroupStyleId": "00000000-0000-0000-0000-000000000000", + "InitialTop": 0.0, + "InitialHeight": 0.0, + "TextblockHeight": 0.0, + "Background": "#FFC1D676", + "PinnedNode": "ed17aaffa2cc456890f43f91d6307693" + }, + { + "Id": "bcac70e033a1483dba06f5ef39ccab17", + "Title": "Collect all elements of that selected Category", + "DescriptionText": null, + "IsExpanded": true, + "WidthAdjustment": 0.0, + "HeightAdjustment": 0.0, + "Nodes": [], + "HasNestedGroups": false, + "Left": 90206.21477205436, + "Top": -4297.693497007918, + "Width": 0.0, + "Height": 0.0, + "FontSize": 36.0, + "GroupStyleId": "00000000-0000-0000-0000-000000000000", + "InitialTop": 0.0, + "InitialHeight": 0.0, + "TextblockHeight": 0.0, + "Background": "#FFC1D676", + "PinnedNode": "c3baf69e99244c09883314344f09230a" + }, + { + "Id": "3e722249f0434c5cbdb3bcafb8e38c40", + "Title": "Get parameter values from Elements by Category via a parameter name", + "DescriptionText": null, + "IsExpanded": true, + "WidthAdjustment": 0.0, + "HeightAdjustment": 0.0, + "Nodes": [], + "HasNestedGroups": false, + "Left": 90593.21477205436, + "Top": -4312.693497007918, + "Width": 0.0, + "Height": 0.0, + "FontSize": 36.0, + "GroupStyleId": "00000000-0000-0000-0000-000000000000", + "InitialTop": 0.0, + "InitialHeight": 0.0, + "TextblockHeight": 0.0, + "Background": "#FFC1D676", + "PinnedNode": "ac5cca7b2ea54fc9b01ee0f8aa2bf111" + }, + { + "Id": "9d0cd5783e8949c180d1f1da85c6961f", + "Title": "Input parameter name, and make sure you take capitalization into account", + "DescriptionText": null, + "IsExpanded": true, + "WidthAdjustment": 0.0, + "HeightAdjustment": 0.0, + "Nodes": [], + "HasNestedGroups": false, + "Left": 90254.71477205436, + "Top": -4042.9057569773872, + "Width": 0.0, + "Height": 0.0, + "FontSize": 36.0, + "GroupStyleId": "00000000-0000-0000-0000-000000000000", + "InitialTop": 0.0, + "InitialHeight": 0.0, + "TextblockHeight": 0.0, + "Background": "#FFC1D676", + "PinnedNode": "8191910e638249e5a3a2fb85b9d563cb" + } + ], + "X": -93439.47156922061, + "Y": 4723.485874233058, + "Zoom": 1.0427979036983706 + } +} \ No newline at end of file diff --git a/doc/distrib/Templates/ExportDataToExcel.dyn b/doc/distrib/Templates/ExportDataToExcel.dyn new file mode 100644 index 0000000000..0b2a669e8d --- /dev/null +++ b/doc/distrib/Templates/ExportDataToExcel.dyn @@ -0,0 +1,302 @@ +{ + "Uuid": "107641db-6b6a-4a08-8282-d474513714b1", + "IsCustomNode": false, + "Description": "Export data to Excel given a chosen sheet name. You will need to connect the data to be exported", + "Name": "ExportDataToExcel", + "ElementResolver": { + "ResolutionMap": {} + }, + "Inputs": [], + "Outputs": [], + "Nodes": [ + { + "ConcreteType": "CoreNodeModels.Input.Filename, CoreNodeModels", + "Id": "d2ca2769c87f4b4396940a74ff1111d2", + "NodeType": "ExtensionNode", + "Inputs": [], + "Outputs": [ + { + "Id": "4cb119c0fc804e47bd4bcd5fff82cf7c", + "Name": "", + "Description": "File Path", + "UsingDefaultValue": false, + "Level": 2, + "UseLevels": false, + "KeepListStructure": false + } + ], + "Replication": "Disabled", + "Description": "Allows you to select a file on the system and returns its file path", + "HintPath": "C:\\Users\\amours\\Desktop\\DynamoRevitTemplates\\No file selected", + "InputValue": "No file selected." + }, + { + "ConcreteType": "CoreNodeModels.Input.StringInput, CoreNodeModels", + "Id": "3bd4fe2e6876454da3e83a01462c85c7", + "NodeType": "StringInputNode", + "Inputs": [], + "Outputs": [ + { + "Id": "3f6242f197704cb08d28d338399cc02b", + "Name": "", + "Description": "String", + "UsingDefaultValue": false, + "Level": 2, + "UseLevels": false, + "KeepListStructure": false + } + ], + "Replication": "Disabled", + "Description": "Creates a string", + "InputValue": "" + }, + { + "ConcreteType": "Dynamo.Graph.Nodes.ZeroTouch.DSFunction, DynamoCore", + "Id": "a30280ae0aea42649c79b5f80b7c6dbe", + "NodeType": "FunctionNode", + "Inputs": [ + { + "Id": "33167a5f9e25441b98598dc1ecc07832", + "Name": "filePath", + "Description": "string", + "UsingDefaultValue": false, + "Level": 2, + "UseLevels": false, + "KeepListStructure": false + }, + { + "Id": "0a38be4fb78c4ac385664c50cf9dbbff", + "Name": "sheetName", + "Description": "string", + "UsingDefaultValue": false, + "Level": 2, + "UseLevels": false, + "KeepListStructure": false + }, + { + "Id": "53fd2ca44312424f9e88959329c97a76", + "Name": "data", + "Description": "var[][]", + "UsingDefaultValue": false, + "Level": 2, + "UseLevels": false, + "KeepListStructure": false + }, + { + "Id": "5cb3225aeccb496989afa724dd38b537", + "Name": "startRow", + "Description": "int\nDefault value : 0", + "UsingDefaultValue": true, + "Level": 2, + "UseLevels": false, + "KeepListStructure": false + }, + { + "Id": "c6b08add41fe4398b6c167e99c73c8b1", + "Name": "startColumn", + "Description": "int\nDefault value : 0", + "UsingDefaultValue": true, + "Level": 2, + "UseLevels": false, + "KeepListStructure": false + }, + { + "Id": "1e16648803b341e395baccc2ff2db3ea", + "Name": "overWrite", + "Description": "bool\nDefault value : false", + "UsingDefaultValue": true, + "Level": 2, + "UseLevels": false, + "KeepListStructure": false + }, + { + "Id": "f6cdbc62f3ef4cee91ae11eb5a21f1de", + "Name": "writeAsString", + "Description": "bool\nDefault value : false", + "UsingDefaultValue": true, + "Level": 2, + "UseLevels": false, + "KeepListStructure": false + } + ], + "Outputs": [ + { + "Id": "937ba830e5174f2a9ed269d57b1f5157", + "Name": "bool", + "Description": "bool", + "UsingDefaultValue": false, + "Level": 2, + "UseLevels": false, + "KeepListStructure": false + } + ], + "FunctionSignature": "DSOffice.Data.OpenXMLExportExcel@string,string,var[][],int,int,bool,bool", + "Replication": "Auto", + "Description": "Data.OpenXMLExportExcel (filePath: string, sheetName: string, data: var[][], startRow: int = 0, startColumn: int = 0, overWrite: bool = false, writeAsString: bool = false): bool" + } + ], + "Connectors": [ + { + "Start": "4cb119c0fc804e47bd4bcd5fff82cf7c", + "End": "33167a5f9e25441b98598dc1ecc07832", + "Id": "b07a2afc08844afeb9ef963e970cb646", + "IsHidden": "False" + }, + { + "Start": "3f6242f197704cb08d28d338399cc02b", + "End": "0a38be4fb78c4ac385664c50cf9dbbff", + "Id": "8f18137f976541a2a0186380ecf744c4", + "IsHidden": "False" + } + ], + "Dependencies": [], + "NodeLibraryDependencies": [], + "EnableLegacyPolyCurveBehavior": true, + "Thumbnail": "", + "GraphDocumentationURL": null, + "ExtensionWorkspaceData": [ + { + "ExtensionGuid": "28992e1d-abb9-417f-8b1b-05e053bee670", + "Name": "Properties", + "Version": "3.0", + "Data": {} + }, + { + "ExtensionGuid": "DFBD9CC0-DB40-457A-939E-8C8555555A9D", + "Name": "Generative Design", + "Version": "7.1", + "Data": {} + } + ], + "Author": "Autodesk", + "Linting": { + "activeLinter": "None", + "activeLinterId": "7b75fb44-43fd-4631-a878-29f4d5d8399a", + "warningCount": 0, + "errorCount": 0 + }, + "Bindings": [], + "View": { + "Dynamo": { + "ScaleFactor": 1.0, + "HasRunWithoutCrash": true, + "IsVisibleInDynamoLibrary": true, + "Version": "3.0.3.7597", + "RunType": "Automatic", + "RunPeriod": "1000" + }, + "Camera": { + "Name": "_Background Preview", + "EyeX": -17.0, + "EyeY": 24.0, + "EyeZ": 50.0, + "LookX": 12.0, + "LookY": -13.0, + "LookZ": -58.0, + "UpX": 0.0, + "UpY": 1.0, + "UpZ": 0.0 + }, + "ConnectorPins": [], + "NodeViews": [ + { + "Id": "d2ca2769c87f4b4396940a74ff1111d2", + "Name": "File Path", + "IsSetAsInput": false, + "IsSetAsOutput": false, + "Excluded": false, + "ShowGeometry": true, + "X": 238.5, + "Y": 282.0 + }, + { + "Id": "3bd4fe2e6876454da3e83a01462c85c7", + "Name": "String", + "IsSetAsInput": false, + "IsSetAsOutput": false, + "Excluded": false, + "ShowGeometry": true, + "X": 238.5, + "Y": 531.5 + }, + { + "Id": "a30280ae0aea42649c79b5f80b7c6dbe", + "Name": "Data.OpenXMLExportExcel", + "IsSetAsInput": false, + "IsSetAsOutput": false, + "Excluded": false, + "ShowGeometry": true, + "X": 811.0, + "Y": 282.0 + } + ], + "Annotations": [ + { + "Id": "f8caed9cca86404397d6c13d7f9a2292", + "Title": "Browse to Excel file to export data to", + "DescriptionText": null, + "IsExpanded": true, + "WidthAdjustment": 0.0, + "HeightAdjustment": 0.0, + "Nodes": [], + "HasNestedGroups": false, + "Left": 213.0, + "Top": 232.0, + "Width": 0.0, + "Height": 0.0, + "FontSize": 36.0, + "GroupStyleId": "00000000-0000-0000-0000-000000000000", + "InitialTop": 0.0, + "InitialHeight": 0.0, + "TextblockHeight": 0.0, + "Background": "#FFC1D676", + "PinnedNode": "d2ca2769c87f4b4396940a74ff1111d2" + }, + { + "Id": "f6199651df8b4e3ebe2e1ba518850914", + "Title": "Type in a Sheet Name, but be mindful of capitalization", + "DescriptionText": null, + "IsExpanded": true, + "WidthAdjustment": 0.0, + "HeightAdjustment": 0.0, + "Nodes": [], + "HasNestedGroups": false, + "Left": 193.5, + "Top": 466.5, + "Width": 0.0, + "Height": 0.0, + "FontSize": 36.0, + "GroupStyleId": "00000000-0000-0000-0000-000000000000", + "InitialTop": 0.0, + "InitialHeight": 0.0, + "TextblockHeight": 0.0, + "Background": "#FFC1D676", + "PinnedNode": "3bd4fe2e6876454da3e83a01462c85c7" + }, + { + "Id": "a69836269d524c90a34e16b7efd8f803", + "Title": "Export Excel data using the OpenXML format from a chosen sheet name", + "DescriptionText": null, + "IsExpanded": true, + "WidthAdjustment": 0.0, + "HeightAdjustment": 0.0, + "Nodes": [], + "HasNestedGroups": false, + "Left": 797.0, + "Top": 217.0, + "Width": 0.0, + "Height": 0.0, + "FontSize": 36.0, + "GroupStyleId": "00000000-0000-0000-0000-000000000000", + "InitialTop": 0.0, + "InitialHeight": 0.0, + "TextblockHeight": 0.0, + "Background": "#FFC1D676", + "PinnedNode": "a30280ae0aea42649c79b5f80b7c6dbe" + } + ], + "X": 196.23761879446965, + "Y": -15.960282864435044, + "Zoom": 1.13507102841452 + } +} \ No newline at end of file diff --git a/doc/distrib/Templates/GetGeometryForAllElementsOfCategory.dyn b/doc/distrib/Templates/GetGeometryForAllElementsOfCategory.dyn new file mode 100644 index 0000000000..86936c7f4e --- /dev/null +++ b/doc/distrib/Templates/GetGeometryForAllElementsOfCategory.dyn @@ -0,0 +1,257 @@ +{ + "Uuid": "6ab2aa77-03ac-43aa-996a-9bcba72a6560", + "IsCustomNode": false, + "Description": "Collect all elements of a chosen category (Defaulting to Doors) and getting each elements Geometry", + "Name": "GetGeometryForAllElementsOfCategory", + "ElementResolver": { + "ResolutionMap": {} + }, + "Inputs": [], + "Outputs": [], + "Nodes": [ + { + "ConcreteType": "DSRevitNodesUI.Categories, DSRevitNodesUI", + "SelectedIndex": 178, + "SelectedString": "OST_Doors", + "Id": "bb34b03a88c14566861ee701d2036259", + "NodeType": "ExtensionNode", + "Inputs": [], + "Outputs": [ + { + "Id": "81976910d2c3462980fe759708cbdd11", + "Name": "Category", + "Description": "The selected Category.", + "UsingDefaultValue": false, + "Level": 2, + "UseLevels": false, + "KeepListStructure": false + } + ], + "Replication": "Disabled", + "Description": "All built-in categories." + }, + { + "ConcreteType": "DSRevitNodesUI.ElementsOfCategory, DSRevitNodesUI", + "Id": "33f773eb560c4fcaa847e18214de2ef7", + "NodeType": "ExtensionNode", + "Inputs": [ + { + "Id": "6d071236512842a99ab51e6ac5633508", + "Name": "Category", + "Description": "The Category", + "UsingDefaultValue": false, + "Level": 2, + "UseLevels": false, + "KeepListStructure": false + } + ], + "Outputs": [ + { + "Id": "9705018e7b36421e93c205f16c29988f", + "Name": "Elements", + "Description": "An element class.", + "UsingDefaultValue": false, + "Level": 2, + "UseLevels": false, + "KeepListStructure": false + } + ], + "Replication": "Disabled", + "Description": "Get all elements of the specified category from the model." + }, + { + "ConcreteType": "Dynamo.Graph.Nodes.ZeroTouch.DSFunction, DynamoCore", + "Id": "736260b981b146eca204f690b6d52bf6", + "NodeType": "FunctionNode", + "Inputs": [ + { + "Id": "4685755d9e5b46679f2dcee806dd42fb", + "Name": "element", + "Description": "Revit.Elements.Element", + "UsingDefaultValue": false, + "Level": 2, + "UseLevels": false, + "KeepListStructure": false + } + ], + "Outputs": [ + { + "Id": "59e132d5dc654e04be8019b84b3f7015", + "Name": "geometry[]", + "Description": "List of geometry from the element", + "UsingDefaultValue": false, + "Level": 2, + "UseLevels": false, + "KeepListStructure": false + } + ], + "FunctionSignature": "Revit.Elements.Element.Geometry", + "Replication": "Auto", + "Description": "Returns all geometry associated with an element. Ignores transforms when used with linked elements.\n\nElement.Geometry ( ): var[]" + } + ], + "Connectors": [ + { + "Start": "81976910d2c3462980fe759708cbdd11", + "End": "6d071236512842a99ab51e6ac5633508", + "Id": "70d5e5a703b94d1b9509ed1c36ee7afb", + "IsHidden": "False" + }, + { + "Start": "9705018e7b36421e93c205f16c29988f", + "End": "4685755d9e5b46679f2dcee806dd42fb", + "Id": "e4117a528d7844b083289073c1053ced", + "IsHidden": "False" + } + ], + "Dependencies": [], + "NodeLibraryDependencies": [], + "EnableLegacyPolyCurveBehavior": true, + "Thumbnail": "", + "GraphDocumentationURL": null, + "ExtensionWorkspaceData": [ + { + "ExtensionGuid": "28992e1d-abb9-417f-8b1b-05e053bee670", + "Name": "Properties", + "Version": "3.0", + "Data": {} + }, + { + "ExtensionGuid": "DFBD9CC0-DB40-457A-939E-8C8555555A9D", + "Name": "Generative Design", + "Version": "7.1", + "Data": {} + } + ], + "Author": "Autodesk", + "Linting": { + "activeLinter": "None", + "activeLinterId": "7b75fb44-43fd-4631-a878-29f4d5d8399a", + "warningCount": 0, + "errorCount": 0 + }, + "Bindings": [], + "View": { + "Dynamo": { + "ScaleFactor": 1.0, + "HasRunWithoutCrash": true, + "IsVisibleInDynamoLibrary": true, + "Version": "3.0.3.7597", + "RunType": "Automatic", + "RunPeriod": "1000" + }, + "Camera": { + "Name": "_Background Preview", + "EyeX": -45.10952377319336, + "EyeY": 126.64234924316406, + "EyeZ": 79.76921844482422, + "LookX": 14.782140731811523, + "LookY": -106.08958435058594, + "LookZ": -86.57583618164062, + "UpX": 0.1296440213918686, + "UpY": 0.6376994848251343, + "UpZ": -0.7592970132827759 + }, + "ConnectorPins": [], + "NodeViews": [ + { + "Id": "bb34b03a88c14566861ee701d2036259", + "Name": "Categories", + "IsSetAsInput": false, + "IsSetAsOutput": false, + "Excluded": false, + "ShowGeometry": true, + "X": 89870.21477205436, + "Y": -4247.693497007918 + }, + { + "Id": "33f773eb560c4fcaa847e18214de2ef7", + "Name": "All Elements of Category", + "IsSetAsInput": false, + "IsSetAsOutput": false, + "Excluded": false, + "ShowGeometry": true, + "X": 90206.21477205436, + "Y": -4247.693497007918 + }, + { + "Id": "736260b981b146eca204f690b6d52bf6", + "Name": "Element.Geometry", + "IsSetAsInput": false, + "IsSetAsOutput": false, + "Excluded": false, + "ShowGeometry": true, + "X": 90574.09037191584, + "Y": -4247.693497007918 + } + ], + "Annotations": [ + { + "Id": "bba4fa218eb6408e941257c49579a7dd", + "Title": "Select Revit Category", + "DescriptionText": null, + "IsExpanded": true, + "WidthAdjustment": 0.0, + "HeightAdjustment": 0.0, + "Nodes": [], + "HasNestedGroups": false, + "Left": 89920.21477205436, + "Top": -4297.693497007918, + "Width": 0.0, + "Height": 0.0, + "FontSize": 36.0, + "GroupStyleId": "00000000-0000-0000-0000-000000000000", + "InitialTop": 0.0, + "InitialHeight": 0.0, + "TextblockHeight": 0.0, + "Background": "#FFC1D676", + "PinnedNode": "bb34b03a88c14566861ee701d2036259" + }, + { + "Id": "9af9581ad0114956a822641259e63620", + "Title": "Collect all elements of that selected Category", + "DescriptionText": null, + "IsExpanded": true, + "WidthAdjustment": 0.0, + "HeightAdjustment": 0.0, + "Nodes": [], + "HasNestedGroups": false, + "Left": 90203.21477205436, + "Top": -4297.693497007918, + "Width": 0.0, + "Height": 0.0, + "FontSize": 36.0, + "GroupStyleId": "00000000-0000-0000-0000-000000000000", + "InitialTop": 0.0, + "InitialHeight": 0.0, + "TextblockHeight": 0.0, + "Background": "#FFC1D676", + "PinnedNode": "33f773eb560c4fcaa847e18214de2ef7" + }, + { + "Id": "c2867b4d2aff4177bb118c225603b573", + "Title": "Get the geometry of all collected elements where possible. It may return a warning and null should there be something missing in Revit, or the geometry be unresolvable", + "DescriptionText": null, + "IsExpanded": true, + "WidthAdjustment": 0.0, + "HeightAdjustment": 0.0, + "Nodes": [], + "HasNestedGroups": false, + "Left": 90553.59037191584, + "Top": -4341.693497007918, + "Width": 0.0, + "Height": 0.0, + "FontSize": 36.0, + "GroupStyleId": "00000000-0000-0000-0000-000000000000", + "InitialTop": 0.0, + "InitialHeight": 0.0, + "TextblockHeight": 0.0, + "Background": "#FFC1D676", + "PinnedNode": "736260b981b146eca204f690b6d52bf6" + } + ], + "X": -113376.05923228659, + "Y": 5631.061522389584, + "Zoom": 1.2633317726382167 + } +} \ No newline at end of file diff --git a/doc/distrib/Templates/ImportDataFromExcel.dyn b/doc/distrib/Templates/ImportDataFromExcel.dyn new file mode 100644 index 0000000000..c9e8756f8f --- /dev/null +++ b/doc/distrib/Templates/ImportDataFromExcel.dyn @@ -0,0 +1,398 @@ +{ + "Uuid": "c49c9e5d-746d-42f7-975a-5a40f1ad1c6c", + "IsCustomNode": false, + "Description": "Import data from an Excel file and transpose the data to flip columns and rows", + "Name": "ImportDataFromExcel", + "ElementResolver": { + "ResolutionMap": {} + }, + "Inputs": [], + "Outputs": [], + "Nodes": [ + { + "ConcreteType": "Dynamo.Graph.Nodes.ZeroTouch.DSFunction, DynamoCore", + "Id": "7620c0a6d174413281b95698fb1d9d57", + "NodeType": "FunctionNode", + "Inputs": [ + { + "Id": "fab5ba40009445218c05f8e2e125c3e2", + "Name": "filePath", + "Description": "string", + "UsingDefaultValue": false, + "Level": 2, + "UseLevels": false, + "KeepListStructure": false + }, + { + "Id": "1838b7ed07924850904317b05d21e435", + "Name": "sheetName", + "Description": "string", + "UsingDefaultValue": false, + "Level": 2, + "UseLevels": false, + "KeepListStructure": false + }, + { + "Id": "2285506c22014e38983dd1f274148b74", + "Name": "startRow", + "Description": "int\nDefault value : 0", + "UsingDefaultValue": true, + "Level": 2, + "UseLevels": false, + "KeepListStructure": false + }, + { + "Id": "fa731e8403c64eb59363e3a25779c3c3", + "Name": "startColumn", + "Description": "int\nDefault value : 0", + "UsingDefaultValue": true, + "Level": 2, + "UseLevels": false, + "KeepListStructure": false + }, + { + "Id": "7b40d5b11e734659a873d691ceacedaf", + "Name": "readAsString", + "Description": "bool\nDefault value : false", + "UsingDefaultValue": true, + "Level": 2, + "UseLevels": false, + "KeepListStructure": false + } + ], + "Outputs": [ + { + "Id": "da29b5f8bea04c09b0e32ec0d27dd1af", + "Name": "var[][]", + "Description": "var[][]", + "UsingDefaultValue": false, + "Level": 2, + "UseLevels": false, + "KeepListStructure": false + } + ], + "FunctionSignature": "DSOffice.Data.OpenXMLImportExcel@string,string,int,int,bool", + "Replication": "Auto", + "Description": "Data.OpenXMLImportExcel (filePath: string, sheetName: string, startRow: int = 0, startColumn: int = 0, readAsString: bool = false): var[][]" + }, + { + "ConcreteType": "CoreNodeModels.Input.Filename, CoreNodeModels", + "Id": "d2ca2769c87f4b4396940a74ff1111d2", + "NodeType": "ExtensionNode", + "Inputs": [], + "Outputs": [ + { + "Id": "4cb119c0fc804e47bd4bcd5fff82cf7c", + "Name": "", + "Description": "File Path", + "UsingDefaultValue": false, + "Level": 2, + "UseLevels": false, + "KeepListStructure": false + } + ], + "Replication": "Disabled", + "Description": "Allows you to select a file on the system and returns its file path", + "HintPath": "C:\\Users\\amours\\Desktop\\DynamoRevitTemplates\\No file selected", + "InputValue": "No file selected." + }, + { + "ConcreteType": "CoreNodeModels.Input.StringInput, CoreNodeModels", + "Id": "3bd4fe2e6876454da3e83a01462c85c7", + "NodeType": "StringInputNode", + "Inputs": [], + "Outputs": [ + { + "Id": "3f6242f197704cb08d28d338399cc02b", + "Name": "", + "Description": "String", + "UsingDefaultValue": false, + "Level": 2, + "UseLevels": false, + "KeepListStructure": false + } + ], + "Replication": "Disabled", + "Description": "Creates a string", + "InputValue": "" + }, + { + "ConcreteType": "Dynamo.Graph.Nodes.ZeroTouch.DSFunction, DynamoCore", + "Id": "13b0e9b105ea4af2a48f0aafdfa0bf5b", + "NodeType": "FunctionNode", + "Inputs": [ + { + "Id": "c2a83726b20f4856956b731605c325fc", + "Name": "lists", + "Description": "List of lists to be transposed\n\nvar[]..[]", + "UsingDefaultValue": false, + "Level": 2, + "UseLevels": false, + "KeepListStructure": false + } + ], + "Outputs": [ + { + "Id": "91219a54373d4ea1b3ee8a1c03ace17a", + "Name": "lists", + "Description": "List of transposed lists", + "UsingDefaultValue": false, + "Level": 2, + "UseLevels": false, + "KeepListStructure": false + } + ], + "FunctionSignature": "DSCore.List.Transpose@var[]..[]", + "Replication": "Auto", + "Description": "Swaps rows and columns in a list of lists. If there are some rows that are shorter than others, null values are inserted as place holders in the resultant array such that it is always rectangular.\n\nList.Transpose (lists: var[]..[]): var[]..[]" + }, + { + "ConcreteType": "CoreNodeModels.Watch, CoreNodeModels", + "WatchWidth": 50.0, + "WatchHeight": 38.0, + "Id": "9277ad9caa034b88b3f4a71ce0489dfc", + "NodeType": "ExtensionNode", + "Inputs": [ + { + "Id": "c8ff6c767c27463fa83801056a1659f4", + "Name": "", + "Description": "Node to show output from", + "UsingDefaultValue": false, + "Level": 2, + "UseLevels": false, + "KeepListStructure": false + } + ], + "Outputs": [ + { + "Id": "e8e96a2d54104462b846e9146c44d28d", + "Name": "", + "Description": "Node output", + "UsingDefaultValue": false, + "Level": 2, + "UseLevels": false, + "KeepListStructure": false + } + ], + "Replication": "Disabled", + "Description": "Visualizes a node's output" + } + ], + "Connectors": [ + { + "Start": "da29b5f8bea04c09b0e32ec0d27dd1af", + "End": "c2a83726b20f4856956b731605c325fc", + "Id": "a21c0cfc98c246f6a048060ecab505b2", + "IsHidden": "False" + }, + { + "Start": "4cb119c0fc804e47bd4bcd5fff82cf7c", + "End": "fab5ba40009445218c05f8e2e125c3e2", + "Id": "c1f29067813448e4a0c018fc9d108ed5", + "IsHidden": "False" + }, + { + "Start": "3f6242f197704cb08d28d338399cc02b", + "End": "1838b7ed07924850904317b05d21e435", + "Id": "23ce470fd17646daa45add92a0e826ce", + "IsHidden": "False" + }, + { + "Start": "91219a54373d4ea1b3ee8a1c03ace17a", + "End": "c8ff6c767c27463fa83801056a1659f4", + "Id": "cc4370cff5a04c1c8ed3f74da4e2fe10", + "IsHidden": "False" + } + ], + "Dependencies": [], + "NodeLibraryDependencies": [], + "EnableLegacyPolyCurveBehavior": true, + "Thumbnail": "", + "GraphDocumentationURL": null, + "ExtensionWorkspaceData": [ + { + "ExtensionGuid": "28992e1d-abb9-417f-8b1b-05e053bee670", + "Name": "Properties", + "Version": "3.0", + "Data": {} + }, + { + "ExtensionGuid": "DFBD9CC0-DB40-457A-939E-8C8555555A9D", + "Name": "Generative Design", + "Version": "7.1", + "Data": {} + } + ], + "Author": "Autodesk", + "Linting": { + "activeLinter": "None", + "activeLinterId": "7b75fb44-43fd-4631-a878-29f4d5d8399a", + "warningCount": 0, + "errorCount": 0 + }, + "Bindings": [], + "View": { + "Dynamo": { + "ScaleFactor": 1.0, + "HasRunWithoutCrash": true, + "IsVisibleInDynamoLibrary": true, + "Version": "3.0.3.7597", + "RunType": "Automatic", + "RunPeriod": "1000" + }, + "Camera": { + "Name": "_Background Preview", + "EyeX": -17.0, + "EyeY": 24.0, + "EyeZ": 50.0, + "LookX": 12.0, + "LookY": -13.0, + "LookZ": -58.0, + "UpX": 0.0, + "UpY": 1.0, + "UpZ": 0.0 + }, + "ConnectorPins": [], + "NodeViews": [ + { + "Id": "7620c0a6d174413281b95698fb1d9d57", + "Name": "Data.OpenXMLImportExcel", + "IsSetAsInput": false, + "IsSetAsOutput": false, + "Excluded": false, + "ShowGeometry": true, + "X": 811.0, + "Y": 282.0 + }, + { + "Id": "d2ca2769c87f4b4396940a74ff1111d2", + "Name": "File Path", + "IsSetAsInput": false, + "IsSetAsOutput": false, + "Excluded": false, + "ShowGeometry": true, + "X": 238.5, + "Y": 282.0 + }, + { + "Id": "3bd4fe2e6876454da3e83a01462c85c7", + "Name": "String", + "IsSetAsInput": false, + "IsSetAsOutput": false, + "Excluded": false, + "ShowGeometry": true, + "X": 238.5, + "Y": 531.5 + }, + { + "Id": "13b0e9b105ea4af2a48f0aafdfa0bf5b", + "Name": "List.Transpose", + "IsSetAsInput": false, + "IsSetAsOutput": false, + "Excluded": false, + "ShowGeometry": true, + "X": 1180.5, + "Y": 282.0 + }, + { + "Id": "9277ad9caa034b88b3f4a71ce0489dfc", + "Name": "Watch", + "IsSetAsInput": false, + "IsSetAsOutput": false, + "Excluded": false, + "ShowGeometry": true, + "X": 1462.0, + "Y": 282.0 + } + ], + "Annotations": [ + { + "Id": "f8caed9cca86404397d6c13d7f9a2292", + "Title": "Browse to Excel file to import data from", + "DescriptionText": null, + "IsExpanded": true, + "WidthAdjustment": 0.0, + "HeightAdjustment": 0.0, + "Nodes": [], + "HasNestedGroups": false, + "Left": 205.0, + "Top": 232.0, + "Width": 0.0, + "Height": 0.0, + "FontSize": 36.0, + "GroupStyleId": "00000000-0000-0000-0000-000000000000", + "InitialTop": 0.0, + "InitialHeight": 0.0, + "TextblockHeight": 0.0, + "Background": "#FFC1D676", + "PinnedNode": "d2ca2769c87f4b4396940a74ff1111d2" + }, + { + "Id": "f6199651df8b4e3ebe2e1ba518850914", + "Title": "Type in a Sheet Name, but be mindful of capitalization", + "DescriptionText": null, + "IsExpanded": true, + "WidthAdjustment": 0.0, + "HeightAdjustment": 0.0, + "Nodes": [], + "HasNestedGroups": false, + "Left": 193.5, + "Top": 466.5, + "Width": 0.0, + "Height": 0.0, + "FontSize": 36.0, + "GroupStyleId": "00000000-0000-0000-0000-000000000000", + "InitialTop": 0.0, + "InitialHeight": 0.0, + "TextblockHeight": 0.0, + "Background": "#FFC1D676", + "PinnedNode": "3bd4fe2e6876454da3e83a01462c85c7" + }, + { + "Id": "a69836269d524c90a34e16b7efd8f803", + "Title": "Import Excel data using the OpenXML format from a chosen sheet name", + "DescriptionText": null, + "IsExpanded": true, + "WidthAdjustment": 0.0, + "HeightAdjustment": 0.0, + "Nodes": [], + "HasNestedGroups": false, + "Left": 799.5, + "Top": 169.0, + "Width": 0.0, + "Height": 0.0, + "FontSize": 36.0, + "GroupStyleId": "00000000-0000-0000-0000-000000000000", + "InitialTop": 0.0, + "InitialHeight": 0.0, + "TextblockHeight": 0.0, + "Background": "#FFC1D676", + "PinnedNode": "7620c0a6d174413281b95698fb1d9d57" + }, + { + "Id": "37460f13b9794e029d2aec8655b5aaa9", + "Title": "Transpose the Excel data to flip Rows and Columns", + "DescriptionText": null, + "IsExpanded": true, + "WidthAdjustment": 0.0, + "HeightAdjustment": 0.0, + "Nodes": [], + "HasNestedGroups": false, + "Left": 1125.0, + "Top": 184.0, + "Width": 0.0, + "Height": 0.0, + "FontSize": 36.0, + "GroupStyleId": "00000000-0000-0000-0000-000000000000", + "InitialTop": 0.0, + "InitialHeight": 0.0, + "TextblockHeight": 0.0, + "Background": "#FFC1D676", + "PinnedNode": "13b0e9b105ea4af2a48f0aafdfa0bf5b" + } + ], + "X": -245.65603726262975, + "Y": -92.29666786098167, + "Zoom": 1.4245790039412396 + } +} \ No newline at end of file diff --git a/doc/distrib/Templates/ReadImageFromFile.dyn b/doc/distrib/Templates/ReadImageFromFile.dyn new file mode 100644 index 0000000000..9bd4f780f7 --- /dev/null +++ b/doc/distrib/Templates/ReadImageFromFile.dyn @@ -0,0 +1,323 @@ +{ + "Uuid": "847b8d50-8963-40c7-90ca-c0afb7b9b9a6", + "IsCustomNode": false, + "Description": "Read Image from disc to be able to work with inside of Dynamo", + "Name": "ReadImageFromFile", + "ElementResolver": { + "ResolutionMap": {} + }, + "Inputs": [], + "Outputs": [], + "Nodes": [ + { + "ConcreteType": "CoreNodeModels.Input.Filename, CoreNodeModels", + "Id": "d2ca2769c87f4b4396940a74ff1111d2", + "NodeType": "ExtensionNode", + "Inputs": [], + "Outputs": [ + { + "Id": "4cb119c0fc804e47bd4bcd5fff82cf7c", + "Name": "", + "Description": "File Path", + "UsingDefaultValue": false, + "Level": 2, + "UseLevels": false, + "KeepListStructure": false + } + ], + "Replication": "Disabled", + "Description": "Allows you to select a file on the system and returns its file path", + "HintPath": "C:\\Users\\amours\\Desktop\\DynamoRevitTemplates\\No file selected", + "InputValue": "No file selected." + }, + { + "ConcreteType": "CoreNodeModels.Input.FileObject, CoreNodeModels", + "Id": "59d22a7921854195813ce16dac4fde76", + "NodeType": "ExtensionNode", + "Inputs": [ + { + "Id": "ac3d97121b3a4e7e81b84beb515453b6", + "Name": "path", + "Description": "Path to the file.", + "UsingDefaultValue": false, + "Level": 2, + "UseLevels": false, + "KeepListStructure": false + } + ], + "Outputs": [ + { + "Id": "e6871041961542a7b371fe5c91060ef7", + "Name": "file", + "Description": "File object", + "UsingDefaultValue": false, + "Level": 2, + "UseLevels": false, + "KeepListStructure": false + } + ], + "Replication": "Disabled", + "Description": "Creates a file object from the given path" + }, + { + "ConcreteType": "Dynamo.Graph.Nodes.ZeroTouch.DSFunction, DynamoCore", + "Id": "19ee29aa65234cd0b7dc15d77fb4eb15", + "NodeType": "FunctionNode", + "Inputs": [ + { + "Id": "eb524fc133cb468b907620050f72b8bf", + "Name": "file", + "Description": "File object to load image from\n\nvar", + "UsingDefaultValue": false, + "Level": 2, + "UseLevels": false, + "KeepListStructure": false + } + ], + "Outputs": [ + { + "Id": "f106b67f8d5f4cab91d132b92814efbd", + "Name": "image", + "Description": "Image object from file", + "UsingDefaultValue": false, + "Level": 2, + "UseLevels": false, + "KeepListStructure": false + } + ], + "FunctionSignature": "DSCore.IO.Image.ReadFromFile@var", + "Replication": "Auto", + "Description": "Loads the file as a bitmap.\n\nImage.ReadFromFile (file: var): var" + }, + { + "ConcreteType": "CoreNodeModels.WatchImageCore, CoreNodeModels", + "Id": "3fe34643619745249cb1e4a286e36944", + "NodeType": "ExtensionNode", + "Inputs": [ + { + "Id": "f4d5f5b983b340f8973b41f72174f9e7", + "Name": "image", + "Description": "Image for visualization", + "UsingDefaultValue": false, + "Level": 2, + "UseLevels": false, + "KeepListStructure": false + } + ], + "Outputs": [ + { + "Id": "bebb4cb152da4adbad95a62a2c1dcc6e", + "Name": "image", + "Description": "Image for visualization", + "UsingDefaultValue": false, + "Level": 2, + "UseLevels": false, + "KeepListStructure": false + } + ], + "Replication": "Disabled", + "Description": "Previews an image" + } + ], + "Connectors": [ + { + "Start": "4cb119c0fc804e47bd4bcd5fff82cf7c", + "End": "ac3d97121b3a4e7e81b84beb515453b6", + "Id": "df3062a3444e41b8b7f34c7a286e4cce", + "IsHidden": "False" + }, + { + "Start": "e6871041961542a7b371fe5c91060ef7", + "End": "eb524fc133cb468b907620050f72b8bf", + "Id": "78544d0ab304493f81cbb3753ea34fec", + "IsHidden": "False" + }, + { + "Start": "f106b67f8d5f4cab91d132b92814efbd", + "End": "f4d5f5b983b340f8973b41f72174f9e7", + "Id": "d95208d4410d4cb9825e4f2d39309326", + "IsHidden": "False" + } + ], + "Dependencies": [], + "NodeLibraryDependencies": [], + "EnableLegacyPolyCurveBehavior": true, + "Thumbnail": "", + "GraphDocumentationURL": null, + "ExtensionWorkspaceData": [ + { + "ExtensionGuid": "28992e1d-abb9-417f-8b1b-05e053bee670", + "Name": "Properties", + "Version": "3.0", + "Data": {} + }, + { + "ExtensionGuid": "DFBD9CC0-DB40-457A-939E-8C8555555A9D", + "Name": "Generative Design", + "Version": "7.1", + "Data": {} + } + ], + "Author": "Autodesk", + "Linting": { + "activeLinter": "None", + "activeLinterId": "7b75fb44-43fd-4631-a878-29f4d5d8399a", + "warningCount": 0, + "errorCount": 0 + }, + "Bindings": [], + "View": { + "Dynamo": { + "ScaleFactor": 1.0, + "HasRunWithoutCrash": true, + "IsVisibleInDynamoLibrary": true, + "Version": "3.0.3.7597", + "RunType": "Automatic", + "RunPeriod": "1000" + }, + "Camera": { + "Name": "_Background Preview", + "EyeX": -17.0, + "EyeY": 24.0, + "EyeZ": 50.0, + "LookX": 12.0, + "LookY": -13.0, + "LookZ": -58.0, + "UpX": 0.0, + "UpY": 1.0, + "UpZ": 0.0 + }, + "ConnectorPins": [], + "NodeViews": [ + { + "Id": "d2ca2769c87f4b4396940a74ff1111d2", + "Name": "File Path", + "IsSetAsInput": false, + "IsSetAsOutput": false, + "Excluded": false, + "ShowGeometry": true, + "X": 238.5, + "Y": 282.0 + }, + { + "Id": "59d22a7921854195813ce16dac4fde76", + "Name": "File From Path", + "IsSetAsInput": false, + "IsSetAsOutput": false, + "Excluded": false, + "ShowGeometry": true, + "X": 811.0, + "Y": 282.0 + }, + { + "Id": "19ee29aa65234cd0b7dc15d77fb4eb15", + "Name": "Image.ReadFromFile", + "IsSetAsInput": false, + "IsSetAsOutput": false, + "Excluded": false, + "ShowGeometry": true, + "X": 1092.7547786720322, + "Y": 282.0 + }, + { + "Id": "3fe34643619745249cb1e4a286e36944", + "Name": "Watch Image", + "IsSetAsInput": false, + "IsSetAsOutput": false, + "Excluded": false, + "ShowGeometry": true, + "X": 1433.866448692153, + "Y": 282.0 + } + ], + "Annotations": [ + { + "Id": "f8caed9cca86404397d6c13d7f9a2292", + "Title": "Browse to Image file to import", + "DescriptionText": null, + "IsExpanded": true, + "WidthAdjustment": 0.0, + "HeightAdjustment": 0.0, + "Nodes": [], + "HasNestedGroups": false, + "Left": 229.5, + "Top": 232.0, + "Width": 0.0, + "Height": 0.0, + "FontSize": 36.0, + "GroupStyleId": "00000000-0000-0000-0000-000000000000", + "InitialTop": 0.0, + "InitialHeight": 0.0, + "TextblockHeight": 0.0, + "Background": "#FFC1D676", + "PinnedNode": "d2ca2769c87f4b4396940a74ff1111d2" + }, + { + "Id": "a69836269d524c90a34e16b7efd8f803", + "Title": "Load the Image file from disk into Dynamo's memory", + "DescriptionText": null, + "IsExpanded": true, + "WidthAdjustment": 0.0, + "HeightAdjustment": 0.0, + "Nodes": [], + "HasNestedGroups": false, + "Left": 772.0, + "Top": 217.0, + "Width": 0.0, + "Height": 0.0, + "FontSize": 36.0, + "GroupStyleId": "00000000-0000-0000-0000-000000000000", + "InitialTop": 0.0, + "InitialHeight": 0.0, + "TextblockHeight": 0.0, + "Background": "#FFC1D676", + "PinnedNode": "59d22a7921854195813ce16dac4fde76" + }, + { + "Id": "37460f13b9794e029d2aec8655b5aaa9", + "Title": "Read Image from File in Dynamo's memory space in the Bitmap format", + "DescriptionText": null, + "IsExpanded": true, + "WidthAdjustment": 0.0, + "HeightAdjustment": 0.0, + "Nodes": [], + "HasNestedGroups": false, + "Left": 1056.2547786720322, + "Top": 169.0, + "Width": 0.0, + "Height": 0.0, + "FontSize": 36.0, + "GroupStyleId": "00000000-0000-0000-0000-000000000000", + "InitialTop": 0.0, + "InitialHeight": 0.0, + "TextblockHeight": 0.0, + "Background": "#FFC1D676", + "PinnedNode": "19ee29aa65234cd0b7dc15d77fb4eb15" + }, + { + "Id": "92781c108d794300982eb5b214c43333", + "Title": "Watch the Image to visually check", + "DescriptionText": null, + "IsExpanded": true, + "WidthAdjustment": 0.0, + "HeightAdjustment": 0.0, + "Nodes": [], + "HasNestedGroups": false, + "Left": 1417.866448692153, + "Top": 232.0, + "Width": 0.0, + "Height": 0.0, + "FontSize": 36.0, + "GroupStyleId": "00000000-0000-0000-0000-000000000000", + "InitialTop": 0.0, + "InitialHeight": 0.0, + "TextblockHeight": 0.0, + "Background": "#FFC1D676", + "PinnedNode": "3fe34643619745249cb1e4a286e36944" + } + ], + "X": -301.7268648176259, + "Y": 70.82444097119173, + "Zoom": 1.4454329621683044 + } +} \ No newline at end of file diff --git a/src/Config/packages.aget b/src/Config/packages.aget index 1853b981ed..fd5518edfe 100644 --- a/src/Config/packages.aget +++ b/src/Config/packages.aget @@ -2,13 +2,13 @@ "nuget": { "references": { "DynamicLanguageRuntime": "1.2.2", - "DynamoVisualProgramming.Core": "3.2.1.5347", - "DynamoVisualProgramming.DynamoCoreNodes": "3.2.1.5347", - "DynamoVisualProgramming.DynamoServices": "3.2.1.5347", - "DynamoVisualProgramming.Tests": "3.2.1.5347", - "DynamoVisualProgramming.WpfUILibrary": "3.2.1.5347", - "DynamoVisualProgramming.ZeroTouchLibrary": "3.2.1.5347", - "DynamoVisualProgramming.DynamoSamples": "3.2.1.5347", + "DynamoVisualProgramming.Core": "3.2.1.5366", + "DynamoVisualProgramming.DynamoCoreNodes": "3.2.1.5366", + "DynamoVisualProgramming.DynamoServices": "3.2.1.5366", + "DynamoVisualProgramming.Tests": "3.2.1.5366", + "DynamoVisualProgramming.WpfUILibrary": "3.2.1.5366", + "DynamoVisualProgramming.ZeroTouchLibrary": "3.2.1.5366", + "DynamoVisualProgramming.DynamoSamples": "3.2.1.5366", "Greg": "3.0.1.4707", "GregRevitAuth": "3.0.8935.26399", "pythonnet_py38_win": "2.5.1", From ce5f1842f645043010a07de795f87f121c634cdd Mon Sep 17 00:00:00 2001 From: Vlad Catalina Date: Fri, 21 Jun 2024 19:04:26 +0300 Subject: [PATCH 20/70] change content publishing --- .version | 2 +- CHANGELOG.md | 3 +++ src/AssemblySharedInfoGenerator/AssemblySharedInfo.tt | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.version b/.version index 841aff5958..0e97bf4857 100644 --- a/.version +++ b/.version @@ -1 +1 @@ -0.5.40 \ No newline at end of file +0.5.41 \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index fd8d671c1f..58e81178fa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## 0.5.41 +* change D4R content publishing + ## 0.5.40 * update Dynamo to published 3.2.1.5366 * add Sample Template files diff --git a/src/AssemblySharedInfoGenerator/AssemblySharedInfo.tt b/src/AssemblySharedInfoGenerator/AssemblySharedInfo.tt index 0ae5611a3e..c130b81048 100644 --- a/src/AssemblySharedInfoGenerator/AssemblySharedInfo.tt +++ b/src/AssemblySharedInfoGenerator/AssemblySharedInfo.tt @@ -69,6 +69,6 @@ using System.Runtime.InteropServices; <#+ int MajorVersion = 3; int MinorVersion = 2; -int BuildNumber = 0; +int BuildNumber = 1; int RevisionNumber = ((int)(DateTime.UtcNow - new DateTime(2023,1,1)).TotalDays)*10+((int)DateTime.UtcNow.Hour)/3; #> From 2ad9983f8d8b82763255f522369450cfd97b90ff Mon Sep 17 00:00:00 2001 From: AdrianaStanica <74306868+AdrianaStanica@users.noreply.github.com> Date: Tue, 6 Aug 2024 10:37:39 +0300 Subject: [PATCH 21/70] Roof.Points bug fix integration in Revit 2025.3 (#3081) * add wrapper over Revit RoofBase class to D4R Roof class * cast value data type to parameter value data type in order to avoid blind pointer cast in revit later on * cast value data type to parameter value data type, get parameter value data type from Storage type where value is null --- .version | 2 +- CHANGELOG.md | 5 +++ .../InternalUtilities/ElementUtils.cs | 38 +++++++++++++++++++ .../InternalUtilities/ElementWrapper.cs | 5 +++ src/Libraries/RevitNodes/Filter/FilterRule.cs | 27 +++++++++---- .../Properties/Resources.Designer.cs | 9 +++++ .../Properties/Resources.en-US.resx | 3 ++ .../RevitNodes/Properties/Resources.resx | 3 ++ 8 files changed, 83 insertions(+), 9 deletions(-) diff --git a/.version b/.version index 0e97bf4857..495bec2926 100644 --- a/.version +++ b/.version @@ -1 +1 @@ -0.5.41 \ No newline at end of file +0.5.42 \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 58e81178fa..4273bcaeb6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## 0.5.42 +* Fix Roof.Points raising an invalid argument exception by adding a wrapper over RoofBase Revit class to Roof D4R class +* Add extra protection in FilterRule.ByRuleType node to prevent invalid data type casting in Revit +* Improved FilterRule.ByRuleType node to use the same data type for the value and the parameter value that it takes as input + ## 0.5.41 * change D4R content publishing diff --git a/src/Libraries/RevitNodes/Elements/InternalUtilities/ElementUtils.cs b/src/Libraries/RevitNodes/Elements/InternalUtilities/ElementUtils.cs index b134beef79..2d5084d20f 100644 --- a/src/Libraries/RevitNodes/Elements/InternalUtilities/ElementUtils.cs +++ b/src/Libraries/RevitNodes/Elements/InternalUtilities/ElementUtils.cs @@ -106,6 +106,44 @@ public static object GetParameterValue(Autodesk.Revit.DB.Parameter param) return result; } + /// + /// Get data type of parameter value, or based on its StorageType if value is null + /// + /// + /// + /// + [SupressImportIntoVM] + public static Type GetParameterType(Elements.Parameter parameter) + { + Type parameterType; + if (!parameter.HasValue) + { + switch (parameter.InternalParameter.StorageType) + { + case StorageType.String: + parameterType = typeof(string); + break; + case Autodesk.Revit.DB.StorageType.Integer: + parameterType = typeof(int); + break; + case Autodesk.Revit.DB.StorageType.Double: + parameterType = typeof(double); + break; + case Autodesk.Revit.DB.StorageType.ElementId: + parameterType = typeof(ElementId); + break; + default: + throw new ApplicationException(Properties.Resources.InputValueParameterValueTypeMismatch); + } + } + else + { + parameterType = parameter.Value.GetType(); + } + + return parameterType; + } + #region dynamic parameter setting methods [SupressImportIntoVM] diff --git a/src/Libraries/RevitNodes/Elements/InternalUtilities/ElementWrapper.cs b/src/Libraries/RevitNodes/Elements/InternalUtilities/ElementWrapper.cs index 35a42a178a..4a985198b5 100644 --- a/src/Libraries/RevitNodes/Elements/InternalUtilities/ElementWrapper.cs +++ b/src/Libraries/RevitNodes/Elements/InternalUtilities/ElementWrapper.cs @@ -390,6 +390,11 @@ public static RoofType Wrap(Autodesk.Revit.DB.RoofType ele, bool isRevitOwned) return RoofType.FromExisting(ele, isRevitOwned); } + public static Roof Wrap(Autodesk.Revit.DB.RoofBase ele, bool isRevitOwned) + { + return Roof.FromExisting(ele, isRevitOwned); + } + public static ScheduleOnSheet Wrap(Autodesk.Revit.DB.ScheduleSheetInstance ele, bool isRevitOwned) { return ScheduleOnSheet.FromExisting(ele, isRevitOwned); diff --git a/src/Libraries/RevitNodes/Filter/FilterRule.cs b/src/Libraries/RevitNodes/Filter/FilterRule.cs index 5f10c0be97..db51204761 100644 --- a/src/Libraries/RevitNodes/Filter/FilterRule.cs +++ b/src/Libraries/RevitNodes/Filter/FilterRule.cs @@ -85,6 +85,17 @@ public static FilterRule ByRuleType(string type, object value, Elements.Paramete ElementId parameterId = parameter.InternalParameter.Id; + object convertedValue = null; + try + { + Type parameterType = Revit.Elements.InternalUtilities.ElementUtils.GetParameterType(parameter); + convertedValue = Convert.ChangeType(value, parameterType); + } + catch (Exception ex) + { + throw new ApplicationException(Properties.Resources.InputValueParameterValueTypeMismatch); + } + // assemble the method name to construct a new filter using the FilterType string methodname = string.Format("{0}{1}{2}", new object[] { CreatePrefix , type, RuleSuffix}); @@ -98,39 +109,39 @@ public static FilterRule ByRuleType(string type, object value, Elements.Paramete ruletype == RuleType.LessOrEqual ) { - if (value.GetType() == typeof(int)) + if (convertedValue.GetType() == typeof(int)) { System.Reflection.MethodInfo methodInfo = typeof(ParameterFilterRuleFactory).GetMethod(methodname, new[] { typeof(ElementId), typeof(int) }); if (methodInfo != null) { - return new FilterRule((Autodesk.Revit.DB.FilterRule)methodInfo.Invoke(null, new object[] { parameterId, (int)value })); + return new FilterRule((Autodesk.Revit.DB.FilterRule)methodInfo.Invoke(null, new object[] { parameterId, (int)convertedValue })); } } - else if (value.GetType() == typeof(double)) + else if (convertedValue.GetType() == typeof(double)) { System.Reflection.MethodInfo methodInfo = typeof(ParameterFilterRuleFactory).GetMethod(methodname, new[] { typeof(ElementId), typeof(double), typeof(double) }); if (methodInfo != null) { - return new FilterRule((Autodesk.Revit.DB.FilterRule)methodInfo.Invoke(null, new object[] { parameterId, (double)value, 0 })); + return new FilterRule((Autodesk.Revit.DB.FilterRule)methodInfo.Invoke(null, new object[] { parameterId, (double)convertedValue, 0 })); } } - else if (value.GetType() == typeof(string)) + else if (convertedValue.GetType() == typeof(string)) { System.Reflection.MethodInfo methodInfo = typeof(ParameterFilterRuleFactory).GetMethod(methodname, new[] { typeof(ElementId), typeof(string), typeof(bool) }); if (methodInfo != null) { - return new FilterRule((Autodesk.Revit.DB.FilterRule)methodInfo.Invoke(null, new object[] { parameterId, (string)value, true })); + return new FilterRule((Autodesk.Revit.DB.FilterRule)methodInfo.Invoke(null, new object[] { parameterId, (string)convertedValue, true })); } } } else { - if (value.GetType() == typeof(string)) + if (convertedValue.GetType() == typeof(string)) { System.Reflection.MethodInfo methodInfo = typeof(ParameterFilterRuleFactory).GetMethod(methodname, new[] { typeof(ElementId), typeof(string), typeof(bool) }); if (methodInfo != null) { - return new FilterRule((Autodesk.Revit.DB.FilterRule)methodInfo.Invoke(null, new object[] { parameterId, (string)value, true })); + return new FilterRule((Autodesk.Revit.DB.FilterRule)methodInfo.Invoke(null, new object[] { parameterId, (string)convertedValue, true })); } } } diff --git a/src/Libraries/RevitNodes/Properties/Resources.Designer.cs b/src/Libraries/RevitNodes/Properties/Resources.Designer.cs index a21937f426..cff71ce692 100644 --- a/src/Libraries/RevitNodes/Properties/Resources.Designer.cs +++ b/src/Libraries/RevitNodes/Properties/Resources.Designer.cs @@ -735,6 +735,15 @@ internal static string InputUVParamsMismatch { } } + /// + /// Looks up a localized string similar to The value and the parameter values' data types are incompatible.. + /// + internal static string InputValueParameterValueTypeMismatch { + get { + return ResourceManager.GetString("InputValueParameterValueTypeMismatch", resourceCulture); + } + } + /// /// Looks up a localized string similar to Could not obtain ImportInstance from imported Element. /// diff --git a/src/Libraries/RevitNodes/Properties/Resources.en-US.resx b/src/Libraries/RevitNodes/Properties/Resources.en-US.resx index ecf080c1c9..4f85bfb5aa 100644 --- a/src/Libraries/RevitNodes/Properties/Resources.en-US.resx +++ b/src/Libraries/RevitNodes/Properties/Resources.en-US.resx @@ -318,6 +318,9 @@ FilterType is not valid. + + The value and the parameter values' data types are incompatible. + The selected face cannot be used to create a wall. Please use a mass face instead. diff --git a/src/Libraries/RevitNodes/Properties/Resources.resx b/src/Libraries/RevitNodes/Properties/Resources.resx index b89074ff73..705812619d 100644 --- a/src/Libraries/RevitNodes/Properties/Resources.resx +++ b/src/Libraries/RevitNodes/Properties/Resources.resx @@ -312,6 +312,9 @@ FilterType is not valid. + + The value and the parameter values' data types are incompatible. + {0} is not a valid GroupType. From a4eb9ca300f17b4aa180dfa22c304c8e973d364a Mon Sep 17 00:00:00 2001 From: Vlad Catalina Date: Tue, 6 Aug 2024 22:32:42 +0300 Subject: [PATCH 22/70] update Dynamo Core to 3.2.2.5494 (#3084) --- .version | 2 +- CHANGELOG.md | 3 +++ .../AssemblySharedInfo.tt | 2 +- src/Config/packages.aget | 14 +++++++------- 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/.version b/.version index 495bec2926..7928fb60bf 100644 --- a/.version +++ b/.version @@ -1 +1 @@ -0.5.42 \ No newline at end of file +0.5.43 \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 4273bcaeb6..2b9b8a37bf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## 0.5.43 +* Update Dynamo Core to 3.2.2.5494 + ## 0.5.42 * Fix Roof.Points raising an invalid argument exception by adding a wrapper over RoofBase Revit class to Roof D4R class * Add extra protection in FilterRule.ByRuleType node to prevent invalid data type casting in Revit diff --git a/src/AssemblySharedInfoGenerator/AssemblySharedInfo.tt b/src/AssemblySharedInfoGenerator/AssemblySharedInfo.tt index c130b81048..87b6ae99f7 100644 --- a/src/AssemblySharedInfoGenerator/AssemblySharedInfo.tt +++ b/src/AssemblySharedInfoGenerator/AssemblySharedInfo.tt @@ -69,6 +69,6 @@ using System.Runtime.InteropServices; <#+ int MajorVersion = 3; int MinorVersion = 2; -int BuildNumber = 1; +int BuildNumber = 2; int RevisionNumber = ((int)(DateTime.UtcNow - new DateTime(2023,1,1)).TotalDays)*10+((int)DateTime.UtcNow.Hour)/3; #> diff --git a/src/Config/packages.aget b/src/Config/packages.aget index fd5518edfe..51ff52dbc8 100644 --- a/src/Config/packages.aget +++ b/src/Config/packages.aget @@ -2,13 +2,13 @@ "nuget": { "references": { "DynamicLanguageRuntime": "1.2.2", - "DynamoVisualProgramming.Core": "3.2.1.5366", - "DynamoVisualProgramming.DynamoCoreNodes": "3.2.1.5366", - "DynamoVisualProgramming.DynamoServices": "3.2.1.5366", - "DynamoVisualProgramming.Tests": "3.2.1.5366", - "DynamoVisualProgramming.WpfUILibrary": "3.2.1.5366", - "DynamoVisualProgramming.ZeroTouchLibrary": "3.2.1.5366", - "DynamoVisualProgramming.DynamoSamples": "3.2.1.5366", + "DynamoVisualProgramming.Core": "3.2.2.5494", + "DynamoVisualProgramming.DynamoCoreNodes": "3.2.2.5494", + "DynamoVisualProgramming.DynamoServices": "3.2.2.5494", + "DynamoVisualProgramming.Tests": "3.2.2.5494", + "DynamoVisualProgramming.WpfUILibrary": "3.2.2.5494", + "DynamoVisualProgramming.ZeroTouchLibrary": "3.2.2.5494", + "DynamoVisualProgramming.DynamoSamples": "3.2.2.5494", "Greg": "3.0.1.4707", "GregRevitAuth": "3.0.8935.26399", "pythonnet_py38_win": "2.5.1", From ffe4ed32a33da2f8f4b7494c39a8a7a52e342964 Mon Sep 17 00:00:00 2001 From: ZbynekHanak-RWS <118838661+ZbynekHanak-RWS@users.noreply.github.com> Date: Wed, 25 Sep 2024 13:54:38 +0200 Subject: [PATCH 23/70] Create ContinuousLocalization.yml --- .adsk/ContinuousLocalization.yml | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 .adsk/ContinuousLocalization.yml diff --git a/.adsk/ContinuousLocalization.yml b/.adsk/ContinuousLocalization.yml new file mode 100644 index 0000000000..c572f367cd --- /dev/null +++ b/.adsk/ContinuousLocalization.yml @@ -0,0 +1,30 @@ +############################ Header ################################################ +# Configuration file for Continuous Localization (CL) process. +# +# To reduce the size of this file, instructions on what each parameter is used for, +# with the respective values to use, can be found on: +# https://wiki.autodesk.com/display/ForgeCL/CL+-+Setup+-+Continuous+Localization+Configuration+File +# +######################### End of Header ############################################## + +common: + branch_section: + maintainer: [cataliv] + ignore_this_branch: true + auto_merge_pr: false + + variable_section: + langProject: [csy, deu, esp, fra, ita, jpn, kor, plk, ptb, rus, chs, cht] + # Microsoft 3-letter language codes as defined on https://www.microsoft.com/resources/msdn/goglobal/default.mspx + langThreeLetter: {enu: enu, eng: eng, deu: deu, fra: fra, ita: ita, esp: esp, ptb: ptb, ptg: ptg, jpn: jpn, chs: chs, cht: cht, kor: kor, csy: csy, plk: plk, rus: rus, hun: hun, trk: trk, cat: cat} + langMsNet: {dnk: da-DK, csy: cs-CZ, plk: pl-PL, deu: de-DE, nld: nl-NL, fin: fi-FI, hrv: hr-HR, cht: zh-TW, ptb: pt-BR, swe: sv-SE, hun: hu-HU, esp: es-ES, ptg: pt-PT, fra: fr-FR, enu: en-US, trk: tr-TR, kor: ko-KR, ita: it-IT, rus: ru-RU, nor: nb-NO, eng: en-GB, rom: ro-RO, cat: ca-ES, chs: zh-CN, jpn: ja-JP} + langBCP47: {enu: en, eng: en-GB, deu: de, fra: fr, ita: it, esp: es, ptb: pt-BR, ptg: pt-PT, jpn: ja, chs: zh-Hans, cht: zh-Hant, zhh: zh-Hant-HK, kor: ko, csy: cs, hun: hu, plk: pl, rus: ru, rom: ro, fin: fi, nor: no, sve: sv, nld: nl, dan: da, hrv: hr, trk: tr, cat: ca} + + components: + - name: DynamoRevit + main_owner: Soft + content_owner: N/A + lang: [csy, deu, esp, fra, ita, jpn, kor, plk, ptb, rus, chs, cht] + file_rules: + - doc\distrib\NodeHelpFiles\*.md, doc\distrib\NodeHelpFiles\%langMsNet%\*.md + - doc\distrib\Templates\*.dyn, doc\distrib\Templates\%langMsNet%\*.dyn From bc2a8fa3297abd8d778e22271b20291948fca1e4 Mon Sep 17 00:00:00 2001 From: Vlad Catalina Date: Mon, 14 Oct 2024 12:58:10 +0300 Subject: [PATCH 24/70] Update Dynamo Core to 3.3.0 --- .version | 2 +- CHANGELOG.md | 3 +++ .../AssemblySharedInfo.tt | 4 ++-- src/Config/packages.aget | 14 +++++++------- 4 files changed, 13 insertions(+), 10 deletions(-) diff --git a/.version b/.version index 7928fb60bf..314b117887 100644 --- a/.version +++ b/.version @@ -1 +1 @@ -0.5.43 \ No newline at end of file +0.5.44 \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 2b9b8a37bf..5e0048024a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## 0.5.44 +* Update Dynamo Core to 3.3.0.6316 + ## 0.5.43 * Update Dynamo Core to 3.2.2.5494 diff --git a/src/AssemblySharedInfoGenerator/AssemblySharedInfo.tt b/src/AssemblySharedInfoGenerator/AssemblySharedInfo.tt index 87b6ae99f7..1b7882217f 100644 --- a/src/AssemblySharedInfoGenerator/AssemblySharedInfo.tt +++ b/src/AssemblySharedInfoGenerator/AssemblySharedInfo.tt @@ -68,7 +68,7 @@ using System.Runtime.InteropServices; [assembly: AssemblyFileVersion("<#= this.MajorVersion #>.<#= this.MinorVersion #>.<#= this.BuildNumber #>.<#= this.RevisionNumber #>")] <#+ int MajorVersion = 3; -int MinorVersion = 2; -int BuildNumber = 2; +int MinorVersion = 3; +int BuildNumber = 0; int RevisionNumber = ((int)(DateTime.UtcNow - new DateTime(2023,1,1)).TotalDays)*10+((int)DateTime.UtcNow.Hour)/3; #> diff --git a/src/Config/packages.aget b/src/Config/packages.aget index 51ff52dbc8..bb3efabadd 100644 --- a/src/Config/packages.aget +++ b/src/Config/packages.aget @@ -2,13 +2,13 @@ "nuget": { "references": { "DynamicLanguageRuntime": "1.2.2", - "DynamoVisualProgramming.Core": "3.2.2.5494", - "DynamoVisualProgramming.DynamoCoreNodes": "3.2.2.5494", - "DynamoVisualProgramming.DynamoServices": "3.2.2.5494", - "DynamoVisualProgramming.Tests": "3.2.2.5494", - "DynamoVisualProgramming.WpfUILibrary": "3.2.2.5494", - "DynamoVisualProgramming.ZeroTouchLibrary": "3.2.2.5494", - "DynamoVisualProgramming.DynamoSamples": "3.2.2.5494", + "DynamoVisualProgramming.Core": "3.3.0.6316", + "DynamoVisualProgramming.DynamoCoreNodes": "3.3.0.6316", + "DynamoVisualProgramming.DynamoServices": "3.3.0.6316", + "DynamoVisualProgramming.Tests": "3.3.0.6316", + "DynamoVisualProgramming.WpfUILibrary": "3.3.0.6316", + "DynamoVisualProgramming.ZeroTouchLibrary": "3.3.0.6316", + "DynamoVisualProgramming.DynamoSamples": "3.3.0.6316", "Greg": "3.0.1.4707", "GregRevitAuth": "3.0.8935.26399", "pythonnet_py38_win": "2.5.1", From 636c47684160cfd64c366d9e5bcc61b5d50855e0 Mon Sep 17 00:00:00 2001 From: pinzart90 Date: Fri, 4 Apr 2025 12:17:33 -0400 Subject: [PATCH 25/70] update --- src/DADynamoApp/ConsoleEntrypoint.cs | 16 +++ src/DADynamoApp/DADynamoApp.csproj | 47 +++++++ src/DADynamoApp/DAEntrypoint.cs | 85 ++++++++++++ src/DADynamoApp/DAHandler.cs | 120 +++++++++++++++++ src/DADynamoApp/DynamoPathResolver.cs | 121 ++++++++++++++++++ src/DADynamoConsole/DADynamoConsole.csproj | 23 ++++ src/DADynamoConsole/Program.cs | 4 + src/DynamoRevit.All.sln | 63 +++++++++ src/DynamoRevit/Properties/AssemblyInfo.cs | 3 +- .../ViewModel/RevitWatchHandler.cs | 43 ++++++- .../RevitNodes/Elements/AdaptiveComponent.cs | 2 +- src/Libraries/RevitNodes/Elements/Element.cs | 17 +-- .../RevitNodes/Elements/LinkElement.cs | 40 +----- .../RevitNodes/Elements/Views/Sheet.cs | 6 +- .../RevitNodes/Elements/Views/View.cs | 9 +- src/Libraries/RevitNodes/RevitNodeModel.cs | 14 ++ .../RevitNodes/Transaction/Transaction.cs | 2 + src/Libraries/RevitNodesUI/Elements.cs | 12 +- src/Libraries/RevitNodesUI/RevitDropDown.cs | 6 +- src/Libraries/RevitNodesUI/RevitTypes.cs | 13 -- .../RevitServices/Elements/DisposeLogic.cs | 22 +++- .../RevitServices/Events/EventHandlerProxy.cs | 13 +- .../Persistence/DocumentManager.cs | 41 +++++- .../RevitServices/Properties/AssemblyInfo.cs | 3 + .../Properties/Resources.Designer.cs | 11 +- .../Properties/Resources.en-US.resx | 3 + .../RevitServices/Properties/Resources.resx | 3 + 27 files changed, 649 insertions(+), 93 deletions(-) create mode 100644 src/DADynamoApp/ConsoleEntrypoint.cs create mode 100644 src/DADynamoApp/DADynamoApp.csproj create mode 100644 src/DADynamoApp/DAEntrypoint.cs create mode 100644 src/DADynamoApp/DAHandler.cs create mode 100644 src/DADynamoApp/DynamoPathResolver.cs create mode 100644 src/DADynamoConsole/DADynamoConsole.csproj create mode 100644 src/DADynamoConsole/Program.cs create mode 100644 src/Libraries/RevitNodes/RevitNodeModel.cs diff --git a/src/DADynamoApp/ConsoleEntrypoint.cs b/src/DADynamoApp/ConsoleEntrypoint.cs new file mode 100644 index 0000000000..91723286f5 --- /dev/null +++ b/src/DADynamoApp/ConsoleEntrypoint.cs @@ -0,0 +1,16 @@ +namespace DADynamoApp +{ + public static class ConsoleEntrypoint + { + public static void DoStuff() + { + Console.WriteLine("Hello, World!"); + + var xx = new DAEntrypoint(); + xx.OnStartup(null); + + var handler = new DADynamoApp.DynamoADApp(); + handler.HandleDesignAutomationReadyEvent(null, new DesignAutomationFramework.DesignAutomationReadyEventArgs(null, "")); + } + } +} diff --git a/src/DADynamoApp/DADynamoApp.csproj b/src/DADynamoApp/DADynamoApp.csproj new file mode 100644 index 0000000000..366e99a7cf --- /dev/null +++ b/src/DADynamoApp/DADynamoApp.csproj @@ -0,0 +1,47 @@ + + + + + + + net8.0-windows + enable + enable + false + + + + + + + + + + + $(REVITAPI)\RevitAPI.dll + False + + + + + + + + + + + + + $(PkgDynamoPlayer)\bin\Release\net8.0\bin\DynamoPlayer.Models.dll + False + + + $(PkgDynamoPlayer)\bin\Release\net8.0\bin\DynamoPlayer.Server.dll + False + + + $(PkgDynamoPlayer)\bin\Release\net8.0\bin\DynamoPlayer.Workflows.dll + False + + + diff --git a/src/DADynamoApp/DAEntrypoint.cs b/src/DADynamoApp/DAEntrypoint.cs new file mode 100644 index 0000000000..99cc7ab9b3 --- /dev/null +++ b/src/DADynamoApp/DAEntrypoint.cs @@ -0,0 +1,85 @@ +using DesignAutomationFramework; +using Autodesk.Revit.ApplicationServices; +using Autodesk.Revit.DB; +using System.Diagnostics; +using System.Runtime.Loader; +using RevitServices.Persistence; +using RevitServices.Elements; + +namespace DADynamoApp +{ + [Autodesk.Revit.Attributes.Regeneration(Autodesk.Revit.Attributes.RegenerationOption.Manual)] + [Autodesk.Revit.Attributes.Transaction(Autodesk.Revit.Attributes.TransactionMode.Manual)] + public class DAEntrypoint : IExternalDBApplication + { + public static List Updaters = new List(); + public ExternalDBApplicationResult OnShutdown(ControlledApplication application) + { + AppDomain.CurrentDomain.AssemblyResolve -= DynamoPathResolver.ResolveAssembly; + return ExternalDBApplicationResult.Succeeded; + } + + + private static void CurrentDomain_ProcessExit(object? sender, EventArgs e) + { + Process proc = Process.GetCurrentProcess(); + Console.WriteLine($"Dynamo exiting with Peak physical memory {proc.PeakWorkingSet64} bytes"); + if (proc.HasExited) + { + Console.WriteLine($"Dynamo exiting with code {proc.ExitCode}"); + } + } + + private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) + { + Console.WriteLine($"Unhandled exception: {e}"); + } + + + public ExternalDBApplicationResult OnStartup(ControlledApplication application) + { + AppDomain.CurrentDomain.AssemblyResolve += DynamoPathResolver.ResolveAssembly; + AssemblyLoadContext.Default.Resolving += DynamoPathResolver.Default_Resolving; + + AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; + AppDomain.CurrentDomain.ProcessExit += CurrentDomain_ProcessExit; + + Console.WriteLine("<> Starting to load D4DA"); + + Console.WriteLine("Loaded assemblies:"); + foreach (var item in AppDomain.CurrentDomain.GetAssemblies()) + { + var name = item?.GetName()?.Name; + if (name.Contains("Revit", StringComparison.OrdinalIgnoreCase) || item.Location.Contains("Revit", StringComparison.OrdinalIgnoreCase)) + { + Console.WriteLine(name); + } + + } + + try + { + RevitServices.Transactions.TransactionManager.SetupManager(new RevitServices.Transactions.AutomaticTransactionStrategy()); + ElementBinder.IsEnabled = true; + + RevitServicesUpdater.Initialize(Updaters); + + DesignAutomationBridge.DesignAutomationReadyEvent += DesignAutomationBridge_DesignAutomationReadyEvent; + + Console.WriteLine("<> D4DA Loaded"); + + return ExternalDBApplicationResult.Succeeded; + } + catch (Exception ex) + { + return ExternalDBApplicationResult.Failed; + } + } + + private void DesignAutomationBridge_DesignAutomationReadyEvent(object? sender, DesignAutomationReadyEventArgs e) + { + var da = new DynamoADApp(); + da.HandleDesignAutomationReadyEvent(sender, e); + } + } +} \ No newline at end of file diff --git a/src/DADynamoApp/DAHandler.cs b/src/DADynamoApp/DAHandler.cs new file mode 100644 index 0000000000..9fe8c879af --- /dev/null +++ b/src/DADynamoApp/DAHandler.cs @@ -0,0 +1,120 @@ +using DesignAutomationFramework; +using Autodesk.Revit.ApplicationServices; +using System.Reflection; +using Dynamo.Models; +using System.IO.Compression; +using DynamoPlayer; +using RevitServices.Persistence; + +namespace DADynamoApp +{ + public class DynamoADApp + { + private ControlledApplication ControlledApplication; + private DynamoModel model; + internal static DynamoPlayerLoggerConfiguration logConfig = new DynamoPlayerLoggerConfiguration() { DynamoLogLevel = Dynamo.Logging.LogLevel.Console, LogLevel = DynamoPlayer.LogLevel.Information }; + + private void CheckIfPythonExists(string inputFolder) + { + var pyDir = "python-3.9.12-embed-amd64"; + var pyRoot = Path.GetDirectoryName(model.PathManager.CommonDataDirectory); + var searchPath = Path.Combine(pyRoot, pyDir); + if (Directory.Exists(searchPath) && File.Exists(Path.Combine(searchPath, "python.exe"))) + { + return; + } + Console.WriteLine($"<> cPython not found at '{searchPath}'"); + var inputDistributionPath = Path.Combine(inputFolder, $"{pyDir}.zip"); + if (File.Exists(inputDistributionPath)) + { + Console.WriteLine("<> cPython distribution detected in input. Attempting to add it... "); + try + { + ZipFile.ExtractToDirectory(inputDistributionPath, searchPath); + Console.WriteLine("<> cPython added."); + } + catch (Exception ex) + { + Console.WriteLine($"<> Failed to add cPython: {ex.Message}"); + } + } + } + + private bool Loaded = false; + private string LoadMessage; + private string WorkItemFolder; + + public void HandleDesignAutomationReadyEvent(object sender, DesignAutomationReadyEventArgs e) + { + Console.WriteLine("<> DA event raised."); + WorkItemFolder = Directory.GetCurrentDirectory(); + var dynTempDir = Path.Combine(WorkItemFolder, "dyn_tmp"); + Console.WriteLine($"<> Work folder is '{WorkItemFolder}'"); + var app = e.DesignAutomationData?.RevitApp; + Console.WriteLine("<> Preparing Dynamo model. Vers 1"); + + + // Initialize Dynamo Core + // Preload ASM from Revit + // Preload Core libs from DynamoCore + // Preload NodeModels and libs from DynamoRevit + // Setup design automation + // Startup Player run request + + var hostloc = typeof(Autodesk.Revit.ApplicationServices.Application).Assembly.Location; + var asmLocation = Path.GetDirectoryName(hostloc); + Console.WriteLine($"using asm at location {asmLocation}"); + + var curFolder = Directory.GetParent(Assembly.GetExecutingAssembly().Location).FullName; + + + Console.WriteLine($"Is Loaded {LoadMessage}"); + + var cmdArgs = new Dynamo.Applications.StartupUtils.CommandLineArguments(); + cmdArgs.ASMPath = asmLocation; + cmdArgs.DisableAnalytics = true; + cmdArgs.ServiceMode = true; + cmdArgs.AnalyticsInfo = new() { HostName = "Revit_DA" }; + cmdArgs.ImportedPaths = [Path.Combine(curFolder, "nodes", "RevitNodes.dll"), Path.Combine(curFolder, "nodes", "DSRevitNodesUI.dll")]; + cmdArgs.UserDataFolder = Path.Combine(dynTempDir, "Dynamo Revit"); + cmdArgs.CommonDataFolder = Path.Combine(dynTempDir, "Dynamo"); + + DocumentManager.Instance.PrepareForAutomation(app); + + //true, asmLocation, "Revit_DA" + model = Dynamo.Applications.StartupUtils.MakeCLIModel(cmdArgs); + + LoadMessage = model != null ? "loaded" : "no loaded"; + Console.WriteLine($"Checking python in {curFolder}"); + CheckIfPythonExists(curFolder); + + var playerHost = new PlayerHostDynamoDefault(model, new DynamoPlayerLogger(logConfig)); + var workflows = new DynamoModelWorkflows( + playerHost, + new DynamoPlayerLogger(logConfig)); + + var controller = new DynamoControllerImplementation(playerHost, workflows, + new DynamoPlayerLogger(logConfig)); + + DynamoPlayerLogger.Initialize(playerHost); + + var dynHandler = new Handler(playerHost, [new DynamoController(controller)]); + + + var testFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + var res = dynHandler.HandleRoute("POST", "/v1/graph/run", File.ReadAllText(Path.Combine(testFolder, "test.json"))); + var output = res.Result; + + Console.WriteLine(Newtonsoft.Json.JsonConvert.SerializeObject(output)); + + model.RunCompleted += Model_RunCompleted; + + e.Succeeded = true; + } + + private void Model_RunCompleted(object sender, bool success) + { + Console.WriteLine($"Run Completed"); + } + } +} \ No newline at end of file diff --git a/src/DADynamoApp/DynamoPathResolver.cs b/src/DADynamoApp/DynamoPathResolver.cs new file mode 100644 index 0000000000..d0e1739591 --- /dev/null +++ b/src/DADynamoApp/DynamoPathResolver.cs @@ -0,0 +1,121 @@ +using System.Reflection; +using System.Runtime.Loader; + +namespace DADynamoApp +{ + internal static class DynamoPathResolver + { + public static string DynamoCorePath + { + get + { + if (string.IsNullOrEmpty(dynamopath)) + { + dynamopath = GetDynamoCorePath(); + } + return dynamopath; + } + } + + /// + /// Finds the Dynamo Core path by looking into registery or potentially a config file. + /// + /// The root folder path of Dynamo Core. + private static string GetDynamoCorePath() + { + var dynamoRevitRootDirectory = Path.GetDirectoryName(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)); + var dynamoRoot = GetDynamoRoot(dynamoRevitRootDirectory); + return dynamoRoot; + } + + /// + /// Gets Dynamo Root folder from the given DynamoRevit root. + /// + /// The root folder of DynamoRevit binaries + /// The root folder path of Dynamo Core + private static string GetDynamoRoot(string dynamoRevitRoot) + { + //TODO: use config file to setup Dynamo Path for debug builds. + + //When there is no config file, just replace DynamoRevit by Dynamo + //from the 'dynamoRevitRoot' folder. + var parent = new DirectoryInfo(dynamoRevitRoot); + var path = string.Empty; + while (null != parent && parent.Name != @"DynamoRevit") + { + path = Path.Combine(parent.Name, path); + parent = Directory.GetParent(parent.FullName); + } + + return parent != null ? Path.Combine(Path.GetDirectoryName(parent.FullName), @"Dynamo", path) : dynamoRevitRoot; + } + + private static string dynamopath; + + public static Assembly? Default_Resolving(AssemblyLoadContext arg1, AssemblyName args) + { + var assemblyPath = string.Empty; + var assemblyName = new AssemblyName(args.Name).Name + ".dll"; + + try + { + assemblyPath = Path.Combine(DynamoPathResolver.DynamoCorePath, assemblyName); + if (File.Exists(assemblyPath)) + { + return arg1.LoadFromAssemblyPath(assemblyPath); + } + + var assemblyLocation = Assembly.GetExecutingAssembly().Location; + var assemblyDirectory = Path.GetDirectoryName(assemblyLocation); + + // Try "Dynamo 0.x\Revit_20xx" folder first... + assemblyPath = Path.Combine(assemblyDirectory, assemblyName); + if (!File.Exists(assemblyPath)) + { + // If assembly cannot be found, try in "Dynamo 0.x" folder. + var parentDirectory = Directory.GetParent(assemblyDirectory); + assemblyPath = Path.Combine(parentDirectory.FullName, assemblyName); + } + + return (File.Exists(assemblyPath) ? arg1.LoadFromAssemblyPath(assemblyPath) : null); + } + catch (Exception ex) + { + throw new Exception(string.Format("The location of the assembly, {0} could not be resolved for loading.", assemblyPath), ex); + } + } + + public static Assembly ResolveAssembly(object sender, ResolveEventArgs args) + { + var assemblyPath = string.Empty; + var assemblyName = new AssemblyName(args.Name).Name + ".dll"; + + try + { + assemblyPath = Path.Combine(DynamoPathResolver.DynamoCorePath, assemblyName); + if (File.Exists(assemblyPath)) + { + return Assembly.LoadFrom(assemblyPath); + } + + var assemblyLocation = Assembly.GetExecutingAssembly().Location; + var assemblyDirectory = Path.GetDirectoryName(assemblyLocation); + + // Try "Dynamo 0.x\Revit_20xx" folder first... + assemblyPath = Path.Combine(assemblyDirectory, assemblyName); + if (!File.Exists(assemblyPath)) + { + // If assembly cannot be found, try in "Dynamo 0.x" folder. + var parentDirectory = Directory.GetParent(assemblyDirectory); + assemblyPath = Path.Combine(parentDirectory.FullName, assemblyName); + } + + return (File.Exists(assemblyPath) ? Assembly.LoadFrom(assemblyPath) : null); + } + catch (Exception ex) + { + throw new Exception(string.Format("The location of the assembly, {0} could not be resolved for loading.", assemblyPath), ex); + } + } + } +} diff --git a/src/DADynamoConsole/DADynamoConsole.csproj b/src/DADynamoConsole/DADynamoConsole.csproj new file mode 100644 index 0000000000..7e61a0b07e --- /dev/null +++ b/src/DADynamoConsole/DADynamoConsole.csproj @@ -0,0 +1,23 @@ + + + + + + + Exe + enable + enable + false + + + + + + + + + + + + + diff --git a/src/DADynamoConsole/Program.cs b/src/DADynamoConsole/Program.cs new file mode 100644 index 0000000000..c42620a3c2 --- /dev/null +++ b/src/DADynamoConsole/Program.cs @@ -0,0 +1,4 @@ +using System.Reflection; + +Assembly.LoadFrom(@"C:\Program Files\Autodesk\Revit 2025\RevitAPI.dll"); +DADynamoApp.ConsoleEntrypoint.DoStuff(); \ No newline at end of file diff --git a/src/DynamoRevit.All.sln b/src/DynamoRevit.All.sln index 04c5a8760a..ad24844616 100644 --- a/src/DynamoRevit.All.sln +++ b/src/DynamoRevit.All.sln @@ -76,64 +76,127 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "config", "config", "{956846 Config\user_local.props = Config\user_local.props EndProjectSection EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DADynamoApp", "DADynamoApp\DADynamoApp.csproj", "{66A0E1C8-2514-48B7-8406-536983F57F88}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DADynamoConsole", "DADynamoConsole\DADynamoConsole.csproj", "{A74FF970-C032-445D-8E41-8BBC70CC01AF}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU Debug|NET80 = Debug|NET80 + Release|Any CPU = Release|Any CPU Release|NET80 = Release|NET80 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution + {FD56AE51-739E-4893-8DE4-925D60C7097C}.Debug|Any CPU.ActiveCfg = Debug|NET70 + {FD56AE51-739E-4893-8DE4-925D60C7097C}.Debug|Any CPU.Build.0 = Debug|NET70 {FD56AE51-739E-4893-8DE4-925D60C7097C}.Debug|NET80.ActiveCfg = Debug|NET80 {FD56AE51-739E-4893-8DE4-925D60C7097C}.Debug|NET80.Build.0 = Debug|NET80 + {FD56AE51-739E-4893-8DE4-925D60C7097C}.Release|Any CPU.ActiveCfg = Release|NET70 + {FD56AE51-739E-4893-8DE4-925D60C7097C}.Release|Any CPU.Build.0 = Release|NET70 {FD56AE51-739E-4893-8DE4-925D60C7097C}.Release|NET80.ActiveCfg = Release|NET80 {FD56AE51-739E-4893-8DE4-925D60C7097C}.Release|NET80.Build.0 = Release|NET80 + {0BC2A611-BD0E-4FCC-A1DE-81F14ED369B2}.Debug|Any CPU.ActiveCfg = Debug|NET70 + {0BC2A611-BD0E-4FCC-A1DE-81F14ED369B2}.Debug|Any CPU.Build.0 = Debug|NET70 {0BC2A611-BD0E-4FCC-A1DE-81F14ED369B2}.Debug|NET80.ActiveCfg = Debug|NET80 {0BC2A611-BD0E-4FCC-A1DE-81F14ED369B2}.Debug|NET80.Build.0 = Debug|NET80 + {0BC2A611-BD0E-4FCC-A1DE-81F14ED369B2}.Release|Any CPU.ActiveCfg = Release|NET70 + {0BC2A611-BD0E-4FCC-A1DE-81F14ED369B2}.Release|Any CPU.Build.0 = Release|NET70 {0BC2A611-BD0E-4FCC-A1DE-81F14ED369B2}.Release|NET80.ActiveCfg = Release|NET80 {0BC2A611-BD0E-4FCC-A1DE-81F14ED369B2}.Release|NET80.Build.0 = Release|NET80 + {75940ACC-3708-4526-8D91-7E3365BAF682}.Debug|Any CPU.ActiveCfg = Debug|NET70 + {75940ACC-3708-4526-8D91-7E3365BAF682}.Debug|Any CPU.Build.0 = Debug|NET70 {75940ACC-3708-4526-8D91-7E3365BAF682}.Debug|NET80.ActiveCfg = Debug|NET80 {75940ACC-3708-4526-8D91-7E3365BAF682}.Debug|NET80.Build.0 = Debug|NET80 + {75940ACC-3708-4526-8D91-7E3365BAF682}.Release|Any CPU.ActiveCfg = Release|NET70 + {75940ACC-3708-4526-8D91-7E3365BAF682}.Release|Any CPU.Build.0 = Release|NET70 {75940ACC-3708-4526-8D91-7E3365BAF682}.Release|NET80.ActiveCfg = Release|NET80 {75940ACC-3708-4526-8D91-7E3365BAF682}.Release|NET80.Build.0 = Release|NET80 + {E4701F9E-41AB-4044-8166-85D924FEB632}.Debug|Any CPU.ActiveCfg = Debug|NET70 + {E4701F9E-41AB-4044-8166-85D924FEB632}.Debug|Any CPU.Build.0 = Debug|NET70 {E4701F9E-41AB-4044-8166-85D924FEB632}.Debug|NET80.ActiveCfg = Debug|NET80 {E4701F9E-41AB-4044-8166-85D924FEB632}.Debug|NET80.Build.0 = Debug|NET80 + {E4701F9E-41AB-4044-8166-85D924FEB632}.Release|Any CPU.ActiveCfg = Release|NET70 + {E4701F9E-41AB-4044-8166-85D924FEB632}.Release|Any CPU.Build.0 = Release|NET70 {E4701F9E-41AB-4044-8166-85D924FEB632}.Release|NET80.ActiveCfg = Release|NET80 {E4701F9E-41AB-4044-8166-85D924FEB632}.Release|NET80.Build.0 = Release|NET80 + {9E79DC8D-25B1-491F-B094-EA39DE1BBC66}.Debug|Any CPU.ActiveCfg = Debug|NET80 {9E79DC8D-25B1-491F-B094-EA39DE1BBC66}.Debug|NET80.ActiveCfg = Debug|NET80 {9E79DC8D-25B1-491F-B094-EA39DE1BBC66}.Debug|NET80.Build.0 = Debug|NET80 + {9E79DC8D-25B1-491F-B094-EA39DE1BBC66}.Release|Any CPU.ActiveCfg = Release|NET80 {9E79DC8D-25B1-491F-B094-EA39DE1BBC66}.Release|NET80.ActiveCfg = Release|NET80 {9E79DC8D-25B1-491F-B094-EA39DE1BBC66}.Release|NET80.Build.0 = Release|NET80 + {AD0499ED-50D3-46F4-9FC9-3F71D88C4870}.Debug|Any CPU.ActiveCfg = Debug|NET80 {AD0499ED-50D3-46F4-9FC9-3F71D88C4870}.Debug|NET80.ActiveCfg = Debug|NET80 {AD0499ED-50D3-46F4-9FC9-3F71D88C4870}.Debug|NET80.Build.0 = Debug|NET80 + {AD0499ED-50D3-46F4-9FC9-3F71D88C4870}.Release|Any CPU.ActiveCfg = Release|NET80 {AD0499ED-50D3-46F4-9FC9-3F71D88C4870}.Release|NET80.ActiveCfg = Release|NET80 {AD0499ED-50D3-46F4-9FC9-3F71D88C4870}.Release|NET80.Build.0 = Release|NET80 + {06B9E5B0-7C50-4351-9D88-E159DC25755F}.Debug|Any CPU.ActiveCfg = Debug|NET70 + {06B9E5B0-7C50-4351-9D88-E159DC25755F}.Debug|Any CPU.Build.0 = Debug|NET70 {06B9E5B0-7C50-4351-9D88-E159DC25755F}.Debug|NET80.ActiveCfg = Debug|NET80 {06B9E5B0-7C50-4351-9D88-E159DC25755F}.Debug|NET80.Build.0 = Debug|NET80 + {06B9E5B0-7C50-4351-9D88-E159DC25755F}.Release|Any CPU.ActiveCfg = Release|NET70 + {06B9E5B0-7C50-4351-9D88-E159DC25755F}.Release|Any CPU.Build.0 = Release|NET70 {06B9E5B0-7C50-4351-9D88-E159DC25755F}.Release|NET80.ActiveCfg = Release|NET80 {06B9E5B0-7C50-4351-9D88-E159DC25755F}.Release|NET80.Build.0 = Release|NET80 + {53D05530-CF64-4883-8F86-B2B819934F83}.Debug|Any CPU.ActiveCfg = Debug|NET70 + {53D05530-CF64-4883-8F86-B2B819934F83}.Debug|Any CPU.Build.0 = Debug|NET70 {53D05530-CF64-4883-8F86-B2B819934F83}.Debug|NET80.ActiveCfg = Debug|NET80 {53D05530-CF64-4883-8F86-B2B819934F83}.Debug|NET80.Build.0 = Debug|NET80 + {53D05530-CF64-4883-8F86-B2B819934F83}.Release|Any CPU.ActiveCfg = Release|NET70 + {53D05530-CF64-4883-8F86-B2B819934F83}.Release|Any CPU.Build.0 = Release|NET70 {53D05530-CF64-4883-8F86-B2B819934F83}.Release|NET80.ActiveCfg = Release|NET80 {53D05530-CF64-4883-8F86-B2B819934F83}.Release|NET80.Build.0 = Release|NET80 + {589F14D7-2937-479C-834A-D44197CB1930}.Debug|Any CPU.ActiveCfg = Debug|NET80 {589F14D7-2937-479C-834A-D44197CB1930}.Debug|NET80.ActiveCfg = Debug|NET80 {589F14D7-2937-479C-834A-D44197CB1930}.Debug|NET80.Build.0 = Debug|NET80 + {589F14D7-2937-479C-834A-D44197CB1930}.Release|Any CPU.ActiveCfg = Release|NET80 {589F14D7-2937-479C-834A-D44197CB1930}.Release|NET80.ActiveCfg = Release|NET80 {589F14D7-2937-479C-834A-D44197CB1930}.Release|NET80.Build.0 = Release|NET80 + {133FC760-5699-46D9-BEA6-E816B5F01016}.Debug|Any CPU.ActiveCfg = Debug|NET70 + {133FC760-5699-46D9-BEA6-E816B5F01016}.Debug|Any CPU.Build.0 = Debug|NET70 {133FC760-5699-46D9-BEA6-E816B5F01016}.Debug|NET80.ActiveCfg = Debug|NET80 {133FC760-5699-46D9-BEA6-E816B5F01016}.Debug|NET80.Build.0 = Debug|NET80 + {133FC760-5699-46D9-BEA6-E816B5F01016}.Release|Any CPU.ActiveCfg = Release|NET70 + {133FC760-5699-46D9-BEA6-E816B5F01016}.Release|Any CPU.Build.0 = Release|NET70 {133FC760-5699-46D9-BEA6-E816B5F01016}.Release|NET80.ActiveCfg = Release|NET80 {133FC760-5699-46D9-BEA6-E816B5F01016}.Release|NET80.Build.0 = Release|NET80 + {9ADADC68-36A3-4A21-9B54-298154A88720}.Debug|Any CPU.ActiveCfg = Debug|NET80 {9ADADC68-36A3-4A21-9B54-298154A88720}.Debug|NET80.ActiveCfg = Debug|NET80 {9ADADC68-36A3-4A21-9B54-298154A88720}.Debug|NET80.Build.0 = Debug|NET80 + {9ADADC68-36A3-4A21-9B54-298154A88720}.Release|Any CPU.ActiveCfg = Release|NET80 {9ADADC68-36A3-4A21-9B54-298154A88720}.Release|NET80.ActiveCfg = Release|NET80 {9ADADC68-36A3-4A21-9B54-298154A88720}.Release|NET80.Build.0 = Release|NET80 + {A31E274C-524A-40CA-85FF-595D3DB53777}.Debug|Any CPU.ActiveCfg = Debug|NET70 + {A31E274C-524A-40CA-85FF-595D3DB53777}.Debug|Any CPU.Build.0 = Debug|NET70 {A31E274C-524A-40CA-85FF-595D3DB53777}.Debug|NET80.ActiveCfg = Debug|NET80 {A31E274C-524A-40CA-85FF-595D3DB53777}.Debug|NET80.Build.0 = Debug|NET80 + {A31E274C-524A-40CA-85FF-595D3DB53777}.Release|Any CPU.ActiveCfg = Release|NET70 + {A31E274C-524A-40CA-85FF-595D3DB53777}.Release|Any CPU.Build.0 = Release|NET70 {A31E274C-524A-40CA-85FF-595D3DB53777}.Release|NET80.ActiveCfg = Release|NET80 {A31E274C-524A-40CA-85FF-595D3DB53777}.Release|NET80.Build.0 = Release|NET80 + {92A46535-D870-4E1A-AED0-7492789E9C4A}.Debug|Any CPU.ActiveCfg = Debug|NET70 + {92A46535-D870-4E1A-AED0-7492789E9C4A}.Debug|Any CPU.Build.0 = Debug|NET70 {92A46535-D870-4E1A-AED0-7492789E9C4A}.Debug|NET80.ActiveCfg = Debug|NET80 {92A46535-D870-4E1A-AED0-7492789E9C4A}.Debug|NET80.Build.0 = Debug|NET80 + {92A46535-D870-4E1A-AED0-7492789E9C4A}.Release|Any CPU.ActiveCfg = Release|NET70 + {92A46535-D870-4E1A-AED0-7492789E9C4A}.Release|Any CPU.Build.0 = Release|NET70 {92A46535-D870-4E1A-AED0-7492789E9C4A}.Release|NET80.ActiveCfg = Release|NET80 {92A46535-D870-4E1A-AED0-7492789E9C4A}.Release|NET80.Build.0 = Release|NET80 + {66A0E1C8-2514-48B7-8406-536983F57F88}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {66A0E1C8-2514-48B7-8406-536983F57F88}.Debug|Any CPU.Build.0 = Debug|Any CPU + {66A0E1C8-2514-48B7-8406-536983F57F88}.Debug|NET80.ActiveCfg = Debug|NET80 + {66A0E1C8-2514-48B7-8406-536983F57F88}.Debug|NET80.Build.0 = Debug|NET80 + {66A0E1C8-2514-48B7-8406-536983F57F88}.Release|Any CPU.ActiveCfg = Release|Any CPU + {66A0E1C8-2514-48B7-8406-536983F57F88}.Release|Any CPU.Build.0 = Release|Any CPU + {66A0E1C8-2514-48B7-8406-536983F57F88}.Release|NET80.ActiveCfg = Release|NET80 + {66A0E1C8-2514-48B7-8406-536983F57F88}.Release|NET80.Build.0 = Release|NET80 + {A74FF970-C032-445D-8E41-8BBC70CC01AF}.Debug|Any CPU.ActiveCfg = Debug|NET80 + {A74FF970-C032-445D-8E41-8BBC70CC01AF}.Debug|NET80.ActiveCfg = Debug|NET80 + {A74FF970-C032-445D-8E41-8BBC70CC01AF}.Debug|NET80.Build.0 = Debug|NET80 + {A74FF970-C032-445D-8E41-8BBC70CC01AF}.Release|Any CPU.ActiveCfg = Release|NET80 + {A74FF970-C032-445D-8E41-8BBC70CC01AF}.Release|NET80.ActiveCfg = Release|NET80 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/DynamoRevit/Properties/AssemblyInfo.cs b/src/DynamoRevit/Properties/AssemblyInfo.cs index 5996d78d11..58ea1f6a8b 100644 --- a/src/DynamoRevit/Properties/AssemblyInfo.cs +++ b/src/DynamoRevit/Properties/AssemblyInfo.cs @@ -9,4 +9,5 @@ [assembly: AssemblyCulture("")] [assembly: Guid("082cab33-cbc7-4e58-ae25-f0962f325d6e")] [assembly: InternalsVisibleTo("RevitTestServices")] -[assembly: InternalsVisibleTo("RevitSystemTests")] \ No newline at end of file +[assembly: InternalsVisibleTo("RevitSystemTests")] +[assembly: InternalsVisibleTo("DADynamoApp")] \ No newline at end of file diff --git a/src/DynamoRevit/ViewModel/RevitWatchHandler.cs b/src/DynamoRevit/ViewModel/RevitWatchHandler.cs index fe5f2ca99a..ee7e6c37cf 100644 --- a/src/DynamoRevit/ViewModel/RevitWatchHandler.cs +++ b/src/DynamoRevit/ViewModel/RevitWatchHandler.cs @@ -3,9 +3,11 @@ using System.Globalization; using System.Linq; using Autodesk.Revit.DB; +using Autodesk.Revit.UI; using Dynamo.Interfaces; using Dynamo.ViewModels; using ProtoCore.Mirror; +using Revit.GeometryConversion; using RevitServices.Persistence; using Element = Revit.Elements.Element; @@ -29,7 +31,44 @@ public RevitWatchHandler(IPreferences prefs) preferences = prefs; } - private WatchViewModel ProcessThing(Element element, List preferredDictionaryOrdering, ProtoCore.RuntimeCore runtimeCore, string tag, bool showRawData, WatchHandlerCallback callback) + // helper for zooming to clicked green Id + internal static void ZoomToLinkedElement(Element element) + { + + UIDocument uiDoc = DocumentManager.Instance.CurrentUIDocument; + Autodesk.Revit.DB.View activeView = uiDoc.ActiveView; + // get active UI view to use + UIView uiview = uiDoc.GetOpenUIViews().FirstOrDefault(uv => uv.ViewId.Equals(activeView.Id)); + Transform linkTransform = Revit.Elements.LinkElement.LinkTransform(element).ToTransform(); + + // use the center of the BoundingBox as zoom center + BoundingBoxXYZ bb = element.InternalElement.get_BoundingBox(null); + // if the BBox cannot be found, attempt to find it using the active view + if (bb == null) + { + bb = element.InternalElement.get_BoundingBox(activeView); + } + // finally, if the BB cannot be found at all + if (bb == null) + { + TaskDialog.Show("Revit", "No good view can be found."); + return; + } + XYZ bbCenter = (bb.Max + bb.Min) / 2; + double zoomOffsetX = bb.Max.X - bbCenter.X; + double zoomOffsetY = bb.Max.Y - bbCenter.Y; + double zoomOffsetZ = bb.Max.Z - bbCenter.Z; + XYZ locationPt = Revit.Elements.LinkElement.TransformPoint(bbCenter, linkTransform); + + if (locationPt != null) + { + XYZ min = new XYZ(locationPt.X - zoomOffsetX, locationPt.Y - zoomOffsetY, locationPt.Z - zoomOffsetZ); + XYZ max = new XYZ(locationPt.X + zoomOffsetX, locationPt.Y + zoomOffsetY, locationPt.Z + zoomOffsetZ); + uiview.ZoomAndCenterRectangle(min, max); + } + } + + private WatchViewModel ProcessThing(Element element, List preferredDictionaryOrdering, ProtoCore.RuntimeCore runtimeCore, string tag, bool showRawData, WatchHandlerCallback callback) { var id = element.Id; @@ -43,7 +82,7 @@ private WatchViewModel ProcessThing(Element element, List preferredDicti Document currrentDoc = Revit.Application.Document.Current.InternalDocument; if (!(elementDoc.Equals(currrentDoc))) { - Revit.Elements.LinkElement.ZoomToLinkedElement(element); + ZoomToLinkedElement(element); } else { diff --git a/src/Libraries/RevitNodes/Elements/AdaptiveComponent.cs b/src/Libraries/RevitNodes/Elements/AdaptiveComponent.cs index 461a43f3c3..4f0e95d22b 100644 --- a/src/Libraries/RevitNodes/Elements/AdaptiveComponent.cs +++ b/src/Libraries/RevitNodes/Elements/AdaptiveComponent.cs @@ -555,7 +555,7 @@ private static AdaptiveComponent[] InternalByPoints(Point[][] points, FamilyType int numOfPoints = remainingPoints[i].Length; var aPoints = remainingPoints[i].ToXyzs(); - var creationData = DocumentManager.Instance.CurrentUIApplication.Application.Create. + var creationData = DocumentManager.Instance.CurrentDBDocument.Application.Create. NewFamilyInstanceCreationData(familyType.InternalFamilySymbol, aPoints); if (creationData != null) diff --git a/src/Libraries/RevitNodes/Elements/Element.cs b/src/Libraries/RevitNodes/Elements/Element.cs index 4c3fde6280..683b8032ed 100644 --- a/src/Libraries/RevitNodes/Elements/Element.cs +++ b/src/Libraries/RevitNodes/Elements/Element.cs @@ -289,16 +289,7 @@ public virtual void Dispose() { if(this.InternalElement is View && InternalElement.IsValidObject) { - Autodesk.Revit.UI.UIDocument uIDocument = new Autodesk.Revit.UI.UIDocument(Document); - var openedViews = uIDocument.GetOpenUIViews().ToList(); - var shouldClosedViews = openedViews.FindAll(x => InternalElement.Id == x.ViewId); - foreach (var v in shouldClosedViews) - { - if (uIDocument.GetOpenUIViews().ToList().Count() > 1) - v.Close(); - else - throw new InvalidOperationException(string.Format(Properties.Resources.CantCloseLastOpenView, this.ToString())); - } + } DocumentManager.Instance.DeleteElement(new ElementUUID(InternalUniqueId)); } @@ -492,7 +483,7 @@ public Element SetParameterByName(string parameterName, object value) public Element OverrideColorInView(Color color) { TransactionManager.Instance.EnsureInTransaction(DocumentManager.Instance.CurrentDBDocument); - var view = DocumentManager.Instance.CurrentUIDocument.ActiveView; + var view = DocumentManager.Instance.CurrentDBDocument.ActiveView; var ogs = new Autodesk.Revit.DB.OverrideGraphicSettings(); var patternCollector = new FilteredElementCollector(DocumentManager.Instance.CurrentDBDocument); @@ -518,7 +509,7 @@ public Element OverrideColorInView(Color color) public Element OverrideInView(Revit.Filter.OverrideGraphicSettings overrides, bool hide = false) { TransactionManager.Instance.EnsureInTransaction(DocumentManager.Instance.CurrentDBDocument); - var view = DocumentManager.Instance.CurrentUIDocument.ActiveView; + var view = DocumentManager.Instance.CurrentDBDocument.ActiveView; view.SetElementOverrides(InternalElementId, overrides.InternalOverrideGraphicSettings); if (hide) view.HideElements(new List() { InternalElementId }); else view.UnhideElements(new List() { InternalElementId }); @@ -534,7 +525,7 @@ public Revit.Filter.OverrideGraphicSettings OverridesInView { get { - var view = DocumentManager.Instance.CurrentUIDocument.ActiveView; + var view = DocumentManager.Instance.CurrentDBDocument.ActiveView; return new Filter.OverrideGraphicSettings(view.GetElementOverrides(InternalElementId)); } diff --git a/src/Libraries/RevitNodes/Elements/LinkElement.cs b/src/Libraries/RevitNodes/Elements/LinkElement.cs index f20f0dc3b8..103f8490b8 100644 --- a/src/Libraries/RevitNodes/Elements/LinkElement.cs +++ b/src/Libraries/RevitNodes/Elements/LinkElement.cs @@ -4,7 +4,7 @@ using Autodesk.DesignScript.Geometry; using Autodesk.DesignScript.Runtime; using Autodesk.Revit.DB; -using Autodesk.Revit.UI; +//using Autodesk.Revit.UI; using Dynamo.Graph.Nodes; using Revit.GeometryConversion; using RevitServices.Persistence; @@ -50,44 +50,6 @@ public static class LinkElement } return matchingLinkInstances; } - - - // helper for zooming to clicked green Id - internal static void ZoomToLinkedElement(Element element) - { - - UIDocument uiDoc = DocumentManager.Instance.CurrentUIDocument; - Autodesk.Revit.DB.View activeView = uiDoc.ActiveView; - // get active UI view to use - UIView uiview = uiDoc.GetOpenUIViews().FirstOrDefault(uv => uv.ViewId.Equals(activeView.Id)); - Transform linkTransform = Revit.Elements.LinkElement.LinkTransform(element).ToTransform(); - - // use the center of the BoundingBox as zoom center - BoundingBoxXYZ bb = element.InternalElement.get_BoundingBox(null); - // if the BBox cannot be found, attempt to find it using the active view - if (bb==null) - { - bb=element.InternalElement.get_BoundingBox(activeView); - } - // finally, if the BB cannot be found at all - if (bb==null) - { - TaskDialog.Show("Revit", "No good view can be found."); - return; - } - XYZ bbCenter = (bb.Max + bb.Min) / 2; - double zoomOffsetX = bb.Max.X - bbCenter.X; - double zoomOffsetY = bb.Max.Y - bbCenter.Y; - double zoomOffsetZ = bb.Max.Z - bbCenter.Z; - XYZ locationPt = Revit.Elements.LinkElement.TransformPoint(bbCenter, linkTransform); - - if (locationPt != null) - { - XYZ min = new XYZ(locationPt.X - zoomOffsetX, locationPt.Y - zoomOffsetY, locationPt.Z - zoomOffsetZ); - XYZ max = new XYZ(locationPt.X + zoomOffsetX, locationPt.Y + zoomOffsetY, locationPt.Z + zoomOffsetZ); - uiview.ZoomAndCenterRectangle(min, max); - } - } // helper to return element's location with transform internal static object GetLinkElementLocation(Element linkElement) diff --git a/src/Libraries/RevitNodes/Elements/Views/Sheet.cs b/src/Libraries/RevitNodes/Elements/Views/Sheet.cs index b28407d482..ebdde30b6f 100644 --- a/src/Libraries/RevitNodes/Elements/Views/Sheet.cs +++ b/src/Libraries/RevitNodes/Elements/Views/Sheet.cs @@ -773,6 +773,7 @@ public static Sheet DuplicateSheet(Sheet sheet, bool duplicateWithContents = fal } } } +#if UI_SUPPORT if(newSheet == null) { Autodesk.Revit.UI.UIDocument uIDocument = new Autodesk.Revit.UI.UIDocument(Document); @@ -789,7 +790,8 @@ public static Sheet DuplicateSheet(Sheet sheet, bool duplicateWithContents = fal } } Document.Delete(elementIds); - } + } +#endif } if (newSheet == null && TraceElements.Count == 0) @@ -842,7 +844,7 @@ public static Sheet DuplicateSheet(Sheet sheet, bool duplicateWithContents = fal return newSheet; } - #endregion +#endregion #region Internal static constructors diff --git a/src/Libraries/RevitNodes/Elements/Views/View.cs b/src/Libraries/RevitNodes/Elements/Views/View.cs index f8ab6d7cc6..8310ad22b7 100644 --- a/src/Libraries/RevitNodes/Elements/Views/View.cs +++ b/src/Libraries/RevitNodes/Elements/Views/View.cs @@ -618,6 +618,8 @@ public static Revit.Elements.Views.View DuplicateView(View view, string viewDupl { newViewName = prefix + view.Name + suffix; } + +#if UI_SUPPORT Autodesk.Revit.UI.UIDocument uIDocument = new Autodesk.Revit.UI.UIDocument(Document); var openedViews = uIDocument.GetOpenUIViews().ToList(); @@ -630,6 +632,7 @@ public static Revit.Elements.Views.View DuplicateView(View view, string viewDupl else count--; } +#endif if (count == 0) { @@ -651,6 +654,7 @@ public static Revit.Elements.Views.View DuplicateView(View view, string viewDupl var param = newView.InternalView.get_Parameter(BuiltInParameter.VIEW_NAME); param.Set(newViewName); } +#if UI_SUPPORT if (viewElement != null) { var shouldClosedViews = openedViews.FindAll(x => viewElement.Id == x.ViewId); @@ -664,7 +668,8 @@ public static Revit.Elements.Views.View DuplicateView(View view, string viewDupl throw new InvalidOperationException(string.Format(Properties.Resources.CantCloseLastOpenView, viewElement.ToString())); } } - } + } +#endif } ElementBinder.CleanupAndSetElementForTrace(Document, newView.InternalElement); @@ -704,7 +709,7 @@ private static Boolean CheckUniqueViewName(String viewName) return IsUnique; } - #endregion +#endregion #region CropBox diff --git a/src/Libraries/RevitNodes/RevitNodeModel.cs b/src/Libraries/RevitNodes/RevitNodeModel.cs new file mode 100644 index 0000000000..96e8d5290b --- /dev/null +++ b/src/Libraries/RevitNodes/RevitNodeModel.cs @@ -0,0 +1,14 @@ +using Dynamo.Graph.Nodes; +using Newtonsoft.Json; +using System.Collections.Generic; + +namespace Dynamo.Applications.Models +{ + public abstract class RevitNodeModel : NodeModel + { + public RevitNodeModel() { } + + [JsonConstructor] + public RevitNodeModel(IEnumerable inPorts, IEnumerable outPorts) : base(inPorts, outPorts) { } + } +} \ No newline at end of file diff --git a/src/Libraries/RevitNodes/Transaction/Transaction.cs b/src/Libraries/RevitNodes/Transaction/Transaction.cs index fbafb5faab..ff79e401e0 100644 --- a/src/Libraries/RevitNodes/Transaction/Transaction.cs +++ b/src/Libraries/RevitNodes/Transaction/Transaction.cs @@ -30,7 +30,9 @@ public static object Start(object input) public static object End(object input) { TransactionManager.Instance.ForceCloseTransaction(); +#if UI_SUPPORT DocumentManager.Instance.CurrentUIDocument.RefreshActiveView(); +#endif return input; } } diff --git a/src/Libraries/RevitNodesUI/Elements.cs b/src/Libraries/RevitNodesUI/Elements.cs index 43050bb310..60333139d7 100644 --- a/src/Libraries/RevitNodesUI/Elements.cs +++ b/src/Libraries/RevitNodesUI/Elements.cs @@ -281,8 +281,8 @@ public ElementsInView() OutPorts.Add(new PortModel(PortType.Output, this, new PortData("elements", Properties.Resources.PortDataAllVisibleElementsToolTip))); RegisterAllPorts(); - DynamoRevitApp.EventHandlerProxy.ViewActivated += RevitDynamoModel_RevitDocumentChanged; - DynamoRevitApp.EventHandlerProxy.DocumentOpened += RevitDynamoModel_RevitDocumentChanged; + //DynamoRevitApp.EventHandlerProxy.ViewActivated += RevitDynamoModel_RevitDocumentChanged; + //DynamoRevitApp.EventHandlerProxy.DocumentOpened += RevitDynamoModel_RevitDocumentChanged; RevitServicesUpdater.Instance.ElementsUpdated += RevitServicesUpdaterOnElementsUpdated; RevitDynamoModel_RevitDocumentChanged(null, null); @@ -291,8 +291,8 @@ public ElementsInView() [JsonConstructor] public ElementsInView(IEnumerable inPorts, IEnumerable outPorts) : base(inPorts, outPorts) { - DynamoRevitApp.EventHandlerProxy.ViewActivated += RevitDynamoModel_RevitDocumentChanged; - DynamoRevitApp.EventHandlerProxy.DocumentOpened += RevitDynamoModel_RevitDocumentChanged; + //DynamoRevitApp.EventHandlerProxy.ViewActivated += RevitDynamoModel_RevitDocumentChanged; + //DynamoRevitApp.EventHandlerProxy.DocumentOpened += RevitDynamoModel_RevitDocumentChanged; RevitServicesUpdater.Instance.ElementsUpdated += RevitServicesUpdaterOnElementsUpdated; RevitDynamoModel_RevitDocumentChanged(null, null); @@ -300,8 +300,8 @@ public ElementsInView(IEnumerable inPorts, IEnumerable out public override void Dispose() { - DynamoRevitApp.EventHandlerProxy.ViewActivated -= RevitDynamoModel_RevitDocumentChanged; - DynamoRevitApp.EventHandlerProxy.DocumentOpened -= RevitDynamoModel_RevitDocumentChanged; + //DynamoRevitApp.EventHandlerProxy.ViewActivated -= RevitDynamoModel_RevitDocumentChanged; + //DynamoRevitApp.EventHandlerProxy.DocumentOpened -= RevitDynamoModel_RevitDocumentChanged; RevitServicesUpdater.Instance.ElementsUpdated -= RevitServicesUpdaterOnElementsUpdated; diff --git a/src/Libraries/RevitNodesUI/RevitDropDown.cs b/src/Libraries/RevitNodesUI/RevitDropDown.cs index 62e59e4d48..bc0798337e 100644 --- a/src/Libraries/RevitNodesUI/RevitDropDown.cs +++ b/src/Libraries/RevitNodesUI/RevitDropDown.cs @@ -48,14 +48,14 @@ public abstract class RevitDropDownBase : DSDropDownBase protected RevitDropDownBase(string value) : base(value) { RevitServicesUpdater.Instance.ElementsUpdated += Updater_ElementsUpdated; - DynamoRevitApp.EventHandlerProxy.DocumentOpened += Controller_RevitDocumentChanged; + //DynamoRevitApp.EventHandlerProxy.DocumentOpened += Controller_RevitDocumentChanged; } [JsonConstructor] public RevitDropDownBase(string value, IEnumerable inPorts, IEnumerable outPorts) : base(value, inPorts, outPorts) { RevitServicesUpdater.Instance.ElementsUpdated += Updater_ElementsUpdated; - DynamoRevitApp.EventHandlerProxy.DocumentOpened += Controller_RevitDocumentChanged; + //DynamoRevitApp.EventHandlerProxy.DocumentOpened += Controller_RevitDocumentChanged; } void Controller_RevitDocumentChanged(object sender, EventArgs e) @@ -90,7 +90,7 @@ private void Updater_ElementsUpdated(object sender, ElementUpdateEventArgs e) public override void Dispose() { RevitServicesUpdater.Instance.ElementsUpdated -= Updater_ElementsUpdated; - DynamoRevitApp.EventHandlerProxy.DocumentOpened -= Controller_RevitDocumentChanged; + //DynamoRevitApp.EventHandlerProxy.DocumentOpened -= Controller_RevitDocumentChanged; base.Dispose(); } diff --git a/src/Libraries/RevitNodesUI/RevitTypes.cs b/src/Libraries/RevitNodesUI/RevitTypes.cs index f4bc73c43a..7bbb3eb98f 100644 --- a/src/Libraries/RevitNodesUI/RevitTypes.cs +++ b/src/Libraries/RevitNodesUI/RevitTypes.cs @@ -1,20 +1,7 @@ using System; using System.Collections.Generic; -using System.Linq; -using System.Text; using Newtonsoft.Json; -using Autodesk.DesignScript.Geometry; -using Autodesk.DesignScript.Runtime; -using DSRevitNodesUI; -using RVT = Autodesk.Revit.DB; -using RevitServices.Persistence; -using RevitServices.Transactions; - -using Dynamo.Utilities; -using Dynamo.Models; -using Dynamo.Nodes; using ProtoCore.AST.AssociativeAST; -using CoreNodeModels.Properties; using Dynamo.Graph.Nodes; namespace DSRevitNodesUI diff --git a/src/Libraries/RevitServices/Elements/DisposeLogic.cs b/src/Libraries/RevitServices/Elements/DisposeLogic.cs index dddf40e144..4751d5ac00 100644 --- a/src/Libraries/RevitServices/Elements/DisposeLogic.cs +++ b/src/Libraries/RevitServices/Elements/DisposeLogic.cs @@ -1,4 +1,8 @@ -namespace RevitServices.Elements +using Autodesk.Revit.DB; +using System; +using System.Linq; + +namespace RevitServices.Elements { public class DisposeLogic { @@ -17,5 +21,21 @@ public class DisposeLogic /// removed. /// public static bool IsClosingHomeworkspace { get; set; } + + internal void CloseDocumentsOnElementDispo(Document document, Element elementId) + { +#if UI_SUPPORT + Autodesk.Revit.UI.UIDocument uIDocument = new Autodesk.Revit.UI.UIDocument(document); + var openedViews = uIDocument.GetOpenUIViews().ToList(); + var shouldClosedViews = openedViews.FindAll(x => elementId.Id == x.ViewId); + foreach (var v in shouldClosedViews) + { + if (uIDocument.GetOpenUIViews().ToList().Count() > 1) + v.Close(); + else + throw new InvalidOperationException(string.Format(Properties.Resources.CantCloseLastOpenView, this.ToString())); + } +#endif + } } } diff --git a/src/Libraries/RevitServices/Events/EventHandlerProxy.cs b/src/Libraries/RevitServices/Events/EventHandlerProxy.cs index 424765351a..b08a5c2e41 100644 --- a/src/Libraries/RevitServices/Events/EventHandlerProxy.cs +++ b/src/Libraries/RevitServices/Events/EventHandlerProxy.cs @@ -1,6 +1,5 @@ using System; using Autodesk.Revit.DB.Events; -using Autodesk.Revit.UI.Events; namespace RevitServices.EventHandler { @@ -13,8 +12,10 @@ public class EventHandlerProxy public event EventHandler DocumentOpened; public event EventHandler DocumentClosing; public event EventHandler DocumentClosed; - public event EventHandler ViewActivating; - public event EventHandler ViewActivated; +#if UI_SUPPORT + public event EventHandler ViewActivating; + public event EventHandler ViewActivated; +#endif public void OnApplicationDocumentOpened(object sender, DocumentOpenedEventArgs args) { @@ -31,15 +32,17 @@ public void OnApplicationDocumentClosed(object sender, DocumentClosedEventArgs a InvokeEventHandler(DocumentClosed, sender, args); } - public void OnApplicationViewActivating(object sender, ViewActivatingEventArgs args) +#if UI_SUPPORT + public void OnApplicationViewActivating(object sender, Autodesk.Revit.UI.Events.ViewActivatingEventArgs args) { InvokeEventHandler(ViewActivating, sender, args); } - public void OnApplicationViewActivated(object sender, ViewActivatedEventArgs args) + public void OnApplicationViewActivated(object sender, Autodesk.Revit.UI.Events.ViewActivatedEventArgs args) { InvokeEventHandler(ViewActivated, sender, args); } +#endif private void InvokeEventHandler(EventHandler eventHandler, object sender, T args) where T: EventArgs { diff --git a/src/Libraries/RevitServices/Persistence/DocumentManager.cs b/src/Libraries/RevitServices/Persistence/DocumentManager.cs index b92124e6a7..480f87a251 100644 --- a/src/Libraries/RevitServices/Persistence/DocumentManager.cs +++ b/src/Libraries/RevitServices/Persistence/DocumentManager.cs @@ -1,8 +1,8 @@ using System; using System.Collections.Generic; using System.Linq; +using Autodesk.Revit.ApplicationServices; using Autodesk.Revit.DB; -using Autodesk.Revit.UI; using RevitServices.Elements; using RevitServices.Transactions; @@ -116,6 +116,8 @@ public void HandleDocumentActivation(View revitView) ActiveDocumentHashCode = revitView.Document.GetHashCode(); } + private Document currentDBDocument; + /// /// Provides the currently active DB document. /// This is based on the CurrentUIDocument @@ -123,8 +125,15 @@ public void HandleDocumentActivation(View revitView) public Document CurrentDBDocument { get { +#if UI_SUPPORT var c = CurrentUIDocument; return c == null ? null : c.Document; +#else + return currentDBDocument; +#endif + } + set { + currentDBDocument = value; } } @@ -143,17 +152,24 @@ public Document CurrentDBDocument { /// public int ActiveDocumentHashCode { get; private set; } + + /// + /// Provides the current Application + /// + public Application CurrentApplication { get; set; } + +#if UI_SUPPORT /// /// Provides the currently active UI document. /// This is the document to which Dynamo is bound. /// - public UIDocument CurrentUIDocument {get; set; } + public Autodesk.Revit.UI.UIDocument CurrentUIDocument {get; set; } /// /// Provides the current UIApplication /// - public UIApplication CurrentUIApplication { get; set; } - + public Autodesk.Revit.UI.UIApplication CurrentUIApplication { get; set; } +#endif /// /// Trigger a document regeneration in the idle context or without /// depending on the state of the transaction manager. @@ -171,5 +187,22 @@ public static void Regenerate() Instance.CurrentDBDocument.Regenerate(); } } + + public void PrepareForAutomation(Application app) + { + if (app == null) + { + return; + } + CurrentApplication = app; + foreach (Document d in app.Documents) + { + if (!d.IsLinked) + { + CurrentDBDocument = d; + break; + } + } + } } } diff --git a/src/Libraries/RevitServices/Properties/AssemblyInfo.cs b/src/Libraries/RevitServices/Properties/AssemblyInfo.cs index fa60dc9887..75c9f633d7 100644 --- a/src/Libraries/RevitServices/Properties/AssemblyInfo.cs +++ b/src/Libraries/RevitServices/Properties/AssemblyInfo.cs @@ -1,4 +1,5 @@ using System.Reflection; +using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following @@ -9,3 +10,5 @@ // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("026be738-81b6-4a11-bc14-36ee3f718921")] +[assembly: InternalsVisibleTo("DADynamoApp")] +[assembly: InternalsVisibleTo("RevitNodes")] diff --git a/src/Libraries/RevitServices/Properties/Resources.Designer.cs b/src/Libraries/RevitServices/Properties/Resources.Designer.cs index a5a8033dae..8cac03742b 100644 --- a/src/Libraries/RevitServices/Properties/Resources.Designer.cs +++ b/src/Libraries/RevitServices/Properties/Resources.Designer.cs @@ -19,7 +19,7 @@ namespace RevitServices.Properties { // class via a tool like ResGen or Visual Studio. // To add or remove a member, edit your .ResX file then rerun ResGen // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class Resources { @@ -60,6 +60,15 @@ internal Resources() { } } + /// + /// Looks up a localized string similar to This is the last opened view {0} , can't be delete. + /// + internal static string CantCloseLastOpenView { + get { + return ResourceManager.GetString("CantCloseLastOpenView", resourceCulture); + } + } + /// /// Looks up a localized string similar to DynamoRevit TransactionManager is disabled. This Node is disabled as new Revit transactions are not supported in this mode.. /// diff --git a/src/Libraries/RevitServices/Properties/Resources.en-US.resx b/src/Libraries/RevitServices/Properties/Resources.en-US.resx index 01e2a8af80..c59e991048 100644 --- a/src/Libraries/RevitServices/Properties/Resources.en-US.resx +++ b/src/Libraries/RevitServices/Properties/Resources.en-US.resx @@ -117,6 +117,9 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + This is the last opened view {0} , can't be delete + DynamoRevit TransactionManager is disabled. This Node is disabled as new Revit transactions are not supported in this mode. diff --git a/src/Libraries/RevitServices/Properties/Resources.resx b/src/Libraries/RevitServices/Properties/Resources.resx index 01e2a8af80..c59e991048 100644 --- a/src/Libraries/RevitServices/Properties/Resources.resx +++ b/src/Libraries/RevitServices/Properties/Resources.resx @@ -117,6 +117,9 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + This is the last opened view {0} , can't be delete + DynamoRevit TransactionManager is disabled. This Node is disabled as new Revit transactions are not supported in this mode. From 027999218007843cac18c39c0c799de0e4e05a8b Mon Sep 17 00:00:00 2001 From: pinzart90 Date: Fri, 4 Apr 2025 12:27:13 -0400 Subject: [PATCH 26/70] update --- src/DynamoRevit.All.sln | 63 -------------------- src/DynamoRevit.DA.sln | 123 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 123 insertions(+), 63 deletions(-) create mode 100644 src/DynamoRevit.DA.sln diff --git a/src/DynamoRevit.All.sln b/src/DynamoRevit.All.sln index ad24844616..04c5a8760a 100644 --- a/src/DynamoRevit.All.sln +++ b/src/DynamoRevit.All.sln @@ -76,127 +76,64 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "config", "config", "{956846 Config\user_local.props = Config\user_local.props EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DADynamoApp", "DADynamoApp\DADynamoApp.csproj", "{66A0E1C8-2514-48B7-8406-536983F57F88}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DADynamoConsole", "DADynamoConsole\DADynamoConsole.csproj", "{A74FF970-C032-445D-8E41-8BBC70CC01AF}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU Debug|NET80 = Debug|NET80 - Release|Any CPU = Release|Any CPU Release|NET80 = Release|NET80 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {FD56AE51-739E-4893-8DE4-925D60C7097C}.Debug|Any CPU.ActiveCfg = Debug|NET70 - {FD56AE51-739E-4893-8DE4-925D60C7097C}.Debug|Any CPU.Build.0 = Debug|NET70 {FD56AE51-739E-4893-8DE4-925D60C7097C}.Debug|NET80.ActiveCfg = Debug|NET80 {FD56AE51-739E-4893-8DE4-925D60C7097C}.Debug|NET80.Build.0 = Debug|NET80 - {FD56AE51-739E-4893-8DE4-925D60C7097C}.Release|Any CPU.ActiveCfg = Release|NET70 - {FD56AE51-739E-4893-8DE4-925D60C7097C}.Release|Any CPU.Build.0 = Release|NET70 {FD56AE51-739E-4893-8DE4-925D60C7097C}.Release|NET80.ActiveCfg = Release|NET80 {FD56AE51-739E-4893-8DE4-925D60C7097C}.Release|NET80.Build.0 = Release|NET80 - {0BC2A611-BD0E-4FCC-A1DE-81F14ED369B2}.Debug|Any CPU.ActiveCfg = Debug|NET70 - {0BC2A611-BD0E-4FCC-A1DE-81F14ED369B2}.Debug|Any CPU.Build.0 = Debug|NET70 {0BC2A611-BD0E-4FCC-A1DE-81F14ED369B2}.Debug|NET80.ActiveCfg = Debug|NET80 {0BC2A611-BD0E-4FCC-A1DE-81F14ED369B2}.Debug|NET80.Build.0 = Debug|NET80 - {0BC2A611-BD0E-4FCC-A1DE-81F14ED369B2}.Release|Any CPU.ActiveCfg = Release|NET70 - {0BC2A611-BD0E-4FCC-A1DE-81F14ED369B2}.Release|Any CPU.Build.0 = Release|NET70 {0BC2A611-BD0E-4FCC-A1DE-81F14ED369B2}.Release|NET80.ActiveCfg = Release|NET80 {0BC2A611-BD0E-4FCC-A1DE-81F14ED369B2}.Release|NET80.Build.0 = Release|NET80 - {75940ACC-3708-4526-8D91-7E3365BAF682}.Debug|Any CPU.ActiveCfg = Debug|NET70 - {75940ACC-3708-4526-8D91-7E3365BAF682}.Debug|Any CPU.Build.0 = Debug|NET70 {75940ACC-3708-4526-8D91-7E3365BAF682}.Debug|NET80.ActiveCfg = Debug|NET80 {75940ACC-3708-4526-8D91-7E3365BAF682}.Debug|NET80.Build.0 = Debug|NET80 - {75940ACC-3708-4526-8D91-7E3365BAF682}.Release|Any CPU.ActiveCfg = Release|NET70 - {75940ACC-3708-4526-8D91-7E3365BAF682}.Release|Any CPU.Build.0 = Release|NET70 {75940ACC-3708-4526-8D91-7E3365BAF682}.Release|NET80.ActiveCfg = Release|NET80 {75940ACC-3708-4526-8D91-7E3365BAF682}.Release|NET80.Build.0 = Release|NET80 - {E4701F9E-41AB-4044-8166-85D924FEB632}.Debug|Any CPU.ActiveCfg = Debug|NET70 - {E4701F9E-41AB-4044-8166-85D924FEB632}.Debug|Any CPU.Build.0 = Debug|NET70 {E4701F9E-41AB-4044-8166-85D924FEB632}.Debug|NET80.ActiveCfg = Debug|NET80 {E4701F9E-41AB-4044-8166-85D924FEB632}.Debug|NET80.Build.0 = Debug|NET80 - {E4701F9E-41AB-4044-8166-85D924FEB632}.Release|Any CPU.ActiveCfg = Release|NET70 - {E4701F9E-41AB-4044-8166-85D924FEB632}.Release|Any CPU.Build.0 = Release|NET70 {E4701F9E-41AB-4044-8166-85D924FEB632}.Release|NET80.ActiveCfg = Release|NET80 {E4701F9E-41AB-4044-8166-85D924FEB632}.Release|NET80.Build.0 = Release|NET80 - {9E79DC8D-25B1-491F-B094-EA39DE1BBC66}.Debug|Any CPU.ActiveCfg = Debug|NET80 {9E79DC8D-25B1-491F-B094-EA39DE1BBC66}.Debug|NET80.ActiveCfg = Debug|NET80 {9E79DC8D-25B1-491F-B094-EA39DE1BBC66}.Debug|NET80.Build.0 = Debug|NET80 - {9E79DC8D-25B1-491F-B094-EA39DE1BBC66}.Release|Any CPU.ActiveCfg = Release|NET80 {9E79DC8D-25B1-491F-B094-EA39DE1BBC66}.Release|NET80.ActiveCfg = Release|NET80 {9E79DC8D-25B1-491F-B094-EA39DE1BBC66}.Release|NET80.Build.0 = Release|NET80 - {AD0499ED-50D3-46F4-9FC9-3F71D88C4870}.Debug|Any CPU.ActiveCfg = Debug|NET80 {AD0499ED-50D3-46F4-9FC9-3F71D88C4870}.Debug|NET80.ActiveCfg = Debug|NET80 {AD0499ED-50D3-46F4-9FC9-3F71D88C4870}.Debug|NET80.Build.0 = Debug|NET80 - {AD0499ED-50D3-46F4-9FC9-3F71D88C4870}.Release|Any CPU.ActiveCfg = Release|NET80 {AD0499ED-50D3-46F4-9FC9-3F71D88C4870}.Release|NET80.ActiveCfg = Release|NET80 {AD0499ED-50D3-46F4-9FC9-3F71D88C4870}.Release|NET80.Build.0 = Release|NET80 - {06B9E5B0-7C50-4351-9D88-E159DC25755F}.Debug|Any CPU.ActiveCfg = Debug|NET70 - {06B9E5B0-7C50-4351-9D88-E159DC25755F}.Debug|Any CPU.Build.0 = Debug|NET70 {06B9E5B0-7C50-4351-9D88-E159DC25755F}.Debug|NET80.ActiveCfg = Debug|NET80 {06B9E5B0-7C50-4351-9D88-E159DC25755F}.Debug|NET80.Build.0 = Debug|NET80 - {06B9E5B0-7C50-4351-9D88-E159DC25755F}.Release|Any CPU.ActiveCfg = Release|NET70 - {06B9E5B0-7C50-4351-9D88-E159DC25755F}.Release|Any CPU.Build.0 = Release|NET70 {06B9E5B0-7C50-4351-9D88-E159DC25755F}.Release|NET80.ActiveCfg = Release|NET80 {06B9E5B0-7C50-4351-9D88-E159DC25755F}.Release|NET80.Build.0 = Release|NET80 - {53D05530-CF64-4883-8F86-B2B819934F83}.Debug|Any CPU.ActiveCfg = Debug|NET70 - {53D05530-CF64-4883-8F86-B2B819934F83}.Debug|Any CPU.Build.0 = Debug|NET70 {53D05530-CF64-4883-8F86-B2B819934F83}.Debug|NET80.ActiveCfg = Debug|NET80 {53D05530-CF64-4883-8F86-B2B819934F83}.Debug|NET80.Build.0 = Debug|NET80 - {53D05530-CF64-4883-8F86-B2B819934F83}.Release|Any CPU.ActiveCfg = Release|NET70 - {53D05530-CF64-4883-8F86-B2B819934F83}.Release|Any CPU.Build.0 = Release|NET70 {53D05530-CF64-4883-8F86-B2B819934F83}.Release|NET80.ActiveCfg = Release|NET80 {53D05530-CF64-4883-8F86-B2B819934F83}.Release|NET80.Build.0 = Release|NET80 - {589F14D7-2937-479C-834A-D44197CB1930}.Debug|Any CPU.ActiveCfg = Debug|NET80 {589F14D7-2937-479C-834A-D44197CB1930}.Debug|NET80.ActiveCfg = Debug|NET80 {589F14D7-2937-479C-834A-D44197CB1930}.Debug|NET80.Build.0 = Debug|NET80 - {589F14D7-2937-479C-834A-D44197CB1930}.Release|Any CPU.ActiveCfg = Release|NET80 {589F14D7-2937-479C-834A-D44197CB1930}.Release|NET80.ActiveCfg = Release|NET80 {589F14D7-2937-479C-834A-D44197CB1930}.Release|NET80.Build.0 = Release|NET80 - {133FC760-5699-46D9-BEA6-E816B5F01016}.Debug|Any CPU.ActiveCfg = Debug|NET70 - {133FC760-5699-46D9-BEA6-E816B5F01016}.Debug|Any CPU.Build.0 = Debug|NET70 {133FC760-5699-46D9-BEA6-E816B5F01016}.Debug|NET80.ActiveCfg = Debug|NET80 {133FC760-5699-46D9-BEA6-E816B5F01016}.Debug|NET80.Build.0 = Debug|NET80 - {133FC760-5699-46D9-BEA6-E816B5F01016}.Release|Any CPU.ActiveCfg = Release|NET70 - {133FC760-5699-46D9-BEA6-E816B5F01016}.Release|Any CPU.Build.0 = Release|NET70 {133FC760-5699-46D9-BEA6-E816B5F01016}.Release|NET80.ActiveCfg = Release|NET80 {133FC760-5699-46D9-BEA6-E816B5F01016}.Release|NET80.Build.0 = Release|NET80 - {9ADADC68-36A3-4A21-9B54-298154A88720}.Debug|Any CPU.ActiveCfg = Debug|NET80 {9ADADC68-36A3-4A21-9B54-298154A88720}.Debug|NET80.ActiveCfg = Debug|NET80 {9ADADC68-36A3-4A21-9B54-298154A88720}.Debug|NET80.Build.0 = Debug|NET80 - {9ADADC68-36A3-4A21-9B54-298154A88720}.Release|Any CPU.ActiveCfg = Release|NET80 {9ADADC68-36A3-4A21-9B54-298154A88720}.Release|NET80.ActiveCfg = Release|NET80 {9ADADC68-36A3-4A21-9B54-298154A88720}.Release|NET80.Build.0 = Release|NET80 - {A31E274C-524A-40CA-85FF-595D3DB53777}.Debug|Any CPU.ActiveCfg = Debug|NET70 - {A31E274C-524A-40CA-85FF-595D3DB53777}.Debug|Any CPU.Build.0 = Debug|NET70 {A31E274C-524A-40CA-85FF-595D3DB53777}.Debug|NET80.ActiveCfg = Debug|NET80 {A31E274C-524A-40CA-85FF-595D3DB53777}.Debug|NET80.Build.0 = Debug|NET80 - {A31E274C-524A-40CA-85FF-595D3DB53777}.Release|Any CPU.ActiveCfg = Release|NET70 - {A31E274C-524A-40CA-85FF-595D3DB53777}.Release|Any CPU.Build.0 = Release|NET70 {A31E274C-524A-40CA-85FF-595D3DB53777}.Release|NET80.ActiveCfg = Release|NET80 {A31E274C-524A-40CA-85FF-595D3DB53777}.Release|NET80.Build.0 = Release|NET80 - {92A46535-D870-4E1A-AED0-7492789E9C4A}.Debug|Any CPU.ActiveCfg = Debug|NET70 - {92A46535-D870-4E1A-AED0-7492789E9C4A}.Debug|Any CPU.Build.0 = Debug|NET70 {92A46535-D870-4E1A-AED0-7492789E9C4A}.Debug|NET80.ActiveCfg = Debug|NET80 {92A46535-D870-4E1A-AED0-7492789E9C4A}.Debug|NET80.Build.0 = Debug|NET80 - {92A46535-D870-4E1A-AED0-7492789E9C4A}.Release|Any CPU.ActiveCfg = Release|NET70 - {92A46535-D870-4E1A-AED0-7492789E9C4A}.Release|Any CPU.Build.0 = Release|NET70 {92A46535-D870-4E1A-AED0-7492789E9C4A}.Release|NET80.ActiveCfg = Release|NET80 {92A46535-D870-4E1A-AED0-7492789E9C4A}.Release|NET80.Build.0 = Release|NET80 - {66A0E1C8-2514-48B7-8406-536983F57F88}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {66A0E1C8-2514-48B7-8406-536983F57F88}.Debug|Any CPU.Build.0 = Debug|Any CPU - {66A0E1C8-2514-48B7-8406-536983F57F88}.Debug|NET80.ActiveCfg = Debug|NET80 - {66A0E1C8-2514-48B7-8406-536983F57F88}.Debug|NET80.Build.0 = Debug|NET80 - {66A0E1C8-2514-48B7-8406-536983F57F88}.Release|Any CPU.ActiveCfg = Release|Any CPU - {66A0E1C8-2514-48B7-8406-536983F57F88}.Release|Any CPU.Build.0 = Release|Any CPU - {66A0E1C8-2514-48B7-8406-536983F57F88}.Release|NET80.ActiveCfg = Release|NET80 - {66A0E1C8-2514-48B7-8406-536983F57F88}.Release|NET80.Build.0 = Release|NET80 - {A74FF970-C032-445D-8E41-8BBC70CC01AF}.Debug|Any CPU.ActiveCfg = Debug|NET80 - {A74FF970-C032-445D-8E41-8BBC70CC01AF}.Debug|NET80.ActiveCfg = Debug|NET80 - {A74FF970-C032-445D-8E41-8BBC70CC01AF}.Debug|NET80.Build.0 = Debug|NET80 - {A74FF970-C032-445D-8E41-8BBC70CC01AF}.Release|Any CPU.ActiveCfg = Release|NET80 - {A74FF970-C032-445D-8E41-8BBC70CC01AF}.Release|NET80.ActiveCfg = Release|NET80 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/DynamoRevit.DA.sln b/src/DynamoRevit.DA.sln new file mode 100644 index 0000000000..3793a5e7cb --- /dev/null +++ b/src/DynamoRevit.DA.sln @@ -0,0 +1,123 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.1.32328.378 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Libraries", "Libraries", "{FA7BE306-A3B0-45FA-9D87-0C69E6932C13}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RevitNodes", "Libraries\RevitNodes\RevitNodes.csproj", "{0BC2A611-BD0E-4FCC-A1DE-81F14ED369B2}" + ProjectSection(ProjectDependencies) = postProject + {133FC760-5699-46D9-BEA6-E816B5F01016} = {133FC760-5699-46D9-BEA6-E816B5F01016} + EndProjectSection +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RevitNodesUI", "Libraries\RevitNodesUI\RevitNodesUI.csproj", "{75940ACC-3708-4526-8D91-7E3365BAF682}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RevitServices", "Libraries\RevitServices\RevitServices.csproj", "{E4701F9E-41AB-4044-8166-85D924FEB632}" + ProjectSection(ProjectDependencies) = postProject + {133FC760-5699-46D9-BEA6-E816B5F01016} = {133FC760-5699-46D9-BEA6-E816B5F01016} + EndProjectSection +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Migrations", "Libraries\Migrations\Migrations.csproj", "{06B9E5B0-7C50-4351-9D88-E159DC25755F}" + ProjectSection(ProjectDependencies) = postProject + {133FC760-5699-46D9-BEA6-E816B5F01016} = {133FC760-5699-46D9-BEA6-E816B5F01016} + EndProjectSection +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AssemblyInfoGenerator", "AssemblySharedInfoGenerator\AssemblyInfoGenerator.csproj", "{133FC760-5699-46D9-BEA6-E816B5F01016}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{4466E6F6-F644-43AB-96B3-5ECE1622E711}" + ProjectSection(SolutionItems) = preProject + ..\.version = ..\.version + ..\CHANGELOG.md = ..\CHANGELOG.md + ..\README.md = ..\README.md + EndProjectSection +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "config", "config", "{9568462D-249F-4494-856B-5B25751DB361}" + ProjectSection(SolutionItems) = preProject + Config.xml = Config.xml + Config\CS_SDK.props = Config\CS_SDK.props + Config\dynamo-nuget.config = Config\dynamo-nuget.config + Config\packages-template.aget = Config\packages-template.aget + Config\packages.aget = Config\packages.aget + Config\user_local.props = Config\user_local.props + EndProjectSection +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DADynamoApp", "DADynamoApp\DADynamoApp.csproj", "{66A0E1C8-2514-48B7-8406-536983F57F88}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DADynamoConsole", "DADynamoConsole\DADynamoConsole.csproj", "{A74FF970-C032-445D-8E41-8BBC70CC01AF}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Debug|NET80 = Debug|NET80 + Release|Any CPU = Release|Any CPU + Release|NET80 = Release|NET80 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {0BC2A611-BD0E-4FCC-A1DE-81F14ED369B2}.Debug|Any CPU.ActiveCfg = Debug|NET80 + {0BC2A611-BD0E-4FCC-A1DE-81F14ED369B2}.Debug|Any CPU.Build.0 = Debug|NET80 + {0BC2A611-BD0E-4FCC-A1DE-81F14ED369B2}.Debug|NET80.ActiveCfg = Debug|NET80 + {0BC2A611-BD0E-4FCC-A1DE-81F14ED369B2}.Debug|NET80.Build.0 = Debug|NET80 + {0BC2A611-BD0E-4FCC-A1DE-81F14ED369B2}.Release|Any CPU.ActiveCfg = Release|NET70 + {0BC2A611-BD0E-4FCC-A1DE-81F14ED369B2}.Release|Any CPU.Build.0 = Release|NET70 + {0BC2A611-BD0E-4FCC-A1DE-81F14ED369B2}.Release|NET80.ActiveCfg = Release|NET80 + {0BC2A611-BD0E-4FCC-A1DE-81F14ED369B2}.Release|NET80.Build.0 = Release|NET80 + {75940ACC-3708-4526-8D91-7E3365BAF682}.Debug|Any CPU.ActiveCfg = Debug|NET80 + {75940ACC-3708-4526-8D91-7E3365BAF682}.Debug|Any CPU.Build.0 = Debug|NET80 + {75940ACC-3708-4526-8D91-7E3365BAF682}.Debug|NET80.ActiveCfg = Debug|NET80 + {75940ACC-3708-4526-8D91-7E3365BAF682}.Debug|NET80.Build.0 = Debug|NET80 + {75940ACC-3708-4526-8D91-7E3365BAF682}.Release|Any CPU.ActiveCfg = Release|NET70 + {75940ACC-3708-4526-8D91-7E3365BAF682}.Release|Any CPU.Build.0 = Release|NET70 + {75940ACC-3708-4526-8D91-7E3365BAF682}.Release|NET80.ActiveCfg = Release|NET80 + {75940ACC-3708-4526-8D91-7E3365BAF682}.Release|NET80.Build.0 = Release|NET80 + {E4701F9E-41AB-4044-8166-85D924FEB632}.Debug|Any CPU.ActiveCfg = Debug|NET80 + {E4701F9E-41AB-4044-8166-85D924FEB632}.Debug|Any CPU.Build.0 = Debug|NET80 + {E4701F9E-41AB-4044-8166-85D924FEB632}.Debug|NET80.ActiveCfg = Debug|NET80 + {E4701F9E-41AB-4044-8166-85D924FEB632}.Debug|NET80.Build.0 = Debug|NET80 + {E4701F9E-41AB-4044-8166-85D924FEB632}.Release|Any CPU.ActiveCfg = Release|NET70 + {E4701F9E-41AB-4044-8166-85D924FEB632}.Release|Any CPU.Build.0 = Release|NET70 + {E4701F9E-41AB-4044-8166-85D924FEB632}.Release|NET80.ActiveCfg = Release|NET80 + {E4701F9E-41AB-4044-8166-85D924FEB632}.Release|NET80.Build.0 = Release|NET80 + {06B9E5B0-7C50-4351-9D88-E159DC25755F}.Debug|Any CPU.ActiveCfg = Debug|NET80 + {06B9E5B0-7C50-4351-9D88-E159DC25755F}.Debug|Any CPU.Build.0 = Debug|NET80 + {06B9E5B0-7C50-4351-9D88-E159DC25755F}.Debug|NET80.ActiveCfg = Debug|NET80 + {06B9E5B0-7C50-4351-9D88-E159DC25755F}.Debug|NET80.Build.0 = Debug|NET80 + {06B9E5B0-7C50-4351-9D88-E159DC25755F}.Release|Any CPU.ActiveCfg = Release|NET70 + {06B9E5B0-7C50-4351-9D88-E159DC25755F}.Release|Any CPU.Build.0 = Release|NET70 + {06B9E5B0-7C50-4351-9D88-E159DC25755F}.Release|NET80.ActiveCfg = Release|NET80 + {06B9E5B0-7C50-4351-9D88-E159DC25755F}.Release|NET80.Build.0 = Release|NET80 + {133FC760-5699-46D9-BEA6-E816B5F01016}.Debug|Any CPU.ActiveCfg = Debug|NET80 + {133FC760-5699-46D9-BEA6-E816B5F01016}.Debug|Any CPU.Build.0 = Debug|NET80 + {133FC760-5699-46D9-BEA6-E816B5F01016}.Debug|NET80.ActiveCfg = Debug|NET80 + {133FC760-5699-46D9-BEA6-E816B5F01016}.Debug|NET80.Build.0 = Debug|NET80 + {133FC760-5699-46D9-BEA6-E816B5F01016}.Release|Any CPU.ActiveCfg = Release|NET70 + {133FC760-5699-46D9-BEA6-E816B5F01016}.Release|Any CPU.Build.0 = Release|NET70 + {133FC760-5699-46D9-BEA6-E816B5F01016}.Release|NET80.ActiveCfg = Release|NET80 + {133FC760-5699-46D9-BEA6-E816B5F01016}.Release|NET80.Build.0 = Release|NET80 + {66A0E1C8-2514-48B7-8406-536983F57F88}.Debug|Any CPU.ActiveCfg = Debug|NET80 + {66A0E1C8-2514-48B7-8406-536983F57F88}.Debug|Any CPU.Build.0 = Debug|NET80 + {66A0E1C8-2514-48B7-8406-536983F57F88}.Debug|NET80.ActiveCfg = Debug|NET80 + {66A0E1C8-2514-48B7-8406-536983F57F88}.Debug|NET80.Build.0 = Debug|NET80 + {66A0E1C8-2514-48B7-8406-536983F57F88}.Release|Any CPU.ActiveCfg = Release|Any CPU + {66A0E1C8-2514-48B7-8406-536983F57F88}.Release|Any CPU.Build.0 = Release|Any CPU + {66A0E1C8-2514-48B7-8406-536983F57F88}.Release|NET80.ActiveCfg = Release|NET80 + {66A0E1C8-2514-48B7-8406-536983F57F88}.Release|NET80.Build.0 = Release|NET80 + {A74FF970-C032-445D-8E41-8BBC70CC01AF}.Debug|Any CPU.ActiveCfg = Debug|NET80 + {A74FF970-C032-445D-8E41-8BBC70CC01AF}.Debug|Any CPU.Build.0 = Debug|NET80 + {A74FF970-C032-445D-8E41-8BBC70CC01AF}.Debug|NET80.ActiveCfg = Debug|NET80 + {A74FF970-C032-445D-8E41-8BBC70CC01AF}.Debug|NET80.Build.0 = Debug|NET80 + {A74FF970-C032-445D-8E41-8BBC70CC01AF}.Release|Any CPU.ActiveCfg = Release|NET80 + {A74FF970-C032-445D-8E41-8BBC70CC01AF}.Release|NET80.ActiveCfg = Release|NET80 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {0BC2A611-BD0E-4FCC-A1DE-81F14ED369B2} = {FA7BE306-A3B0-45FA-9D87-0C69E6932C13} + {75940ACC-3708-4526-8D91-7E3365BAF682} = {FA7BE306-A3B0-45FA-9D87-0C69E6932C13} + {E4701F9E-41AB-4044-8166-85D924FEB632} = {FA7BE306-A3B0-45FA-9D87-0C69E6932C13} + {06B9E5B0-7C50-4351-9D88-E159DC25755F} = {FA7BE306-A3B0-45FA-9D87-0C69E6932C13} + {9568462D-249F-4494-856B-5B25751DB361} = {4466E6F6-F644-43AB-96B3-5ECE1622E711} + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {757AAA40-191F-4673-9B04-8270A3370BCA} + EndGlobalSection +EndGlobal From 76742f29d495dbde7697cc3b6dc66ea08b9cccb8 Mon Sep 17 00:00:00 2001 From: pinzart90 Date: Fri, 4 Apr 2025 12:31:13 -0400 Subject: [PATCH 27/70] update --- src/DynamoRevit/Properties/AssemblyInfo.cs | 3 +- .../ViewModel/RevitWatchHandler.cs | 43 +------------------ 2 files changed, 3 insertions(+), 43 deletions(-) diff --git a/src/DynamoRevit/Properties/AssemblyInfo.cs b/src/DynamoRevit/Properties/AssemblyInfo.cs index 58ea1f6a8b..5996d78d11 100644 --- a/src/DynamoRevit/Properties/AssemblyInfo.cs +++ b/src/DynamoRevit/Properties/AssemblyInfo.cs @@ -9,5 +9,4 @@ [assembly: AssemblyCulture("")] [assembly: Guid("082cab33-cbc7-4e58-ae25-f0962f325d6e")] [assembly: InternalsVisibleTo("RevitTestServices")] -[assembly: InternalsVisibleTo("RevitSystemTests")] -[assembly: InternalsVisibleTo("DADynamoApp")] \ No newline at end of file +[assembly: InternalsVisibleTo("RevitSystemTests")] \ No newline at end of file diff --git a/src/DynamoRevit/ViewModel/RevitWatchHandler.cs b/src/DynamoRevit/ViewModel/RevitWatchHandler.cs index ee7e6c37cf..fe5f2ca99a 100644 --- a/src/DynamoRevit/ViewModel/RevitWatchHandler.cs +++ b/src/DynamoRevit/ViewModel/RevitWatchHandler.cs @@ -3,11 +3,9 @@ using System.Globalization; using System.Linq; using Autodesk.Revit.DB; -using Autodesk.Revit.UI; using Dynamo.Interfaces; using Dynamo.ViewModels; using ProtoCore.Mirror; -using Revit.GeometryConversion; using RevitServices.Persistence; using Element = Revit.Elements.Element; @@ -31,44 +29,7 @@ public RevitWatchHandler(IPreferences prefs) preferences = prefs; } - // helper for zooming to clicked green Id - internal static void ZoomToLinkedElement(Element element) - { - - UIDocument uiDoc = DocumentManager.Instance.CurrentUIDocument; - Autodesk.Revit.DB.View activeView = uiDoc.ActiveView; - // get active UI view to use - UIView uiview = uiDoc.GetOpenUIViews().FirstOrDefault(uv => uv.ViewId.Equals(activeView.Id)); - Transform linkTransform = Revit.Elements.LinkElement.LinkTransform(element).ToTransform(); - - // use the center of the BoundingBox as zoom center - BoundingBoxXYZ bb = element.InternalElement.get_BoundingBox(null); - // if the BBox cannot be found, attempt to find it using the active view - if (bb == null) - { - bb = element.InternalElement.get_BoundingBox(activeView); - } - // finally, if the BB cannot be found at all - if (bb == null) - { - TaskDialog.Show("Revit", "No good view can be found."); - return; - } - XYZ bbCenter = (bb.Max + bb.Min) / 2; - double zoomOffsetX = bb.Max.X - bbCenter.X; - double zoomOffsetY = bb.Max.Y - bbCenter.Y; - double zoomOffsetZ = bb.Max.Z - bbCenter.Z; - XYZ locationPt = Revit.Elements.LinkElement.TransformPoint(bbCenter, linkTransform); - - if (locationPt != null) - { - XYZ min = new XYZ(locationPt.X - zoomOffsetX, locationPt.Y - zoomOffsetY, locationPt.Z - zoomOffsetZ); - XYZ max = new XYZ(locationPt.X + zoomOffsetX, locationPt.Y + zoomOffsetY, locationPt.Z + zoomOffsetZ); - uiview.ZoomAndCenterRectangle(min, max); - } - } - - private WatchViewModel ProcessThing(Element element, List preferredDictionaryOrdering, ProtoCore.RuntimeCore runtimeCore, string tag, bool showRawData, WatchHandlerCallback callback) + private WatchViewModel ProcessThing(Element element, List preferredDictionaryOrdering, ProtoCore.RuntimeCore runtimeCore, string tag, bool showRawData, WatchHandlerCallback callback) { var id = element.Id; @@ -82,7 +43,7 @@ private WatchViewModel ProcessThing(Element element, List preferredDicti Document currrentDoc = Revit.Application.Document.Current.InternalDocument; if (!(elementDoc.Equals(currrentDoc))) { - ZoomToLinkedElement(element); + Revit.Elements.LinkElement.ZoomToLinkedElement(element); } else { From 8fc45d57f12fed29a2e46398814d864f4d9b85e8 Mon Sep 17 00:00:00 2001 From: pinzart90 Date: Fri, 4 Apr 2025 13:14:35 -0400 Subject: [PATCH 28/70] update --- src/Config/CS_SDK.props | 11 +++--- src/DynamoRevit.DA.sln | 81 ++++++++++++----------------------------- 2 files changed, 28 insertions(+), 64 deletions(-) diff --git a/src/Config/CS_SDK.props b/src/Config/CS_SDK.props index c3683387ef..a68d3b9012 100644 --- a/src/Config/CS_SDK.props +++ b/src/Config/CS_SDK.props @@ -1,11 +1,10 @@ - NET70;NET80 + NET70;NET80;NET80_DA x64 - net8.0-windows - net7.0-windows - net6.0-windows + net8.0-windows + net7.0-windows net48 17.0 Preview Release @@ -20,8 +19,8 @@ C:\Program Files\Dynamo 0.7 - net8.0 - net6.0 + net8.0 + net7.0 net6.0 $(SolutionDir)..\lib\Revit $(RevitVersionNumber)\$(DCoreLibSubFolder) C:\Program Files\Autodesk\Revit Architecture $(RevitVersionNumber) diff --git a/src/DynamoRevit.DA.sln b/src/DynamoRevit.DA.sln index 3793a5e7cb..bb1d3b324c 100644 --- a/src/DynamoRevit.DA.sln +++ b/src/DynamoRevit.DA.sln @@ -46,66 +46,31 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DADynamoConsole", "DADynamo EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Debug|NET80 = Debug|NET80 - Release|Any CPU = Release|Any CPU - Release|NET80 = Release|NET80 + Debug|NET80_DA = Debug|NET80_DA + Release|NET80_DA = Release|NET80_DA EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {0BC2A611-BD0E-4FCC-A1DE-81F14ED369B2}.Debug|Any CPU.ActiveCfg = Debug|NET80 - {0BC2A611-BD0E-4FCC-A1DE-81F14ED369B2}.Debug|Any CPU.Build.0 = Debug|NET80 - {0BC2A611-BD0E-4FCC-A1DE-81F14ED369B2}.Debug|NET80.ActiveCfg = Debug|NET80 - {0BC2A611-BD0E-4FCC-A1DE-81F14ED369B2}.Debug|NET80.Build.0 = Debug|NET80 - {0BC2A611-BD0E-4FCC-A1DE-81F14ED369B2}.Release|Any CPU.ActiveCfg = Release|NET70 - {0BC2A611-BD0E-4FCC-A1DE-81F14ED369B2}.Release|Any CPU.Build.0 = Release|NET70 - {0BC2A611-BD0E-4FCC-A1DE-81F14ED369B2}.Release|NET80.ActiveCfg = Release|NET80 - {0BC2A611-BD0E-4FCC-A1DE-81F14ED369B2}.Release|NET80.Build.0 = Release|NET80 - {75940ACC-3708-4526-8D91-7E3365BAF682}.Debug|Any CPU.ActiveCfg = Debug|NET80 - {75940ACC-3708-4526-8D91-7E3365BAF682}.Debug|Any CPU.Build.0 = Debug|NET80 - {75940ACC-3708-4526-8D91-7E3365BAF682}.Debug|NET80.ActiveCfg = Debug|NET80 - {75940ACC-3708-4526-8D91-7E3365BAF682}.Debug|NET80.Build.0 = Debug|NET80 - {75940ACC-3708-4526-8D91-7E3365BAF682}.Release|Any CPU.ActiveCfg = Release|NET70 - {75940ACC-3708-4526-8D91-7E3365BAF682}.Release|Any CPU.Build.0 = Release|NET70 - {75940ACC-3708-4526-8D91-7E3365BAF682}.Release|NET80.ActiveCfg = Release|NET80 - {75940ACC-3708-4526-8D91-7E3365BAF682}.Release|NET80.Build.0 = Release|NET80 - {E4701F9E-41AB-4044-8166-85D924FEB632}.Debug|Any CPU.ActiveCfg = Debug|NET80 - {E4701F9E-41AB-4044-8166-85D924FEB632}.Debug|Any CPU.Build.0 = Debug|NET80 - {E4701F9E-41AB-4044-8166-85D924FEB632}.Debug|NET80.ActiveCfg = Debug|NET80 - {E4701F9E-41AB-4044-8166-85D924FEB632}.Debug|NET80.Build.0 = Debug|NET80 - {E4701F9E-41AB-4044-8166-85D924FEB632}.Release|Any CPU.ActiveCfg = Release|NET70 - {E4701F9E-41AB-4044-8166-85D924FEB632}.Release|Any CPU.Build.0 = Release|NET70 - {E4701F9E-41AB-4044-8166-85D924FEB632}.Release|NET80.ActiveCfg = Release|NET80 - {E4701F9E-41AB-4044-8166-85D924FEB632}.Release|NET80.Build.0 = Release|NET80 - {06B9E5B0-7C50-4351-9D88-E159DC25755F}.Debug|Any CPU.ActiveCfg = Debug|NET80 - {06B9E5B0-7C50-4351-9D88-E159DC25755F}.Debug|Any CPU.Build.0 = Debug|NET80 - {06B9E5B0-7C50-4351-9D88-E159DC25755F}.Debug|NET80.ActiveCfg = Debug|NET80 - {06B9E5B0-7C50-4351-9D88-E159DC25755F}.Debug|NET80.Build.0 = Debug|NET80 - {06B9E5B0-7C50-4351-9D88-E159DC25755F}.Release|Any CPU.ActiveCfg = Release|NET70 - {06B9E5B0-7C50-4351-9D88-E159DC25755F}.Release|Any CPU.Build.0 = Release|NET70 - {06B9E5B0-7C50-4351-9D88-E159DC25755F}.Release|NET80.ActiveCfg = Release|NET80 - {06B9E5B0-7C50-4351-9D88-E159DC25755F}.Release|NET80.Build.0 = Release|NET80 - {133FC760-5699-46D9-BEA6-E816B5F01016}.Debug|Any CPU.ActiveCfg = Debug|NET80 - {133FC760-5699-46D9-BEA6-E816B5F01016}.Debug|Any CPU.Build.0 = Debug|NET80 - {133FC760-5699-46D9-BEA6-E816B5F01016}.Debug|NET80.ActiveCfg = Debug|NET80 - {133FC760-5699-46D9-BEA6-E816B5F01016}.Debug|NET80.Build.0 = Debug|NET80 - {133FC760-5699-46D9-BEA6-E816B5F01016}.Release|Any CPU.ActiveCfg = Release|NET70 - {133FC760-5699-46D9-BEA6-E816B5F01016}.Release|Any CPU.Build.0 = Release|NET70 - {133FC760-5699-46D9-BEA6-E816B5F01016}.Release|NET80.ActiveCfg = Release|NET80 - {133FC760-5699-46D9-BEA6-E816B5F01016}.Release|NET80.Build.0 = Release|NET80 - {66A0E1C8-2514-48B7-8406-536983F57F88}.Debug|Any CPU.ActiveCfg = Debug|NET80 - {66A0E1C8-2514-48B7-8406-536983F57F88}.Debug|Any CPU.Build.0 = Debug|NET80 - {66A0E1C8-2514-48B7-8406-536983F57F88}.Debug|NET80.ActiveCfg = Debug|NET80 - {66A0E1C8-2514-48B7-8406-536983F57F88}.Debug|NET80.Build.0 = Debug|NET80 - {66A0E1C8-2514-48B7-8406-536983F57F88}.Release|Any CPU.ActiveCfg = Release|Any CPU - {66A0E1C8-2514-48B7-8406-536983F57F88}.Release|Any CPU.Build.0 = Release|Any CPU - {66A0E1C8-2514-48B7-8406-536983F57F88}.Release|NET80.ActiveCfg = Release|NET80 - {66A0E1C8-2514-48B7-8406-536983F57F88}.Release|NET80.Build.0 = Release|NET80 - {A74FF970-C032-445D-8E41-8BBC70CC01AF}.Debug|Any CPU.ActiveCfg = Debug|NET80 - {A74FF970-C032-445D-8E41-8BBC70CC01AF}.Debug|Any CPU.Build.0 = Debug|NET80 - {A74FF970-C032-445D-8E41-8BBC70CC01AF}.Debug|NET80.ActiveCfg = Debug|NET80 - {A74FF970-C032-445D-8E41-8BBC70CC01AF}.Debug|NET80.Build.0 = Debug|NET80 - {A74FF970-C032-445D-8E41-8BBC70CC01AF}.Release|Any CPU.ActiveCfg = Release|NET80 - {A74FF970-C032-445D-8E41-8BBC70CC01AF}.Release|NET80.ActiveCfg = Release|NET80 + {0BC2A611-BD0E-4FCC-A1DE-81F14ED369B2}.Debug|NET80_DA.ActiveCfg = Debug|NET80_DA + {0BC2A611-BD0E-4FCC-A1DE-81F14ED369B2}.Debug|NET80_DA.Build.0 = Debug|NET80_DA + {0BC2A611-BD0E-4FCC-A1DE-81F14ED369B2}.Release|NET80_DA.ActiveCfg = Release|NET80_DA + {75940ACC-3708-4526-8D91-7E3365BAF682}.Debug|NET80_DA.ActiveCfg = Debug|NET80_DA + {75940ACC-3708-4526-8D91-7E3365BAF682}.Debug|NET80_DA.Build.0 = Debug|NET80_DA + {75940ACC-3708-4526-8D91-7E3365BAF682}.Release|NET80_DA.ActiveCfg = Release|NET80_DA + {E4701F9E-41AB-4044-8166-85D924FEB632}.Debug|NET80_DA.ActiveCfg = Debug|NET80_DA + {E4701F9E-41AB-4044-8166-85D924FEB632}.Debug|NET80_DA.Build.0 = Debug|NET80_DA + {E4701F9E-41AB-4044-8166-85D924FEB632}.Release|NET80_DA.ActiveCfg = Release|NET80_DA + {06B9E5B0-7C50-4351-9D88-E159DC25755F}.Debug|NET80_DA.ActiveCfg = Debug|NET80_DA + {06B9E5B0-7C50-4351-9D88-E159DC25755F}.Debug|NET80_DA.Build.0 = Debug|NET80_DA + {06B9E5B0-7C50-4351-9D88-E159DC25755F}.Release|NET80_DA.ActiveCfg = Release|NET80_DA + {133FC760-5699-46D9-BEA6-E816B5F01016}.Debug|NET80_DA.ActiveCfg = Debug|NET80_DA + {133FC760-5699-46D9-BEA6-E816B5F01016}.Debug|NET80_DA.Build.0 = Debug|NET80_DA + {133FC760-5699-46D9-BEA6-E816B5F01016}.Release|NET80_DA.ActiveCfg = Release|NET80_DA + {66A0E1C8-2514-48B7-8406-536983F57F88}.Debug|NET80_DA.ActiveCfg = Debug|NET80_DA + {66A0E1C8-2514-48B7-8406-536983F57F88}.Debug|NET80_DA.Build.0 = Debug|NET80_DA + {66A0E1C8-2514-48B7-8406-536983F57F88}.Release|NET80_DA.ActiveCfg = Release|NET80_DA + {A74FF970-C032-445D-8E41-8BBC70CC01AF}.Debug|NET80_DA.ActiveCfg = Debug|NET80_DA + {A74FF970-C032-445D-8E41-8BBC70CC01AF}.Debug|NET80_DA.Build.0 = Debug|NET80_DA + {A74FF970-C032-445D-8E41-8BBC70CC01AF}.Release|NET80_DA.ActiveCfg = Release|NET80_DA EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE From b3a4fb8ba13fb0c2e76e26f03d7db928330fef8c Mon Sep 17 00:00:00 2001 From: pinzart90 Date: Fri, 4 Apr 2025 13:18:13 -0400 Subject: [PATCH 29/70] Update RevitNodesUI.csproj --- .../RevitNodesUI/RevitNodesUI.csproj | 21 ++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/src/Libraries/RevitNodesUI/RevitNodesUI.csproj b/src/Libraries/RevitNodesUI/RevitNodesUI.csproj index b58b8865c6..c837ab0769 100644 --- a/src/Libraries/RevitNodesUI/RevitNodesUI.csproj +++ b/src/Libraries/RevitNodesUI/RevitNodesUI.csproj @@ -36,6 +36,21 @@ + + + + + + + + + + + + + + + $(PACKAGESPATH)\DynamoVisualProgramming.Core\lib\$(DCoreLibSubFolder)\DynamoUtilities.dll @@ -64,9 +79,9 @@ $(REVITAPI)\RevitAPIUI.dll False + - - + ComboControl.xaml @@ -121,7 +136,7 @@ - + From 0227ab88390f09d77f9c551e506221e8b7576f11 Mon Sep 17 00:00:00 2001 From: pinzart90 Date: Mon, 7 Apr 2025 11:41:02 -0400 Subject: [PATCH 30/70] UPDATE --- src/Libraries/RevitNodesUI/RevitNodesUI.csproj | 3 +-- src/Libraries/RevitNodesUI/SiteLocation.cs | 15 ++++++++++++--- src/Libraries/RevitNodesUI/SunPath.cs | 10 +++++++--- 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/src/Libraries/RevitNodesUI/RevitNodesUI.csproj b/src/Libraries/RevitNodesUI/RevitNodesUI.csproj index c837ab0769..22b407f4d1 100644 --- a/src/Libraries/RevitNodesUI/RevitNodesUI.csproj +++ b/src/Libraries/RevitNodesUI/RevitNodesUI.csproj @@ -44,8 +44,6 @@ - - @@ -136,6 +134,7 @@ + diff --git a/src/Libraries/RevitNodesUI/SiteLocation.cs b/src/Libraries/RevitNodesUI/SiteLocation.cs index 4fa72b5ea6..87832d7625 100644 --- a/src/Libraries/RevitNodesUI/SiteLocation.cs +++ b/src/Libraries/RevitNodesUI/SiteLocation.cs @@ -1,8 +1,11 @@ using Dynamo.Applications; using Dynamo.Applications.Models; +#if UI_SUPPORT using Dynamo.Controls; +#else +using DynamoRevitApp = DADynamoApp.DynamoADApp; +#endif using Dynamo.Graph.Nodes; -using Dynamo.Wpf; using Newtonsoft.Json; using ProtoCore.AST.AssociativeAST; using Revit.GeometryConversion; @@ -15,7 +18,8 @@ namespace DSRevitNodesUI { - public class SiteLocationNodeViewCustomization : INodeViewCustomization +#if UI_SUPPORT + public class SiteLocationNodeViewCustomization : INodeViewCustomization { public void CustomizeView(SiteLocation model, NodeView nodeView) { @@ -28,6 +32,7 @@ public void Dispose() } } +#endif [NodeName("SiteLocation"), NodeCategory(BuiltinNodeCategories.ANALYZE), NodeDescription("SiteLocationDescription", typeof(Properties.Resources)), IsDesignScriptCompatible] @@ -49,8 +54,10 @@ public SiteLocation() DynamoRevitApp.EventHandlerProxy.DocumentOpened += model_RevitDocumentChanged; RevitServicesUpdater.Instance.ElementsUpdated += RevitServicesUpdater_ElementsUpdated; - + +#if UI_SUPPORT DynamoRevitApp.AddIdleAction(() => Update()); +#endif } [JsonConstructor] @@ -64,7 +71,9 @@ public SiteLocation(IEnumerable inPorts, IEnumerable outPo DynamoRevitApp.EventHandlerProxy.DocumentOpened += model_RevitDocumentChanged; RevitServicesUpdater.Instance.ElementsUpdated += RevitServicesUpdater_ElementsUpdated; +#if UI_SUPPORT DynamoRevitApp.AddIdleAction(() => Update()); +#endif } #region public methods diff --git a/src/Libraries/RevitNodesUI/SunPath.cs b/src/Libraries/RevitNodesUI/SunPath.cs index eee3f8fd9c..69388f4ef2 100644 --- a/src/Libraries/RevitNodesUI/SunPath.cs +++ b/src/Libraries/RevitNodesUI/SunPath.cs @@ -32,25 +32,29 @@ public SunSettings() RegisterAllPorts(); RevitServicesUpdater.Instance.ElementsUpdated += Updater_ElementsUpdated; - DynamoRevitApp.EventHandlerProxy.ViewActivated += CurrentUIApplication_ViewActivated; +#if UI_SUPPORT + DynamoRevitApp.EventHandlerProxy.ViewActivated += CurrentUIApplication_ViewActivated; DynamoRevitApp.AddIdleAction(() => CurrentUIApplicationOnViewActivated()); +#endif } [JsonConstructor] public SunSettings(IEnumerable inPorts, IEnumerable outPorts) : base(inPorts, outPorts) { RevitServicesUpdater.Instance.ElementsUpdated += Updater_ElementsUpdated; +#if UI_SUPPORT DynamoRevitApp.EventHandlerProxy.ViewActivated += CurrentUIApplication_ViewActivated; - DynamoRevitApp.AddIdleAction(() => CurrentUIApplicationOnViewActivated()); +#endif } public override void Dispose() { RevitServicesUpdater.Instance.ElementsUpdated -= Updater_ElementsUpdated; +#if UI_SUPPORT DynamoRevitApp.EventHandlerProxy.ViewActivated -= CurrentUIApplication_ViewActivated; - +#endif base.Dispose(); } From 2d268cd2e674448cbe28a7c2cc1eedeed10cfea1 Mon Sep 17 00:00:00 2001 From: pinzart90 Date: Tue, 8 Apr 2025 19:12:02 -0400 Subject: [PATCH 31/70] update --- src/DADynamoApp/ConsoleEntrypoint.cs | 16 --- src/DADynamoApp/DAEntrypoint.cs | 144 +++++++++++++++---- src/DADynamoApp/DAHandler.cs | 120 ---------------- src/DADynamoApp/DynamoPathResolver.cs | 159 +++++++-------------- src/DynamoRevit.DA.sln | 5 - src/Libraries/RevitNodesUI/SiteLocation.cs | 2 +- 6 files changed, 173 insertions(+), 273 deletions(-) delete mode 100644 src/DADynamoApp/ConsoleEntrypoint.cs delete mode 100644 src/DADynamoApp/DAHandler.cs diff --git a/src/DADynamoApp/ConsoleEntrypoint.cs b/src/DADynamoApp/ConsoleEntrypoint.cs deleted file mode 100644 index 91723286f5..0000000000 --- a/src/DADynamoApp/ConsoleEntrypoint.cs +++ /dev/null @@ -1,16 +0,0 @@ -namespace DADynamoApp -{ - public static class ConsoleEntrypoint - { - public static void DoStuff() - { - Console.WriteLine("Hello, World!"); - - var xx = new DAEntrypoint(); - xx.OnStartup(null); - - var handler = new DADynamoApp.DynamoADApp(); - handler.HandleDesignAutomationReadyEvent(null, new DesignAutomationFramework.DesignAutomationReadyEventArgs(null, "")); - } - } -} diff --git a/src/DADynamoApp/DAEntrypoint.cs b/src/DADynamoApp/DAEntrypoint.cs index 99cc7ab9b3..8fbb109359 100644 --- a/src/DADynamoApp/DAEntrypoint.cs +++ b/src/DADynamoApp/DAEntrypoint.cs @@ -1,10 +1,15 @@ -using DesignAutomationFramework; -using Autodesk.Revit.ApplicationServices; +using Autodesk.Revit.ApplicationServices; using Autodesk.Revit.DB; -using System.Diagnostics; -using System.Runtime.Loader; +using DesignAutomationFramework; +using Dynamo.Models; +using DynamoPlayer; using RevitServices.Persistence; using RevitServices.Elements; +using RevitServices.EventHandler; +using System.IO.Compression; +using System.Reflection; +using System.Runtime.Loader; +using System.Diagnostics; namespace DADynamoApp { @@ -12,14 +17,54 @@ namespace DADynamoApp [Autodesk.Revit.Attributes.Transaction(Autodesk.Revit.Attributes.TransactionMode.Manual)] public class DAEntrypoint : IExternalDBApplication { + private DynamoModel model; + internal static DynamoPlayerLoggerConfiguration logConfig = new DynamoPlayerLoggerConfiguration() { DynamoLogLevel = Dynamo.Logging.LogLevel.Console, LogLevel = DynamoPlayer.LogLevel.Information }; + + private string LoadMessage; + private string WorkItemFolder; + + private static EventHandlerProxy proxy; + public static EventHandlerProxy EventHandlerProxy + { + get { return proxy; } + } + public static List Updaters = new List(); + + private void CheckIfPythonExists(string inputFolder) + { + var pyDir = "python-3.9.12-embed-amd64"; + var pyRoot = Path.GetDirectoryName(model.PathManager.CommonDataDirectory); + var searchPath = Path.Combine(pyRoot, pyDir); + if (Directory.Exists(searchPath) && File.Exists(Path.Combine(searchPath, "python.exe"))) + { + return; + } + Console.WriteLine($"<> cPython not found at '{searchPath}'"); + var inputDistributionPath = Path.Combine(inputFolder, $"{pyDir}.zip"); + if (File.Exists(inputDistributionPath)) + { + Console.WriteLine("<> cPython distribution detected in input. Attempting to add it... "); + try + { + ZipFile.ExtractToDirectory(inputDistributionPath, searchPath); + Console.WriteLine("<> cPython added."); + } + catch (Exception ex) + { + Console.WriteLine($"<> Failed to add cPython: {ex.Message}"); + } + } + } + public ExternalDBApplicationResult OnShutdown(ControlledApplication application) { + AppDomain.CurrentDomain.UnhandledException -= CurrentDomain_UnhandledException; + AppDomain.CurrentDomain.ProcessExit -= CurrentDomain_ProcessExit; AppDomain.CurrentDomain.AssemblyResolve -= DynamoPathResolver.ResolveAssembly; return ExternalDBApplicationResult.Succeeded; } - private static void CurrentDomain_ProcessExit(object? sender, EventArgs e) { Process proc = Process.GetCurrentProcess(); @@ -35,28 +80,14 @@ private static void CurrentDomain_UnhandledException(object sender, UnhandledExc Console.WriteLine($"Unhandled exception: {e}"); } - public ExternalDBApplicationResult OnStartup(ControlledApplication application) { - AppDomain.CurrentDomain.AssemblyResolve += DynamoPathResolver.ResolveAssembly; - AssemblyLoadContext.Default.Resolving += DynamoPathResolver.Default_Resolving; - AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; AppDomain.CurrentDomain.ProcessExit += CurrentDomain_ProcessExit; + AppDomain.CurrentDomain.AssemblyResolve += DynamoPathResolver.ResolveAssembly; Console.WriteLine("<> Starting to load D4DA"); - Console.WriteLine("Loaded assemblies:"); - foreach (var item in AppDomain.CurrentDomain.GetAssemblies()) - { - var name = item?.GetName()?.Name; - if (name.Contains("Revit", StringComparison.OrdinalIgnoreCase) || item.Location.Contains("Revit", StringComparison.OrdinalIgnoreCase)) - { - Console.WriteLine(name); - } - - } - try { RevitServices.Transactions.TransactionManager.SetupManager(new RevitServices.Transactions.AutomaticTransactionStrategy()); @@ -64,7 +95,7 @@ public ExternalDBApplicationResult OnStartup(ControlledApplication application) RevitServicesUpdater.Initialize(Updaters); - DesignAutomationBridge.DesignAutomationReadyEvent += DesignAutomationBridge_DesignAutomationReadyEvent; + DesignAutomationBridge.DesignAutomationReadyEvent += HandleDesignAutomationReadyEvent; Console.WriteLine("<> D4DA Loaded"); @@ -76,10 +107,75 @@ public ExternalDBApplicationResult OnStartup(ControlledApplication application) } } - private void DesignAutomationBridge_DesignAutomationReadyEvent(object? sender, DesignAutomationReadyEventArgs e) + public void HandleDesignAutomationReadyEvent(object sender, DesignAutomationReadyEventArgs e) + { + Console.WriteLine("<> DA event raised."); + WorkItemFolder = Directory.GetCurrentDirectory(); + + foreach (var xx in Directory.EnumerateFiles(WorkItemFolder)) + Console.WriteLine(xx); + + var dynTempDir = Path.Combine(WorkItemFolder, "dyn_tmp"); + Console.WriteLine($"<> Work folder is '{WorkItemFolder}'"); + var app = e.DesignAutomationData?.RevitApp; + Console.WriteLine("<> Preparing Dynamo model. Vers 1"); + + var hostloc = typeof(Autodesk.Revit.ApplicationServices.Application).Assembly.Location; + var asmLocation = Path.GetDirectoryName(hostloc); + Console.WriteLine($"using asm at location {asmLocation}"); + Console.WriteLine($"Is Loaded {LoadMessage}"); + var curFolder = Directory.GetParent(Assembly.GetExecutingAssembly().Location).FullName; + var cmdArgs = new Dynamo.Applications.StartupUtils.CommandLineArguments(); + cmdArgs.ASMPath = asmLocation; + cmdArgs.DisableAnalytics = true; + cmdArgs.ServiceMode = true; + cmdArgs.AnalyticsInfo = new() { HostName = "Revit_DA" }; + cmdArgs.ImportedPaths = [Path.Combine(curFolder, "nodes", "RevitNodes.dll"), Path.Combine(curFolder, "nodes", "DSRevitNodesUI.dll")]; + // need this for cloud, does not work on local + cmdArgs.UserDataFolder = Path.Combine(dynTempDir, "Dynamo Revit"); + cmdArgs.CommonDataFolder = Path.Combine(dynTempDir, "Dynamo"); + + app.NewProjectDocument(Autodesk.Revit.DB.UnitSystem.Metric); + + DocumentManager.Instance.PrepareForAutomation(app); + + //true, asmLocation, "Revit_DA" + model = Dynamo.Applications.StartupUtils.MakeCLIModel(cmdArgs); + + LoadMessage = model != null ? "loaded" : "no loaded"; + Console.WriteLine($"Checking python in {curFolder}"); + CheckIfPythonExists(curFolder); + + var playerHost = new PlayerHostDynamoDefault(model, new DynamoPlayerLogger(logConfig)); + var workflows = new DynamoModelWorkflows( + playerHost, + new DynamoPlayerLogger(logConfig)); + + var controller = new DynamoControllerImplementation(playerHost, workflows, + new DynamoPlayerLogger(logConfig)); + + DynamoPlayerLogger.Initialize(playerHost); + + var dynHandler = new Handler(playerHost, [new DynamoController(controller)]); + + var runContent = File.ReadAllText(Path.Combine(WorkItemFolder, "run.json")); + + var testFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + var res = dynHandler.HandleRoute("POST", "/v1/graph/run", runContent); + var output = res.Result; + + var result = Newtonsoft.Json.JsonConvert.SerializeObject(output); + Console.WriteLine(result); + + File.WriteAllText(Path.Combine(WorkItemFolder, "result.json"), result); + + model.RunCompleted += Model_RunCompleted; + e.Succeeded = true; + } + + private void Model_RunCompleted(object sender, bool success) { - var da = new DynamoADApp(); - da.HandleDesignAutomationReadyEvent(sender, e); + Console.WriteLine($"Run Completed"); } } } \ No newline at end of file diff --git a/src/DADynamoApp/DAHandler.cs b/src/DADynamoApp/DAHandler.cs deleted file mode 100644 index 9fe8c879af..0000000000 --- a/src/DADynamoApp/DAHandler.cs +++ /dev/null @@ -1,120 +0,0 @@ -using DesignAutomationFramework; -using Autodesk.Revit.ApplicationServices; -using System.Reflection; -using Dynamo.Models; -using System.IO.Compression; -using DynamoPlayer; -using RevitServices.Persistence; - -namespace DADynamoApp -{ - public class DynamoADApp - { - private ControlledApplication ControlledApplication; - private DynamoModel model; - internal static DynamoPlayerLoggerConfiguration logConfig = new DynamoPlayerLoggerConfiguration() { DynamoLogLevel = Dynamo.Logging.LogLevel.Console, LogLevel = DynamoPlayer.LogLevel.Information }; - - private void CheckIfPythonExists(string inputFolder) - { - var pyDir = "python-3.9.12-embed-amd64"; - var pyRoot = Path.GetDirectoryName(model.PathManager.CommonDataDirectory); - var searchPath = Path.Combine(pyRoot, pyDir); - if (Directory.Exists(searchPath) && File.Exists(Path.Combine(searchPath, "python.exe"))) - { - return; - } - Console.WriteLine($"<> cPython not found at '{searchPath}'"); - var inputDistributionPath = Path.Combine(inputFolder, $"{pyDir}.zip"); - if (File.Exists(inputDistributionPath)) - { - Console.WriteLine("<> cPython distribution detected in input. Attempting to add it... "); - try - { - ZipFile.ExtractToDirectory(inputDistributionPath, searchPath); - Console.WriteLine("<> cPython added."); - } - catch (Exception ex) - { - Console.WriteLine($"<> Failed to add cPython: {ex.Message}"); - } - } - } - - private bool Loaded = false; - private string LoadMessage; - private string WorkItemFolder; - - public void HandleDesignAutomationReadyEvent(object sender, DesignAutomationReadyEventArgs e) - { - Console.WriteLine("<> DA event raised."); - WorkItemFolder = Directory.GetCurrentDirectory(); - var dynTempDir = Path.Combine(WorkItemFolder, "dyn_tmp"); - Console.WriteLine($"<> Work folder is '{WorkItemFolder}'"); - var app = e.DesignAutomationData?.RevitApp; - Console.WriteLine("<> Preparing Dynamo model. Vers 1"); - - - // Initialize Dynamo Core - // Preload ASM from Revit - // Preload Core libs from DynamoCore - // Preload NodeModels and libs from DynamoRevit - // Setup design automation - // Startup Player run request - - var hostloc = typeof(Autodesk.Revit.ApplicationServices.Application).Assembly.Location; - var asmLocation = Path.GetDirectoryName(hostloc); - Console.WriteLine($"using asm at location {asmLocation}"); - - var curFolder = Directory.GetParent(Assembly.GetExecutingAssembly().Location).FullName; - - - Console.WriteLine($"Is Loaded {LoadMessage}"); - - var cmdArgs = new Dynamo.Applications.StartupUtils.CommandLineArguments(); - cmdArgs.ASMPath = asmLocation; - cmdArgs.DisableAnalytics = true; - cmdArgs.ServiceMode = true; - cmdArgs.AnalyticsInfo = new() { HostName = "Revit_DA" }; - cmdArgs.ImportedPaths = [Path.Combine(curFolder, "nodes", "RevitNodes.dll"), Path.Combine(curFolder, "nodes", "DSRevitNodesUI.dll")]; - cmdArgs.UserDataFolder = Path.Combine(dynTempDir, "Dynamo Revit"); - cmdArgs.CommonDataFolder = Path.Combine(dynTempDir, "Dynamo"); - - DocumentManager.Instance.PrepareForAutomation(app); - - //true, asmLocation, "Revit_DA" - model = Dynamo.Applications.StartupUtils.MakeCLIModel(cmdArgs); - - LoadMessage = model != null ? "loaded" : "no loaded"; - Console.WriteLine($"Checking python in {curFolder}"); - CheckIfPythonExists(curFolder); - - var playerHost = new PlayerHostDynamoDefault(model, new DynamoPlayerLogger(logConfig)); - var workflows = new DynamoModelWorkflows( - playerHost, - new DynamoPlayerLogger(logConfig)); - - var controller = new DynamoControllerImplementation(playerHost, workflows, - new DynamoPlayerLogger(logConfig)); - - DynamoPlayerLogger.Initialize(playerHost); - - var dynHandler = new Handler(playerHost, [new DynamoController(controller)]); - - - var testFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); - var res = dynHandler.HandleRoute("POST", "/v1/graph/run", File.ReadAllText(Path.Combine(testFolder, "test.json"))); - var output = res.Result; - - Console.WriteLine(Newtonsoft.Json.JsonConvert.SerializeObject(output)); - - model.RunCompleted += Model_RunCompleted; - - e.Succeeded = true; - } - - private void Model_RunCompleted(object sender, bool success) - { - Console.WriteLine($"Run Completed"); - } - } -} \ No newline at end of file diff --git a/src/DADynamoApp/DynamoPathResolver.cs b/src/DADynamoApp/DynamoPathResolver.cs index d0e1739591..bb27833d36 100644 --- a/src/DADynamoApp/DynamoPathResolver.cs +++ b/src/DADynamoApp/DynamoPathResolver.cs @@ -3,119 +3,64 @@ namespace DADynamoApp { - internal static class DynamoPathResolver - { - public static string DynamoCorePath + internal static class DynamoPathResolver { - get - { - if (string.IsNullOrEmpty(dynamopath)) + /// + /// Finds the Dynamo Core path by looking into registery or potentially a config file. + /// + /// The root folder path of Dynamo Core. + private static string GetDynamoCorePath() { - dynamopath = GetDynamoCorePath(); + var dynamoRevitRoot = Path.GetDirectoryName(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)); + //TODO: use config file to setup Dynamo Path for debug builds. + + //When there is no config file, just replace DynamoRevit by Dynamo + //from the 'dynamoRevitRoot' folder. + var parent = new DirectoryInfo(dynamoRevitRoot); + var path = string.Empty; + while (null != parent && parent.Name != @"DynamoRevit") + { + path = Path.Combine(parent.Name, path); + parent = Directory.GetParent(parent.FullName); + } + + return parent != null ? Path.Combine(Path.GetDirectoryName(parent.FullName), @"Dynamo", path) : dynamoRevitRoot; } - return dynamopath; - } - } - - /// - /// Finds the Dynamo Core path by looking into registery or potentially a config file. - /// - /// The root folder path of Dynamo Core. - private static string GetDynamoCorePath() - { - var dynamoRevitRootDirectory = Path.GetDirectoryName(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)); - var dynamoRoot = GetDynamoRoot(dynamoRevitRootDirectory); - return dynamoRoot; - } - - /// - /// Gets Dynamo Root folder from the given DynamoRevit root. - /// - /// The root folder of DynamoRevit binaries - /// The root folder path of Dynamo Core - private static string GetDynamoRoot(string dynamoRevitRoot) - { - //TODO: use config file to setup Dynamo Path for debug builds. - - //When there is no config file, just replace DynamoRevit by Dynamo - //from the 'dynamoRevitRoot' folder. - var parent = new DirectoryInfo(dynamoRevitRoot); - var path = string.Empty; - while (null != parent && parent.Name != @"DynamoRevit") - { - path = Path.Combine(parent.Name, path); - parent = Directory.GetParent(parent.FullName); - } - return parent != null ? Path.Combine(Path.GetDirectoryName(parent.FullName), @"Dynamo", path) : dynamoRevitRoot; - } - - private static string dynamopath; - - public static Assembly? Default_Resolving(AssemblyLoadContext arg1, AssemblyName args) - { - var assemblyPath = string.Empty; - var assemblyName = new AssemblyName(args.Name).Name + ".dll"; + private static string dynamopath = null; - try - { - assemblyPath = Path.Combine(DynamoPathResolver.DynamoCorePath, assemblyName); - if (File.Exists(assemblyPath)) + + public static Assembly ResolveAssembly(object? sender, ResolveEventArgs args) { - return arg1.LoadFromAssemblyPath(assemblyPath); + dynamopath ??= GetDynamoCorePath(); + + var assemblyName = new AssemblyName(args.Name).Name + ".dll"; + var assemblyPath = Path.Combine(dynamopath, assemblyName); + try + { + if (File.Exists(assemblyPath)) + { + return Assembly.LoadFrom(assemblyPath); + } + + var assemblyLocation = Assembly.GetExecutingAssembly().Location; + var assemblyDirectory = Path.GetDirectoryName(assemblyLocation); + + // Try "Dynamo 0.x\Revit_20xx" folder first... + assemblyPath = Path.Combine(assemblyDirectory, assemblyName); + if (!File.Exists(assemblyPath)) + { + // If assembly cannot be found, try in "Dynamo 0.x" folder. + var parentDirectory = Directory.GetParent(assemblyDirectory); + assemblyPath = Path.Combine(parentDirectory.FullName, assemblyName); + } + + return (File.Exists(assemblyPath) ? Assembly.LoadFrom(assemblyPath) : null); + } + catch (Exception ex) + { + throw new Exception(string.Format("The location of the assembly, {0} could not be resolved for loading.", assemblyPath), ex); + } } - - var assemblyLocation = Assembly.GetExecutingAssembly().Location; - var assemblyDirectory = Path.GetDirectoryName(assemblyLocation); - - // Try "Dynamo 0.x\Revit_20xx" folder first... - assemblyPath = Path.Combine(assemblyDirectory, assemblyName); - if (!File.Exists(assemblyPath)) - { - // If assembly cannot be found, try in "Dynamo 0.x" folder. - var parentDirectory = Directory.GetParent(assemblyDirectory); - assemblyPath = Path.Combine(parentDirectory.FullName, assemblyName); - } - - return (File.Exists(assemblyPath) ? arg1.LoadFromAssemblyPath(assemblyPath) : null); - } - catch (Exception ex) - { - throw new Exception(string.Format("The location of the assembly, {0} could not be resolved for loading.", assemblyPath), ex); - } - } - - public static Assembly ResolveAssembly(object sender, ResolveEventArgs args) - { - var assemblyPath = string.Empty; - var assemblyName = new AssemblyName(args.Name).Name + ".dll"; - - try - { - assemblyPath = Path.Combine(DynamoPathResolver.DynamoCorePath, assemblyName); - if (File.Exists(assemblyPath)) - { - return Assembly.LoadFrom(assemblyPath); - } - - var assemblyLocation = Assembly.GetExecutingAssembly().Location; - var assemblyDirectory = Path.GetDirectoryName(assemblyLocation); - - // Try "Dynamo 0.x\Revit_20xx" folder first... - assemblyPath = Path.Combine(assemblyDirectory, assemblyName); - if (!File.Exists(assemblyPath)) - { - // If assembly cannot be found, try in "Dynamo 0.x" folder. - var parentDirectory = Directory.GetParent(assemblyDirectory); - assemblyPath = Path.Combine(parentDirectory.FullName, assemblyName); - } - - return (File.Exists(assemblyPath) ? Assembly.LoadFrom(assemblyPath) : null); - } - catch (Exception ex) - { - throw new Exception(string.Format("The location of the assembly, {0} could not be resolved for loading.", assemblyPath), ex); - } } - } } diff --git a/src/DynamoRevit.DA.sln b/src/DynamoRevit.DA.sln index bb1d3b324c..c4e1eaa42f 100644 --- a/src/DynamoRevit.DA.sln +++ b/src/DynamoRevit.DA.sln @@ -42,8 +42,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "config", "config", "{956846 EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DADynamoApp", "DADynamoApp\DADynamoApp.csproj", "{66A0E1C8-2514-48B7-8406-536983F57F88}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DADynamoConsole", "DADynamoConsole\DADynamoConsole.csproj", "{A74FF970-C032-445D-8E41-8BBC70CC01AF}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|NET80_DA = Debug|NET80_DA @@ -68,9 +66,6 @@ Global {66A0E1C8-2514-48B7-8406-536983F57F88}.Debug|NET80_DA.ActiveCfg = Debug|NET80_DA {66A0E1C8-2514-48B7-8406-536983F57F88}.Debug|NET80_DA.Build.0 = Debug|NET80_DA {66A0E1C8-2514-48B7-8406-536983F57F88}.Release|NET80_DA.ActiveCfg = Release|NET80_DA - {A74FF970-C032-445D-8E41-8BBC70CC01AF}.Debug|NET80_DA.ActiveCfg = Debug|NET80_DA - {A74FF970-C032-445D-8E41-8BBC70CC01AF}.Debug|NET80_DA.Build.0 = Debug|NET80_DA - {A74FF970-C032-445D-8E41-8BBC70CC01AF}.Release|NET80_DA.ActiveCfg = Release|NET80_DA EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/Libraries/RevitNodesUI/SiteLocation.cs b/src/Libraries/RevitNodesUI/SiteLocation.cs index 87832d7625..933ebacbfd 100644 --- a/src/Libraries/RevitNodesUI/SiteLocation.cs +++ b/src/Libraries/RevitNodesUI/SiteLocation.cs @@ -3,7 +3,7 @@ #if UI_SUPPORT using Dynamo.Controls; #else -using DynamoRevitApp = DADynamoApp.DynamoADApp; +using DynamoRevitApp = DADynamoApp.DAEntrypoint; #endif using Dynamo.Graph.Nodes; using Newtonsoft.Json; From f89cd62b0e06b441737070bf9b683e2a78cb8a1a Mon Sep 17 00:00:00 2001 From: pinzart90 Date: Tue, 8 Apr 2025 19:13:45 -0400 Subject: [PATCH 32/70] update --- src/DADynamoConsole/DADynamoConsole.csproj | 23 ---------------------- src/DADynamoConsole/Program.cs | 4 ---- 2 files changed, 27 deletions(-) delete mode 100644 src/DADynamoConsole/DADynamoConsole.csproj delete mode 100644 src/DADynamoConsole/Program.cs diff --git a/src/DADynamoConsole/DADynamoConsole.csproj b/src/DADynamoConsole/DADynamoConsole.csproj deleted file mode 100644 index 7e61a0b07e..0000000000 --- a/src/DADynamoConsole/DADynamoConsole.csproj +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - Exe - enable - enable - false - - - - - - - - - - - - - diff --git a/src/DADynamoConsole/Program.cs b/src/DADynamoConsole/Program.cs deleted file mode 100644 index c42620a3c2..0000000000 --- a/src/DADynamoConsole/Program.cs +++ /dev/null @@ -1,4 +0,0 @@ -using System.Reflection; - -Assembly.LoadFrom(@"C:\Program Files\Autodesk\Revit 2025\RevitAPI.dll"); -DADynamoApp.ConsoleEntrypoint.DoStuff(); \ No newline at end of file From aaf11947b0d7b661085f56253e97f8112e9666bd Mon Sep 17 00:00:00 2001 From: pinzart90 Date: Tue, 8 Apr 2025 19:22:48 -0400 Subject: [PATCH 33/70] update --- src/DynamoRevit/Models/RevitNodeModel.cs | 14 -------------- src/DynamoRevit/Properties/AssemblyInfo.cs | 3 ++- src/Libraries/RevitNodes/Elements/Element.cs | 13 ++++++++++++- src/Libraries/RevitNodes/Elements/LinkElement.cs | 1 - 4 files changed, 14 insertions(+), 17 deletions(-) delete mode 100644 src/DynamoRevit/Models/RevitNodeModel.cs diff --git a/src/DynamoRevit/Models/RevitNodeModel.cs b/src/DynamoRevit/Models/RevitNodeModel.cs deleted file mode 100644 index a5014e3d62..0000000000 --- a/src/DynamoRevit/Models/RevitNodeModel.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System.Collections.Generic; -using Dynamo.Graph.Nodes; -using Newtonsoft.Json; - -namespace Dynamo.Applications.Models -{ - public abstract class RevitNodeModel : NodeModel - { - public RevitNodeModel() { } - - [JsonConstructor] - public RevitNodeModel(IEnumerable inPorts, IEnumerable outPorts) : base(inPorts, outPorts) { } - } -} diff --git a/src/DynamoRevit/Properties/AssemblyInfo.cs b/src/DynamoRevit/Properties/AssemblyInfo.cs index 5996d78d11..68599b3ba7 100644 --- a/src/DynamoRevit/Properties/AssemblyInfo.cs +++ b/src/DynamoRevit/Properties/AssemblyInfo.cs @@ -9,4 +9,5 @@ [assembly: AssemblyCulture("")] [assembly: Guid("082cab33-cbc7-4e58-ae25-f0962f325d6e")] [assembly: InternalsVisibleTo("RevitTestServices")] -[assembly: InternalsVisibleTo("RevitSystemTests")] \ No newline at end of file +[assembly: InternalsVisibleTo("RevitSystemTests")] +[assembly: TypeForwardedTo(typeof(Dynamo.Applications.Models.RevitNodeModel))] \ No newline at end of file diff --git a/src/Libraries/RevitNodes/Elements/Element.cs b/src/Libraries/RevitNodes/Elements/Element.cs index 683b8032ed..3b29a39e2d 100644 --- a/src/Libraries/RevitNodes/Elements/Element.cs +++ b/src/Libraries/RevitNodes/Elements/Element.cs @@ -287,10 +287,21 @@ public virtual void Dispose() // Do not delete Revit owned elements if (!IsRevitOwned && remainingBindings == 0 && !didRevitDelete) { +#if UI_SUPPORT if(this.InternalElement is View && InternalElement.IsValidObject) { - + Autodesk.Revit.UI.UIDocument uIDocument = new Autodesk.Revit.UI.UIDocument(Document); + var openedViews = uIDocument.GetOpenUIViews().ToList(); + var shouldClosedViews = openedViews.FindAll(x => InternalElement.Id == x.ViewId); + foreach (var v in shouldClosedViews) + { + if (uIDocument.GetOpenUIViews().ToList().Count() > 1) + v.Close(); + else + throw new InvalidOperationException(string.Format(Properties.Resources.CantCloseLastOpenView, this.ToString())); + } } +#endif DocumentManager.Instance.DeleteElement(new ElementUUID(InternalUniqueId)); } else diff --git a/src/Libraries/RevitNodes/Elements/LinkElement.cs b/src/Libraries/RevitNodes/Elements/LinkElement.cs index 103f8490b8..1976ba99be 100644 --- a/src/Libraries/RevitNodes/Elements/LinkElement.cs +++ b/src/Libraries/RevitNodes/Elements/LinkElement.cs @@ -4,7 +4,6 @@ using Autodesk.DesignScript.Geometry; using Autodesk.DesignScript.Runtime; using Autodesk.Revit.DB; -//using Autodesk.Revit.UI; using Dynamo.Graph.Nodes; using Revit.GeometryConversion; using RevitServices.Persistence; From 54896d96f53e52186624d652c58fc4971b5ba9a1 Mon Sep 17 00:00:00 2001 From: pinzart90 Date: Tue, 8 Apr 2025 19:35:56 -0400 Subject: [PATCH 34/70] update --- src/Libraries/RevitNodesUI/Elements.cs | 22 ++++++++++++++----- src/Libraries/RevitNodesUI/RevitDropDown.cs | 10 ++++++--- .../RevitServices/Elements/DisposeLogic.cs | 16 -------------- .../Properties/Resources.Designer.cs | 11 +--------- .../Properties/Resources.en-US.resx | 3 --- .../RevitServices/Properties/Resources.resx | 3 --- 6 files changed, 24 insertions(+), 41 deletions(-) diff --git a/src/Libraries/RevitNodesUI/Elements.cs b/src/Libraries/RevitNodesUI/Elements.cs index 60333139d7..60890a37cb 100644 --- a/src/Libraries/RevitNodesUI/Elements.cs +++ b/src/Libraries/RevitNodesUI/Elements.cs @@ -29,6 +29,10 @@ using View = Revit.Elements.Views.View; using RevitServices.Transactions; +#if !UI_SUPPORT +using DynamoRevitApp = DADynamoApp.DAEntrypoint; +#endif + namespace DSRevitNodesUI { public abstract class ElementsQueryBase : RevitNodeModel @@ -281,8 +285,10 @@ public ElementsInView() OutPorts.Add(new PortModel(PortType.Output, this, new PortData("elements", Properties.Resources.PortDataAllVisibleElementsToolTip))); RegisterAllPorts(); - //DynamoRevitApp.EventHandlerProxy.ViewActivated += RevitDynamoModel_RevitDocumentChanged; - //DynamoRevitApp.EventHandlerProxy.DocumentOpened += RevitDynamoModel_RevitDocumentChanged; +#if UI_SUPPORT + DynamoRevitApp.EventHandlerProxy.ViewActivated += RevitDynamoModel_RevitDocumentChanged; +#endif + DynamoRevitApp.EventHandlerProxy.DocumentOpened += RevitDynamoModel_RevitDocumentChanged; RevitServicesUpdater.Instance.ElementsUpdated += RevitServicesUpdaterOnElementsUpdated; RevitDynamoModel_RevitDocumentChanged(null, null); @@ -291,8 +297,10 @@ public ElementsInView() [JsonConstructor] public ElementsInView(IEnumerable inPorts, IEnumerable outPorts) : base(inPorts, outPorts) { - //DynamoRevitApp.EventHandlerProxy.ViewActivated += RevitDynamoModel_RevitDocumentChanged; - //DynamoRevitApp.EventHandlerProxy.DocumentOpened += RevitDynamoModel_RevitDocumentChanged; +#if UI_SUPPORT + DynamoRevitApp.EventHandlerProxy.ViewActivated += RevitDynamoModel_RevitDocumentChanged; +#endif + DynamoRevitApp.EventHandlerProxy.DocumentOpened += RevitDynamoModel_RevitDocumentChanged; RevitServicesUpdater.Instance.ElementsUpdated += RevitServicesUpdaterOnElementsUpdated; RevitDynamoModel_RevitDocumentChanged(null, null); @@ -300,8 +308,10 @@ public ElementsInView(IEnumerable inPorts, IEnumerable out public override void Dispose() { - //DynamoRevitApp.EventHandlerProxy.ViewActivated -= RevitDynamoModel_RevitDocumentChanged; - //DynamoRevitApp.EventHandlerProxy.DocumentOpened -= RevitDynamoModel_RevitDocumentChanged; +#if UI_SUPPORT + DynamoRevitApp.EventHandlerProxy.ViewActivated -= RevitDynamoModel_RevitDocumentChanged; +#endif + DynamoRevitApp.EventHandlerProxy.DocumentOpened -= RevitDynamoModel_RevitDocumentChanged; RevitServicesUpdater.Instance.ElementsUpdated -= RevitServicesUpdaterOnElementsUpdated; diff --git a/src/Libraries/RevitNodesUI/RevitDropDown.cs b/src/Libraries/RevitNodesUI/RevitDropDown.cs index bc0798337e..db808e076c 100644 --- a/src/Libraries/RevitNodesUI/RevitDropDown.cs +++ b/src/Libraries/RevitNodesUI/RevitDropDown.cs @@ -28,6 +28,10 @@ using RevitServices.Elements; using RevitServices.Transactions; +#if !UI_SUPPORT +using DynamoRevitApp = DADynamoApp.DAEntrypoint; +#endif + namespace DSRevitNodesUI { public class DropDownItemEqualityComparer : IEqualityComparer @@ -48,14 +52,14 @@ public abstract class RevitDropDownBase : DSDropDownBase protected RevitDropDownBase(string value) : base(value) { RevitServicesUpdater.Instance.ElementsUpdated += Updater_ElementsUpdated; - //DynamoRevitApp.EventHandlerProxy.DocumentOpened += Controller_RevitDocumentChanged; + DynamoRevitApp.EventHandlerProxy.DocumentOpened += Controller_RevitDocumentChanged; } [JsonConstructor] public RevitDropDownBase(string value, IEnumerable inPorts, IEnumerable outPorts) : base(value, inPorts, outPorts) { RevitServicesUpdater.Instance.ElementsUpdated += Updater_ElementsUpdated; - //DynamoRevitApp.EventHandlerProxy.DocumentOpened += Controller_RevitDocumentChanged; + DynamoRevitApp.EventHandlerProxy.DocumentOpened += Controller_RevitDocumentChanged; } void Controller_RevitDocumentChanged(object sender, EventArgs e) @@ -90,7 +94,7 @@ private void Updater_ElementsUpdated(object sender, ElementUpdateEventArgs e) public override void Dispose() { RevitServicesUpdater.Instance.ElementsUpdated -= Updater_ElementsUpdated; - //DynamoRevitApp.EventHandlerProxy.DocumentOpened -= Controller_RevitDocumentChanged; + DynamoRevitApp.EventHandlerProxy.DocumentOpened -= Controller_RevitDocumentChanged; base.Dispose(); } diff --git a/src/Libraries/RevitServices/Elements/DisposeLogic.cs b/src/Libraries/RevitServices/Elements/DisposeLogic.cs index 4751d5ac00..fa9d1f88aa 100644 --- a/src/Libraries/RevitServices/Elements/DisposeLogic.cs +++ b/src/Libraries/RevitServices/Elements/DisposeLogic.cs @@ -21,21 +21,5 @@ public class DisposeLogic /// removed. /// public static bool IsClosingHomeworkspace { get; set; } - - internal void CloseDocumentsOnElementDispo(Document document, Element elementId) - { -#if UI_SUPPORT - Autodesk.Revit.UI.UIDocument uIDocument = new Autodesk.Revit.UI.UIDocument(document); - var openedViews = uIDocument.GetOpenUIViews().ToList(); - var shouldClosedViews = openedViews.FindAll(x => elementId.Id == x.ViewId); - foreach (var v in shouldClosedViews) - { - if (uIDocument.GetOpenUIViews().ToList().Count() > 1) - v.Close(); - else - throw new InvalidOperationException(string.Format(Properties.Resources.CantCloseLastOpenView, this.ToString())); - } -#endif - } } } diff --git a/src/Libraries/RevitServices/Properties/Resources.Designer.cs b/src/Libraries/RevitServices/Properties/Resources.Designer.cs index 8cac03742b..a5a8033dae 100644 --- a/src/Libraries/RevitServices/Properties/Resources.Designer.cs +++ b/src/Libraries/RevitServices/Properties/Resources.Designer.cs @@ -19,7 +19,7 @@ namespace RevitServices.Properties { // class via a tool like ResGen or Visual Studio. // To add or remove a member, edit your .ResX file then rerun ResGen // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class Resources { @@ -60,15 +60,6 @@ internal Resources() { } } - /// - /// Looks up a localized string similar to This is the last opened view {0} , can't be delete. - /// - internal static string CantCloseLastOpenView { - get { - return ResourceManager.GetString("CantCloseLastOpenView", resourceCulture); - } - } - /// /// Looks up a localized string similar to DynamoRevit TransactionManager is disabled. This Node is disabled as new Revit transactions are not supported in this mode.. /// diff --git a/src/Libraries/RevitServices/Properties/Resources.en-US.resx b/src/Libraries/RevitServices/Properties/Resources.en-US.resx index c59e991048..01e2a8af80 100644 --- a/src/Libraries/RevitServices/Properties/Resources.en-US.resx +++ b/src/Libraries/RevitServices/Properties/Resources.en-US.resx @@ -117,9 +117,6 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - This is the last opened view {0} , can't be delete - DynamoRevit TransactionManager is disabled. This Node is disabled as new Revit transactions are not supported in this mode. diff --git a/src/Libraries/RevitServices/Properties/Resources.resx b/src/Libraries/RevitServices/Properties/Resources.resx index c59e991048..01e2a8af80 100644 --- a/src/Libraries/RevitServices/Properties/Resources.resx +++ b/src/Libraries/RevitServices/Properties/Resources.resx @@ -117,9 +117,6 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - This is the last opened view {0} , can't be delete - DynamoRevit TransactionManager is disabled. This Node is disabled as new Revit transactions are not supported in this mode. From 8b754f8a20b20d73196a59fddb90f498737c13f1 Mon Sep 17 00:00:00 2001 From: pinzart90 Date: Tue, 8 Apr 2025 19:37:45 -0400 Subject: [PATCH 35/70] Update DisposeLogic.cs --- src/Libraries/RevitServices/Elements/DisposeLogic.cs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/Libraries/RevitServices/Elements/DisposeLogic.cs b/src/Libraries/RevitServices/Elements/DisposeLogic.cs index fa9d1f88aa..dddf40e144 100644 --- a/src/Libraries/RevitServices/Elements/DisposeLogic.cs +++ b/src/Libraries/RevitServices/Elements/DisposeLogic.cs @@ -1,8 +1,4 @@ -using Autodesk.Revit.DB; -using System; -using System.Linq; - -namespace RevitServices.Elements +namespace RevitServices.Elements { public class DisposeLogic { From 3019b88866e46a5089216a5289faf3664433036f Mon Sep 17 00:00:00 2001 From: pinzart90 Date: Wed, 9 Apr 2025 14:53:33 -0400 Subject: [PATCH 36/70] update --- src/Config/CS_SDK.props | 3 +++ src/Libraries/RevitNodes/Elements/Element.cs | 2 +- src/Libraries/RevitNodes/Elements/Views/Sheet.cs | 2 +- src/Libraries/RevitNodes/Elements/Views/View.cs | 4 ++-- src/Libraries/RevitNodes/Transaction/Transaction.cs | 2 +- src/Libraries/RevitNodesUI/Elements.cs | 8 ++++---- src/Libraries/RevitNodesUI/RevitDropDown.cs | 2 +- src/Libraries/RevitNodesUI/SiteLocation.cs | 8 ++++---- src/Libraries/RevitNodesUI/SunPath.cs | 6 +++--- src/Libraries/RevitServices/Events/EventHandlerProxy.cs | 4 ++-- .../RevitServices/Persistence/DocumentManager.cs | 4 ++-- 11 files changed, 24 insertions(+), 21 deletions(-) diff --git a/src/Config/CS_SDK.props b/src/Config/CS_SDK.props index a68d3b9012..26bc873583 100644 --- a/src/Config/CS_SDK.props +++ b/src/Config/CS_SDK.props @@ -55,4 +55,7 @@ true $(DefineConstants);NETFRAMEWORK + + $(DefineConstants);DESIGN_AUTOMATION + diff --git a/src/Libraries/RevitNodes/Elements/Element.cs b/src/Libraries/RevitNodes/Elements/Element.cs index 3b29a39e2d..33f69fdf98 100644 --- a/src/Libraries/RevitNodes/Elements/Element.cs +++ b/src/Libraries/RevitNodes/Elements/Element.cs @@ -287,7 +287,7 @@ public virtual void Dispose() // Do not delete Revit owned elements if (!IsRevitOwned && remainingBindings == 0 && !didRevitDelete) { -#if UI_SUPPORT +#if !DESIGN_AUTOMATION if(this.InternalElement is View && InternalElement.IsValidObject) { Autodesk.Revit.UI.UIDocument uIDocument = new Autodesk.Revit.UI.UIDocument(Document); diff --git a/src/Libraries/RevitNodes/Elements/Views/Sheet.cs b/src/Libraries/RevitNodes/Elements/Views/Sheet.cs index ebdde30b6f..34d73a7fb7 100644 --- a/src/Libraries/RevitNodes/Elements/Views/Sheet.cs +++ b/src/Libraries/RevitNodes/Elements/Views/Sheet.cs @@ -773,7 +773,7 @@ public static Sheet DuplicateSheet(Sheet sheet, bool duplicateWithContents = fal } } } -#if UI_SUPPORT +#if !DESIGN_AUTOMATION if(newSheet == null) { Autodesk.Revit.UI.UIDocument uIDocument = new Autodesk.Revit.UI.UIDocument(Document); diff --git a/src/Libraries/RevitNodes/Elements/Views/View.cs b/src/Libraries/RevitNodes/Elements/Views/View.cs index 8310ad22b7..5050e95d26 100644 --- a/src/Libraries/RevitNodes/Elements/Views/View.cs +++ b/src/Libraries/RevitNodes/Elements/Views/View.cs @@ -619,7 +619,7 @@ public static Revit.Elements.Views.View DuplicateView(View view, string viewDupl newViewName = prefix + view.Name + suffix; } -#if UI_SUPPORT +#if !DESIGN_AUTOMATION Autodesk.Revit.UI.UIDocument uIDocument = new Autodesk.Revit.UI.UIDocument(Document); var openedViews = uIDocument.GetOpenUIViews().ToList(); @@ -654,7 +654,7 @@ public static Revit.Elements.Views.View DuplicateView(View view, string viewDupl var param = newView.InternalView.get_Parameter(BuiltInParameter.VIEW_NAME); param.Set(newViewName); } -#if UI_SUPPORT +#if !DESIGN_AUTOMATION if (viewElement != null) { var shouldClosedViews = openedViews.FindAll(x => viewElement.Id == x.ViewId); diff --git a/src/Libraries/RevitNodes/Transaction/Transaction.cs b/src/Libraries/RevitNodes/Transaction/Transaction.cs index ff79e401e0..8d67caa323 100644 --- a/src/Libraries/RevitNodes/Transaction/Transaction.cs +++ b/src/Libraries/RevitNodes/Transaction/Transaction.cs @@ -30,7 +30,7 @@ public static object Start(object input) public static object End(object input) { TransactionManager.Instance.ForceCloseTransaction(); -#if UI_SUPPORT +#if !DESIGN_AUTOMATION DocumentManager.Instance.CurrentUIDocument.RefreshActiveView(); #endif return input; diff --git a/src/Libraries/RevitNodesUI/Elements.cs b/src/Libraries/RevitNodesUI/Elements.cs index 60890a37cb..182206fb0d 100644 --- a/src/Libraries/RevitNodesUI/Elements.cs +++ b/src/Libraries/RevitNodesUI/Elements.cs @@ -29,7 +29,7 @@ using View = Revit.Elements.Views.View; using RevitServices.Transactions; -#if !UI_SUPPORT +#if DESIGN_AUTOMATION using DynamoRevitApp = DADynamoApp.DAEntrypoint; #endif @@ -285,7 +285,7 @@ public ElementsInView() OutPorts.Add(new PortModel(PortType.Output, this, new PortData("elements", Properties.Resources.PortDataAllVisibleElementsToolTip))); RegisterAllPorts(); -#if UI_SUPPORT +#if !DESIGN_AUTOMATION DynamoRevitApp.EventHandlerProxy.ViewActivated += RevitDynamoModel_RevitDocumentChanged; #endif DynamoRevitApp.EventHandlerProxy.DocumentOpened += RevitDynamoModel_RevitDocumentChanged; @@ -297,7 +297,7 @@ public ElementsInView() [JsonConstructor] public ElementsInView(IEnumerable inPorts, IEnumerable outPorts) : base(inPorts, outPorts) { -#if UI_SUPPORT +#if !DESIGN_AUTOMATION DynamoRevitApp.EventHandlerProxy.ViewActivated += RevitDynamoModel_RevitDocumentChanged; #endif DynamoRevitApp.EventHandlerProxy.DocumentOpened += RevitDynamoModel_RevitDocumentChanged; @@ -308,7 +308,7 @@ public ElementsInView(IEnumerable inPorts, IEnumerable out public override void Dispose() { -#if UI_SUPPORT +#if !DESIGN_AUTOMATION DynamoRevitApp.EventHandlerProxy.ViewActivated -= RevitDynamoModel_RevitDocumentChanged; #endif DynamoRevitApp.EventHandlerProxy.DocumentOpened -= RevitDynamoModel_RevitDocumentChanged; diff --git a/src/Libraries/RevitNodesUI/RevitDropDown.cs b/src/Libraries/RevitNodesUI/RevitDropDown.cs index db808e076c..f16a886416 100644 --- a/src/Libraries/RevitNodesUI/RevitDropDown.cs +++ b/src/Libraries/RevitNodesUI/RevitDropDown.cs @@ -28,7 +28,7 @@ using RevitServices.Elements; using RevitServices.Transactions; -#if !UI_SUPPORT +#if DESIGN_AUTOMATION using DynamoRevitApp = DADynamoApp.DAEntrypoint; #endif diff --git a/src/Libraries/RevitNodesUI/SiteLocation.cs b/src/Libraries/RevitNodesUI/SiteLocation.cs index 933ebacbfd..5c12dacd77 100644 --- a/src/Libraries/RevitNodesUI/SiteLocation.cs +++ b/src/Libraries/RevitNodesUI/SiteLocation.cs @@ -1,6 +1,6 @@ using Dynamo.Applications; using Dynamo.Applications.Models; -#if UI_SUPPORT +#if !DESIGN_AUTOMATION using Dynamo.Controls; #else using DynamoRevitApp = DADynamoApp.DAEntrypoint; @@ -18,7 +18,7 @@ namespace DSRevitNodesUI { -#if UI_SUPPORT +#if !DESIGN_AUTOMATION public class SiteLocationNodeViewCustomization : INodeViewCustomization { public void CustomizeView(SiteLocation model, NodeView nodeView) @@ -55,7 +55,7 @@ public SiteLocation() DynamoRevitApp.EventHandlerProxy.DocumentOpened += model_RevitDocumentChanged; RevitServicesUpdater.Instance.ElementsUpdated += RevitServicesUpdater_ElementsUpdated; -#if UI_SUPPORT +#if !DESIGN_AUTOMATION DynamoRevitApp.AddIdleAction(() => Update()); #endif } @@ -71,7 +71,7 @@ public SiteLocation(IEnumerable inPorts, IEnumerable outPo DynamoRevitApp.EventHandlerProxy.DocumentOpened += model_RevitDocumentChanged; RevitServicesUpdater.Instance.ElementsUpdated += RevitServicesUpdater_ElementsUpdated; -#if UI_SUPPORT +#if !DESIGN_AUTOMATION DynamoRevitApp.AddIdleAction(() => Update()); #endif } diff --git a/src/Libraries/RevitNodesUI/SunPath.cs b/src/Libraries/RevitNodesUI/SunPath.cs index 69388f4ef2..f880b6214a 100644 --- a/src/Libraries/RevitNodesUI/SunPath.cs +++ b/src/Libraries/RevitNodesUI/SunPath.cs @@ -33,7 +33,7 @@ public SunSettings() RevitServicesUpdater.Instance.ElementsUpdated += Updater_ElementsUpdated; -#if UI_SUPPORT +#if !DESIGN_AUTOMATION DynamoRevitApp.EventHandlerProxy.ViewActivated += CurrentUIApplication_ViewActivated; DynamoRevitApp.AddIdleAction(() => CurrentUIApplicationOnViewActivated()); #endif @@ -43,7 +43,7 @@ public SunSettings() public SunSettings(IEnumerable inPorts, IEnumerable outPorts) : base(inPorts, outPorts) { RevitServicesUpdater.Instance.ElementsUpdated += Updater_ElementsUpdated; -#if UI_SUPPORT +#if !DESIGN_AUTOMATION DynamoRevitApp.EventHandlerProxy.ViewActivated += CurrentUIApplication_ViewActivated; DynamoRevitApp.AddIdleAction(() => CurrentUIApplicationOnViewActivated()); #endif @@ -52,7 +52,7 @@ public SunSettings(IEnumerable inPorts, IEnumerable outPor public override void Dispose() { RevitServicesUpdater.Instance.ElementsUpdated -= Updater_ElementsUpdated; -#if UI_SUPPORT +#if !DESIGN_AUTOMATION DynamoRevitApp.EventHandlerProxy.ViewActivated -= CurrentUIApplication_ViewActivated; #endif base.Dispose(); diff --git a/src/Libraries/RevitServices/Events/EventHandlerProxy.cs b/src/Libraries/RevitServices/Events/EventHandlerProxy.cs index b08a5c2e41..f959350dc6 100644 --- a/src/Libraries/RevitServices/Events/EventHandlerProxy.cs +++ b/src/Libraries/RevitServices/Events/EventHandlerProxy.cs @@ -12,7 +12,7 @@ public class EventHandlerProxy public event EventHandler DocumentOpened; public event EventHandler DocumentClosing; public event EventHandler DocumentClosed; -#if UI_SUPPORT +#if !DESIGN_AUTOMATION public event EventHandler ViewActivating; public event EventHandler ViewActivated; #endif @@ -32,7 +32,7 @@ public void OnApplicationDocumentClosed(object sender, DocumentClosedEventArgs a InvokeEventHandler(DocumentClosed, sender, args); } -#if UI_SUPPORT +#if !DESIGN_AUTOMATION public void OnApplicationViewActivating(object sender, Autodesk.Revit.UI.Events.ViewActivatingEventArgs args) { InvokeEventHandler(ViewActivating, sender, args); diff --git a/src/Libraries/RevitServices/Persistence/DocumentManager.cs b/src/Libraries/RevitServices/Persistence/DocumentManager.cs index 480f87a251..f95f0e4499 100644 --- a/src/Libraries/RevitServices/Persistence/DocumentManager.cs +++ b/src/Libraries/RevitServices/Persistence/DocumentManager.cs @@ -125,7 +125,7 @@ public void HandleDocumentActivation(View revitView) public Document CurrentDBDocument { get { -#if UI_SUPPORT +#if !DESIGN_AUTOMATION var c = CurrentUIDocument; return c == null ? null : c.Document; #else @@ -158,7 +158,7 @@ public Document CurrentDBDocument { /// public Application CurrentApplication { get; set; } -#if UI_SUPPORT +#if !DESIGN_AUTOMATION /// /// Provides the currently active UI document. /// This is the document to which Dynamo is bound. From efb08c51f1ab80475d33edc671067f358a6f68db Mon Sep 17 00:00:00 2001 From: pinzart90 Date: Thu, 10 Apr 2025 08:51:20 -0400 Subject: [PATCH 37/70] update --- src/DADynamoApp/DAEntrypoint.cs | 3 ++- src/DADynamoApp/DynamoPathResolver.cs | 1 - 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/DADynamoApp/DAEntrypoint.cs b/src/DADynamoApp/DAEntrypoint.cs index 8fbb109359..f3cb74cecb 100644 --- a/src/DADynamoApp/DAEntrypoint.cs +++ b/src/DADynamoApp/DAEntrypoint.cs @@ -135,7 +135,8 @@ public void HandleDesignAutomationReadyEvent(object sender, DesignAutomationRead cmdArgs.UserDataFolder = Path.Combine(dynTempDir, "Dynamo Revit"); cmdArgs.CommonDataFolder = Path.Combine(dynTempDir, "Dynamo"); - app.NewProjectDocument(Autodesk.Revit.DB.UnitSystem.Metric); + // Startup a new project, maybe an option we can have ? + //app.NewProjectDocument(Autodesk.Revit.DB.UnitSystem.Metric); DocumentManager.Instance.PrepareForAutomation(app); diff --git a/src/DADynamoApp/DynamoPathResolver.cs b/src/DADynamoApp/DynamoPathResolver.cs index bb27833d36..76c23cbbd1 100644 --- a/src/DADynamoApp/DynamoPathResolver.cs +++ b/src/DADynamoApp/DynamoPathResolver.cs @@ -1,5 +1,4 @@ using System.Reflection; -using System.Runtime.Loader; namespace DADynamoApp { From 5dde24ab438afb1b05d30b23021c9e34167b2730 Mon Sep 17 00:00:00 2001 From: pinzart90 Date: Thu, 17 Apr 2025 10:23:40 -0400 Subject: [PATCH 38/70] update --- src/Config/CS_SDK.props | 2 +- src/DynamoRevit.DA.sln | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Config/CS_SDK.props b/src/Config/CS_SDK.props index 78c8655351..0e3d79e8e1 100644 --- a/src/Config/CS_SDK.props +++ b/src/Config/CS_SDK.props @@ -40,6 +40,6 @@ TRACE - $(DefineConstants);DESIGN_AUTOMATION + $(DefineConstants);DESIGN_AUTOMATION diff --git a/src/DynamoRevit.DA.sln b/src/DynamoRevit.DA.sln index c4e1eaa42f..044f22b065 100644 --- a/src/DynamoRevit.DA.sln +++ b/src/DynamoRevit.DA.sln @@ -42,6 +42,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "config", "config", "{956846 EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DADynamoApp", "DADynamoApp\DADynamoApp.csproj", "{66A0E1C8-2514-48B7-8406-536983F57F88}" EndProject +Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "SharedUtilities", "SharedUtilities\SharedUtilities.shproj", "{BCFD5D77-45F8-41A4-B60C-582509B9262B}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|NET80_DA = Debug|NET80_DA @@ -80,4 +82,7 @@ Global GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {757AAA40-191F-4673-9B04-8270A3370BCA} EndGlobalSection + GlobalSection(SharedMSBuildProjectFiles) = preSolution + SharedUtilities\SharedUtilities.projitems*{bcfd5d77-45f8-41a4-b60c-582509b9262b}*SharedItemsImports = 13 + EndGlobalSection EndGlobal From ff9a95146502152e338eb29229161e1a3a8c9316 Mon Sep 17 00:00:00 2001 From: pinzart90 Date: Thu, 17 Apr 2025 10:25:47 -0400 Subject: [PATCH 39/70] update --- .../CollectAllElementsOfCategory.dyn | 258 ------------ ...tAllElementsOfCategoryAndGetParameters.dyn | 323 -------------- doc/distrib/Templates/ExportDataToExcel.dyn | 302 ------------- .../GetGeometryForAllElementsOfCategory.dyn | 257 ----------- doc/distrib/Templates/ImportDataFromExcel.dyn | 398 ------------------ doc/distrib/Templates/ReadImageFromFile.dyn | 323 -------------- 6 files changed, 1861 deletions(-) delete mode 100644 doc/distrib/Templates/CollectAllElementsOfCategory.dyn delete mode 100644 doc/distrib/Templates/CollectAllElementsOfCategoryAndGetParameters.dyn delete mode 100644 doc/distrib/Templates/ExportDataToExcel.dyn delete mode 100644 doc/distrib/Templates/GetGeometryForAllElementsOfCategory.dyn delete mode 100644 doc/distrib/Templates/ImportDataFromExcel.dyn delete mode 100644 doc/distrib/Templates/ReadImageFromFile.dyn diff --git a/doc/distrib/Templates/CollectAllElementsOfCategory.dyn b/doc/distrib/Templates/CollectAllElementsOfCategory.dyn deleted file mode 100644 index a09890493c..0000000000 --- a/doc/distrib/Templates/CollectAllElementsOfCategory.dyn +++ /dev/null @@ -1,258 +0,0 @@ -{ - "Uuid": "f36fba0c-8a97-4fef-b3dc-6f0d4d61aafa", - "IsCustomNode": false, - "Description": "Collect all elements of a chosen category (Defaulting to Rooms)", - "Name": "CollectAllElementsOfCategory", - "ElementResolver": { - "ResolutionMap": {} - }, - "Inputs": [], - "Outputs": [], - "Nodes": [ - { - "ConcreteType": "DSRevitNodesUI.Categories, DSRevitNodesUI", - "SelectedIndex": 507, - "SelectedString": "OST_Rooms", - "Id": "1400fd6298f44dfbb91bb11505c879f5", - "NodeType": "ExtensionNode", - "Inputs": [], - "Outputs": [ - { - "Id": "ca529bd2c6784809b882c1cda2584135", - "Name": "Category", - "Description": "The selected Category.", - "UsingDefaultValue": false, - "Level": 2, - "UseLevels": false, - "KeepListStructure": false - } - ], - "Replication": "Disabled", - "Description": "All built-in categories." - }, - { - "ConcreteType": "DSRevitNodesUI.ElementsOfCategory, DSRevitNodesUI", - "Id": "59f1256567874cfb855f5354eb87646f", - "NodeType": "ExtensionNode", - "Inputs": [ - { - "Id": "9747105e6ec74aa59a9478911c780165", - "Name": "Category", - "Description": "The Category", - "UsingDefaultValue": false, - "Level": 2, - "UseLevels": false, - "KeepListStructure": false - } - ], - "Outputs": [ - { - "Id": "ee4a35b876d6409cbe8d34b67945d69c", - "Name": "Elements", - "Description": "An element class.", - "UsingDefaultValue": false, - "Level": 2, - "UseLevels": false, - "KeepListStructure": false - } - ], - "Replication": "Disabled", - "Description": "Get all elements of the specified category from the model." - }, - { - "ConcreteType": "CoreNodeModels.Watch, CoreNodeModels", - "WatchWidth": 50.0, - "WatchHeight": 38.0, - "Id": "f7a0ba86dc714b328564f6390b1ffa92", - "NodeType": "ExtensionNode", - "Inputs": [ - { - "Id": "a41994fd9039439da30bbd9e37f15df2", - "Name": "", - "Description": "Node to show output from", - "UsingDefaultValue": false, - "Level": 2, - "UseLevels": false, - "KeepListStructure": false - } - ], - "Outputs": [ - { - "Id": "6589178d81c64f0ebe7a71eee07c5333", - "Name": "", - "Description": "Node output", - "UsingDefaultValue": false, - "Level": 2, - "UseLevels": false, - "KeepListStructure": false - } - ], - "Replication": "Disabled", - "Description": "Visualizes a node's output" - } - ], - "Connectors": [ - { - "Start": "ca529bd2c6784809b882c1cda2584135", - "End": "9747105e6ec74aa59a9478911c780165", - "Id": "7cac21d0b5fa4589ab93e035fbc94b98", - "IsHidden": "False" - }, - { - "Start": "ee4a35b876d6409cbe8d34b67945d69c", - "End": "a41994fd9039439da30bbd9e37f15df2", - "Id": "beb2bfe394284d458668b2e4cefadc8f", - "IsHidden": "False" - } - ], - "Dependencies": [], - "NodeLibraryDependencies": [], - "EnableLegacyPolyCurveBehavior": true, - "Thumbnail": "", - "GraphDocumentationURL": null, - "ExtensionWorkspaceData": [ - { - "ExtensionGuid": "28992e1d-abb9-417f-8b1b-05e053bee670", - "Name": "Properties", - "Version": "3.0", - "Data": {} - }, - { - "ExtensionGuid": "DFBD9CC0-DB40-457A-939E-8C8555555A9D", - "Name": "Generative Design", - "Version": "7.1", - "Data": {} - } - ], - "Author": "Autodesk", - "Linting": { - "activeLinter": "None", - "activeLinterId": "7b75fb44-43fd-4631-a878-29f4d5d8399a", - "warningCount": 0, - "errorCount": 0 - }, - "Bindings": [], - "View": { - "Dynamo": { - "ScaleFactor": 1.0, - "HasRunWithoutCrash": true, - "IsVisibleInDynamoLibrary": true, - "Version": "3.0.3.7597", - "RunType": "Automatic", - "RunPeriod": "1000" - }, - "Camera": { - "Name": "_Background Preview", - "EyeX": -17.0, - "EyeY": 24.0, - "EyeZ": 50.0, - "LookX": 12.0, - "LookY": -13.0, - "LookZ": -58.0, - "UpX": 0.0, - "UpY": 1.0, - "UpZ": 0.0 - }, - "ConnectorPins": [], - "NodeViews": [ - { - "Id": "1400fd6298f44dfbb91bb11505c879f5", - "Name": "Categories", - "IsSetAsInput": false, - "IsSetAsOutput": false, - "Excluded": false, - "ShowGeometry": true, - "X": 89870.21477205436, - "Y": -4247.693497007918 - }, - { - "Id": "59f1256567874cfb855f5354eb87646f", - "Name": "All Elements of Category", - "IsSetAsInput": false, - "IsSetAsOutput": false, - "Excluded": false, - "ShowGeometry": true, - "X": 90206.21477205436, - "Y": -4247.693497007918 - }, - { - "Id": "f7a0ba86dc714b328564f6390b1ffa92", - "Name": "Watch", - "IsSetAsInput": false, - "IsSetAsOutput": false, - "Excluded": false, - "ShowGeometry": true, - "X": 90563.21477205436, - "Y": -4247.693497007918 - } - ], - "Annotations": [ - { - "Id": "0d323631560047b5a5f69d0e63a173fc", - "Title": "Select Revit Category", - "DescriptionText": null, - "IsExpanded": true, - "WidthAdjustment": 0.0, - "HeightAdjustment": 0.0, - "Nodes": [], - "HasNestedGroups": false, - "Left": 89920.21477205436, - "Top": -4297.693497007918, - "Width": 0.0, - "Height": 0.0, - "FontSize": 36.0, - "GroupStyleId": "00000000-0000-0000-0000-000000000000", - "InitialTop": 0.0, - "InitialHeight": 0.0, - "TextblockHeight": 0.0, - "Background": "#FFC1D676", - "PinnedNode": "1400fd6298f44dfbb91bb11505c879f5" - }, - { - "Id": "cf7dcb56bee2467882c6a3715c0b459f", - "Title": "Collect all elements of that selected Category", - "DescriptionText": null, - "IsExpanded": true, - "WidthAdjustment": 0.0, - "HeightAdjustment": 0.0, - "Nodes": [], - "HasNestedGroups": false, - "Left": 90203.21477205436, - "Top": -4297.693497007918, - "Width": 0.0, - "Height": 0.0, - "FontSize": 36.0, - "GroupStyleId": "00000000-0000-0000-0000-000000000000", - "InitialTop": 0.0, - "InitialHeight": 0.0, - "TextblockHeight": 0.0, - "Background": "#FFC1D676", - "PinnedNode": "59f1256567874cfb855f5354eb87646f" - }, - { - "Id": "bd0885cebce64783be7ce4b6a6284bd4", - "Title": "Watch results of collecting every element of a chosen category", - "DescriptionText": null, - "IsExpanded": true, - "WidthAdjustment": 0.0, - "HeightAdjustment": 0.0, - "Nodes": [], - "HasNestedGroups": false, - "Left": 90494.21477205436, - "Top": -4312.693497007918, - "Width": 0.0, - "Height": 0.0, - "FontSize": 36.0, - "GroupStyleId": "00000000-0000-0000-0000-000000000000", - "InitialTop": 0.0, - "InitialHeight": 0.0, - "TextblockHeight": 0.0, - "Background": "#FFC1D676", - "PinnedNode": "f7a0ba86dc714b328564f6390b1ffa92" - } - ], - "X": -93439.47156922061, - "Y": 4723.485874233058, - "Zoom": 1.0427979036983706 - } -} \ No newline at end of file diff --git a/doc/distrib/Templates/CollectAllElementsOfCategoryAndGetParameters.dyn b/doc/distrib/Templates/CollectAllElementsOfCategoryAndGetParameters.dyn deleted file mode 100644 index 8ce21d8f56..0000000000 --- a/doc/distrib/Templates/CollectAllElementsOfCategoryAndGetParameters.dyn +++ /dev/null @@ -1,323 +0,0 @@ -{ - "Uuid": "b3342583-c831-4c51-800a-ffbe4db82efa", - "IsCustomNode": false, - "Description": "Collect all elements of a chosen category (Defaulting to Rooms) and getting each elements Room Area", - "Name": "CollectAllElementsOfCategoryAndGetParameters", - "ElementResolver": { - "ResolutionMap": {} - }, - "Inputs": [], - "Outputs": [], - "Nodes": [ - { - "ConcreteType": "DSRevitNodesUI.Categories, DSRevitNodesUI", - "SelectedIndex": 507, - "SelectedString": "OST_Rooms", - "Id": "ed17aaffa2cc456890f43f91d6307693", - "NodeType": "ExtensionNode", - "Inputs": [], - "Outputs": [ - { - "Id": "34705ee8b2f946a2aa58a222acf21623", - "Name": "Category", - "Description": "The selected Category.", - "UsingDefaultValue": false, - "Level": 2, - "UseLevels": false, - "KeepListStructure": false - } - ], - "Replication": "Disabled", - "Description": "All built-in categories." - }, - { - "ConcreteType": "DSRevitNodesUI.ElementsOfCategory, DSRevitNodesUI", - "Id": "c3baf69e99244c09883314344f09230a", - "NodeType": "ExtensionNode", - "Inputs": [ - { - "Id": "ee6f864350fd45efa292b7ed0b6c4005", - "Name": "Category", - "Description": "The Category", - "UsingDefaultValue": false, - "Level": 2, - "UseLevels": false, - "KeepListStructure": false - } - ], - "Outputs": [ - { - "Id": "9636b76d7fea47c7b6c9c8a2fc917646", - "Name": "Elements", - "Description": "An element class.", - "UsingDefaultValue": false, - "Level": 2, - "UseLevels": false, - "KeepListStructure": false - } - ], - "Replication": "Disabled", - "Description": "Get all elements of the specified category from the model." - }, - { - "ConcreteType": "Dynamo.Graph.Nodes.ZeroTouch.DSFunction, DynamoCore", - "Id": "ac5cca7b2ea54fc9b01ee0f8aa2bf111", - "NodeType": "FunctionNode", - "Inputs": [ - { - "Id": "7f24488c689540da931ecf8e66297039", - "Name": "element", - "Description": "Revit.Elements.Element", - "UsingDefaultValue": false, - "Level": 2, - "UseLevels": false, - "KeepListStructure": false - }, - { - "Id": "f8e752733b37486b8b3a75b32605d4dd", - "Name": "parameterName", - "Description": "The name of the parameter whose value you want to obtain.\n\nstring", - "UsingDefaultValue": false, - "Level": 2, - "UseLevels": false, - "KeepListStructure": false - } - ], - "Outputs": [ - { - "Id": "5138e0135c444a949fa971333222030b", - "Name": "var[]..[]", - "Description": "var[]..[]", - "UsingDefaultValue": false, - "Level": 2, - "UseLevels": false, - "KeepListStructure": false - } - ], - "FunctionSignature": "Revit.Elements.Element.GetParameterValueByName@string", - "Replication": "Auto", - "Description": "Get the value of one of the element's parameters.\n\nElement.GetParameterValueByName (parameterName: string): var[]..[]" - }, - { - "ConcreteType": "CoreNodeModels.Input.StringInput, CoreNodeModels", - "Id": "8191910e638249e5a3a2fb85b9d563cb", - "NodeType": "StringInputNode", - "Inputs": [], - "Outputs": [ - { - "Id": "4eb48f9dc024487286a1c3beba048dc8", - "Name": "", - "Description": "String", - "UsingDefaultValue": false, - "Level": 2, - "UseLevels": false, - "KeepListStructure": false - } - ], - "Replication": "Disabled", - "Description": "Creates a string", - "InputValue": "Area" - } - ], - "Connectors": [ - { - "Start": "34705ee8b2f946a2aa58a222acf21623", - "End": "ee6f864350fd45efa292b7ed0b6c4005", - "Id": "5055c2abf7ac4e08a0fb2792bfffb480", - "IsHidden": "False" - }, - { - "Start": "9636b76d7fea47c7b6c9c8a2fc917646", - "End": "7f24488c689540da931ecf8e66297039", - "Id": "ea5f0cf77f804c8c854070034a3a6364", - "IsHidden": "False" - }, - { - "Start": "4eb48f9dc024487286a1c3beba048dc8", - "End": "f8e752733b37486b8b3a75b32605d4dd", - "Id": "52e19a722d7e4cd79a12a89fcea6d077", - "IsHidden": "False" - } - ], - "Dependencies": [], - "NodeLibraryDependencies": [], - "EnableLegacyPolyCurveBehavior": true, - "Thumbnail": "", - "GraphDocumentationURL": null, - "ExtensionWorkspaceData": [ - { - "ExtensionGuid": "28992e1d-abb9-417f-8b1b-05e053bee670", - "Name": "Properties", - "Version": "3.0", - "Data": {} - }, - { - "ExtensionGuid": "DFBD9CC0-DB40-457A-939E-8C8555555A9D", - "Name": "Generative Design", - "Version": "7.1", - "Data": {} - } - ], - "Author": "Autodesk", - "Linting": { - "activeLinter": "None", - "activeLinterId": "7b75fb44-43fd-4631-a878-29f4d5d8399a", - "warningCount": 0, - "errorCount": 0 - }, - "Bindings": [], - "View": { - "Dynamo": { - "ScaleFactor": 1.0, - "HasRunWithoutCrash": true, - "IsVisibleInDynamoLibrary": true, - "Version": "3.0.3.7597", - "RunType": "Automatic", - "RunPeriod": "1000" - }, - "Camera": { - "Name": "_Background Preview", - "EyeX": -17.0, - "EyeY": 24.0, - "EyeZ": 50.0, - "LookX": 12.0, - "LookY": -13.0, - "LookZ": -58.0, - "UpX": 0.0, - "UpY": 1.0, - "UpZ": 0.0 - }, - "ConnectorPins": [], - "NodeViews": [ - { - "Id": "ed17aaffa2cc456890f43f91d6307693", - "Name": "Categories", - "IsSetAsInput": false, - "IsSetAsOutput": false, - "Excluded": false, - "ShowGeometry": true, - "X": 89870.21477205436, - "Y": -4247.693497007918 - }, - { - "Id": "c3baf69e99244c09883314344f09230a", - "Name": "All Elements of Category", - "IsSetAsInput": false, - "IsSetAsOutput": false, - "Excluded": false, - "ShowGeometry": true, - "X": 90209.21477205436, - "Y": -4247.693497007918 - }, - { - "Id": "ac5cca7b2ea54fc9b01ee0f8aa2bf111", - "Name": "Element.GetParameterValueByName", - "IsSetAsInput": false, - "IsSetAsOutput": false, - "Excluded": false, - "ShowGeometry": true, - "X": 90569.21477205436, - "Y": -4247.693497007918 - }, - { - "Id": "8191910e638249e5a3a2fb85b9d563cb", - "Name": "String", - "IsSetAsInput": false, - "IsSetAsOutput": false, - "Excluded": false, - "ShowGeometry": true, - "X": 90318.21477205436, - "Y": -3977.9057569773872 - } - ], - "Annotations": [ - { - "Id": "413e32392339406dbcc552c6bd8449d9", - "Title": "Select Revit Category", - "DescriptionText": null, - "IsExpanded": true, - "WidthAdjustment": 0.0, - "HeightAdjustment": 0.0, - "Nodes": [], - "HasNestedGroups": false, - "Left": 89920.21477205436, - "Top": -4297.693497007918, - "Width": 0.0, - "Height": 0.0, - "FontSize": 36.0, - "GroupStyleId": "00000000-0000-0000-0000-000000000000", - "InitialTop": 0.0, - "InitialHeight": 0.0, - "TextblockHeight": 0.0, - "Background": "#FFC1D676", - "PinnedNode": "ed17aaffa2cc456890f43f91d6307693" - }, - { - "Id": "bcac70e033a1483dba06f5ef39ccab17", - "Title": "Collect all elements of that selected Category", - "DescriptionText": null, - "IsExpanded": true, - "WidthAdjustment": 0.0, - "HeightAdjustment": 0.0, - "Nodes": [], - "HasNestedGroups": false, - "Left": 90206.21477205436, - "Top": -4297.693497007918, - "Width": 0.0, - "Height": 0.0, - "FontSize": 36.0, - "GroupStyleId": "00000000-0000-0000-0000-000000000000", - "InitialTop": 0.0, - "InitialHeight": 0.0, - "TextblockHeight": 0.0, - "Background": "#FFC1D676", - "PinnedNode": "c3baf69e99244c09883314344f09230a" - }, - { - "Id": "3e722249f0434c5cbdb3bcafb8e38c40", - "Title": "Get parameter values from Elements by Category via a parameter name", - "DescriptionText": null, - "IsExpanded": true, - "WidthAdjustment": 0.0, - "HeightAdjustment": 0.0, - "Nodes": [], - "HasNestedGroups": false, - "Left": 90593.21477205436, - "Top": -4312.693497007918, - "Width": 0.0, - "Height": 0.0, - "FontSize": 36.0, - "GroupStyleId": "00000000-0000-0000-0000-000000000000", - "InitialTop": 0.0, - "InitialHeight": 0.0, - "TextblockHeight": 0.0, - "Background": "#FFC1D676", - "PinnedNode": "ac5cca7b2ea54fc9b01ee0f8aa2bf111" - }, - { - "Id": "9d0cd5783e8949c180d1f1da85c6961f", - "Title": "Input parameter name, and make sure you take capitalization into account", - "DescriptionText": null, - "IsExpanded": true, - "WidthAdjustment": 0.0, - "HeightAdjustment": 0.0, - "Nodes": [], - "HasNestedGroups": false, - "Left": 90254.71477205436, - "Top": -4042.9057569773872, - "Width": 0.0, - "Height": 0.0, - "FontSize": 36.0, - "GroupStyleId": "00000000-0000-0000-0000-000000000000", - "InitialTop": 0.0, - "InitialHeight": 0.0, - "TextblockHeight": 0.0, - "Background": "#FFC1D676", - "PinnedNode": "8191910e638249e5a3a2fb85b9d563cb" - } - ], - "X": -93439.47156922061, - "Y": 4723.485874233058, - "Zoom": 1.0427979036983706 - } -} \ No newline at end of file diff --git a/doc/distrib/Templates/ExportDataToExcel.dyn b/doc/distrib/Templates/ExportDataToExcel.dyn deleted file mode 100644 index 0b2a669e8d..0000000000 --- a/doc/distrib/Templates/ExportDataToExcel.dyn +++ /dev/null @@ -1,302 +0,0 @@ -{ - "Uuid": "107641db-6b6a-4a08-8282-d474513714b1", - "IsCustomNode": false, - "Description": "Export data to Excel given a chosen sheet name. You will need to connect the data to be exported", - "Name": "ExportDataToExcel", - "ElementResolver": { - "ResolutionMap": {} - }, - "Inputs": [], - "Outputs": [], - "Nodes": [ - { - "ConcreteType": "CoreNodeModels.Input.Filename, CoreNodeModels", - "Id": "d2ca2769c87f4b4396940a74ff1111d2", - "NodeType": "ExtensionNode", - "Inputs": [], - "Outputs": [ - { - "Id": "4cb119c0fc804e47bd4bcd5fff82cf7c", - "Name": "", - "Description": "File Path", - "UsingDefaultValue": false, - "Level": 2, - "UseLevels": false, - "KeepListStructure": false - } - ], - "Replication": "Disabled", - "Description": "Allows you to select a file on the system and returns its file path", - "HintPath": "C:\\Users\\amours\\Desktop\\DynamoRevitTemplates\\No file selected", - "InputValue": "No file selected." - }, - { - "ConcreteType": "CoreNodeModels.Input.StringInput, CoreNodeModels", - "Id": "3bd4fe2e6876454da3e83a01462c85c7", - "NodeType": "StringInputNode", - "Inputs": [], - "Outputs": [ - { - "Id": "3f6242f197704cb08d28d338399cc02b", - "Name": "", - "Description": "String", - "UsingDefaultValue": false, - "Level": 2, - "UseLevels": false, - "KeepListStructure": false - } - ], - "Replication": "Disabled", - "Description": "Creates a string", - "InputValue": "" - }, - { - "ConcreteType": "Dynamo.Graph.Nodes.ZeroTouch.DSFunction, DynamoCore", - "Id": "a30280ae0aea42649c79b5f80b7c6dbe", - "NodeType": "FunctionNode", - "Inputs": [ - { - "Id": "33167a5f9e25441b98598dc1ecc07832", - "Name": "filePath", - "Description": "string", - "UsingDefaultValue": false, - "Level": 2, - "UseLevels": false, - "KeepListStructure": false - }, - { - "Id": "0a38be4fb78c4ac385664c50cf9dbbff", - "Name": "sheetName", - "Description": "string", - "UsingDefaultValue": false, - "Level": 2, - "UseLevels": false, - "KeepListStructure": false - }, - { - "Id": "53fd2ca44312424f9e88959329c97a76", - "Name": "data", - "Description": "var[][]", - "UsingDefaultValue": false, - "Level": 2, - "UseLevels": false, - "KeepListStructure": false - }, - { - "Id": "5cb3225aeccb496989afa724dd38b537", - "Name": "startRow", - "Description": "int\nDefault value : 0", - "UsingDefaultValue": true, - "Level": 2, - "UseLevels": false, - "KeepListStructure": false - }, - { - "Id": "c6b08add41fe4398b6c167e99c73c8b1", - "Name": "startColumn", - "Description": "int\nDefault value : 0", - "UsingDefaultValue": true, - "Level": 2, - "UseLevels": false, - "KeepListStructure": false - }, - { - "Id": "1e16648803b341e395baccc2ff2db3ea", - "Name": "overWrite", - "Description": "bool\nDefault value : false", - "UsingDefaultValue": true, - "Level": 2, - "UseLevels": false, - "KeepListStructure": false - }, - { - "Id": "f6cdbc62f3ef4cee91ae11eb5a21f1de", - "Name": "writeAsString", - "Description": "bool\nDefault value : false", - "UsingDefaultValue": true, - "Level": 2, - "UseLevels": false, - "KeepListStructure": false - } - ], - "Outputs": [ - { - "Id": "937ba830e5174f2a9ed269d57b1f5157", - "Name": "bool", - "Description": "bool", - "UsingDefaultValue": false, - "Level": 2, - "UseLevels": false, - "KeepListStructure": false - } - ], - "FunctionSignature": "DSOffice.Data.OpenXMLExportExcel@string,string,var[][],int,int,bool,bool", - "Replication": "Auto", - "Description": "Data.OpenXMLExportExcel (filePath: string, sheetName: string, data: var[][], startRow: int = 0, startColumn: int = 0, overWrite: bool = false, writeAsString: bool = false): bool" - } - ], - "Connectors": [ - { - "Start": "4cb119c0fc804e47bd4bcd5fff82cf7c", - "End": "33167a5f9e25441b98598dc1ecc07832", - "Id": "b07a2afc08844afeb9ef963e970cb646", - "IsHidden": "False" - }, - { - "Start": "3f6242f197704cb08d28d338399cc02b", - "End": "0a38be4fb78c4ac385664c50cf9dbbff", - "Id": "8f18137f976541a2a0186380ecf744c4", - "IsHidden": "False" - } - ], - "Dependencies": [], - "NodeLibraryDependencies": [], - "EnableLegacyPolyCurveBehavior": true, - "Thumbnail": "", - "GraphDocumentationURL": null, - "ExtensionWorkspaceData": [ - { - "ExtensionGuid": "28992e1d-abb9-417f-8b1b-05e053bee670", - "Name": "Properties", - "Version": "3.0", - "Data": {} - }, - { - "ExtensionGuid": "DFBD9CC0-DB40-457A-939E-8C8555555A9D", - "Name": "Generative Design", - "Version": "7.1", - "Data": {} - } - ], - "Author": "Autodesk", - "Linting": { - "activeLinter": "None", - "activeLinterId": "7b75fb44-43fd-4631-a878-29f4d5d8399a", - "warningCount": 0, - "errorCount": 0 - }, - "Bindings": [], - "View": { - "Dynamo": { - "ScaleFactor": 1.0, - "HasRunWithoutCrash": true, - "IsVisibleInDynamoLibrary": true, - "Version": "3.0.3.7597", - "RunType": "Automatic", - "RunPeriod": "1000" - }, - "Camera": { - "Name": "_Background Preview", - "EyeX": -17.0, - "EyeY": 24.0, - "EyeZ": 50.0, - "LookX": 12.0, - "LookY": -13.0, - "LookZ": -58.0, - "UpX": 0.0, - "UpY": 1.0, - "UpZ": 0.0 - }, - "ConnectorPins": [], - "NodeViews": [ - { - "Id": "d2ca2769c87f4b4396940a74ff1111d2", - "Name": "File Path", - "IsSetAsInput": false, - "IsSetAsOutput": false, - "Excluded": false, - "ShowGeometry": true, - "X": 238.5, - "Y": 282.0 - }, - { - "Id": "3bd4fe2e6876454da3e83a01462c85c7", - "Name": "String", - "IsSetAsInput": false, - "IsSetAsOutput": false, - "Excluded": false, - "ShowGeometry": true, - "X": 238.5, - "Y": 531.5 - }, - { - "Id": "a30280ae0aea42649c79b5f80b7c6dbe", - "Name": "Data.OpenXMLExportExcel", - "IsSetAsInput": false, - "IsSetAsOutput": false, - "Excluded": false, - "ShowGeometry": true, - "X": 811.0, - "Y": 282.0 - } - ], - "Annotations": [ - { - "Id": "f8caed9cca86404397d6c13d7f9a2292", - "Title": "Browse to Excel file to export data to", - "DescriptionText": null, - "IsExpanded": true, - "WidthAdjustment": 0.0, - "HeightAdjustment": 0.0, - "Nodes": [], - "HasNestedGroups": false, - "Left": 213.0, - "Top": 232.0, - "Width": 0.0, - "Height": 0.0, - "FontSize": 36.0, - "GroupStyleId": "00000000-0000-0000-0000-000000000000", - "InitialTop": 0.0, - "InitialHeight": 0.0, - "TextblockHeight": 0.0, - "Background": "#FFC1D676", - "PinnedNode": "d2ca2769c87f4b4396940a74ff1111d2" - }, - { - "Id": "f6199651df8b4e3ebe2e1ba518850914", - "Title": "Type in a Sheet Name, but be mindful of capitalization", - "DescriptionText": null, - "IsExpanded": true, - "WidthAdjustment": 0.0, - "HeightAdjustment": 0.0, - "Nodes": [], - "HasNestedGroups": false, - "Left": 193.5, - "Top": 466.5, - "Width": 0.0, - "Height": 0.0, - "FontSize": 36.0, - "GroupStyleId": "00000000-0000-0000-0000-000000000000", - "InitialTop": 0.0, - "InitialHeight": 0.0, - "TextblockHeight": 0.0, - "Background": "#FFC1D676", - "PinnedNode": "3bd4fe2e6876454da3e83a01462c85c7" - }, - { - "Id": "a69836269d524c90a34e16b7efd8f803", - "Title": "Export Excel data using the OpenXML format from a chosen sheet name", - "DescriptionText": null, - "IsExpanded": true, - "WidthAdjustment": 0.0, - "HeightAdjustment": 0.0, - "Nodes": [], - "HasNestedGroups": false, - "Left": 797.0, - "Top": 217.0, - "Width": 0.0, - "Height": 0.0, - "FontSize": 36.0, - "GroupStyleId": "00000000-0000-0000-0000-000000000000", - "InitialTop": 0.0, - "InitialHeight": 0.0, - "TextblockHeight": 0.0, - "Background": "#FFC1D676", - "PinnedNode": "a30280ae0aea42649c79b5f80b7c6dbe" - } - ], - "X": 196.23761879446965, - "Y": -15.960282864435044, - "Zoom": 1.13507102841452 - } -} \ No newline at end of file diff --git a/doc/distrib/Templates/GetGeometryForAllElementsOfCategory.dyn b/doc/distrib/Templates/GetGeometryForAllElementsOfCategory.dyn deleted file mode 100644 index 86936c7f4e..0000000000 --- a/doc/distrib/Templates/GetGeometryForAllElementsOfCategory.dyn +++ /dev/null @@ -1,257 +0,0 @@ -{ - "Uuid": "6ab2aa77-03ac-43aa-996a-9bcba72a6560", - "IsCustomNode": false, - "Description": "Collect all elements of a chosen category (Defaulting to Doors) and getting each elements Geometry", - "Name": "GetGeometryForAllElementsOfCategory", - "ElementResolver": { - "ResolutionMap": {} - }, - "Inputs": [], - "Outputs": [], - "Nodes": [ - { - "ConcreteType": "DSRevitNodesUI.Categories, DSRevitNodesUI", - "SelectedIndex": 178, - "SelectedString": "OST_Doors", - "Id": "bb34b03a88c14566861ee701d2036259", - "NodeType": "ExtensionNode", - "Inputs": [], - "Outputs": [ - { - "Id": "81976910d2c3462980fe759708cbdd11", - "Name": "Category", - "Description": "The selected Category.", - "UsingDefaultValue": false, - "Level": 2, - "UseLevels": false, - "KeepListStructure": false - } - ], - "Replication": "Disabled", - "Description": "All built-in categories." - }, - { - "ConcreteType": "DSRevitNodesUI.ElementsOfCategory, DSRevitNodesUI", - "Id": "33f773eb560c4fcaa847e18214de2ef7", - "NodeType": "ExtensionNode", - "Inputs": [ - { - "Id": "6d071236512842a99ab51e6ac5633508", - "Name": "Category", - "Description": "The Category", - "UsingDefaultValue": false, - "Level": 2, - "UseLevels": false, - "KeepListStructure": false - } - ], - "Outputs": [ - { - "Id": "9705018e7b36421e93c205f16c29988f", - "Name": "Elements", - "Description": "An element class.", - "UsingDefaultValue": false, - "Level": 2, - "UseLevels": false, - "KeepListStructure": false - } - ], - "Replication": "Disabled", - "Description": "Get all elements of the specified category from the model." - }, - { - "ConcreteType": "Dynamo.Graph.Nodes.ZeroTouch.DSFunction, DynamoCore", - "Id": "736260b981b146eca204f690b6d52bf6", - "NodeType": "FunctionNode", - "Inputs": [ - { - "Id": "4685755d9e5b46679f2dcee806dd42fb", - "Name": "element", - "Description": "Revit.Elements.Element", - "UsingDefaultValue": false, - "Level": 2, - "UseLevels": false, - "KeepListStructure": false - } - ], - "Outputs": [ - { - "Id": "59e132d5dc654e04be8019b84b3f7015", - "Name": "geometry[]", - "Description": "List of geometry from the element", - "UsingDefaultValue": false, - "Level": 2, - "UseLevels": false, - "KeepListStructure": false - } - ], - "FunctionSignature": "Revit.Elements.Element.Geometry", - "Replication": "Auto", - "Description": "Returns all geometry associated with an element. Ignores transforms when used with linked elements.\n\nElement.Geometry ( ): var[]" - } - ], - "Connectors": [ - { - "Start": "81976910d2c3462980fe759708cbdd11", - "End": "6d071236512842a99ab51e6ac5633508", - "Id": "70d5e5a703b94d1b9509ed1c36ee7afb", - "IsHidden": "False" - }, - { - "Start": "9705018e7b36421e93c205f16c29988f", - "End": "4685755d9e5b46679f2dcee806dd42fb", - "Id": "e4117a528d7844b083289073c1053ced", - "IsHidden": "False" - } - ], - "Dependencies": [], - "NodeLibraryDependencies": [], - "EnableLegacyPolyCurveBehavior": true, - "Thumbnail": "", - "GraphDocumentationURL": null, - "ExtensionWorkspaceData": [ - { - "ExtensionGuid": "28992e1d-abb9-417f-8b1b-05e053bee670", - "Name": "Properties", - "Version": "3.0", - "Data": {} - }, - { - "ExtensionGuid": "DFBD9CC0-DB40-457A-939E-8C8555555A9D", - "Name": "Generative Design", - "Version": "7.1", - "Data": {} - } - ], - "Author": "Autodesk", - "Linting": { - "activeLinter": "None", - "activeLinterId": "7b75fb44-43fd-4631-a878-29f4d5d8399a", - "warningCount": 0, - "errorCount": 0 - }, - "Bindings": [], - "View": { - "Dynamo": { - "ScaleFactor": 1.0, - "HasRunWithoutCrash": true, - "IsVisibleInDynamoLibrary": true, - "Version": "3.0.3.7597", - "RunType": "Automatic", - "RunPeriod": "1000" - }, - "Camera": { - "Name": "_Background Preview", - "EyeX": -45.10952377319336, - "EyeY": 126.64234924316406, - "EyeZ": 79.76921844482422, - "LookX": 14.782140731811523, - "LookY": -106.08958435058594, - "LookZ": -86.57583618164062, - "UpX": 0.1296440213918686, - "UpY": 0.6376994848251343, - "UpZ": -0.7592970132827759 - }, - "ConnectorPins": [], - "NodeViews": [ - { - "Id": "bb34b03a88c14566861ee701d2036259", - "Name": "Categories", - "IsSetAsInput": false, - "IsSetAsOutput": false, - "Excluded": false, - "ShowGeometry": true, - "X": 89870.21477205436, - "Y": -4247.693497007918 - }, - { - "Id": "33f773eb560c4fcaa847e18214de2ef7", - "Name": "All Elements of Category", - "IsSetAsInput": false, - "IsSetAsOutput": false, - "Excluded": false, - "ShowGeometry": true, - "X": 90206.21477205436, - "Y": -4247.693497007918 - }, - { - "Id": "736260b981b146eca204f690b6d52bf6", - "Name": "Element.Geometry", - "IsSetAsInput": false, - "IsSetAsOutput": false, - "Excluded": false, - "ShowGeometry": true, - "X": 90574.09037191584, - "Y": -4247.693497007918 - } - ], - "Annotations": [ - { - "Id": "bba4fa218eb6408e941257c49579a7dd", - "Title": "Select Revit Category", - "DescriptionText": null, - "IsExpanded": true, - "WidthAdjustment": 0.0, - "HeightAdjustment": 0.0, - "Nodes": [], - "HasNestedGroups": false, - "Left": 89920.21477205436, - "Top": -4297.693497007918, - "Width": 0.0, - "Height": 0.0, - "FontSize": 36.0, - "GroupStyleId": "00000000-0000-0000-0000-000000000000", - "InitialTop": 0.0, - "InitialHeight": 0.0, - "TextblockHeight": 0.0, - "Background": "#FFC1D676", - "PinnedNode": "bb34b03a88c14566861ee701d2036259" - }, - { - "Id": "9af9581ad0114956a822641259e63620", - "Title": "Collect all elements of that selected Category", - "DescriptionText": null, - "IsExpanded": true, - "WidthAdjustment": 0.0, - "HeightAdjustment": 0.0, - "Nodes": [], - "HasNestedGroups": false, - "Left": 90203.21477205436, - "Top": -4297.693497007918, - "Width": 0.0, - "Height": 0.0, - "FontSize": 36.0, - "GroupStyleId": "00000000-0000-0000-0000-000000000000", - "InitialTop": 0.0, - "InitialHeight": 0.0, - "TextblockHeight": 0.0, - "Background": "#FFC1D676", - "PinnedNode": "33f773eb560c4fcaa847e18214de2ef7" - }, - { - "Id": "c2867b4d2aff4177bb118c225603b573", - "Title": "Get the geometry of all collected elements where possible. It may return a warning and null should there be something missing in Revit, or the geometry be unresolvable", - "DescriptionText": null, - "IsExpanded": true, - "WidthAdjustment": 0.0, - "HeightAdjustment": 0.0, - "Nodes": [], - "HasNestedGroups": false, - "Left": 90553.59037191584, - "Top": -4341.693497007918, - "Width": 0.0, - "Height": 0.0, - "FontSize": 36.0, - "GroupStyleId": "00000000-0000-0000-0000-000000000000", - "InitialTop": 0.0, - "InitialHeight": 0.0, - "TextblockHeight": 0.0, - "Background": "#FFC1D676", - "PinnedNode": "736260b981b146eca204f690b6d52bf6" - } - ], - "X": -113376.05923228659, - "Y": 5631.061522389584, - "Zoom": 1.2633317726382167 - } -} \ No newline at end of file diff --git a/doc/distrib/Templates/ImportDataFromExcel.dyn b/doc/distrib/Templates/ImportDataFromExcel.dyn deleted file mode 100644 index c9e8756f8f..0000000000 --- a/doc/distrib/Templates/ImportDataFromExcel.dyn +++ /dev/null @@ -1,398 +0,0 @@ -{ - "Uuid": "c49c9e5d-746d-42f7-975a-5a40f1ad1c6c", - "IsCustomNode": false, - "Description": "Import data from an Excel file and transpose the data to flip columns and rows", - "Name": "ImportDataFromExcel", - "ElementResolver": { - "ResolutionMap": {} - }, - "Inputs": [], - "Outputs": [], - "Nodes": [ - { - "ConcreteType": "Dynamo.Graph.Nodes.ZeroTouch.DSFunction, DynamoCore", - "Id": "7620c0a6d174413281b95698fb1d9d57", - "NodeType": "FunctionNode", - "Inputs": [ - { - "Id": "fab5ba40009445218c05f8e2e125c3e2", - "Name": "filePath", - "Description": "string", - "UsingDefaultValue": false, - "Level": 2, - "UseLevels": false, - "KeepListStructure": false - }, - { - "Id": "1838b7ed07924850904317b05d21e435", - "Name": "sheetName", - "Description": "string", - "UsingDefaultValue": false, - "Level": 2, - "UseLevels": false, - "KeepListStructure": false - }, - { - "Id": "2285506c22014e38983dd1f274148b74", - "Name": "startRow", - "Description": "int\nDefault value : 0", - "UsingDefaultValue": true, - "Level": 2, - "UseLevels": false, - "KeepListStructure": false - }, - { - "Id": "fa731e8403c64eb59363e3a25779c3c3", - "Name": "startColumn", - "Description": "int\nDefault value : 0", - "UsingDefaultValue": true, - "Level": 2, - "UseLevels": false, - "KeepListStructure": false - }, - { - "Id": "7b40d5b11e734659a873d691ceacedaf", - "Name": "readAsString", - "Description": "bool\nDefault value : false", - "UsingDefaultValue": true, - "Level": 2, - "UseLevels": false, - "KeepListStructure": false - } - ], - "Outputs": [ - { - "Id": "da29b5f8bea04c09b0e32ec0d27dd1af", - "Name": "var[][]", - "Description": "var[][]", - "UsingDefaultValue": false, - "Level": 2, - "UseLevels": false, - "KeepListStructure": false - } - ], - "FunctionSignature": "DSOffice.Data.OpenXMLImportExcel@string,string,int,int,bool", - "Replication": "Auto", - "Description": "Data.OpenXMLImportExcel (filePath: string, sheetName: string, startRow: int = 0, startColumn: int = 0, readAsString: bool = false): var[][]" - }, - { - "ConcreteType": "CoreNodeModels.Input.Filename, CoreNodeModels", - "Id": "d2ca2769c87f4b4396940a74ff1111d2", - "NodeType": "ExtensionNode", - "Inputs": [], - "Outputs": [ - { - "Id": "4cb119c0fc804e47bd4bcd5fff82cf7c", - "Name": "", - "Description": "File Path", - "UsingDefaultValue": false, - "Level": 2, - "UseLevels": false, - "KeepListStructure": false - } - ], - "Replication": "Disabled", - "Description": "Allows you to select a file on the system and returns its file path", - "HintPath": "C:\\Users\\amours\\Desktop\\DynamoRevitTemplates\\No file selected", - "InputValue": "No file selected." - }, - { - "ConcreteType": "CoreNodeModels.Input.StringInput, CoreNodeModels", - "Id": "3bd4fe2e6876454da3e83a01462c85c7", - "NodeType": "StringInputNode", - "Inputs": [], - "Outputs": [ - { - "Id": "3f6242f197704cb08d28d338399cc02b", - "Name": "", - "Description": "String", - "UsingDefaultValue": false, - "Level": 2, - "UseLevels": false, - "KeepListStructure": false - } - ], - "Replication": "Disabled", - "Description": "Creates a string", - "InputValue": "" - }, - { - "ConcreteType": "Dynamo.Graph.Nodes.ZeroTouch.DSFunction, DynamoCore", - "Id": "13b0e9b105ea4af2a48f0aafdfa0bf5b", - "NodeType": "FunctionNode", - "Inputs": [ - { - "Id": "c2a83726b20f4856956b731605c325fc", - "Name": "lists", - "Description": "List of lists to be transposed\n\nvar[]..[]", - "UsingDefaultValue": false, - "Level": 2, - "UseLevels": false, - "KeepListStructure": false - } - ], - "Outputs": [ - { - "Id": "91219a54373d4ea1b3ee8a1c03ace17a", - "Name": "lists", - "Description": "List of transposed lists", - "UsingDefaultValue": false, - "Level": 2, - "UseLevels": false, - "KeepListStructure": false - } - ], - "FunctionSignature": "DSCore.List.Transpose@var[]..[]", - "Replication": "Auto", - "Description": "Swaps rows and columns in a list of lists. If there are some rows that are shorter than others, null values are inserted as place holders in the resultant array such that it is always rectangular.\n\nList.Transpose (lists: var[]..[]): var[]..[]" - }, - { - "ConcreteType": "CoreNodeModels.Watch, CoreNodeModels", - "WatchWidth": 50.0, - "WatchHeight": 38.0, - "Id": "9277ad9caa034b88b3f4a71ce0489dfc", - "NodeType": "ExtensionNode", - "Inputs": [ - { - "Id": "c8ff6c767c27463fa83801056a1659f4", - "Name": "", - "Description": "Node to show output from", - "UsingDefaultValue": false, - "Level": 2, - "UseLevels": false, - "KeepListStructure": false - } - ], - "Outputs": [ - { - "Id": "e8e96a2d54104462b846e9146c44d28d", - "Name": "", - "Description": "Node output", - "UsingDefaultValue": false, - "Level": 2, - "UseLevels": false, - "KeepListStructure": false - } - ], - "Replication": "Disabled", - "Description": "Visualizes a node's output" - } - ], - "Connectors": [ - { - "Start": "da29b5f8bea04c09b0e32ec0d27dd1af", - "End": "c2a83726b20f4856956b731605c325fc", - "Id": "a21c0cfc98c246f6a048060ecab505b2", - "IsHidden": "False" - }, - { - "Start": "4cb119c0fc804e47bd4bcd5fff82cf7c", - "End": "fab5ba40009445218c05f8e2e125c3e2", - "Id": "c1f29067813448e4a0c018fc9d108ed5", - "IsHidden": "False" - }, - { - "Start": "3f6242f197704cb08d28d338399cc02b", - "End": "1838b7ed07924850904317b05d21e435", - "Id": "23ce470fd17646daa45add92a0e826ce", - "IsHidden": "False" - }, - { - "Start": "91219a54373d4ea1b3ee8a1c03ace17a", - "End": "c8ff6c767c27463fa83801056a1659f4", - "Id": "cc4370cff5a04c1c8ed3f74da4e2fe10", - "IsHidden": "False" - } - ], - "Dependencies": [], - "NodeLibraryDependencies": [], - "EnableLegacyPolyCurveBehavior": true, - "Thumbnail": "", - "GraphDocumentationURL": null, - "ExtensionWorkspaceData": [ - { - "ExtensionGuid": "28992e1d-abb9-417f-8b1b-05e053bee670", - "Name": "Properties", - "Version": "3.0", - "Data": {} - }, - { - "ExtensionGuid": "DFBD9CC0-DB40-457A-939E-8C8555555A9D", - "Name": "Generative Design", - "Version": "7.1", - "Data": {} - } - ], - "Author": "Autodesk", - "Linting": { - "activeLinter": "None", - "activeLinterId": "7b75fb44-43fd-4631-a878-29f4d5d8399a", - "warningCount": 0, - "errorCount": 0 - }, - "Bindings": [], - "View": { - "Dynamo": { - "ScaleFactor": 1.0, - "HasRunWithoutCrash": true, - "IsVisibleInDynamoLibrary": true, - "Version": "3.0.3.7597", - "RunType": "Automatic", - "RunPeriod": "1000" - }, - "Camera": { - "Name": "_Background Preview", - "EyeX": -17.0, - "EyeY": 24.0, - "EyeZ": 50.0, - "LookX": 12.0, - "LookY": -13.0, - "LookZ": -58.0, - "UpX": 0.0, - "UpY": 1.0, - "UpZ": 0.0 - }, - "ConnectorPins": [], - "NodeViews": [ - { - "Id": "7620c0a6d174413281b95698fb1d9d57", - "Name": "Data.OpenXMLImportExcel", - "IsSetAsInput": false, - "IsSetAsOutput": false, - "Excluded": false, - "ShowGeometry": true, - "X": 811.0, - "Y": 282.0 - }, - { - "Id": "d2ca2769c87f4b4396940a74ff1111d2", - "Name": "File Path", - "IsSetAsInput": false, - "IsSetAsOutput": false, - "Excluded": false, - "ShowGeometry": true, - "X": 238.5, - "Y": 282.0 - }, - { - "Id": "3bd4fe2e6876454da3e83a01462c85c7", - "Name": "String", - "IsSetAsInput": false, - "IsSetAsOutput": false, - "Excluded": false, - "ShowGeometry": true, - "X": 238.5, - "Y": 531.5 - }, - { - "Id": "13b0e9b105ea4af2a48f0aafdfa0bf5b", - "Name": "List.Transpose", - "IsSetAsInput": false, - "IsSetAsOutput": false, - "Excluded": false, - "ShowGeometry": true, - "X": 1180.5, - "Y": 282.0 - }, - { - "Id": "9277ad9caa034b88b3f4a71ce0489dfc", - "Name": "Watch", - "IsSetAsInput": false, - "IsSetAsOutput": false, - "Excluded": false, - "ShowGeometry": true, - "X": 1462.0, - "Y": 282.0 - } - ], - "Annotations": [ - { - "Id": "f8caed9cca86404397d6c13d7f9a2292", - "Title": "Browse to Excel file to import data from", - "DescriptionText": null, - "IsExpanded": true, - "WidthAdjustment": 0.0, - "HeightAdjustment": 0.0, - "Nodes": [], - "HasNestedGroups": false, - "Left": 205.0, - "Top": 232.0, - "Width": 0.0, - "Height": 0.0, - "FontSize": 36.0, - "GroupStyleId": "00000000-0000-0000-0000-000000000000", - "InitialTop": 0.0, - "InitialHeight": 0.0, - "TextblockHeight": 0.0, - "Background": "#FFC1D676", - "PinnedNode": "d2ca2769c87f4b4396940a74ff1111d2" - }, - { - "Id": "f6199651df8b4e3ebe2e1ba518850914", - "Title": "Type in a Sheet Name, but be mindful of capitalization", - "DescriptionText": null, - "IsExpanded": true, - "WidthAdjustment": 0.0, - "HeightAdjustment": 0.0, - "Nodes": [], - "HasNestedGroups": false, - "Left": 193.5, - "Top": 466.5, - "Width": 0.0, - "Height": 0.0, - "FontSize": 36.0, - "GroupStyleId": "00000000-0000-0000-0000-000000000000", - "InitialTop": 0.0, - "InitialHeight": 0.0, - "TextblockHeight": 0.0, - "Background": "#FFC1D676", - "PinnedNode": "3bd4fe2e6876454da3e83a01462c85c7" - }, - { - "Id": "a69836269d524c90a34e16b7efd8f803", - "Title": "Import Excel data using the OpenXML format from a chosen sheet name", - "DescriptionText": null, - "IsExpanded": true, - "WidthAdjustment": 0.0, - "HeightAdjustment": 0.0, - "Nodes": [], - "HasNestedGroups": false, - "Left": 799.5, - "Top": 169.0, - "Width": 0.0, - "Height": 0.0, - "FontSize": 36.0, - "GroupStyleId": "00000000-0000-0000-0000-000000000000", - "InitialTop": 0.0, - "InitialHeight": 0.0, - "TextblockHeight": 0.0, - "Background": "#FFC1D676", - "PinnedNode": "7620c0a6d174413281b95698fb1d9d57" - }, - { - "Id": "37460f13b9794e029d2aec8655b5aaa9", - "Title": "Transpose the Excel data to flip Rows and Columns", - "DescriptionText": null, - "IsExpanded": true, - "WidthAdjustment": 0.0, - "HeightAdjustment": 0.0, - "Nodes": [], - "HasNestedGroups": false, - "Left": 1125.0, - "Top": 184.0, - "Width": 0.0, - "Height": 0.0, - "FontSize": 36.0, - "GroupStyleId": "00000000-0000-0000-0000-000000000000", - "InitialTop": 0.0, - "InitialHeight": 0.0, - "TextblockHeight": 0.0, - "Background": "#FFC1D676", - "PinnedNode": "13b0e9b105ea4af2a48f0aafdfa0bf5b" - } - ], - "X": -245.65603726262975, - "Y": -92.29666786098167, - "Zoom": 1.4245790039412396 - } -} \ No newline at end of file diff --git a/doc/distrib/Templates/ReadImageFromFile.dyn b/doc/distrib/Templates/ReadImageFromFile.dyn deleted file mode 100644 index 9bd4f780f7..0000000000 --- a/doc/distrib/Templates/ReadImageFromFile.dyn +++ /dev/null @@ -1,323 +0,0 @@ -{ - "Uuid": "847b8d50-8963-40c7-90ca-c0afb7b9b9a6", - "IsCustomNode": false, - "Description": "Read Image from disc to be able to work with inside of Dynamo", - "Name": "ReadImageFromFile", - "ElementResolver": { - "ResolutionMap": {} - }, - "Inputs": [], - "Outputs": [], - "Nodes": [ - { - "ConcreteType": "CoreNodeModels.Input.Filename, CoreNodeModels", - "Id": "d2ca2769c87f4b4396940a74ff1111d2", - "NodeType": "ExtensionNode", - "Inputs": [], - "Outputs": [ - { - "Id": "4cb119c0fc804e47bd4bcd5fff82cf7c", - "Name": "", - "Description": "File Path", - "UsingDefaultValue": false, - "Level": 2, - "UseLevels": false, - "KeepListStructure": false - } - ], - "Replication": "Disabled", - "Description": "Allows you to select a file on the system and returns its file path", - "HintPath": "C:\\Users\\amours\\Desktop\\DynamoRevitTemplates\\No file selected", - "InputValue": "No file selected." - }, - { - "ConcreteType": "CoreNodeModels.Input.FileObject, CoreNodeModels", - "Id": "59d22a7921854195813ce16dac4fde76", - "NodeType": "ExtensionNode", - "Inputs": [ - { - "Id": "ac3d97121b3a4e7e81b84beb515453b6", - "Name": "path", - "Description": "Path to the file.", - "UsingDefaultValue": false, - "Level": 2, - "UseLevels": false, - "KeepListStructure": false - } - ], - "Outputs": [ - { - "Id": "e6871041961542a7b371fe5c91060ef7", - "Name": "file", - "Description": "File object", - "UsingDefaultValue": false, - "Level": 2, - "UseLevels": false, - "KeepListStructure": false - } - ], - "Replication": "Disabled", - "Description": "Creates a file object from the given path" - }, - { - "ConcreteType": "Dynamo.Graph.Nodes.ZeroTouch.DSFunction, DynamoCore", - "Id": "19ee29aa65234cd0b7dc15d77fb4eb15", - "NodeType": "FunctionNode", - "Inputs": [ - { - "Id": "eb524fc133cb468b907620050f72b8bf", - "Name": "file", - "Description": "File object to load image from\n\nvar", - "UsingDefaultValue": false, - "Level": 2, - "UseLevels": false, - "KeepListStructure": false - } - ], - "Outputs": [ - { - "Id": "f106b67f8d5f4cab91d132b92814efbd", - "Name": "image", - "Description": "Image object from file", - "UsingDefaultValue": false, - "Level": 2, - "UseLevels": false, - "KeepListStructure": false - } - ], - "FunctionSignature": "DSCore.IO.Image.ReadFromFile@var", - "Replication": "Auto", - "Description": "Loads the file as a bitmap.\n\nImage.ReadFromFile (file: var): var" - }, - { - "ConcreteType": "CoreNodeModels.WatchImageCore, CoreNodeModels", - "Id": "3fe34643619745249cb1e4a286e36944", - "NodeType": "ExtensionNode", - "Inputs": [ - { - "Id": "f4d5f5b983b340f8973b41f72174f9e7", - "Name": "image", - "Description": "Image for visualization", - "UsingDefaultValue": false, - "Level": 2, - "UseLevels": false, - "KeepListStructure": false - } - ], - "Outputs": [ - { - "Id": "bebb4cb152da4adbad95a62a2c1dcc6e", - "Name": "image", - "Description": "Image for visualization", - "UsingDefaultValue": false, - "Level": 2, - "UseLevels": false, - "KeepListStructure": false - } - ], - "Replication": "Disabled", - "Description": "Previews an image" - } - ], - "Connectors": [ - { - "Start": "4cb119c0fc804e47bd4bcd5fff82cf7c", - "End": "ac3d97121b3a4e7e81b84beb515453b6", - "Id": "df3062a3444e41b8b7f34c7a286e4cce", - "IsHidden": "False" - }, - { - "Start": "e6871041961542a7b371fe5c91060ef7", - "End": "eb524fc133cb468b907620050f72b8bf", - "Id": "78544d0ab304493f81cbb3753ea34fec", - "IsHidden": "False" - }, - { - "Start": "f106b67f8d5f4cab91d132b92814efbd", - "End": "f4d5f5b983b340f8973b41f72174f9e7", - "Id": "d95208d4410d4cb9825e4f2d39309326", - "IsHidden": "False" - } - ], - "Dependencies": [], - "NodeLibraryDependencies": [], - "EnableLegacyPolyCurveBehavior": true, - "Thumbnail": "", - "GraphDocumentationURL": null, - "ExtensionWorkspaceData": [ - { - "ExtensionGuid": "28992e1d-abb9-417f-8b1b-05e053bee670", - "Name": "Properties", - "Version": "3.0", - "Data": {} - }, - { - "ExtensionGuid": "DFBD9CC0-DB40-457A-939E-8C8555555A9D", - "Name": "Generative Design", - "Version": "7.1", - "Data": {} - } - ], - "Author": "Autodesk", - "Linting": { - "activeLinter": "None", - "activeLinterId": "7b75fb44-43fd-4631-a878-29f4d5d8399a", - "warningCount": 0, - "errorCount": 0 - }, - "Bindings": [], - "View": { - "Dynamo": { - "ScaleFactor": 1.0, - "HasRunWithoutCrash": true, - "IsVisibleInDynamoLibrary": true, - "Version": "3.0.3.7597", - "RunType": "Automatic", - "RunPeriod": "1000" - }, - "Camera": { - "Name": "_Background Preview", - "EyeX": -17.0, - "EyeY": 24.0, - "EyeZ": 50.0, - "LookX": 12.0, - "LookY": -13.0, - "LookZ": -58.0, - "UpX": 0.0, - "UpY": 1.0, - "UpZ": 0.0 - }, - "ConnectorPins": [], - "NodeViews": [ - { - "Id": "d2ca2769c87f4b4396940a74ff1111d2", - "Name": "File Path", - "IsSetAsInput": false, - "IsSetAsOutput": false, - "Excluded": false, - "ShowGeometry": true, - "X": 238.5, - "Y": 282.0 - }, - { - "Id": "59d22a7921854195813ce16dac4fde76", - "Name": "File From Path", - "IsSetAsInput": false, - "IsSetAsOutput": false, - "Excluded": false, - "ShowGeometry": true, - "X": 811.0, - "Y": 282.0 - }, - { - "Id": "19ee29aa65234cd0b7dc15d77fb4eb15", - "Name": "Image.ReadFromFile", - "IsSetAsInput": false, - "IsSetAsOutput": false, - "Excluded": false, - "ShowGeometry": true, - "X": 1092.7547786720322, - "Y": 282.0 - }, - { - "Id": "3fe34643619745249cb1e4a286e36944", - "Name": "Watch Image", - "IsSetAsInput": false, - "IsSetAsOutput": false, - "Excluded": false, - "ShowGeometry": true, - "X": 1433.866448692153, - "Y": 282.0 - } - ], - "Annotations": [ - { - "Id": "f8caed9cca86404397d6c13d7f9a2292", - "Title": "Browse to Image file to import", - "DescriptionText": null, - "IsExpanded": true, - "WidthAdjustment": 0.0, - "HeightAdjustment": 0.0, - "Nodes": [], - "HasNestedGroups": false, - "Left": 229.5, - "Top": 232.0, - "Width": 0.0, - "Height": 0.0, - "FontSize": 36.0, - "GroupStyleId": "00000000-0000-0000-0000-000000000000", - "InitialTop": 0.0, - "InitialHeight": 0.0, - "TextblockHeight": 0.0, - "Background": "#FFC1D676", - "PinnedNode": "d2ca2769c87f4b4396940a74ff1111d2" - }, - { - "Id": "a69836269d524c90a34e16b7efd8f803", - "Title": "Load the Image file from disk into Dynamo's memory", - "DescriptionText": null, - "IsExpanded": true, - "WidthAdjustment": 0.0, - "HeightAdjustment": 0.0, - "Nodes": [], - "HasNestedGroups": false, - "Left": 772.0, - "Top": 217.0, - "Width": 0.0, - "Height": 0.0, - "FontSize": 36.0, - "GroupStyleId": "00000000-0000-0000-0000-000000000000", - "InitialTop": 0.0, - "InitialHeight": 0.0, - "TextblockHeight": 0.0, - "Background": "#FFC1D676", - "PinnedNode": "59d22a7921854195813ce16dac4fde76" - }, - { - "Id": "37460f13b9794e029d2aec8655b5aaa9", - "Title": "Read Image from File in Dynamo's memory space in the Bitmap format", - "DescriptionText": null, - "IsExpanded": true, - "WidthAdjustment": 0.0, - "HeightAdjustment": 0.0, - "Nodes": [], - "HasNestedGroups": false, - "Left": 1056.2547786720322, - "Top": 169.0, - "Width": 0.0, - "Height": 0.0, - "FontSize": 36.0, - "GroupStyleId": "00000000-0000-0000-0000-000000000000", - "InitialTop": 0.0, - "InitialHeight": 0.0, - "TextblockHeight": 0.0, - "Background": "#FFC1D676", - "PinnedNode": "19ee29aa65234cd0b7dc15d77fb4eb15" - }, - { - "Id": "92781c108d794300982eb5b214c43333", - "Title": "Watch the Image to visually check", - "DescriptionText": null, - "IsExpanded": true, - "WidthAdjustment": 0.0, - "HeightAdjustment": 0.0, - "Nodes": [], - "HasNestedGroups": false, - "Left": 1417.866448692153, - "Top": 232.0, - "Width": 0.0, - "Height": 0.0, - "FontSize": 36.0, - "GroupStyleId": "00000000-0000-0000-0000-000000000000", - "InitialTop": 0.0, - "InitialHeight": 0.0, - "TextblockHeight": 0.0, - "Background": "#FFC1D676", - "PinnedNode": "3fe34643619745249cb1e4a286e36944" - } - ], - "X": -301.7268648176259, - "Y": 70.82444097119173, - "Zoom": 1.4454329621683044 - } -} \ No newline at end of file From 88f164191e37dfc9c68f78285cea5a1790e4360a Mon Sep 17 00:00:00 2001 From: pinzart90 Date: Thu, 17 Apr 2025 10:28:11 -0400 Subject: [PATCH 40/70] Update AssemblyInfoGenerator.csproj --- .../AssemblyInfoGenerator.csproj | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/src/AssemblySharedInfoGenerator/AssemblyInfoGenerator.csproj b/src/AssemblySharedInfoGenerator/AssemblyInfoGenerator.csproj index 3865546c4d..26069ccb5e 100644 --- a/src/AssemblySharedInfoGenerator/AssemblyInfoGenerator.csproj +++ b/src/AssemblySharedInfoGenerator/AssemblyInfoGenerator.csproj @@ -35,22 +35,6 @@ - - - TextTemplatingFileGenerator - AssemblySharedInfo.cs - - - - - True - True - AssemblySharedInfo.tt - - - - - From 18bea1486a456b89220486b3fff54dea8534ae95 Mon Sep 17 00:00:00 2001 From: pinzart90 Date: Thu, 17 Apr 2025 10:28:55 -0400 Subject: [PATCH 41/70] Update AssemblyInfoGenerator.csproj --- src/AssemblySharedInfoGenerator/AssemblyInfoGenerator.csproj | 1 - 1 file changed, 1 deletion(-) diff --git a/src/AssemblySharedInfoGenerator/AssemblyInfoGenerator.csproj b/src/AssemblySharedInfoGenerator/AssemblyInfoGenerator.csproj index 26069ccb5e..51431227af 100644 --- a/src/AssemblySharedInfoGenerator/AssemblyInfoGenerator.csproj +++ b/src/AssemblySharedInfoGenerator/AssemblyInfoGenerator.csproj @@ -35,7 +35,6 @@ - From e3f8b6168405ac7d0a04d78c01de6d6a1bfbf446 Mon Sep 17 00:00:00 2001 From: pinzart90 Date: Thu, 17 Apr 2025 11:16:45 -0400 Subject: [PATCH 42/70] update --- src/DynamoRevit/DynamoRevit.csproj | 159 ----------------- src/DynamoRevitIcons/DynamoRevitIcons.csproj | 3 - .../RevitNodesUI/RevitNodesUI.csproj | 167 ++---------------- 3 files changed, 17 insertions(+), 312 deletions(-) diff --git a/src/DynamoRevit/DynamoRevit.csproj b/src/DynamoRevit/DynamoRevit.csproj index 8fee1ebc1f..001ce91538 100644 --- a/src/DynamoRevit/DynamoRevit.csproj +++ b/src/DynamoRevit/DynamoRevit.csproj @@ -49,165 +49,6 @@ Lines="<?xml version="1.0" encoding="utf-8"?> <configuration> <appSettings> <add key="DynamoRuntime" value="$(DYNAMOAPI)"/> </appSettings> </configuration> " Overwrite="true" /> - - - $(PACKAGESPATH)\DynamoVisualProgramming.Core\lib\$(DCoreLibSubFolder)\DynamoApplications.dll - $(DYNAMOBUILDPATH)\DynamoApplications.dll - False - - - $(PACKAGESPATH)\DynamoVisualProgramming.DynamoServices\lib\netstandard2.0\DynamoServices.dll - $(DYNAMOBUILDPATH)\DynamoServices.dll - False - - - $(PACKAGESPATH)\Greg\lib\net8.0\Greg.dll - False - - - $(PACKAGESPATH)\GregRevitAuth\lib\net8.0\GregRevitAuth.dll - True - - - $(PACKAGESPATH)\DynamicLanguageRuntime\lib\net45\Microsoft.Dynamic.dll - False - - - $(PACKAGESPATH)\Prism\lib\NET40\Microsoft.Practices.Prism.dll - False - - - $(PACKAGESPATH)\DynamicLanguageRuntime\lib\net45\Microsoft.Scripting.dll - False - - - $(PACKAGESPATH)\Newtonsoft.Json\lib\net45\Newtonsoft.Json.dll - False - - - $(PACKAGESPATH)\DynamoVisualProgramming.ZeroTouchLibrary\lib\$(DCoreLibSubFolder)\ProtoGeometry.dll - $(DYNAMOBUILDPATH)\ProtoGeometry.dll - False - - - $(PACKAGESPATH)\pythonnet\lib\net40\Python.Runtime.dll - False - - - $(PACKAGESPATH)\RestSharp\lib\net6.0\RestSharp.dll - False - - - $(REVITAPI)\RevitAPI.dll - False - - - $(REVITAPI)\RevitAPIUI.dll - False - - - - - - True - True - Resources.resx - - - True - True - Resources.en-US.resx - - - - - PublicResXFileCodeGenerator - Resources.Designer.cs - Designer - - - PublicResXFileCodeGenerator - Resources.en-US.Designer.cs - - - - - $(PACKAGESPATH)\DynamoVisualProgramming.Core\lib\$(DCoreLibSubFolder)\ProtoCore.dll - $(DYNAMOBUILDPATH)\ProtoCore.dll - False - - - $(PACKAGESPATH)\DynamoVisualProgramming.WpfUILibrary\lib\$(DCoreLibSubFolder)\DynamoCoreWpf.dll - $(DYNAMOBUILDPATH)\DynamoCoreWpf.dll - False - - - $(PACKAGESPATH)\DynamoVisualProgramming.Core\lib\$(DCoreLibSubFolder)\DynamoCore.dll - $(DYNAMOBUILDPATH)\DynamoCore.dll - False - - - $(PACKAGESPATH)\DynamoVisualProgramming.Core\lib\$(DCoreLibSubFolder)\DynamoUtilities.dll - $(DYNAMOBUILDPATH)\DynamoUtilities.dll - False - - - $(PACKAGESPATH)\DynamoVisualProgramming.Core\lib\$(DCoreLibSubFolder)\DynamoShapeManager.dll - $(DYNAMOBUILDPATH)\DynamoShapeManager.dll - False - - - $(PACKAGESPATH)\DynamoVisualProgramming.Core\lib\$(DCoreLibSubFolder)\DynamoInstallDetective.dll - $(DYNAMOBUILDPATH)\DynamoInstallDetective.dll - False - - - - - - - - - - - - - - - - - false - $(BuildDependsOn);AfterBuildMigrated - if exist $(ProjectDir)PostBuildStep.bat call $(ProjectDir)PostBuildStep.bat $(SolutionDir) - DynamoRevitDS - true - true - - - None - - - false - TRACE;DEBUG - false - - - true - TRACE - - - true - - - if exist $(ProjectDir)PostBuildStep.bat call $(ProjectDir)PostBuildStep.bat $(SolutionDir) - x64 - - - - $(PACKAGESPATH)\DynamoVisualProgramming.Core\lib\$(DCoreLibSubFolder)\DynamoApplications.dll diff --git a/src/DynamoRevitIcons/DynamoRevitIcons.csproj b/src/DynamoRevitIcons/DynamoRevitIcons.csproj index 8815472aaf..331e249dd5 100644 --- a/src/DynamoRevitIcons/DynamoRevitIcons.csproj +++ b/src/DynamoRevitIcons/DynamoRevitIcons.csproj @@ -35,9 +35,6 @@ ItemName="MyAssemblyIdentities"/> - - - diff --git a/src/Libraries/RevitNodesUI/RevitNodesUI.csproj b/src/Libraries/RevitNodesUI/RevitNodesUI.csproj index c250667c2f..0c3bcf6090 100644 --- a/src/Libraries/RevitNodesUI/RevitNodesUI.csproj +++ b/src/Libraries/RevitNodesUI/RevitNodesUI.csproj @@ -27,153 +27,19 @@ - - - - - - - - - - - - - - - - - - - - - - - - - $(PACKAGESPATH)\DynamoVisualProgramming.Core\lib\$(DCoreLibSubFolder)\DynamoUtilities.dll - $(DYNAMOBUILDPATH)\DynamoUtilities.dll - False - - - $(PACKAGESPATH)\Newtonsoft.Json\lib\net45\Newtonsoft.Json.dll - False - - - $(PACKAGESPATH)\DynamoVisualProgramming.ZeroTouchLibrary\lib\$(DCoreLibSubFolder)\ProtoGeometry.dll - $(DYNAMOBUILDPATH)\ProtoGeometry.dll - False - - - $(PACKAGESPATH)\DynamoVisualProgramming.DynamoServices\lib\netstandard2.0\DynamoServices.dll - $(DYNAMOBUILDPATH)\DynamoServices.dll - False - - - $(REVITAPI)\RevitAPI.dll - False - - - $(REVITAPI)\RevitAPIUI.dll - False - - - - - - ComboControl.xaml - - - LocationControl.xaml - - - True - True - Resources.resx - - - - - $(PACKAGESPATH)\DynamoVisualProgramming.WpfUILibrary\lib\$(DCoreLibSubFolder)\DynamoCoreWpf.dll - $(DYNAMOBUILDPATH)\DynamoCoreWpf.dll - False - - - $(PACKAGESPATH)\DynamoVisualProgramming.Core\lib\$(DCoreLibSubFolder)\ProtoCore.dll - $(DYNAMOBUILDPATH)\ProtoCore.dll - False - - - $(PACKAGESPATH)\DynamoVisualProgramming.WpfUILibrary\lib\$(DCoreLibSubFolder)\CoreNodeModelsWpf.dll - $(DYNAMOBUILDPATH)\nodes\CoreNodeModelsWpf.dll - False - - - $(PACKAGESPATH)\DynamoVisualProgramming.DynamoCoreNodes\lib\$(DCoreLibSubFolder)\CoreNodeModels.dll - $(DYNAMOBUILDPATH)\nodes\CoreNodeModels.dll - False - - - $(PACKAGESPATH)\DynamoVisualProgramming.Core\lib\$(DCoreLibSubFolder)\DynamoCore.dll - $(DYNAMOBUILDPATH)\DynamoCore.dll - False - - - $(PACKAGESPATH)\DynamoVisualProgramming.DynamoCoreNodes\lib\$(DCoreLibSubFolder)\DSCoreNodes.dll - $(DYNAMOBUILDPATH)\DSCoreNodes.dll - False - - - $(PACKAGESPATH)\DynamoVisualProgramming.ZeroTouchLibrary\lib\$(DCoreLibSubFolder)\DynamoUnits.dll - $(DYNAMOBUILDPATH)\DynamoUnits.dll - False - - - $(PACKAGESPATH)\Prism\lib\NET40\Microsoft.Practices.Prism.dll - False - - - - - - - - - - - ResXFileCodeGenerator - Designer - Resources.Designer.cs - - - - - - - DSRevitNodesUI - DSRevitNodesUI - $(OutputPath)\nodes\ - prompt - 4 - false - true - false - - - - true - full - false - DEBUG;TRACE - - - pdbonly - true - TRACE - - - - + + + + + + + + + + + + + $(PACKAGESPATH)\DynamoVisualProgramming.Core\lib\$(DCoreLibSubFolder)\DynamoUtilities.dll @@ -202,9 +68,9 @@ $(REVITAPI)\RevitAPIUI.dll False - - + + ComboControl.xaml @@ -255,7 +121,8 @@ - + + False From c94a31e3a08b44ddcfff41de2e5e14febabb5645 Mon Sep 17 00:00:00 2001 From: pinzart90 Date: Thu, 17 Apr 2025 11:19:52 -0400 Subject: [PATCH 43/70] Update DynamoRevitIcons.csproj --- src/DynamoRevitIcons/DynamoRevitIcons.csproj | 1 - 1 file changed, 1 deletion(-) diff --git a/src/DynamoRevitIcons/DynamoRevitIcons.csproj b/src/DynamoRevitIcons/DynamoRevitIcons.csproj index 331e249dd5..043e6743c1 100644 --- a/src/DynamoRevitIcons/DynamoRevitIcons.csproj +++ b/src/DynamoRevitIcons/DynamoRevitIcons.csproj @@ -28,7 +28,6 @@ AssemblyFiles="$(OutputPath)AssemblyInfoGenerator.dll"> Date: Wed, 23 Apr 2025 16:11:11 -0400 Subject: [PATCH 44/70] update --- .../AssemblyInfoGenerator.csproj | 3 +- src/Config/CS_SDK.props | 5 + src/DADynamoApp/DADynamoApp.csproj | 22 +- src/DADynamoApp/DAEntrypoint.cs | 201 +++++++++++++----- src/DADynamoApp/DynamoPathResolver.cs | 65 ------ src/DynamoRevit.All.sln | 6 + src/DynamoRevit.DA.sln | 1 + src/DynamoRevit/DynamoRevit.cs | 200 +---------------- src/DynamoRevit/DynamoRevit.csproj | 6 +- src/DynamoRevit/DynamoRevitApp.cs | 32 +-- src/DynamoRevit/Models/RevitDynamoModel.cs | 108 +--------- src/DynamoRevitIcons/DynamoRevitIcons.csproj | 2 +- src/Libraries/Migrations/Migrations.csproj | 14 -- .../RevitNodes/Elements/LinkElement.cs | 40 ++++ .../RevitNodes/Properties/AssemblyInfo.cs | 1 + src/Libraries/RevitNodes/RevitNodes.csproj | 13 -- src/Libraries/RevitNodesUI/Elements.cs | 18 +- src/Libraries/RevitNodesUI/RevitDropDown.cs | 10 +- .../RevitNodesUI/RevitNodesUI.csproj | 17 +- src/Libraries/RevitNodesUI/SiteLocation.cs | 9 +- src/Libraries/RevitNodesUI/SunPath.cs | 7 +- .../RevitServices/Events/ApplicationEvents.cs | 52 +++++ .../RevitServices/Events/EventHandlerProxy.cs | 1 + .../RevitServices/Properties/AssemblyInfo.cs | 1 + .../RevitServices/RevitServices.csproj | 27 +-- src/SharedUtilities/ASMPreloader.cs | 93 ++++++++ .../DynamoRevitInternalNodes.cs | 123 +++++++++++ .../DynamoRevitPythonManager.cs | 146 +++++++++++++ .../RevitPathResolver.cs | 61 +++++- src/SharedUtilities/SharedUtilities.projitems | 17 ++ src/SharedUtilities/SharedUtilities.shproj | 13 ++ 31 files changed, 761 insertions(+), 553 deletions(-) delete mode 100644 src/DADynamoApp/DynamoPathResolver.cs create mode 100644 src/Libraries/RevitServices/Events/ApplicationEvents.cs create mode 100644 src/SharedUtilities/ASMPreloader.cs create mode 100644 src/SharedUtilities/DynamoRevitInternalNodes.cs create mode 100644 src/SharedUtilities/DynamoRevitPythonManager.cs rename src/{DynamoRevit => SharedUtilities}/RevitPathResolver.cs (65%) create mode 100644 src/SharedUtilities/SharedUtilities.projitems create mode 100644 src/SharedUtilities/SharedUtilities.shproj diff --git a/src/AssemblySharedInfoGenerator/AssemblyInfoGenerator.csproj b/src/AssemblySharedInfoGenerator/AssemblyInfoGenerator.csproj index 51431227af..dcb8f0015a 100644 --- a/src/AssemblySharedInfoGenerator/AssemblyInfoGenerator.csproj +++ b/src/AssemblySharedInfoGenerator/AssemblyInfoGenerator.csproj @@ -9,9 +9,10 @@ false false "$(SolutionDir)transform_all.bat" "$(ProjectDir)" - false + false None AssemblyInfoGenerator + bin\$(Configuration)\ false diff --git a/src/Config/CS_SDK.props b/src/Config/CS_SDK.props index 0e3d79e8e1..1d88dc5094 100644 --- a/src/Config/CS_SDK.props +++ b/src/Config/CS_SDK.props @@ -42,4 +42,9 @@ $(DefineConstants);DESIGN_AUTOMATION + + + all + + diff --git a/src/DADynamoApp/DADynamoApp.csproj b/src/DADynamoApp/DADynamoApp.csproj index 366e99a7cf..11fdb99b3a 100644 --- a/src/DADynamoApp/DADynamoApp.csproj +++ b/src/DADynamoApp/DADynamoApp.csproj @@ -1,13 +1,17 @@  + - net8.0-windows + net8.0-windows enable enable false + + + true @@ -24,10 +28,21 @@ - + + + runtime + + + runtime + + + $(Pkgpythonnet_py38_win)\pythonnet\lib\net40\Python.Runtime.dll + False + + @@ -44,4 +59,7 @@ False + + + diff --git a/src/DADynamoApp/DAEntrypoint.cs b/src/DADynamoApp/DAEntrypoint.cs index f3cb74cecb..1d0f646cbc 100644 --- a/src/DADynamoApp/DAEntrypoint.cs +++ b/src/DADynamoApp/DAEntrypoint.cs @@ -6,10 +6,20 @@ using RevitServices.Persistence; using RevitServices.Elements; using RevitServices.EventHandler; -using System.IO.Compression; using System.Reflection; using System.Runtime.Loader; using System.Diagnostics; +using Dynamo.Applications; +using Dynamo.Scheduler; +using static Dynamo.Models.DynamoModel; +using System.Text.RegularExpressions; +using Greg.AuthProviders; +using Revit.Elements; +using Greg.Responses; +using Dynamo.PythonServices; +using Microsoft.VisualBasic.FileIO; +using DSCPython; +using System.Collections; namespace DADynamoApp { @@ -19,49 +29,30 @@ public class DAEntrypoint : IExternalDBApplication { private DynamoModel model; internal static DynamoPlayerLoggerConfiguration logConfig = new DynamoPlayerLoggerConfiguration() { DynamoLogLevel = Dynamo.Logging.LogLevel.Console, LogLevel = DynamoPlayer.LogLevel.Information }; + private AssemblyLoadContext loadContext = AssemblyLoadContext.GetLoadContext(Assembly.GetExecutingAssembly()) ?? AssemblyLoadContext.Default; + private string DynamoPath; + private string DynamoRevitPath; + private ControlledApplication controlledApplication; private string LoadMessage; private string WorkItemFolder; + private readonly string PythonDllFolder = "pythonDependencies"; - private static EventHandlerProxy proxy; - public static EventHandlerProxy EventHandlerProxy - { - get { return proxy; } - } public static List Updaters = new List(); - private void CheckIfPythonExists(string inputFolder) - { - var pyDir = "python-3.9.12-embed-amd64"; - var pyRoot = Path.GetDirectoryName(model.PathManager.CommonDataDirectory); - var searchPath = Path.Combine(pyRoot, pyDir); - if (Directory.Exists(searchPath) && File.Exists(Path.Combine(searchPath, "python.exe"))) - { - return; - } - Console.WriteLine($"<> cPython not found at '{searchPath}'"); - var inputDistributionPath = Path.Combine(inputFolder, $"{pyDir}.zip"); - if (File.Exists(inputDistributionPath)) - { - Console.WriteLine("<> cPython distribution detected in input. Attempting to add it... "); - try - { - ZipFile.ExtractToDirectory(inputDistributionPath, searchPath); - Console.WriteLine("<> cPython added."); - } - catch (Exception ex) - { - Console.WriteLine($"<> Failed to add cPython: {ex.Message}"); - } - } - } - public ExternalDBApplicationResult OnShutdown(ControlledApplication application) { AppDomain.CurrentDomain.UnhandledException -= CurrentDomain_UnhandledException; AppDomain.CurrentDomain.ProcessExit -= CurrentDomain_ProcessExit; - AppDomain.CurrentDomain.AssemblyResolve -= DynamoPathResolver.ResolveAssembly; + AppDomain.CurrentDomain.AssemblyResolve -= CurrentDomain_AssemblyResolve; + + controlledApplication.DocumentClosing -= RevitServices.Events.ApplicationEvents.OnApplicationDocumentClosing; + controlledApplication.DocumentClosed -= RevitServices.Events.ApplicationEvents.OnApplicationDocumentClosed; + controlledApplication.DocumentOpened -= RevitServices.Events.ApplicationEvents.OnApplicationDocumentOpened; + + DynamoRevitPythonManager.Cleanup(); + return ExternalDBApplicationResult.Succeeded; } @@ -82,23 +73,38 @@ private static void CurrentDomain_UnhandledException(object sender, UnhandledExc public ExternalDBApplicationResult OnStartup(ControlledApplication application) { + controlledApplication = application; + + WorkItemFolder = Directory.GetCurrentDirectory(); + Console.WriteLine($"<> Work folder is '{WorkItemFolder}'"); + + DynamoRevitPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + DynamoPath = Directory.GetParent(DynamoRevitPath).FullName; + + var hostloc = typeof(Autodesk.Revit.ApplicationServices.Application).Assembly.Location; + var hostDir = Path.GetDirectoryName(hostloc); + AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; AppDomain.CurrentDomain.ProcessExit += CurrentDomain_ProcessExit; - AppDomain.CurrentDomain.AssemblyResolve += DynamoPathResolver.ResolveAssembly; + AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve; Console.WriteLine("<> Starting to load D4DA"); try { + RevitServicesUpdater.Initialize(Updaters); + Console.WriteLine("<> D4DA Loaded"); + RevitServices.Transactions.TransactionManager.SetupManager(new RevitServices.Transactions.AutomaticTransactionStrategy()); + // TODO: do we need element binding in Design Automations? ElementBinder.IsEnabled = true; - - RevitServicesUpdater.Initialize(Updaters); + + controlledApplication.DocumentClosing += RevitServices.Events.ApplicationEvents.OnApplicationDocumentClosing; + controlledApplication.DocumentClosed += RevitServices.Events.ApplicationEvents.OnApplicationDocumentClosed; + controlledApplication.DocumentOpened += RevitServices.Events.ApplicationEvents.OnApplicationDocumentOpened; DesignAutomationBridge.DesignAutomationReadyEvent += HandleDesignAutomationReadyEvent; - Console.WriteLine("<> D4DA Loaded"); - return ExternalDBApplicationResult.Succeeded; } catch (Exception ex) @@ -107,16 +113,25 @@ public ExternalDBApplicationResult OnStartup(ControlledApplication application) } } + private Assembly? CurrentDomain_AssemblyResolve(object? sender, ResolveEventArgs args) + { + return DynamoRevitAssemblyResolver.ResolveDynamoAssembly(DynamoPath, [Path.Combine(WorkItemFolder, PythonDllFolder)], args); + } + + private static string GetRevitContext(Autodesk.Revit.ApplicationServices.Application app) + { + var r = new Regex(@"\b(Autodesk |Structure |MEP |Architecture )\b"); + return r.Replace(app.VersionName, ""); + } + public void HandleDesignAutomationReadyEvent(object sender, DesignAutomationReadyEventArgs e) { Console.WriteLine("<> DA event raised."); - WorkItemFolder = Directory.GetCurrentDirectory(); - foreach (var xx in Directory.EnumerateFiles(WorkItemFolder)) - Console.WriteLine(xx); + // Local Change + //WorkItemFolder = SpecialDirectories.CurrentUserApplicationData; var dynTempDir = Path.Combine(WorkItemFolder, "dyn_tmp"); - Console.WriteLine($"<> Work folder is '{WorkItemFolder}'"); var app = e.DesignAutomationData?.RevitApp; Console.WriteLine("<> Preparing Dynamo model. Vers 1"); @@ -124,28 +139,39 @@ public void HandleDesignAutomationReadyEvent(object sender, DesignAutomationRead var asmLocation = Path.GetDirectoryName(hostloc); Console.WriteLine($"using asm at location {asmLocation}"); Console.WriteLine($"Is Loaded {LoadMessage}"); - var curFolder = Directory.GetParent(Assembly.GetExecutingAssembly().Location).FullName; - var cmdArgs = new Dynamo.Applications.StartupUtils.CommandLineArguments(); - cmdArgs.ASMPath = asmLocation; - cmdArgs.DisableAnalytics = true; - cmdArgs.ServiceMode = true; - cmdArgs.AnalyticsInfo = new() { HostName = "Revit_DA" }; - cmdArgs.ImportedPaths = [Path.Combine(curFolder, "nodes", "RevitNodes.dll"), Path.Combine(curFolder, "nodes", "DSRevitNodesUI.dll")]; - // need this for cloud, does not work on local - cmdArgs.UserDataFolder = Path.Combine(dynTempDir, "Dynamo Revit"); - cmdArgs.CommonDataFolder = Path.Combine(dynTempDir, "Dynamo"); + // need this for cloud, does not work on local + var userDataFolder = Path.Combine(dynTempDir, "Dynamo Revit"); + var commonDataFolder = Path.Combine(dynTempDir, "Dynamo"); // Startup a new project, maybe an option we can have ? //app.NewProjectDocument(Autodesk.Revit.DB.UnitSystem.Metric); DocumentManager.Instance.PrepareForAutomation(app); - //true, asmLocation, "Revit_DA" - model = Dynamo.Applications.StartupUtils.MakeCLIModel(cmdArgs); + // Local Change + //var geometryFactoryPath = @"C:\\Program Files\\Autodesk\\Revit 2025"; + + var loadedLibGVersion = ASMPrealoaderUtils.PreloadAsmFromRevit(controlledApplication, DynamoPath); + var geometryFactoryPath = ASMPrealoaderUtils.GetGeometryFactoryPath(DynamoPath, loadedLibGVersion); + + model = DynamoModel.Start( + new DefaultStartConfiguration + { + DynamoCorePath = DynamoPath, + DynamoHostPath = DynamoRevitPath, + GeometryFactoryPath = geometryFactoryPath, + PathResolver = new RevitPathResolver(userDataFolder, commonDataFolder), + Context = GetRevitContext(app), + AuthProvider = new RevitOAuth2Provider(SynchronizationContext.Current ?? new SynchronizationContext()), + ProcessMode = TaskProcessMode.Synchronous, + CLIMode = true, + IsHeadless = true, + IsServiceMode = true + }); + + SetupPython(); LoadMessage = model != null ? "loaded" : "no loaded"; - Console.WriteLine($"Checking python in {curFolder}"); - CheckIfPythonExists(curFolder); var playerHost = new PlayerHostDynamoDefault(model, new DynamoPlayerLogger(logConfig)); var workflows = new DynamoModelWorkflows( @@ -160,10 +186,19 @@ public void HandleDesignAutomationReadyEvent(object sender, DesignAutomationRead var dynHandler = new Handler(playerHost, [new DynamoController(controller)]); var runContent = File.ReadAllText(Path.Combine(WorkItemFolder, "run.json")); - + var testFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); - var res = dynHandler.HandleRoute("POST", "/v1/graph/run", runContent); - var output = res.Result; + + var output = string.Empty; + try + { + var res = dynHandler.HandleRoute("POST", "/v1/graph/run", runContent); + output = res.Result; + } + catch (Exception ex) + { + Console.WriteLine(ex.Message); + } var result = Newtonsoft.Json.JsonConvert.SerializeObject(output); Console.WriteLine(result); @@ -174,6 +209,54 @@ public void HandleDesignAutomationReadyEvent(object sender, DesignAutomationRead e.Succeeded = true; } + private void SetupPython() + { + try + { + var pyIncluded = Assembly.LoadFrom(Path.Combine(WorkItemFolder, PythonDllFolder, "Python.Included.dll")); + if (pyIncluded == null) + { + throw new Exception("Null Python.Included assembly"); + } + var type = pyIncluded.GetType("Python.Included.Installer"); + if (type == null) + { + throw new Exception("null Installer type"); + } + var property = type.GetProperty("INSTALL_PATH", BindingFlags.Public | BindingFlags.Static); + if (property == null) + { + throw new Exception("null INSTALL_PATH property"); + } + + // Set the python install location to the DA workfolder (that is the only place we have wrie access) + property.SetValue(null, WorkItemFolder); + + // Dynamo's 'VerifyEngineReferences' wants all the PythonEngine's dependencies to be in the Dynamo folder. + // Temporary until we fix it on the Dynamo side. + if (PythonEngineManager.Instance.AvailableEngines.Count == 0) + { + PropertyInfo instanceProp = typeof(CPythonEvaluator).GetProperty("Instance", BindingFlags.NonPublic | BindingFlags.Static); + if (instanceProp != null) + { + PythonEngine engine = (PythonEngine)instanceProp.GetValue(null); + if (engine == null) + { + throw new Exception($"Could not get a valid PythonEngine instance"); + } + + PythonEngineManager.Instance.AvailableEngines.Add(engine); + } + } + + DynamoRevitPythonManager.SetupPython(model.Logger); + } + catch (Exception ex) + { + Console.WriteLine("Could not setup python " + ex.Message); + } + } + private void Model_RunCompleted(object sender, bool success) { Console.WriteLine($"Run Completed"); diff --git a/src/DADynamoApp/DynamoPathResolver.cs b/src/DADynamoApp/DynamoPathResolver.cs deleted file mode 100644 index 76c23cbbd1..0000000000 --- a/src/DADynamoApp/DynamoPathResolver.cs +++ /dev/null @@ -1,65 +0,0 @@ -using System.Reflection; - -namespace DADynamoApp -{ - internal static class DynamoPathResolver - { - /// - /// Finds the Dynamo Core path by looking into registery or potentially a config file. - /// - /// The root folder path of Dynamo Core. - private static string GetDynamoCorePath() - { - var dynamoRevitRoot = Path.GetDirectoryName(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)); - //TODO: use config file to setup Dynamo Path for debug builds. - - //When there is no config file, just replace DynamoRevit by Dynamo - //from the 'dynamoRevitRoot' folder. - var parent = new DirectoryInfo(dynamoRevitRoot); - var path = string.Empty; - while (null != parent && parent.Name != @"DynamoRevit") - { - path = Path.Combine(parent.Name, path); - parent = Directory.GetParent(parent.FullName); - } - - return parent != null ? Path.Combine(Path.GetDirectoryName(parent.FullName), @"Dynamo", path) : dynamoRevitRoot; - } - - private static string dynamopath = null; - - - public static Assembly ResolveAssembly(object? sender, ResolveEventArgs args) - { - dynamopath ??= GetDynamoCorePath(); - - var assemblyName = new AssemblyName(args.Name).Name + ".dll"; - var assemblyPath = Path.Combine(dynamopath, assemblyName); - try - { - if (File.Exists(assemblyPath)) - { - return Assembly.LoadFrom(assemblyPath); - } - - var assemblyLocation = Assembly.GetExecutingAssembly().Location; - var assemblyDirectory = Path.GetDirectoryName(assemblyLocation); - - // Try "Dynamo 0.x\Revit_20xx" folder first... - assemblyPath = Path.Combine(assemblyDirectory, assemblyName); - if (!File.Exists(assemblyPath)) - { - // If assembly cannot be found, try in "Dynamo 0.x" folder. - var parentDirectory = Directory.GetParent(assemblyDirectory); - assemblyPath = Path.Combine(parentDirectory.FullName, assemblyName); - } - - return (File.Exists(assemblyPath) ? Assembly.LoadFrom(assemblyPath) : null); - } - catch (Exception ex) - { - throw new Exception(string.Format("The location of the assembly, {0} could not be resolved for loading.", assemblyPath), ex); - } - } - } -} diff --git a/src/DynamoRevit.All.sln b/src/DynamoRevit.All.sln index 3be8a33931..6fef17d57f 100644 --- a/src/DynamoRevit.All.sln +++ b/src/DynamoRevit.All.sln @@ -86,6 +86,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".adsk", ".adsk", "{D6EED31E ..\.adsk\ContinuousLocalization.yml = ..\.adsk\ContinuousLocalization.yml EndProjectSection EndProject +Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "SharedUtilities", "SharedUtilities\SharedUtilities.shproj", "{BCFD5D77-45F8-41A4-B60C-582509B9262B}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|NET80 = Debug|NET80 @@ -167,4 +169,8 @@ Global GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {757AAA40-191F-4673-9B04-8270A3370BCA} EndGlobalSection + GlobalSection(SharedMSBuildProjectFiles) = preSolution + SharedUtilities\SharedUtilities.projitems*{bcfd5d77-45f8-41a4-b60c-582509b9262b}*SharedItemsImports = 13 + SharedUtilities\SharedUtilities.projitems*{fd56ae51-739e-4893-8de4-925d60c7097c}*SharedItemsImports = 5 + EndGlobalSection EndGlobal diff --git a/src/DynamoRevit.DA.sln b/src/DynamoRevit.DA.sln index 044f22b065..33b53213cd 100644 --- a/src/DynamoRevit.DA.sln +++ b/src/DynamoRevit.DA.sln @@ -83,6 +83,7 @@ Global SolutionGuid = {757AAA40-191F-4673-9B04-8270A3370BCA} EndGlobalSection GlobalSection(SharedMSBuildProjectFiles) = preSolution + SharedUtilities\SharedUtilities.projitems*{66a0e1c8-2514-48b7-8406-536983f57f88}*SharedItemsImports = 5 SharedUtilities\SharedUtilities.projitems*{bcfd5d77-45f8-41a4-b60c-582509b9262b}*SharedItemsImports = 13 EndGlobalSection EndGlobal diff --git a/src/DynamoRevit/DynamoRevit.cs b/src/DynamoRevit/DynamoRevit.cs index 9cb94c3198..a9ba157ffd 100644 --- a/src/DynamoRevit/DynamoRevit.cs +++ b/src/DynamoRevit/DynamoRevit.cs @@ -483,34 +483,6 @@ private static void UpdateSystemPathForProcess() #region Initialization - /// - /// DynamoShapeManager.dll is a companion assembly of Dynamo core components, - /// we do not want a static reference to it (since the Revit add-on can be - /// installed anywhere that's outside of Dynamo), we do not want a duplicated - /// reference to it. Here we use reflection to obtain GetGeometryFactoryPath - /// method, and call it to get the geometry factory assembly path. - /// - /// The path where DynamoShapeManager.dll can be - /// located. - /// The version of DynamoShapeManager.dll - /// Returns the full path to geometry factory assembly. - /// - public static string GetGeometryFactoryPath(string corePath, Version version) - { - var dynamoAsmPath = Path.Combine(corePath, "DynamoShapeManager.dll"); - var assembly = Assembly.LoadFrom(dynamoAsmPath); - if (assembly == null) - throw new FileNotFoundException("File not found", dynamoAsmPath); - - var utilities = assembly.GetType("DynamoShapeManager.Utilities"); - var getGeometryFactoryPath = utilities.GetMethod("GetGeometryFactoryPath2"); - - return (getGeometryFactoryPath.Invoke(null, - new object[] { corePath, version }) as string); - } - - - private static void PreloadDynamoCoreDlls() { // Assume Revit Install folder as look for root. Assembly name is compromised. @@ -570,15 +542,14 @@ private static RevitDynamoModel InitializeCoreModel(DynamoRevitCommandData comma // when Dynamo runs on top of Revit we must load the same version of ASM as revit // so tell Dynamo core we've loaded that version. - var loadedLibGVersion = PreloadAsmFromRevit(); - + var loadedLibGVersion = ASMPrealoaderUtils.PreloadAsmFromRevit(DynamoRevitApp.ControlledApplication, DynamoRevitApp.DynamoCorePath); return RevitDynamoModel.Start( new RevitDynamoModel.RevitStartConfiguration() { DynamoCorePath = corePath, DynamoHostPath = dynamoRevitRoot, - GeometryFactoryPath = GetGeometryFactoryPath(corePath, loadedLibGVersion), + GeometryFactoryPath = ASMPrealoaderUtils.GetGeometryFactoryPath(corePath, loadedLibGVersion), PathResolver = new RevitPathResolver(userDataFolder, commonDataFolder), Context = GetRevitContext(commandData), SchedulerThread = new RevitSchedulerThread(commandData.Application), @@ -590,61 +561,6 @@ private static RevitDynamoModel InitializeCoreModel(DynamoRevitCommandData comma }); } - internal static Version PreloadAsmFromRevit() - { - var asmLocation = DynamoRevitApp.ControlledApplication.SharedComponentsLocation; - - Version libGVersion = findRevitASMVersion(asmLocation); - var dynCorePath = DynamoRevitApp.DynamoCorePath; - // Get the corresponding libG preloader location for the target ASM loading version. - // If there is exact match preloader version to the target ASM version, use it, - // otherwise use the closest below. - var preloaderLocation = DynamoShapeManager.Utilities.GetLibGPreloaderLocation(libGVersion, dynCorePath); - - // [Tech Debt] (Will refactor the code later) - // The LibG version maybe different in Dynamo and Revit, using the one which is in Dynamo. - Version preLoadLibGVersion = PreloadLibGVersion(preloaderLocation); - DynamoShapeManager.Utilities.PreloadAsmFromPath(preloaderLocation, asmLocation); - return preLoadLibGVersion; - } - - // [Tech Debt] (Will refactor the code later) - /// - /// Return the preload version of LibG. - /// - /// - /// - internal static Version PreloadLibGVersion(string preloaderLocation) - { - preloaderLocation = new DirectoryInfo(preloaderLocation).Name; - var regExp = new Regex(@"^libg_(\d\d\d)_(\d)_(\d)$", RegexOptions.IgnoreCase); - - var match = regExp.Match(preloaderLocation); - if (match.Groups.Count == 4) - { - return new Version( - Convert.ToInt32(match.Groups[1].Value), - Convert.ToInt32(match.Groups[2].Value), - Convert.ToInt32(match.Groups[3].Value)); - } - - return new Version(); - } - - /// - /// Returns the version of ASM which is installed with Revit at the requested path. - /// This version number can be used to load the appropriate libG version. - /// - /// path where asm dlls are located, this is usually the product(Revit) install path - /// - internal static Version findRevitASMVersion(string asmLocation) - { - var lookup = new InstalledProductLookUp("Revit", "ASMAHL*.dll"); - var product = lookup.GetProductFromInstallPath(asmLocation); - var libGversion = new Version(product.VersionInfo.Item1, product.VersionInfo.Item2, product.VersionInfo.Item3); - return libGversion; - } - private static DynamoViewModel InitializeCoreViewModel(RevitDynamoModel revitDynamoModel) { var viewModel = DynamoRevitViewModel.Start( @@ -1114,116 +1030,4 @@ public static void AddIdleAction(Action a) } } } - - /// - /// Defines parameters used for loading internal Dynamo Revit packages - /// - [Serializable()] - public class InternalPackage - { - /// - /// keeps the path to the node file - /// - public string NodePath { get; set; } - - /// - /// keeps the path to the layoutSpecs.json file - /// - public string LayoutSpecsPath { get; set; } - - /// - /// keeps paths to additional assembly load paths - /// - public List AdditionalAssemblyLoadPaths { get; set; } - } - internal static class DynamoRevitInternalNodes - { - private const string InternalNodesDir = "nodes"; - private static IEnumerable GetAllInternalPackageFiles() - { - string currentAssemblyPath = Assembly.GetExecutingAssembly().Location; - string currentAssemblyDir = Path.GetDirectoryName(currentAssemblyPath); - - string internalNodesDir = Path.Combine(currentAssemblyDir, InternalNodesDir); - if (false == Directory.Exists(internalNodesDir)) - { - return new List(); - } - - string[] internalNodesFolders = Directory.GetDirectories(internalNodesDir); - - List internalPackageFiles = new List(); - foreach (string dir in internalNodesFolders) - { - string internalPackageFile = Path.Combine(dir, "internalPackage.xml"); - if (true == File.Exists(internalPackageFile)) - { - internalPackageFiles.Add(internalPackageFile); - } - } - return internalPackageFiles; - } - private static IEnumerable ParseinternalPackageFiles(IEnumerable internalPackageFiles) - { - List internalPackages = new List(); - string basePath = Path.GetDirectoryName(Process.GetCurrentProcess().MainModule.FileName); - - foreach (string internalPackageFile in internalPackageFiles) - { - try - { - string internalPackageDir = Path.GetDirectoryName(internalPackageFile); - using (StreamReader reader = new StreamReader(internalPackageFile)) - { - XmlSerializer serializer = new XmlSerializer(typeof(InternalPackage)); - InternalPackage intPackage = serializer.Deserialize(reader) as InternalPackage; - - // convert to absolute path, if needed - if (false == Path.IsPathRooted(intPackage.NodePath)) - { - intPackage.NodePath = Path.Combine(internalPackageDir, intPackage.NodePath); - } - - // convert to absolute path, if needed - if (false == Path.IsPathRooted(intPackage.LayoutSpecsPath)) - { - intPackage.LayoutSpecsPath = Path.Combine(internalPackageDir, intPackage.LayoutSpecsPath); - } - - // convert to absolute paths, if needed - if (null != intPackage.AdditionalAssemblyLoadPaths && intPackage.AdditionalAssemblyLoadPaths.Count > 0) - { - intPackage.AdditionalAssemblyLoadPaths = intPackage.AdditionalAssemblyLoadPaths - .Select(p => !Path.IsPathRooted(p) ? Path.Combine(basePath, p) : p) - .Where(Path.Exists).ToList(); - } - - internalPackages.Add(intPackage); - } - } - catch (Exception) - { - Console.WriteLine(string.Format("Exception while trying to parse internalPackage file {0}", internalPackageFile)); - } - } - - return internalPackages; - } - internal static IEnumerable GetNodesToPreload() - { - IEnumerable internalPackageFiles = GetAllInternalPackageFiles(); - return ParseinternalPackageFiles(internalPackageFiles).Select(pkg => pkg.NodePath); - } - internal static IEnumerable GetLayoutSpecsFiles() - { - IEnumerable internalPackageFiles = GetAllInternalPackageFiles(); - return ParseinternalPackageFiles(internalPackageFiles).Select(pkg => pkg.LayoutSpecsPath); - } - - internal static IEnumerable GetAdditionalAssemblyLoadPaths() - { - IEnumerable internalPackageFiles = GetAllInternalPackageFiles(); - return ParseinternalPackageFiles(internalPackageFiles).SelectMany(pkg => pkg.AdditionalAssemblyLoadPaths); - } - } } diff --git a/src/DynamoRevit/DynamoRevit.csproj b/src/DynamoRevit/DynamoRevit.csproj index 001ce91538..c48d864aba 100644 --- a/src/DynamoRevit/DynamoRevit.csproj +++ b/src/DynamoRevit/DynamoRevit.csproj @@ -1,4 +1,5 @@  + @@ -44,10 +45,7 @@ x64 - + diff --git a/src/DynamoRevit/DynamoRevitApp.cs b/src/DynamoRevit/DynamoRevitApp.cs index 7f2366c671..8bb23a233f 100644 --- a/src/DynamoRevit/DynamoRevitApp.cs +++ b/src/DynamoRevit/DynamoRevitApp.cs @@ -26,8 +26,6 @@ namespace Dynamo.Applications { - - [Transaction(Autodesk.Revit.Attributes.TransactionMode.Manual), Regeneration(RegenerationOption.Manual)] public class DynamoRevitApp : IExternalApplication @@ -333,35 +331,7 @@ private void UnsubscribeAssemblyEvents() /// public static Assembly ResolveAssembly(object sender, ResolveEventArgs args) { - var assemblyPath = string.Empty; - var assemblyName = new AssemblyName(args.Name).Name + ".dll"; - - try - { - assemblyPath = Path.Combine(DynamoRevitApp.DynamoCorePath, assemblyName); - if(File.Exists(assemblyPath)) - { - return Assembly.LoadFrom(assemblyPath); - } - - var assemblyLocation = Assembly.GetExecutingAssembly().Location; - var assemblyDirectory = Path.GetDirectoryName(assemblyLocation); - - // Try "Dynamo 0.x\Revit_20xx" folder first... - assemblyPath = Path.Combine(assemblyDirectory, assemblyName); - if (!File.Exists(assemblyPath)) - { - // If assembly cannot be found, try in "Dynamo 0.x" folder. - var parentDirectory = Directory.GetParent(assemblyDirectory); - assemblyPath = Path.Combine(parentDirectory.FullName, assemblyName); - } - - return (File.Exists(assemblyPath) ? Assembly.LoadFrom(assemblyPath) : null); - } - catch (Exception ex) - { - throw new Exception(string.Format("The location of the assembly, {0} could not be resolved for loading.", assemblyPath), ex); - } + return DynamoRevitAssemblyResolver.ResolveDynamoAssembly(DynamoCorePath, null, args); } private void SubscribeDocumentChangedEvent() diff --git a/src/DynamoRevit/Models/RevitDynamoModel.cs b/src/DynamoRevit/Models/RevitDynamoModel.cs index bb5e59564f..ee577fe277 100644 --- a/src/DynamoRevit/Models/RevitDynamoModel.cs +++ b/src/DynamoRevit/Models/RevitDynamoModel.cs @@ -226,7 +226,7 @@ private RevitDynamoModel(IRevitStartConfiguration configuration) : SubscribeDocumentManagerEvents(); SubscribeTransactionManagerEvents(); - SetupPython(); + DynamoRevitPythonManager.SetupPython(Logger); } @@ -436,108 +436,6 @@ internal void HandlePostInitialization() InitializeMaterials(); // Initialize materials for preview. } - private PythonServices.EventHandlers.EvaluationStartedEventHandler OnPythonEvalStart; - - /// - /// Setup the python engine so that it can manage Revit data - /// - /// - private void SetupPythonEngine(PythonEngine engine) - { - if (engine != null) - { - try - { - if (engine.HostDataMarshaler is null) - { - var revitDataMarshaler = new DataMarshaler(); - revitDataMarshaler.RegisterMarshaler((Revit.Elements.Element element) => element.InternalElement); - revitDataMarshaler.RegisterMarshaler((Category element) => element.InternalCategory); - engine.HostDataMarshaler = revitDataMarshaler; - engine.RegisterHostDataMarshalers(); - } - - (engine.OutputDataMarshaler as DataMarshaler).RegisterMarshaler((Element element) => element.ToDSType(true)); - engine.EvaluationFinished += OnPythonEvalFinished; - OnPythonEvalStart = (string code, IList bindingValues, PythonServices.EventHandlers.ScopeSetAction scopeSet) => - { - // Turn off element binding during python script execution - ElementBinder.IsEnabled = false; - if (engine.HostDataMarshaler != null) - { - Func unwrap = (engine.HostDataMarshaler as DataMarshaler).Marshal; - // register UnwrapElement method - scopeSet("UnwrapElement", unwrap); - } - }; - - engine.EvaluationStarted += OnPythonEvalStart; - } - catch(FileNotFoundException ex) - { - Logger.Log(ex); - } - } - } - - /// - /// Cleanup all subscribed events and registered marshalers - /// - /// - private void CleanUpPythonEngine(PythonEngine engine) - { - try - { - if (engine != null) - { - (engine.OutputDataMarshaler as DataMarshaler).UnregisterMarshalerOfType(); - engine.EvaluationStarted -= OnPythonEvalStart; - engine.EvaluationFinished -= OnPythonEvalFinished; - } - } - catch (FileNotFoundException ex) - { - Logger.Log(ex); - } - } - - /// - /// Sets up new python engines registered in the available PythonEngine collection - /// - /// - /// - private void OnPythonEngineCollectionChanged(object sender, NotifyCollectionChangedEventArgs e) - { - if (e.Action == NotifyCollectionChangedAction.Add) - { - foreach (var item in e.NewItems) - { - SetupPythonEngine(item as PythonEngine); - } - } - } - - // Python evaluation finished event handler - private void OnPythonEvalFinished(EvaluationState state, string code, IList bindingValues, PythonServices.EventHandlers.ScopeGetAction scopeGet) - { - // Turn on element binding after python script execution - ElementBinder.IsEnabled = true; - } - - private bool setupPython; - - private void SetupPython() - { - if (setupPython) return; - - // Setup engines for all existing python engines - PythonEngineManager.Instance.AvailableEngines.ToList().ForEach(engine => SetupPythonEngine(engine)); - // Setup engines for any python engines that might be registered later on - PythonEngineManager.Instance.AvailableEngines.CollectionChanged += OnPythonEngineCollectionChanged; - - setupPython = true; - } - internal void InitializeDocumentManager() { // Set the intitial document. @@ -732,8 +630,8 @@ protected override void ShutDownCore(bool shutDownHost) UnsubscribeDocumentManagerEvents(); UnsubscribeRevitServicesUpdaterEvents(); UnsubscribeTransactionManagerEvents(); - PythonEngineManager.Instance.AvailableEngines.ToList().ForEach(engine => CleanUpPythonEngine(engine)); - PythonEngineManager.Instance.AvailableEngines.CollectionChanged -= OnPythonEngineCollectionChanged; + + DynamoRevitPythonManager.Cleanup(); ElementIDLifecycleManager.DisposeInstance(); } diff --git a/src/DynamoRevitIcons/DynamoRevitIcons.csproj b/src/DynamoRevitIcons/DynamoRevitIcons.csproj index 043e6743c1..f5a7a9dc76 100644 --- a/src/DynamoRevitIcons/DynamoRevitIcons.csproj +++ b/src/DynamoRevitIcons/DynamoRevitIcons.csproj @@ -28,7 +28,7 @@ + AssemblyFiles="$(SolutionDir)\AssemblySharedInfoGenerator\bin\$(Configuration)\AssemblyInfoGenerator.dll"> diff --git a/src/Libraries/Migrations/Migrations.csproj b/src/Libraries/Migrations/Migrations.csproj index 919c885c3b..4b8e51f734 100644 --- a/src/Libraries/Migrations/Migrations.csproj +++ b/src/Libraries/Migrations/Migrations.csproj @@ -7,22 +7,8 @@ true true $(NoWarn);CS3001;CS3002 - prompt - 4 - false $(OutputPath)\nodes\ - - true - full - false - DEBUG;TRACE - - - pdbonly - true - TRACE - $(PACKAGESPATH)\DynamoVisualProgramming.DynamoServices\lib\netstandard2.0\DynamoServices.dll diff --git a/src/Libraries/RevitNodes/Elements/LinkElement.cs b/src/Libraries/RevitNodes/Elements/LinkElement.cs index 3c042e092f..bedb4c42b5 100644 --- a/src/Libraries/RevitNodes/Elements/LinkElement.cs +++ b/src/Libraries/RevitNodes/Elements/LinkElement.cs @@ -4,6 +4,7 @@ using Autodesk.DesignScript.Geometry; using Autodesk.DesignScript.Runtime; using Autodesk.Revit.DB; +using Autodesk.Revit.UI; using Dynamo.Graph.Nodes; using Revit.GeometryConversion; using RevitServices.Persistence; @@ -50,6 +51,45 @@ public static class LinkElement return matchingLinkInstances; } + // TODO: move to a UI library +#if !DESIGN_AUTOMATION + // helper for zooming to clicked green Id + internal static void ZoomToLinkedElement(Element element) + { + UIDocument uiDoc = DocumentManager.Instance.CurrentUIDocument; + Autodesk.Revit.DB.View activeView = uiDoc.ActiveView; + // get active UI view to use + UIView uiview = uiDoc.GetOpenUIViews().FirstOrDefault(uv => uv.ViewId.Equals(activeView.Id)); + Transform linkTransform = Revit.Elements.LinkElement.LinkTransform(element).ToTransform(); + + // use the center of the BoundingBox as zoom center + BoundingBoxXYZ bb = element.InternalElement.get_BoundingBox(null); + // if the BBox cannot be found, attempt to find it using the active view + if (bb == null) + { + bb = element.InternalElement.get_BoundingBox(activeView); + } + // finally, if the BB cannot be found at all + if (bb == null) + { + TaskDialog.Show("Revit", "No good view can be found."); + return; + } + XYZ bbCenter = (bb.Max + bb.Min) / 2; + double zoomOffsetX = bb.Max.X - bbCenter.X; + double zoomOffsetY = bb.Max.Y - bbCenter.Y; + double zoomOffsetZ = bb.Max.Z - bbCenter.Z; + XYZ locationPt = Revit.Elements.LinkElement.TransformPoint(bbCenter, linkTransform); + + if (locationPt != null) + { + XYZ min = new XYZ(locationPt.X - zoomOffsetX, locationPt.Y - zoomOffsetY, locationPt.Z - zoomOffsetZ); + XYZ max = new XYZ(locationPt.X + zoomOffsetX, locationPt.Y + zoomOffsetY, locationPt.Z + zoomOffsetZ); + uiview.ZoomAndCenterRectangle(min, max); + } + } +#endif + // helper to return element's location with transform internal static object GetLinkElementLocation(Element linkElement) { diff --git a/src/Libraries/RevitNodes/Properties/AssemblyInfo.cs b/src/Libraries/RevitNodes/Properties/AssemblyInfo.cs index 1d6207cd65..31666a56c9 100644 --- a/src/Libraries/RevitNodes/Properties/AssemblyInfo.cs +++ b/src/Libraries/RevitNodes/Properties/AssemblyInfo.cs @@ -6,3 +6,4 @@ [assembly: Guid("17f8f9d8-c00e-4c11-9eb1-06a716689de9")] [assembly: InternalsVisibleTo("RevitNodesTests")] [assembly: InternalsVisibleTo("DynamoRevitDS")] +[assembly: InternalsVisibleTo("DADynamoApp")] diff --git a/src/Libraries/RevitNodes/RevitNodes.csproj b/src/Libraries/RevitNodes/RevitNodes.csproj index f5321b7c5f..40caa3736f 100644 --- a/src/Libraries/RevitNodes/RevitNodes.csproj +++ b/src/Libraries/RevitNodes/RevitNodes.csproj @@ -8,9 +8,6 @@ false $(OutputPath)\$(UICulture)\RevitNodes.xml $(NoWarn);1591;CA2200 - false - prompt - 4 DSRevitNodes true true @@ -18,16 +15,6 @@ None - - full - false - DEBUG;TRACE - - - pdbonly - true - TRACE - diff --git a/src/Libraries/RevitNodesUI/Elements.cs b/src/Libraries/RevitNodesUI/Elements.cs index 182206fb0d..14cfc6311b 100644 --- a/src/Libraries/RevitNodesUI/Elements.cs +++ b/src/Libraries/RevitNodesUI/Elements.cs @@ -28,9 +28,13 @@ using BuiltinNodeCategories = Revit.Elements.BuiltinNodeCategories; using View = Revit.Elements.Views.View; using RevitServices.Transactions; +using Autodesk.Revit.ApplicationServices; +using RevitServices.Events; + + #if DESIGN_AUTOMATION -using DynamoRevitApp = DADynamoApp.DAEntrypoint; +using DynamoRevitApp = RevitServices.Events.ApplicationEvents; #endif namespace DSRevitNodesUI @@ -286,9 +290,9 @@ public ElementsInView() RegisterAllPorts(); #if !DESIGN_AUTOMATION - DynamoRevitApp.EventHandlerProxy.ViewActivated += RevitDynamoModel_RevitDocumentChanged; + RevitServices.Events.ApplicationEvents.ViewActivated += RevitDynamoModel_RevitDocumentChanged; #endif - DynamoRevitApp.EventHandlerProxy.DocumentOpened += RevitDynamoModel_RevitDocumentChanged; + RevitServices.Events.ApplicationEvents.DocumentOpened += RevitDynamoModel_RevitDocumentChanged; RevitServicesUpdater.Instance.ElementsUpdated += RevitServicesUpdaterOnElementsUpdated; RevitDynamoModel_RevitDocumentChanged(null, null); @@ -298,9 +302,9 @@ public ElementsInView() public ElementsInView(IEnumerable inPorts, IEnumerable outPorts) : base(inPorts, outPorts) { #if !DESIGN_AUTOMATION - DynamoRevitApp.EventHandlerProxy.ViewActivated += RevitDynamoModel_RevitDocumentChanged; + RevitServices.Events.ApplicationEvents.ViewActivated += RevitDynamoModel_RevitDocumentChanged; #endif - DynamoRevitApp.EventHandlerProxy.DocumentOpened += RevitDynamoModel_RevitDocumentChanged; + RevitServices.Events.ApplicationEvents.DocumentOpened += RevitDynamoModel_RevitDocumentChanged; RevitServicesUpdater.Instance.ElementsUpdated += RevitServicesUpdaterOnElementsUpdated; RevitDynamoModel_RevitDocumentChanged(null, null); @@ -309,9 +313,9 @@ public ElementsInView(IEnumerable inPorts, IEnumerable out public override void Dispose() { #if !DESIGN_AUTOMATION - DynamoRevitApp.EventHandlerProxy.ViewActivated -= RevitDynamoModel_RevitDocumentChanged; + RevitServices.Events.ApplicationEvents.ViewActivated -= RevitDynamoModel_RevitDocumentChanged; #endif - DynamoRevitApp.EventHandlerProxy.DocumentOpened -= RevitDynamoModel_RevitDocumentChanged; + RevitServices.Events.ApplicationEvents.DocumentOpened -= RevitDynamoModel_RevitDocumentChanged; RevitServicesUpdater.Instance.ElementsUpdated -= RevitServicesUpdaterOnElementsUpdated; diff --git a/src/Libraries/RevitNodesUI/RevitDropDown.cs b/src/Libraries/RevitNodesUI/RevitDropDown.cs index 5172b4d59e..06cb7e4541 100644 --- a/src/Libraries/RevitNodesUI/RevitDropDown.cs +++ b/src/Libraries/RevitNodesUI/RevitDropDown.cs @@ -28,10 +28,6 @@ using RevitServices.Elements; using RevitServices.Transactions; -#if DESIGN_AUTOMATION -using DynamoRevitApp = DADynamoApp.DAEntrypoint; -#endif - namespace DSRevitNodesUI { public class DropDownItemEqualityComparer : IEqualityComparer @@ -52,14 +48,14 @@ public abstract class RevitDropDownBase : DSDropDownBase protected RevitDropDownBase(string value) : base(value) { RevitServicesUpdater.Instance.ElementsUpdated += Updater_ElementsUpdated; - DynamoRevitApp.EventHandlerProxy.DocumentOpened += Controller_RevitDocumentChanged; + RevitServices.Events.ApplicationEvents.DocumentOpened += Controller_RevitDocumentChanged; } [JsonConstructor] public RevitDropDownBase(string value, IEnumerable inPorts, IEnumerable outPorts) : base(value, inPorts, outPorts) { RevitServicesUpdater.Instance.ElementsUpdated += Updater_ElementsUpdated; - DynamoRevitApp.EventHandlerProxy.DocumentOpened += Controller_RevitDocumentChanged; + RevitServices.Events.ApplicationEvents.DocumentOpened += Controller_RevitDocumentChanged; } void Controller_RevitDocumentChanged(object sender, EventArgs e) @@ -94,7 +90,7 @@ private void Updater_ElementsUpdated(object sender, ElementUpdateEventArgs e) public override void Dispose() { RevitServicesUpdater.Instance.ElementsUpdated -= Updater_ElementsUpdated; - DynamoRevitApp.EventHandlerProxy.DocumentOpened -= Controller_RevitDocumentChanged; + RevitServices.Events.ApplicationEvents.DocumentOpened -= Controller_RevitDocumentChanged; base.Dispose(); } diff --git a/src/Libraries/RevitNodesUI/RevitNodesUI.csproj b/src/Libraries/RevitNodesUI/RevitNodesUI.csproj index 0c3bcf6090..dea49474df 100644 --- a/src/Libraries/RevitNodesUI/RevitNodesUI.csproj +++ b/src/Libraries/RevitNodesUI/RevitNodesUI.csproj @@ -6,24 +6,10 @@ DSRevitNodesUI DSRevitNodesUI $(OutputPath)\nodes\ - prompt - 4 - false true false - - true - full - false - DEBUG;TRACE - - - pdbonly - true - TRACE - @@ -120,8 +106,7 @@ False - - + False diff --git a/src/Libraries/RevitNodesUI/SiteLocation.cs b/src/Libraries/RevitNodesUI/SiteLocation.cs index 5c12dacd77..4dd3a40920 100644 --- a/src/Libraries/RevitNodesUI/SiteLocation.cs +++ b/src/Libraries/RevitNodesUI/SiteLocation.cs @@ -2,8 +2,7 @@ using Dynamo.Applications.Models; #if !DESIGN_AUTOMATION using Dynamo.Controls; -#else -using DynamoRevitApp = DADynamoApp.DAEntrypoint; +using Dynamo.Wpf; #endif using Dynamo.Graph.Nodes; using Newtonsoft.Json; @@ -52,7 +51,7 @@ public SiteLocation() ArgumentLacing = LacingStrategy.Disabled; - DynamoRevitApp.EventHandlerProxy.DocumentOpened += model_RevitDocumentChanged; + RevitServices.Events.ApplicationEvents.DocumentOpened += model_RevitDocumentChanged; RevitServicesUpdater.Instance.ElementsUpdated += RevitServicesUpdater_ElementsUpdated; #if !DESIGN_AUTOMATION @@ -68,7 +67,7 @@ public SiteLocation(IEnumerable inPorts, IEnumerable outPo ArgumentLacing = LacingStrategy.Disabled; - DynamoRevitApp.EventHandlerProxy.DocumentOpened += model_RevitDocumentChanged; + RevitServices.Events.ApplicationEvents.DocumentOpened += model_RevitDocumentChanged; RevitServicesUpdater.Instance.ElementsUpdated += RevitServicesUpdater_ElementsUpdated; #if !DESIGN_AUTOMATION @@ -80,7 +79,7 @@ public SiteLocation(IEnumerable inPorts, IEnumerable outPo public override void Dispose() { - DynamoRevitApp.EventHandlerProxy.DocumentOpened -= model_RevitDocumentChanged; + RevitServices.Events.ApplicationEvents.DocumentOpened -= model_RevitDocumentChanged; RevitServicesUpdater.Instance.ElementsUpdated -= RevitServicesUpdater_ElementsUpdated; base.Dispose(); } diff --git a/src/Libraries/RevitNodesUI/SunPath.cs b/src/Libraries/RevitNodesUI/SunPath.cs index f880b6214a..d0d55f2473 100644 --- a/src/Libraries/RevitNodesUI/SunPath.cs +++ b/src/Libraries/RevitNodesUI/SunPath.cs @@ -2,9 +2,9 @@ using System.Collections.Generic; using System.Linq; using Newtonsoft.Json; - +#if !DESIGN_AUTOMATION using Autodesk.Revit.UI.Events; - +#endif using Dynamo.Applications; using Dynamo.Applications.Models; using Dynamo.Graph.Nodes; @@ -58,11 +58,12 @@ public override void Dispose() base.Dispose(); } +#if !DESIGN_AUTOMATION private void CurrentUIApplication_ViewActivated(object sender, ViewActivatedEventArgs e) { CurrentUIApplicationOnViewActivated(); } - +#endif private void CurrentUIApplicationOnViewActivated() { settingsID = diff --git a/src/Libraries/RevitServices/Events/ApplicationEvents.cs b/src/Libraries/RevitServices/Events/ApplicationEvents.cs new file mode 100644 index 0000000000..57bf6b57d1 --- /dev/null +++ b/src/Libraries/RevitServices/Events/ApplicationEvents.cs @@ -0,0 +1,52 @@ +using Autodesk.Revit.DB.Events; +using System; + +namespace RevitServices.Events +{ + internal static class ApplicationEvents + { + public static event EventHandler DocumentOpened; + public static event EventHandler DocumentClosing; + public static event EventHandler DocumentClosed; +#if !DESIGN_AUTOMATION + public static event EventHandler ViewActivating; + public static event EventHandler ViewActivated; +#endif + + public static void OnApplicationDocumentOpened(object sender, DocumentOpenedEventArgs args) + { + InvokeEventHandler(DocumentOpened, sender, args); + } + + public static void OnApplicationDocumentClosing(object sender, DocumentClosingEventArgs args) + { + InvokeEventHandler(DocumentClosing, sender, args); + } + + public static void OnApplicationDocumentClosed(object sender, DocumentClosedEventArgs args) + { + InvokeEventHandler(DocumentClosed, sender, args); + } + +#if !DESIGN_AUTOMATION + public static void OnApplicationViewActivating(object sender, Autodesk.Revit.UI.Events.ViewActivatingEventArgs args) + { + InvokeEventHandler(ViewActivating, sender, args); + } + + public static void OnApplicationViewActivated(object sender, Autodesk.Revit.UI.Events.ViewActivatedEventArgs args) + { + InvokeEventHandler(ViewActivated, sender, args); + } +#endif + + private static void InvokeEventHandler(EventHandler eventHandler, object sender, T args) where T : EventArgs + { + var tempHandler = eventHandler; + if (tempHandler != null) + { + tempHandler(sender, args); + } + } + } +} diff --git a/src/Libraries/RevitServices/Events/EventHandlerProxy.cs b/src/Libraries/RevitServices/Events/EventHandlerProxy.cs index f959350dc6..8fc79a5f29 100644 --- a/src/Libraries/RevitServices/Events/EventHandlerProxy.cs +++ b/src/Libraries/RevitServices/Events/EventHandlerProxy.cs @@ -7,6 +7,7 @@ namespace RevitServices.EventHandler /// This is a event handler proxy class to serve as a proxy between the event publisher and /// the event subscriber /// + [Obsolete("Obsolete class, please use RevitServices.Events.ApplicationEvents instead.")] public class EventHandlerProxy { public event EventHandler DocumentOpened; diff --git a/src/Libraries/RevitServices/Properties/AssemblyInfo.cs b/src/Libraries/RevitServices/Properties/AssemblyInfo.cs index 75c9f633d7..5b948fdf94 100644 --- a/src/Libraries/RevitServices/Properties/AssemblyInfo.cs +++ b/src/Libraries/RevitServices/Properties/AssemblyInfo.cs @@ -12,3 +12,4 @@ [assembly: Guid("026be738-81b6-4a11-bc14-36ee3f718921")] [assembly: InternalsVisibleTo("DADynamoApp")] [assembly: InternalsVisibleTo("RevitNodes")] +[assembly: InternalsVisibleTo("DSRevitNodesUI")] \ No newline at end of file diff --git a/src/Libraries/RevitServices/RevitServices.csproj b/src/Libraries/RevitServices/RevitServices.csproj index f1d250f4bf..13b4c9352d 100644 --- a/src/Libraries/RevitServices/RevitServices.csproj +++ b/src/Libraries/RevitServices/RevitServices.csproj @@ -20,33 +20,14 @@ limitations under the License. 8.0.30703 false - true true - - true - full - false - TRACE;DEBUG - prompt - 4 - false - - - full - true - TRACE - prompt - 4 - true - false - - $(PACKAGESPATH)\DynamoVisualProgramming.DynamoServices\lib\netstandard2.0\DynamoServices.dll - $(DYNAMOBUILDPATH)\DynamoServices.dll + $(PACKAGESPATH)\DynamoVisualProgramming.DynamoServices\lib\netstandard2.0\DynamoServices.dll + $(DYNAMOBUILDPATH)\DynamoServices.dll False @@ -96,5 +77,9 @@ limitations under the License. + + + + \ No newline at end of file diff --git a/src/SharedUtilities/ASMPreloader.cs b/src/SharedUtilities/ASMPreloader.cs new file mode 100644 index 0000000000..078ba87728 --- /dev/null +++ b/src/SharedUtilities/ASMPreloader.cs @@ -0,0 +1,93 @@ +using Autodesk.Revit.ApplicationServices; +using DynamoInstallDetective; +using System; +using System.IO; +using System.Reflection; +using System.Text.RegularExpressions; + +namespace Dynamo.Applications +{ + internal static class ASMPrealoaderUtils + { + /// + /// Returns the version of ASM which is installed with Revit at the requested path. + /// This version number can be used to load the appropriate libG version. + /// + /// path where asm dlls are located, this is usually the product(Revit) install path + /// + internal static Version findRevitASMVersion(string asmLocation) + { + var lookup = new InstalledProductLookUp("Revit", "ASMAHL*.dll"); + var product = lookup.GetProductFromInstallPath(asmLocation); + var libGversion = new Version(product.VersionInfo.Item1, product.VersionInfo.Item2, product.VersionInfo.Item3); + return libGversion; + } + + // [Tech Debt] (Will refactor the code later) + /// + /// Return the preload version of LibG. + /// + /// + /// + internal static Version PreloadLibGVersion(string preloaderLocation) + { + preloaderLocation = new DirectoryInfo(preloaderLocation).Name; + var regExp = new Regex(@"^libg_(\d\d\d)_(\d)_(\d)$", RegexOptions.IgnoreCase); + + var match = regExp.Match(preloaderLocation); + if (match.Groups.Count == 4) + { + return new Version( + Convert.ToInt32(match.Groups[1].Value), + Convert.ToInt32(match.Groups[2].Value), + Convert.ToInt32(match.Groups[3].Value)); + } + + return new Version(); + } + + internal static Version PreloadAsmFromRevit(ControlledApplication controlledApplication, string dynamoCorePath) + { + var asmLocation = controlledApplication.SharedComponentsLocation; + + Version libGVersion = findRevitASMVersion(asmLocation); + // Get the corresponding libG preloader location for the target ASM loading version. + // If there is exact match preloader version to the target ASM version, use it, + // otherwise use the closest below. + var preloaderLocation = DynamoShapeManager.Utilities.GetLibGPreloaderLocation(libGVersion, dynamoCorePath); + + // [Tech Debt] (Will refactor the code later) + // The LibG version maybe different in Dynamo and Revit, using the one which is in Dynamo. + Version preLoadLibGVersion = PreloadLibGVersion(preloaderLocation); + DynamoShapeManager.Utilities.PreloadAsmFromPath(preloaderLocation, asmLocation); + return preLoadLibGVersion; + } + + + /// + /// DynamoShapeManager.dll is a companion assembly of Dynamo core components, + /// we do not want a static reference to it (since the Revit add-on can be + /// installed anywhere that's outside of Dynamo), we do not want a duplicated + /// reference to it. Here we use reflection to obtain GetGeometryFactoryPath + /// method, and call it to get the geometry factory assembly path. + /// + /// The path where DynamoShapeManager.dll can be + /// located. + /// The version of DynamoShapeManager.dll + /// Returns the full path to geometry factory assembly. + /// + public static string GetGeometryFactoryPath(string corePath, Version version) + { + var dynamoAsmPath = Path.Combine(corePath, "DynamoShapeManager.dll"); + var assembly = Assembly.LoadFrom(dynamoAsmPath); + if (assembly == null) + throw new FileNotFoundException("File not found", dynamoAsmPath); + + var utilities = assembly.GetType("DynamoShapeManager.Utilities"); + var getGeometryFactoryPath = utilities.GetMethod("GetGeometryFactoryPath2"); + + return (getGeometryFactoryPath.Invoke(null, + new object[] { corePath, version }) as string); + } + } +} \ No newline at end of file diff --git a/src/SharedUtilities/DynamoRevitInternalNodes.cs b/src/SharedUtilities/DynamoRevitInternalNodes.cs new file mode 100644 index 0000000000..7b0460f5fa --- /dev/null +++ b/src/SharedUtilities/DynamoRevitInternalNodes.cs @@ -0,0 +1,123 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.IO; +using System.Linq; +using System.Reflection; +using System.Xml.Serialization; + +namespace Dynamo.Applications +{ + /// + /// Defines parameters used for loading internal Dynamo Revit packages + /// + [Serializable()] + public class InternalPackage + { + /// + /// keeps the path to the node file + /// + public string NodePath { get; set; } + + /// + /// keeps the path to the layoutSpecs.json file + /// + public string LayoutSpecsPath { get; set; } + + /// + /// keeps paths to additional assembly load paths + /// + public List AdditionalAssemblyLoadPaths { get; set; } + } + + internal static class DynamoRevitInternalNodes + { + private const string InternalNodesDir = "nodes"; + private static IEnumerable GetAllInternalPackageFiles() + { + string currentAssemblyPath = Assembly.GetExecutingAssembly().Location; + string currentAssemblyDir = Path.GetDirectoryName(currentAssemblyPath); + + string internalNodesDir = Path.Combine(currentAssemblyDir, InternalNodesDir); + if (false == Directory.Exists(internalNodesDir)) + { + return new List(); + } + + string[] internalNodesFolders = Directory.GetDirectories(internalNodesDir); + + List internalPackageFiles = new List(); + foreach (string dir in internalNodesFolders) + { + string internalPackageFile = Path.Combine(dir, "internalPackage.xml"); + if (true == File.Exists(internalPackageFile)) + { + internalPackageFiles.Add(internalPackageFile); + } + } + return internalPackageFiles; + } + private static IEnumerable ParseinternalPackageFiles(IEnumerable internalPackageFiles) + { + List internalPackages = new List(); + string basePath = Path.GetDirectoryName(Process.GetCurrentProcess().MainModule.FileName); + + foreach (string internalPackageFile in internalPackageFiles) + { + try + { + string internalPackageDir = Path.GetDirectoryName(internalPackageFile); + using (StreamReader reader = new StreamReader(internalPackageFile)) + { + XmlSerializer serializer = new XmlSerializer(typeof(InternalPackage)); + InternalPackage intPackage = serializer.Deserialize(reader) as InternalPackage; + + // convert to absolute path, if needed + if (false == Path.IsPathRooted(intPackage.NodePath)) + { + intPackage.NodePath = Path.Combine(internalPackageDir, intPackage.NodePath); + } + + // convert to absolute path, if needed + if (false == Path.IsPathRooted(intPackage.LayoutSpecsPath)) + { + intPackage.LayoutSpecsPath = Path.Combine(internalPackageDir, intPackage.LayoutSpecsPath); + } + + // convert to absolute paths, if needed + if (null != intPackage.AdditionalAssemblyLoadPaths && intPackage.AdditionalAssemblyLoadPaths.Count > 0) + { + intPackage.AdditionalAssemblyLoadPaths = intPackage.AdditionalAssemblyLoadPaths + .Select(p => !Path.IsPathRooted(p) ? Path.Combine(basePath, p) : p) + .Where(Path.Exists).ToList(); + } + + internalPackages.Add(intPackage); + } + } + catch (Exception) + { + Console.WriteLine(string.Format("Exception while trying to parse internalPackage file {0}", internalPackageFile)); + } + } + + return internalPackages; + } + internal static IEnumerable GetNodesToPreload() + { + IEnumerable internalPackageFiles = GetAllInternalPackageFiles(); + return ParseinternalPackageFiles(internalPackageFiles).Select(pkg => pkg.NodePath); + } + internal static IEnumerable GetLayoutSpecsFiles() + { + IEnumerable internalPackageFiles = GetAllInternalPackageFiles(); + return ParseinternalPackageFiles(internalPackageFiles).Select(pkg => pkg.LayoutSpecsPath); + } + + internal static IEnumerable GetAdditionalAssemblyLoadPaths() + { + IEnumerable internalPackageFiles = GetAllInternalPackageFiles(); + return ParseinternalPackageFiles(internalPackageFiles).SelectMany(pkg => pkg.AdditionalAssemblyLoadPaths); + } + } +} \ No newline at end of file diff --git a/src/SharedUtilities/DynamoRevitPythonManager.cs b/src/SharedUtilities/DynamoRevitPythonManager.cs new file mode 100644 index 0000000000..ad2b306691 --- /dev/null +++ b/src/SharedUtilities/DynamoRevitPythonManager.cs @@ -0,0 +1,146 @@ +using Dynamo.Utilities; +using RevitServices.Persistence; +using System.Collections; +using System.Collections.Specialized; +using Dynamo.Logging; +using PythonEngine = Dynamo.PythonServices.PythonEngine; +using Dynamo.PythonServices; +using System; +using System.IO; +using System.Linq; + +namespace Revit.Elements +{ + internal static class DynamoRevitPythonManager + { + private static DynamoLogger Logger; + + private static Dynamo.PythonServices.EventHandlers.EvaluationStartedEventHandler OnPythonEvalStart; + + /// + /// Setup the python engine so that it can manage Revit data + /// + /// + private static void SetupPythonEngine(PythonEngine engine) + { + if (engine != null) + { + try + { + var property = engine.GetType().GetProperty("HostDataMarshaler", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance); + if (property == null) + { + throw new Exception("Could not find a valid HostDataMarshaler property"); + } + + var hostDataMarshaler = property.GetValue(engine); + if (hostDataMarshaler is null) + { + var revitDataMarshaler = new DataMarshaler(); + revitDataMarshaler.RegisterMarshaler((Revit.Elements.Element element) => element.InternalElement); + revitDataMarshaler.RegisterMarshaler((Category element) => element.InternalCategory); + property.SetValue(engine, revitDataMarshaler); + + var method = engine.GetType().GetMethod("RegisterHostDataMarshalers", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance); + if (method == null) + { + throw new Exception("Could not find a valid RegisterHostDataMarshalers method"); + } + method.Invoke(engine, null); + } + + (engine.OutputDataMarshaler as DataMarshaler).RegisterMarshaler((Autodesk.Revit.DB.Element element) => element.ToDSType(true)); + engine.EvaluationFinished += OnPythonEvalFinished; + OnPythonEvalStart = (string code, IList bindingValues, Dynamo.PythonServices.EventHandlers.ScopeSetAction scopeSet) => + { + hostDataMarshaler = property.GetValue(engine); + // Turn off element binding during python script execution + ElementBinder.IsEnabled = false; + if (hostDataMarshaler != null) + { + Func unwrap = (hostDataMarshaler as DataMarshaler).Marshal; + // register UnwrapElement method + scopeSet("UnwrapElement", unwrap); + } + }; + + engine.EvaluationStarted += OnPythonEvalStart; + } + catch (FileNotFoundException ex) + { + Logger.Log(ex); + } + catch (Exception ex) { + Console.WriteLine(ex.Message + ex.StackTrace); + throw; + } + } + } + + /// + /// Cleanup all subscribed events and registered marshalers + /// + /// + private static void CleanUpPythonEngine(PythonEngine engine) + { + try + { + if (engine != null) + { + (engine.OutputDataMarshaler as DataMarshaler).UnregisterMarshalerOfType(); + engine.EvaluationStarted -= OnPythonEvalStart; + engine.EvaluationFinished -= OnPythonEvalFinished; + } + } + catch (FileNotFoundException ex) + { + Logger.Log(ex); + } + } + + /// + /// Sets up new python engines registered in the available PythonEngine collection + /// + /// + /// + private static void OnPythonEngineCollectionChanged(object sender, NotifyCollectionChangedEventArgs e) + { + Console.WriteLine("Called OnPythonEngineCollectionChanged"); + if (e.Action == NotifyCollectionChangedAction.Add) + { + foreach (var item in e.NewItems) + { + SetupPythonEngine(item as PythonEngine); + } + } + } + + // Python evaluation finished event handler + private static void OnPythonEvalFinished(EvaluationState state, string code, IList bindingValues, Dynamo.PythonServices.EventHandlers.ScopeGetAction scopeGet) + { + // Turn on element binding after python script execution + ElementBinder.IsEnabled = true; + } + + private static bool setupPython; + + internal static void SetupPython(DynamoLogger logger) + { + if (setupPython) return; + + // Setup engines for all existing python engines + PythonEngineManager.Instance.AvailableEngines.ToList().ForEach(engine => SetupPythonEngine(engine)); + // Setup engines for any python engines that might be registered later on + PythonEngineManager.Instance.AvailableEngines.CollectionChanged += OnPythonEngineCollectionChanged; + + Logger = logger; + setupPython = true; + } + + internal static void Cleanup() + { + PythonEngineManager.Instance.AvailableEngines.ToList().ForEach(engine => CleanUpPythonEngine(engine)); + PythonEngineManager.Instance.AvailableEngines.CollectionChanged -= OnPythonEngineCollectionChanged; + } + } +} diff --git a/src/DynamoRevit/RevitPathResolver.cs b/src/SharedUtilities/RevitPathResolver.cs similarity index 65% rename from src/DynamoRevit/RevitPathResolver.cs rename to src/SharedUtilities/RevitPathResolver.cs index 3acdaf79b8..5c009abae7 100644 --- a/src/DynamoRevit/RevitPathResolver.cs +++ b/src/SharedUtilities/RevitPathResolver.cs @@ -6,6 +6,65 @@ namespace Dynamo.Applications { + class DynamoRevitAssemblyResolver + { + /// + /// Handler to the ApplicationDomain's AssemblyResolve event. + /// If an assembly's location cannot be resolved, an exception is + /// thrown. Failure to resolve an assembly will leave Dynamo in + /// a bad state, so we should throw an exception here which gets caught + /// by our unhandled exception handler and presents the crash dialogue. + /// + /// + /// + /// + internal static Assembly ResolveDynamoAssembly(string dynamoCorePath, List additionalPaths, ResolveEventArgs args) + { + var assemblyPath = string.Empty; + var assemblyName = new AssemblyName(args.Name).Name + ".dll"; + + try + { + assemblyPath = Path.Combine(dynamoCorePath, assemblyName); + if (File.Exists(assemblyPath)) + { + return Assembly.LoadFrom(assemblyPath); + } + + if (additionalPaths != null) + { + foreach (var additionalPath in additionalPaths) + { + assemblyPath = Path.Combine(additionalPath, assemblyName); + if (File.Exists(assemblyPath)) + { + return Assembly.LoadFrom(assemblyPath); + } + } + } + + var assemblyLocation = Assembly.GetExecutingAssembly().Location; + var assemblyDirectory = Path.GetDirectoryName(assemblyLocation); + + // Try "Dynamo 0.x\Revit_20xx" folder first... + assemblyPath = Path.Combine(assemblyDirectory, assemblyName); + if (!File.Exists(assemblyPath)) + { + // If assembly cannot be found, try in "Dynamo 0.x" folder. + var parentDirectory = Directory.GetParent(assemblyDirectory); + assemblyPath = Path.Combine(parentDirectory.FullName, assemblyName); + } + + return (File.Exists(assemblyPath) ? Assembly.LoadFrom(assemblyPath) : null); + } + catch (Exception ex) + { + Console.WriteLine(ex.Message + ex.StackTrace); + throw new Exception(string.Format("The location of the assembly, {0} could not be resolved for loading.", assemblyPath), ex); + } + } + } + class RevitPathResolver : IPathResolver { private readonly List preloadLibraryPaths; @@ -130,4 +189,4 @@ public IEnumerable GetDynamoUserDataLocations() return paths; } } -} +} \ No newline at end of file diff --git a/src/SharedUtilities/SharedUtilities.projitems b/src/SharedUtilities/SharedUtilities.projitems new file mode 100644 index 0000000000..c670ed84d9 --- /dev/null +++ b/src/SharedUtilities/SharedUtilities.projitems @@ -0,0 +1,17 @@ + + + + $(MSBuildAllProjects);$(MSBuildThisFileFullPath) + true + bcfd5d77-45f8-41a4-b60c-582509b9262b + + + SharedUtilities + + + + + + + + \ No newline at end of file diff --git a/src/SharedUtilities/SharedUtilities.shproj b/src/SharedUtilities/SharedUtilities.shproj new file mode 100644 index 0000000000..e6c88ece43 --- /dev/null +++ b/src/SharedUtilities/SharedUtilities.shproj @@ -0,0 +1,13 @@ + + + + bcfd5d77-45f8-41a4-b60c-582509b9262b + 14.0 + + + + + + + + From 581914c0932523f9cb6ab8a1cb34616f883db0a6 Mon Sep 17 00:00:00 2001 From: pinzart90 Date: Fri, 25 Apr 2025 09:13:01 -0400 Subject: [PATCH 45/70] update --- src/DADynamoApp/DADynamoApp.csproj | 7 ------- src/DADynamoApp/DAEntrypoint.cs | 14 ++++++++------ src/DynamoRevit.DA.sln | 6 ++++++ 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/src/DADynamoApp/DADynamoApp.csproj b/src/DADynamoApp/DADynamoApp.csproj index 11fdb99b3a..ee7a03dde1 100644 --- a/src/DADynamoApp/DADynamoApp.csproj +++ b/src/DADynamoApp/DADynamoApp.csproj @@ -33,13 +33,6 @@ runtime - - runtime - - - $(Pkgpythonnet_py38_win)\pythonnet\lib\net40\Python.Runtime.dll - False - diff --git a/src/DADynamoApp/DAEntrypoint.cs b/src/DADynamoApp/DAEntrypoint.cs index 1d0f646cbc..99e96d27b6 100644 --- a/src/DADynamoApp/DAEntrypoint.cs +++ b/src/DADynamoApp/DAEntrypoint.cs @@ -5,7 +5,6 @@ using DynamoPlayer; using RevitServices.Persistence; using RevitServices.Elements; -using RevitServices.EventHandler; using System.Reflection; using System.Runtime.Loader; using System.Diagnostics; @@ -15,11 +14,8 @@ using System.Text.RegularExpressions; using Greg.AuthProviders; using Revit.Elements; -using Greg.Responses; using Dynamo.PythonServices; -using Microsoft.VisualBasic.FileIO; using DSCPython; -using System.Collections; namespace DADynamoApp { @@ -213,10 +209,16 @@ private void SetupPython() { try { - var pyIncluded = Assembly.LoadFrom(Path.Combine(WorkItemFolder, PythonDllFolder, "Python.Included.dll")); + // Preload all python assemblies at the PythonDllFolder. + foreach (var pyDll in Directory.EnumerateFiles(Path.Combine(WorkItemFolder, PythonDllFolder), "*.dll")) + { + Assembly.LoadFrom(pyDll); + } + + var pyIncluded = AppDomain.CurrentDomain.GetAssemblies().FirstOrDefault(x => x.GetName().Name == "Python.Included"); if (pyIncluded == null) { - throw new Exception("Null Python.Included assembly"); + throw new Exception("Could not find Python.Included assembly"); } var type = pyIncluded.GetType("Python.Included.Installer"); if (type == null) diff --git a/src/DynamoRevit.DA.sln b/src/DynamoRevit.DA.sln index 33b53213cd..cc3f331a16 100644 --- a/src/DynamoRevit.DA.sln +++ b/src/DynamoRevit.DA.sln @@ -53,21 +53,27 @@ Global {0BC2A611-BD0E-4FCC-A1DE-81F14ED369B2}.Debug|NET80_DA.ActiveCfg = Debug|NET80_DA {0BC2A611-BD0E-4FCC-A1DE-81F14ED369B2}.Debug|NET80_DA.Build.0 = Debug|NET80_DA {0BC2A611-BD0E-4FCC-A1DE-81F14ED369B2}.Release|NET80_DA.ActiveCfg = Release|NET80_DA + {0BC2A611-BD0E-4FCC-A1DE-81F14ED369B2}.Release|NET80_DA.Build.0 = Release|NET80_DA {75940ACC-3708-4526-8D91-7E3365BAF682}.Debug|NET80_DA.ActiveCfg = Debug|NET80_DA {75940ACC-3708-4526-8D91-7E3365BAF682}.Debug|NET80_DA.Build.0 = Debug|NET80_DA {75940ACC-3708-4526-8D91-7E3365BAF682}.Release|NET80_DA.ActiveCfg = Release|NET80_DA + {75940ACC-3708-4526-8D91-7E3365BAF682}.Release|NET80_DA.Build.0 = Release|NET80_DA {E4701F9E-41AB-4044-8166-85D924FEB632}.Debug|NET80_DA.ActiveCfg = Debug|NET80_DA {E4701F9E-41AB-4044-8166-85D924FEB632}.Debug|NET80_DA.Build.0 = Debug|NET80_DA {E4701F9E-41AB-4044-8166-85D924FEB632}.Release|NET80_DA.ActiveCfg = Release|NET80_DA + {E4701F9E-41AB-4044-8166-85D924FEB632}.Release|NET80_DA.Build.0 = Release|NET80_DA {06B9E5B0-7C50-4351-9D88-E159DC25755F}.Debug|NET80_DA.ActiveCfg = Debug|NET80_DA {06B9E5B0-7C50-4351-9D88-E159DC25755F}.Debug|NET80_DA.Build.0 = Debug|NET80_DA {06B9E5B0-7C50-4351-9D88-E159DC25755F}.Release|NET80_DA.ActiveCfg = Release|NET80_DA + {06B9E5B0-7C50-4351-9D88-E159DC25755F}.Release|NET80_DA.Build.0 = Release|NET80_DA {133FC760-5699-46D9-BEA6-E816B5F01016}.Debug|NET80_DA.ActiveCfg = Debug|NET80_DA {133FC760-5699-46D9-BEA6-E816B5F01016}.Debug|NET80_DA.Build.0 = Debug|NET80_DA {133FC760-5699-46D9-BEA6-E816B5F01016}.Release|NET80_DA.ActiveCfg = Release|NET80_DA + {133FC760-5699-46D9-BEA6-E816B5F01016}.Release|NET80_DA.Build.0 = Release|NET80_DA {66A0E1C8-2514-48B7-8406-536983F57F88}.Debug|NET80_DA.ActiveCfg = Debug|NET80_DA {66A0E1C8-2514-48B7-8406-536983F57F88}.Debug|NET80_DA.Build.0 = Debug|NET80_DA {66A0E1C8-2514-48B7-8406-536983F57F88}.Release|NET80_DA.ActiveCfg = Release|NET80_DA + {66A0E1C8-2514-48B7-8406-536983F57F88}.Release|NET80_DA.Build.0 = Release|NET80_DA EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE From 1202a2c222498f116fc1ca8afac26e12578fdaf0 Mon Sep 17 00:00:00 2001 From: pinzart90 Date: Tue, 6 May 2025 04:01:42 -0400 Subject: [PATCH 46/70] update add saveRvt option --- src/DADynamoApp/DAEntrypoint.cs | 23 +++++++++++++++++------ src/DADynamoApp/SetupDAController.cs | 27 +++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 6 deletions(-) create mode 100644 src/DADynamoApp/SetupDAController.cs diff --git a/src/DADynamoApp/DAEntrypoint.cs b/src/DADynamoApp/DAEntrypoint.cs index 99e96d27b6..4803fd4795 100644 --- a/src/DADynamoApp/DAEntrypoint.cs +++ b/src/DADynamoApp/DAEntrypoint.cs @@ -39,6 +39,8 @@ public class DAEntrypoint : IExternalDBApplication public ExternalDBApplicationResult OnShutdown(ControlledApplication application) { + DynamoRevitPythonManager.Cleanup(); + AppDomain.CurrentDomain.UnhandledException -= CurrentDomain_UnhandledException; AppDomain.CurrentDomain.ProcessExit -= CurrentDomain_ProcessExit; AppDomain.CurrentDomain.AssemblyResolve -= CurrentDomain_AssemblyResolve; @@ -47,8 +49,6 @@ public ExternalDBApplicationResult OnShutdown(ControlledApplication application) controlledApplication.DocumentClosed -= RevitServices.Events.ApplicationEvents.OnApplicationDocumentClosed; controlledApplication.DocumentOpened -= RevitServices.Events.ApplicationEvents.OnApplicationDocumentOpened; - DynamoRevitPythonManager.Cleanup(); - return ExternalDBApplicationResult.Succeeded; } @@ -125,12 +125,19 @@ public void HandleDesignAutomationReadyEvent(object sender, DesignAutomationRead Console.WriteLine("<> DA event raised."); // Local Change - //WorkItemFolder = SpecialDirectories.CurrentUserApplicationData; + //WorkItemFolder = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); var dynTempDir = Path.Combine(WorkItemFolder, "dyn_tmp"); var app = e.DesignAutomationData?.RevitApp; Console.WriteLine("<> Preparing Dynamo model. Vers 1"); + // Some options we may need to process before setting up the dynamo model. + // Startup a new project, maybe an option we can have ? + //app.NewProjectDocument(Autodesk.Revit.DB.UnitSystem.Metric); + + Document? doc = e.DesignAutomationData?.RevitDoc; + if (doc == null) throw new InvalidOperationException("Could not open revit document."); + var hostloc = typeof(Autodesk.Revit.ApplicationServices.Application).Assembly.Location; var asmLocation = Path.GetDirectoryName(hostloc); Console.WriteLine($"using asm at location {asmLocation}"); @@ -139,8 +146,6 @@ public void HandleDesignAutomationReadyEvent(object sender, DesignAutomationRead // need this for cloud, does not work on local var userDataFolder = Path.Combine(dynTempDir, "Dynamo Revit"); var commonDataFolder = Path.Combine(dynTempDir, "Dynamo"); - // Startup a new project, maybe an option we can have ? - //app.NewProjectDocument(Autodesk.Revit.DB.UnitSystem.Metric); DocumentManager.Instance.PrepareForAutomation(app); @@ -179,7 +184,8 @@ public void HandleDesignAutomationReadyEvent(object sender, DesignAutomationRead DynamoPlayerLogger.Initialize(playerHost); - var dynHandler = new Handler(playerHost, [new DynamoController(controller)]); + var setupController = new SetupDAController(controller); + var dynHandler = new Handler(playerHost, [new DynamoController(controller), setupController]); var runContent = File.ReadAllText(Path.Combine(WorkItemFolder, "run.json")); @@ -200,6 +206,11 @@ public void HandleDesignAutomationReadyEvent(object sender, DesignAutomationRead Console.WriteLine(result); File.WriteAllText(Path.Combine(WorkItemFolder, "result.json"), result); + if (setupController.setupDA?.SaveRvt ?? false) + { + ModelPath path = ModelPathUtils.ConvertUserVisiblePathToModelPath("result.rvt"); + doc.SaveAs(path, new SaveAsOptions()); + } model.RunCompleted += Model_RunCompleted; e.Succeeded = true; diff --git a/src/DADynamoApp/SetupDAController.cs b/src/DADynamoApp/SetupDAController.cs new file mode 100644 index 0000000000..d8657f680d --- /dev/null +++ b/src/DADynamoApp/SetupDAController.cs @@ -0,0 +1,27 @@ +using DynamoPlayer; +using Newtonsoft.Json; + +namespace DADynamoApp +{ + public class SetupDARequest + { + // + // Summary: + // Save the revit document to the default result.rvt file. + [JsonProperty("saveRvt", Required = Required.AllowNull, NullValueHandling = NullValueHandling.Ignore)] + public bool? SaveRvt { get; set; } = false; + } + + internal class SetupDAController(IDynamoController implementation) : DynamoController(implementation) + { + internal SetupDARequest? setupDA; + + [HttpPost] + [Route("setup", Name = "post-setup")] + public Task Setup([FromBody] SetupDARequest req) + { + setupDA = req; + return Task.CompletedTask; + } + } +} From 1a1e913e21ace8412c36125830427b2e19c7b5aa Mon Sep 17 00:00:00 2001 From: pinzart90 Date: Tue, 6 May 2025 04:17:23 -0400 Subject: [PATCH 47/70] update --- src/DADynamoApp/DAEntrypoint.cs | 37 ++++++++++++++++++++++------ src/DADynamoApp/SetupDAController.cs | 9 +++---- 2 files changed, 34 insertions(+), 12 deletions(-) diff --git a/src/DADynamoApp/DAEntrypoint.cs b/src/DADynamoApp/DAEntrypoint.cs index 4803fd4795..6816b1d468 100644 --- a/src/DADynamoApp/DAEntrypoint.cs +++ b/src/DADynamoApp/DAEntrypoint.cs @@ -16,6 +16,7 @@ using Revit.Elements; using Dynamo.PythonServices; using DSCPython; +using Newtonsoft.Json; namespace DADynamoApp { @@ -187,8 +188,24 @@ public void HandleDesignAutomationReadyEvent(object sender, DesignAutomationRead var setupController = new SetupDAController(controller); var dynHandler = new Handler(playerHost, [new DynamoController(controller), setupController]); + bool saveRvt = false; + var setupReqPath = Path.Combine(WorkItemFolder, "setup.json"); + if (File.Exists(setupReqPath)) + { + var setupRequest = File.ReadAllText(setupReqPath); + try + { + var res = dynHandler.HandleRoute("POST", "/v1/setup", setupRequest); + SetupDARequest setupReq = JsonConvert.DeserializeObject(res.Result); + saveRvt = setupReq?.SaveRvt ?? false; + } + catch (Exception ex) + { + Console.WriteLine(ex.Message); + } + } + var runContent = File.ReadAllText(Path.Combine(WorkItemFolder, "run.json")); - var testFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); var output = string.Empty; @@ -202,14 +219,20 @@ public void HandleDesignAutomationReadyEvent(object sender, DesignAutomationRead Console.WriteLine(ex.Message); } - var result = Newtonsoft.Json.JsonConvert.SerializeObject(output); - Console.WriteLine(result); + Console.WriteLine(output); + File.WriteAllText(Path.Combine(WorkItemFolder, "result.json"), output); - File.WriteAllText(Path.Combine(WorkItemFolder, "result.json"), result); - if (setupController.setupDA?.SaveRvt ?? false) + if (saveRvt) { - ModelPath path = ModelPathUtils.ConvertUserVisiblePathToModelPath("result.rvt"); - doc.SaveAs(path, new SaveAsOptions()); + try + { + ModelPath path = ModelPathUtils.ConvertUserVisiblePathToModelPath("result.rvt"); + doc.SaveAs(path, new SaveAsOptions()); + } + catch (Exception ex) + { + Console.WriteLine(ex.Message); + } } model.RunCompleted += Model_RunCompleted; diff --git a/src/DADynamoApp/SetupDAController.cs b/src/DADynamoApp/SetupDAController.cs index d8657f680d..a774515a70 100644 --- a/src/DADynamoApp/SetupDAController.cs +++ b/src/DADynamoApp/SetupDAController.cs @@ -3,13 +3,13 @@ namespace DADynamoApp { - public class SetupDARequest + internal class SetupDARequest { // // Summary: // Save the revit document to the default result.rvt file. [JsonProperty("saveRvt", Required = Required.AllowNull, NullValueHandling = NullValueHandling.Ignore)] - public bool? SaveRvt { get; set; } = false; + public bool SaveRvt { get; set; } = false; } internal class SetupDAController(IDynamoController implementation) : DynamoController(implementation) @@ -18,10 +18,9 @@ internal class SetupDAController(IDynamoController implementation) : DynamoContr [HttpPost] [Route("setup", Name = "post-setup")] - public Task Setup([FromBody] SetupDARequest req) + public Task Setup([FromBody] SetupDARequest req) { - setupDA = req; - return Task.CompletedTask; + return Task.FromResult(req); } } } From 8fdb261536c7f832a0f25d087c05cbbade19fd8d Mon Sep 17 00:00:00 2001 From: pinzart90 Date: Tue, 6 May 2025 04:26:26 -0400 Subject: [PATCH 48/70] update --- src/DADynamoApp/DAEntrypoint.cs | 9 +++------ src/DADynamoApp/SetupDAController.cs | 26 -------------------------- src/DADynamoApp/SetupDARequest.cs | 16 ++++++++++++++++ 3 files changed, 19 insertions(+), 32 deletions(-) delete mode 100644 src/DADynamoApp/SetupDAController.cs create mode 100644 src/DADynamoApp/SetupDARequest.cs diff --git a/src/DADynamoApp/DAEntrypoint.cs b/src/DADynamoApp/DAEntrypoint.cs index 6816b1d468..72367f9643 100644 --- a/src/DADynamoApp/DAEntrypoint.cs +++ b/src/DADynamoApp/DAEntrypoint.cs @@ -132,7 +132,6 @@ public void HandleDesignAutomationReadyEvent(object sender, DesignAutomationRead var app = e.DesignAutomationData?.RevitApp; Console.WriteLine("<> Preparing Dynamo model. Vers 1"); - // Some options we may need to process before setting up the dynamo model. // Startup a new project, maybe an option we can have ? //app.NewProjectDocument(Autodesk.Revit.DB.UnitSystem.Metric); @@ -185,18 +184,16 @@ public void HandleDesignAutomationReadyEvent(object sender, DesignAutomationRead DynamoPlayerLogger.Initialize(playerHost); - var setupController = new SetupDAController(controller); - var dynHandler = new Handler(playerHost, [new DynamoController(controller), setupController]); + var dynHandler = new Handler(playerHost, [new DynamoController(controller)]); bool saveRvt = false; var setupReqPath = Path.Combine(WorkItemFolder, "setup.json"); if (File.Exists(setupReqPath)) { - var setupRequest = File.ReadAllText(setupReqPath); try { - var res = dynHandler.HandleRoute("POST", "/v1/setup", setupRequest); - SetupDARequest setupReq = JsonConvert.DeserializeObject(res.Result); + var setupRequest = File.ReadAllText(setupReqPath); + SetupDARequest setupReq = JsonConvert.DeserializeObject(setupRequest, new JsonSerializerSettings() { TypeNameHandling = TypeNameHandling.Auto}); saveRvt = setupReq?.SaveRvt ?? false; } catch (Exception ex) diff --git a/src/DADynamoApp/SetupDAController.cs b/src/DADynamoApp/SetupDAController.cs deleted file mode 100644 index a774515a70..0000000000 --- a/src/DADynamoApp/SetupDAController.cs +++ /dev/null @@ -1,26 +0,0 @@ -using DynamoPlayer; -using Newtonsoft.Json; - -namespace DADynamoApp -{ - internal class SetupDARequest - { - // - // Summary: - // Save the revit document to the default result.rvt file. - [JsonProperty("saveRvt", Required = Required.AllowNull, NullValueHandling = NullValueHandling.Ignore)] - public bool SaveRvt { get; set; } = false; - } - - internal class SetupDAController(IDynamoController implementation) : DynamoController(implementation) - { - internal SetupDARequest? setupDA; - - [HttpPost] - [Route("setup", Name = "post-setup")] - public Task Setup([FromBody] SetupDARequest req) - { - return Task.FromResult(req); - } - } -} diff --git a/src/DADynamoApp/SetupDARequest.cs b/src/DADynamoApp/SetupDARequest.cs new file mode 100644 index 0000000000..497d4a756d --- /dev/null +++ b/src/DADynamoApp/SetupDARequest.cs @@ -0,0 +1,16 @@ +using Newtonsoft.Json; + +namespace DADynamoApp +{ + /// + /// Request body used to setup aspects of the Design Automation environment. + /// + internal class SetupDARequest + { + // + // Summary: + // Save the revit document to the default result.rvt file. + [JsonProperty("saveRvt", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] + public bool SaveRvt { get; set; } = false; + } +} From 6dffdd52e9a64ed057773657f5b4449b7fecdedd Mon Sep 17 00:00:00 2001 From: pinzart90 Date: Tue, 6 May 2025 14:52:51 -0400 Subject: [PATCH 49/70] update --- src/DADynamoApp/DAEntrypoint.cs | 4 ++- src/DADynamoApp/DARunGraphController.cs | 33 +++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 src/DADynamoApp/DARunGraphController.cs diff --git a/src/DADynamoApp/DAEntrypoint.cs b/src/DADynamoApp/DAEntrypoint.cs index 72367f9643..09ceccef07 100644 --- a/src/DADynamoApp/DAEntrypoint.cs +++ b/src/DADynamoApp/DAEntrypoint.cs @@ -184,7 +184,9 @@ public void HandleDesignAutomationReadyEvent(object sender, DesignAutomationRead DynamoPlayerLogger.Initialize(playerHost); - var dynHandler = new Handler(playerHost, [new DynamoController(controller)]); + workflows.LoadDependencies(new GraphTarget() { DependenciesPath = WorkItemFolder }); + + var dynHandler = new Handler(playerHost, [new DARunGraphController(controller, model, WorkItemFolder)]); bool saveRvt = false; var setupReqPath = Path.Combine(WorkItemFolder, "setup.json"); diff --git a/src/DADynamoApp/DARunGraphController.cs b/src/DADynamoApp/DARunGraphController.cs new file mode 100644 index 0000000000..e061599b44 --- /dev/null +++ b/src/DADynamoApp/DARunGraphController.cs @@ -0,0 +1,33 @@ +using Dynamo.Models; +using DynamoPlayer; + +namespace DADynamoApp +{ + internal class DARunGraphController : DynamoController + { + IDynamoController implementation; + string workFolder = string.Empty; + DynamoModel model; + + public DARunGraphController(IDynamoController implementation, DynamoModel model, string workFolder) : base(implementation) + { + this.workFolder = workFolder; + this.implementation = implementation; + this.model = model; + } + + [Route("graph/run", Name = "post-graph-run")] + public new Task PostGraphRun([FromBody] RunGraph body) + { + if (body.Target is CurrentGraphTarget) + { + this.model.OpenFileFromPath(Path.Combine(workFolder, "run.dyn")); + } + else if (body.Target is PathGraphTarget pGraphTarget) + { + pGraphTarget.Path = Path.Combine(this.workFolder, pGraphTarget.Path); + } + return implementation.PostGraphRunAsync(body); + } + } +} \ No newline at end of file From f184ad870df4fdcb9544647bce77171bab9490e3 Mon Sep 17 00:00:00 2001 From: pinzart90 Date: Tue, 13 May 2025 06:37:06 -0400 Subject: [PATCH 50/70] Update DAEntrypoint.cs --- src/DADynamoApp/DAEntrypoint.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/DADynamoApp/DAEntrypoint.cs b/src/DADynamoApp/DAEntrypoint.cs index 09ceccef07..9d5f794d00 100644 --- a/src/DADynamoApp/DAEntrypoint.cs +++ b/src/DADynamoApp/DAEntrypoint.cs @@ -188,7 +188,8 @@ public void HandleDesignAutomationReadyEvent(object sender, DesignAutomationRead var dynHandler = new Handler(playerHost, [new DARunGraphController(controller, model, WorkItemFolder)]); - bool saveRvt = false; + // Default, save the rvt + bool saveRvt = true; var setupReqPath = Path.Combine(WorkItemFolder, "setup.json"); if (File.Exists(setupReqPath)) { @@ -196,7 +197,7 @@ public void HandleDesignAutomationReadyEvent(object sender, DesignAutomationRead { var setupRequest = File.ReadAllText(setupReqPath); SetupDARequest setupReq = JsonConvert.DeserializeObject(setupRequest, new JsonSerializerSettings() { TypeNameHandling = TypeNameHandling.Auto}); - saveRvt = setupReq?.SaveRvt ?? false; + saveRvt = setupReq?.SaveRvt ?? saveRvt; } catch (Exception ex) { From 33976341bbe77ac93933b1dd3232268e55e160ab Mon Sep 17 00:00:00 2001 From: pinzart90 Date: Tue, 13 May 2025 13:03:33 -0400 Subject: [PATCH 51/70] update --- src/DADynamoApp/DADynamoApp.csproj | 2 +- src/DADynamoApp/DAEntrypoint.cs | 15 ++-- src/DynamoRevit.All.sln | 6 -- src/DynamoRevit.DA.sln | 8 +- src/DynamoRevit/DynamoRevit.csproj | 37 +++------ src/DynamoRevit/Models/RevitDynamoModel.cs | 75 +++++++++++++------ .../Models}/RevitNodeModel.cs | 6 +- src/DynamoRevit/Properties/AssemblyInfo.cs | 2 +- .../Utilities}/ASMPreloader.cs | 0 .../Utilities}/DynamoRevitInternalNodes.cs | 0 .../Utilities}/DynamoRevitPythonManager.cs | 0 .../Utilities}/RevitPathResolver.cs | 0 .../RevitNodesUI/RevitNodesUI.csproj | 2 +- src/SharedUtilities/SharedUtilities.projitems | 17 ----- src/SharedUtilities/SharedUtilities.shproj | 13 ---- 15 files changed, 85 insertions(+), 98 deletions(-) rename src/{Libraries/RevitNodes => DynamoRevit/Models}/RevitNodeModel.cs (82%) rename src/{SharedUtilities => DynamoRevit/Utilities}/ASMPreloader.cs (100%) rename src/{SharedUtilities => DynamoRevit/Utilities}/DynamoRevitInternalNodes.cs (100%) rename src/{SharedUtilities => DynamoRevit/Utilities}/DynamoRevitPythonManager.cs (100%) rename src/{SharedUtilities => DynamoRevit/Utilities}/RevitPathResolver.cs (100%) delete mode 100644 src/SharedUtilities/SharedUtilities.projitems delete mode 100644 src/SharedUtilities/SharedUtilities.shproj diff --git a/src/DADynamoApp/DADynamoApp.csproj b/src/DADynamoApp/DADynamoApp.csproj index ee7a03dde1..ba8a99a20c 100644 --- a/src/DADynamoApp/DADynamoApp.csproj +++ b/src/DADynamoApp/DADynamoApp.csproj @@ -1,5 +1,4 @@  - @@ -35,6 +34,7 @@ + diff --git a/src/DADynamoApp/DAEntrypoint.cs b/src/DADynamoApp/DAEntrypoint.cs index 9d5f794d00..19443bc5e8 100644 --- a/src/DADynamoApp/DAEntrypoint.cs +++ b/src/DADynamoApp/DAEntrypoint.cs @@ -17,6 +17,7 @@ using Dynamo.PythonServices; using DSCPython; using Newtonsoft.Json; +using Revit.Transaction; namespace DADynamoApp { @@ -155,7 +156,9 @@ public void HandleDesignAutomationReadyEvent(object sender, DesignAutomationRead var loadedLibGVersion = ASMPrealoaderUtils.PreloadAsmFromRevit(controlledApplication, DynamoPath); var geometryFactoryPath = ASMPrealoaderUtils.GetGeometryFactoryPath(DynamoPath, loadedLibGVersion); - model = DynamoModel.Start( + PreInstallPythonDependencies(); + + model = Dynamo.Applications.Models.RevitDynamoModel.Start( new DefaultStartConfiguration { DynamoCorePath = DynamoPath, @@ -170,8 +173,6 @@ public void HandleDesignAutomationReadyEvent(object sender, DesignAutomationRead IsServiceMode = true }); - SetupPython(); - LoadMessage = model != null ? "loaded" : "no loaded"; var playerHost = new PlayerHostDynamoDefault(model, new DynamoPlayerLogger(logConfig)); @@ -196,6 +197,8 @@ public void HandleDesignAutomationReadyEvent(object sender, DesignAutomationRead try { var setupRequest = File.ReadAllText(setupReqPath); + Console.WriteLine(setupRequest); + SetupDARequest setupReq = JsonConvert.DeserializeObject(setupRequest, new JsonSerializerSettings() { TypeNameHandling = TypeNameHandling.Auto}); saveRvt = setupReq?.SaveRvt ?? saveRvt; } @@ -222,10 +225,12 @@ public void HandleDesignAutomationReadyEvent(object sender, DesignAutomationRead Console.WriteLine(output); File.WriteAllText(Path.Combine(WorkItemFolder, "result.json"), output); + Console.WriteLine($"{nameof(saveRvt)} is set to {saveRvt}"); if (saveRvt) { try { + RevitServices.Transactions.TransactionManager.Instance.ForceCloseTransaction(); ModelPath path = ModelPathUtils.ConvertUserVisiblePathToModelPath("result.rvt"); doc.SaveAs(path, new SaveAsOptions()); } @@ -239,7 +244,7 @@ public void HandleDesignAutomationReadyEvent(object sender, DesignAutomationRead e.Succeeded = true; } - private void SetupPython() + private void PreInstallPythonDependencies() { try { @@ -284,8 +289,6 @@ private void SetupPython() PythonEngineManager.Instance.AvailableEngines.Add(engine); } } - - DynamoRevitPythonManager.SetupPython(model.Logger); } catch (Exception ex) { diff --git a/src/DynamoRevit.All.sln b/src/DynamoRevit.All.sln index 6fef17d57f..3be8a33931 100644 --- a/src/DynamoRevit.All.sln +++ b/src/DynamoRevit.All.sln @@ -86,8 +86,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".adsk", ".adsk", "{D6EED31E ..\.adsk\ContinuousLocalization.yml = ..\.adsk\ContinuousLocalization.yml EndProjectSection EndProject -Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "SharedUtilities", "SharedUtilities\SharedUtilities.shproj", "{BCFD5D77-45F8-41A4-B60C-582509B9262B}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|NET80 = Debug|NET80 @@ -169,8 +167,4 @@ Global GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {757AAA40-191F-4673-9B04-8270A3370BCA} EndGlobalSection - GlobalSection(SharedMSBuildProjectFiles) = preSolution - SharedUtilities\SharedUtilities.projitems*{bcfd5d77-45f8-41a4-b60c-582509b9262b}*SharedItemsImports = 13 - SharedUtilities\SharedUtilities.projitems*{fd56ae51-739e-4893-8de4-925d60c7097c}*SharedItemsImports = 5 - EndGlobalSection EndGlobal diff --git a/src/DynamoRevit.DA.sln b/src/DynamoRevit.DA.sln index cc3f331a16..5ef1122e35 100644 --- a/src/DynamoRevit.DA.sln +++ b/src/DynamoRevit.DA.sln @@ -42,7 +42,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "config", "config", "{956846 EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DADynamoApp", "DADynamoApp\DADynamoApp.csproj", "{66A0E1C8-2514-48B7-8406-536983F57F88}" EndProject -Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "SharedUtilities", "SharedUtilities\SharedUtilities.shproj", "{BCFD5D77-45F8-41A4-B60C-582509B9262B}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DynamoRevit", "DynamoRevit\DynamoRevit.csproj", "{BD7126B6-E716-4024-854F-6DA2CFA25B84}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -74,6 +74,10 @@ Global {66A0E1C8-2514-48B7-8406-536983F57F88}.Debug|NET80_DA.Build.0 = Debug|NET80_DA {66A0E1C8-2514-48B7-8406-536983F57F88}.Release|NET80_DA.ActiveCfg = Release|NET80_DA {66A0E1C8-2514-48B7-8406-536983F57F88}.Release|NET80_DA.Build.0 = Release|NET80_DA + {BD7126B6-E716-4024-854F-6DA2CFA25B84}.Debug|NET80_DA.ActiveCfg = Debug|NET80_DA + {BD7126B6-E716-4024-854F-6DA2CFA25B84}.Debug|NET80_DA.Build.0 = Debug|NET80_DA + {BD7126B6-E716-4024-854F-6DA2CFA25B84}.Release|NET80_DA.ActiveCfg = Release|NET80_DA + {BD7126B6-E716-4024-854F-6DA2CFA25B84}.Release|NET80_DA.Build.0 = Release|NET80_DA EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -90,6 +94,6 @@ Global EndGlobalSection GlobalSection(SharedMSBuildProjectFiles) = preSolution SharedUtilities\SharedUtilities.projitems*{66a0e1c8-2514-48b7-8406-536983f57f88}*SharedItemsImports = 5 - SharedUtilities\SharedUtilities.projitems*{bcfd5d77-45f8-41a4-b60c-582509b9262b}*SharedItemsImports = 13 + SharedUtilities\SharedUtilities.projitems*{bd7126b6-e716-4024-854f-6da2cfa25b84}*SharedItemsImports = 5 EndGlobalSection EndGlobal diff --git a/src/DynamoRevit/DynamoRevit.csproj b/src/DynamoRevit/DynamoRevit.csproj index c48d864aba..a8b15e4bd4 100644 --- a/src/DynamoRevit/DynamoRevit.csproj +++ b/src/DynamoRevit/DynamoRevit.csproj @@ -1,5 +1,4 @@  - @@ -10,33 +9,19 @@ - prompt - 3 - full $(NoWarn);618 - true - false MinimumRecommendedRules.ruleset - false - $(BuildDependsOn);AfterBuildMigrated - if exist $(ProjectDir)PostBuildStep.bat call $(ProjectDir)PostBuildStep.bat $(SolutionDir) - DynamoRevitDS - true - true + false + $(BuildDependsOn);AfterBuildMigrated + if exist $(ProjectDir)PostBuildStep.bat call $(ProjectDir)PostBuildStep.bat $(SolutionDir) + DynamoRevitDS + true + true None - - false - TRACE;DEBUG - false - - - true - TRACE - true @@ -114,11 +99,6 @@ $(DYNAMOBUILDPATH)\ProtoCore.dll False - - $(PACKAGESPATH)\DynamoVisualProgramming.WpfUILibrary\lib\$(DCoreLibSubFolder)\DynamoCoreWpf.dll - $(DYNAMOBUILDPATH)\DynamoCoreWpf.dll - False - $(PACKAGESPATH)\DynamoVisualProgramming.Core\lib\$(DCoreLibSubFolder)\DynamoCore.dll $(DYNAMOBUILDPATH)\DynamoCore.dll @@ -157,4 +137,9 @@ + + + + + \ No newline at end of file diff --git a/src/DynamoRevit/Models/RevitDynamoModel.cs b/src/DynamoRevit/Models/RevitDynamoModel.cs index ee577fe277..6304c94dea 100644 --- a/src/DynamoRevit/Models/RevitDynamoModel.cs +++ b/src/DynamoRevit/Models/RevitDynamoModel.cs @@ -8,8 +8,11 @@ using System.Windows.Forms; using Autodesk.Revit.DB; using Autodesk.Revit.DB.Events; +#if !DESIGN_AUTOMATION using Autodesk.Revit.UI; using Autodesk.Revit.UI.Events; +using RevitServices.Threading; +#endif using Dynamo.Graph.Nodes; using Dynamo.Graph.Nodes.ZeroTouch; using Dynamo.Graph.Workspaces; @@ -27,7 +30,6 @@ using RevitServices.Elements; using RevitServices.Materials; using RevitServices.Persistence; -using RevitServices.Threading; using RevitServices.Transactions; using Category = Revit.Elements.Category; using Element = Autodesk.Revit.DB.Element; @@ -39,7 +41,9 @@ public class RevitDynamoModel : DynamoModel { public interface IRevitStartConfiguration : IStartConfiguration { +#if !DESIGN_AUTOMATION DynamoRevitCommandData ExternalCommandData { get; set; } +#endif } public struct RevitStartConfiguration : IRevitStartConfiguration @@ -55,7 +59,9 @@ public struct RevitStartConfiguration : IRevitStartConfiguration public string GeometryFactoryPath { get; set; } public IAuthProvider AuthProvider { get; set; } public string PackageManagerAddress { get; set; } +#if !DESIGN_AUTOMATION public DynamoRevitCommandData ExternalCommandData { get; set; } +#endif public IEnumerable Extensions { get; set; } public TaskProcessMode ProcessMode { get; set; } //the property will contain revit host information, to be passed on to Dynamo. @@ -69,9 +75,10 @@ public struct RevitStartConfiguration : IRevitStartConfiguration /// private bool updateCurrentUIDoc; +#if !DESIGN_AUTOMATION private readonly DynamoRevitCommandData externalCommandData; - - #region Events +#endif +#region Events public event EventHandler RevitDocumentChanged; @@ -155,7 +162,7 @@ protected override void OnWorkspaceAdded(WorkspaceModel workspace) var dm = DocumentManager.Instance; if (dm.CurrentDBDocument != null) { - SetRunEnabledBasedOnContext(dm.CurrentUIDocument.ActiveView); + SetRunEnabledBasedOnContext(dm.CurrentDBDocument.ActiveView); } } @@ -185,7 +192,7 @@ public bool IsInMatchingDocumentContext return false; // There's no current document stored. // Selection is not allowed in perspective view mode. - var view3D = dm.CurrentUIDocument.ActiveView as View3D; + var view3D = dm.CurrentDBDocument.ActiveView as View3D; if ((view3D != null) && view3D.IsPerspective) return false; // There's no view, or in perspective view. @@ -216,12 +223,12 @@ private RevitDynamoModel(IRevitStartConfiguration configuration) : base(configuration) { DisposeLogic.IsShuttingDown = false; - +#if !DESIGN_AUTOMATION externalCommandData = configuration.ExternalCommandData; - + SubscribeApplicationEvents(configuration.ExternalCommandData); +#endif SubscribeRevitServicesUpdaterEvents(); - SubscribeApplicationEvents(configuration.ExternalCommandData); InitializeDocumentManager(); SubscribeDocumentManagerEvents(); SubscribeTransactionManagerEvents(); @@ -230,7 +237,7 @@ private RevitDynamoModel(IRevitStartConfiguration configuration) : } - #endregion +#endregion #region trace reconciliation @@ -325,12 +332,14 @@ public override void PostTraceReconciliation(Dictionary> orph } else { +#if !DESIGN_AUTOMATION // Delete all the orphans. IdlePromise.ExecuteOnIdleAsync( () => { DeleteOrphanedElements(orphanedIds, Logger); }); +#endif } } @@ -422,7 +431,7 @@ private static void DeleteOrphanedElements(IEnumerable orphanedIds, ILog } } - #endregion +#endregion #region Initialization @@ -438,6 +447,7 @@ internal void HandlePostInitialization() internal void InitializeDocumentManager() { +#if !DESIGN_AUTOMATION // Set the intitial document. var activeUIDocument = DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument; if (activeUIDocument != null) @@ -447,6 +457,7 @@ internal void InitializeDocumentManager() OnRevitDocumentChanged(); } +#endif } private static void InitializeMaterials() @@ -454,10 +465,14 @@ private static void InitializeMaterials() // Ensure that the current document has the needed materials // and graphic styles to support visualization in Revit. var mgr = MaterialsManager.Instance; +#if !DESIGN_AUTOMATION IdlePromise.ExecuteOnIdleAsync(mgr.InitializeForActiveDocumentOnIdle); +#else + mgr.InitializeForActiveDocumentOnIdle(); +#endif } - #endregion +#endregion #region Event subscribe/unsubscribe @@ -493,6 +508,7 @@ private void UnsubscribeDocumentManagerEvents() DocumentManager.OnLogError -= Logger.Log; } +#if !DESIGN_AUTOMATION private bool hasRegisteredApplicationEvents; private void SubscribeApplicationEvents(DynamoRevitCommandData commandData) { @@ -525,8 +541,9 @@ private void UnsubscribeApplicationEvents(DynamoRevitCommandData commandData) hasRegisteredApplicationEvents = false; } +#endif - #endregion +#endregion #region Application event handler /// @@ -564,6 +581,7 @@ private void OnApplicationDocumentClosed(object sender, DocumentClosedEventArgs HandleApplicationDocumentClosed(); } +#if !DESIGN_AUTOMATION /// /// Handler for Revit's ViewActivating event. /// Addins are not available in some views in Revit, notably perspective views. @@ -586,8 +604,8 @@ private void OnApplicationViewActivated(object sender, ViewActivatedEventArgs e) { HandleRevitViewActivated(); } - - #endregion +#endif +#endregion #region Public methods @@ -605,7 +623,11 @@ protected override void PreShutdownCore(bool shutdownHost) { if (shutdownHost) { +#if !DESIGN_AUTOMATION DynamoRevitApp.AddIdleAction(ShutdownRevitHostOnce); +#else + ShutdownRevitHostOnce(); +#endif } base.PreShutdownCore(shutdownHost); @@ -613,7 +635,6 @@ protected override void PreShutdownCore(bool shutdownHost) private static void ShutdownRevitHostOnce() { - var uiApplication = DocumentManager.Instance.CurrentUIApplication; ShutdownRevitHost(); } @@ -626,7 +647,9 @@ protected override void ShutDownCore(bool shutDownHost) // unsubscribe events RevitServicesUpdater.Instance.UnRegisterAllChangeHooks(); +#if !DESIGN_AUTOMATION UnsubscribeApplicationEvents(externalCommandData); +#endif UnsubscribeDocumentManagerEvents(); UnsubscribeRevitServicesUpdaterEvents(); UnsubscribeTransactionManagerEvents(); @@ -639,9 +662,11 @@ protected override void ShutDownCore(bool shutDownHost) protected override void PostShutdownCore(bool shutdownHost) { base.PostShutdownCore(shutdownHost); - + +#if !DESIGN_AUTOMATION // Always reset current UI document on shutdown DocumentManager.Instance.CurrentUIDocument = null; +#endif } /// @@ -728,7 +753,7 @@ var ws in Workspaces.OfType()) // If there is a current document, then set the run enabled // state based on whether the view just activated is // the same document. - if (DocumentManager.Instance.CurrentUIDocument != null) + if (DocumentManager.Instance.CurrentDBDocument != null) { var newEnabled = newView != null && newView.Document.Equals(DocumentManager.Instance.CurrentDBDocument); @@ -747,7 +772,7 @@ var ws in Workspaces.OfType()) } } - #endregion +#endregion #region Event handlers @@ -761,14 +786,15 @@ private void HandleApplicationDocumentOpened() // If the current document is null, for instance if there are // no documents open, then set the current document, and // present a message telling us where Dynamo is pointing. - if (DocumentManager.Instance.CurrentUIDocument == null) + if (DocumentManager.Instance.CurrentDBDocument == null) { +#if !DESIGN_AUTOMATION var activeUIDocument = DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument; DocumentManager.Instance.CurrentUIDocument = activeUIDocument; if (activeUIDocument != null) DocumentManager.Instance.HandleDocumentActivation(activeUIDocument.ActiveView); - +#endif OnRevitDocumentChanged(); foreach (HomeWorkspaceModel ws in Workspaces.OfType()) @@ -799,6 +825,7 @@ private void HandleApplicationDocumentClosing(Document doc) /// private void HandleApplicationDocumentClosed() { +#if !DESIGN_AUTOMATION // If the active UI document is null, it means that all views have been // closed from all document. Clear our reference, present a warning, // and disable running. @@ -831,6 +858,7 @@ private void HandleApplicationDocumentClosed() { SetRunEnabledBasedOnContext(uiDoc.ActiveView); } +#endif } /// @@ -842,11 +870,12 @@ private void HandleRevitViewActivated() { // If there is no active document, then set it to whatever // document has just been activated - if (DocumentManager.Instance.CurrentUIDocument == null) + if (DocumentManager.Instance.CurrentDBDocument == null) { +#if !DESIGN_AUTOMATION DocumentManager.Instance.CurrentUIDocument = DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument; - +#endif OnRevitDocumentChanged(); InitializeMaterials(); @@ -872,6 +901,7 @@ private void ResetForNewDocument() private static void ShutdownRevitHost() { +#if !DESIGN_AUTOMATION // this method cannot be called without Revit 2014 var exitCommand = RevitCommandId.LookupPostableCommandId(PostableCommand.ExitRevit); var uiApplication = DocumentManager.Instance.CurrentUIApplication; @@ -884,6 +914,7 @@ private static void ShutdownRevitHost() "A command in progress prevented Dynamo from " + "closing revit. Dynamo update will be cancelled."); } +#endif } private void TransactionManager_FailuresRaised(FailuresAccessor failuresAccessor) diff --git a/src/Libraries/RevitNodes/RevitNodeModel.cs b/src/DynamoRevit/Models/RevitNodeModel.cs similarity index 82% rename from src/Libraries/RevitNodes/RevitNodeModel.cs rename to src/DynamoRevit/Models/RevitNodeModel.cs index 96e8d5290b..a5014e3d62 100644 --- a/src/Libraries/RevitNodes/RevitNodeModel.cs +++ b/src/DynamoRevit/Models/RevitNodeModel.cs @@ -1,6 +1,6 @@ -using Dynamo.Graph.Nodes; +using System.Collections.Generic; +using Dynamo.Graph.Nodes; using Newtonsoft.Json; -using System.Collections.Generic; namespace Dynamo.Applications.Models { @@ -11,4 +11,4 @@ public RevitNodeModel() { } [JsonConstructor] public RevitNodeModel(IEnumerable inPorts, IEnumerable outPorts) : base(inPorts, outPorts) { } } -} \ No newline at end of file +} diff --git a/src/DynamoRevit/Properties/AssemblyInfo.cs b/src/DynamoRevit/Properties/AssemblyInfo.cs index 68599b3ba7..58ea1f6a8b 100644 --- a/src/DynamoRevit/Properties/AssemblyInfo.cs +++ b/src/DynamoRevit/Properties/AssemblyInfo.cs @@ -10,4 +10,4 @@ [assembly: Guid("082cab33-cbc7-4e58-ae25-f0962f325d6e")] [assembly: InternalsVisibleTo("RevitTestServices")] [assembly: InternalsVisibleTo("RevitSystemTests")] -[assembly: TypeForwardedTo(typeof(Dynamo.Applications.Models.RevitNodeModel))] \ No newline at end of file +[assembly: InternalsVisibleTo("DADynamoApp")] \ No newline at end of file diff --git a/src/SharedUtilities/ASMPreloader.cs b/src/DynamoRevit/Utilities/ASMPreloader.cs similarity index 100% rename from src/SharedUtilities/ASMPreloader.cs rename to src/DynamoRevit/Utilities/ASMPreloader.cs diff --git a/src/SharedUtilities/DynamoRevitInternalNodes.cs b/src/DynamoRevit/Utilities/DynamoRevitInternalNodes.cs similarity index 100% rename from src/SharedUtilities/DynamoRevitInternalNodes.cs rename to src/DynamoRevit/Utilities/DynamoRevitInternalNodes.cs diff --git a/src/SharedUtilities/DynamoRevitPythonManager.cs b/src/DynamoRevit/Utilities/DynamoRevitPythonManager.cs similarity index 100% rename from src/SharedUtilities/DynamoRevitPythonManager.cs rename to src/DynamoRevit/Utilities/DynamoRevitPythonManager.cs diff --git a/src/SharedUtilities/RevitPathResolver.cs b/src/DynamoRevit/Utilities/RevitPathResolver.cs similarity index 100% rename from src/SharedUtilities/RevitPathResolver.cs rename to src/DynamoRevit/Utilities/RevitPathResolver.cs diff --git a/src/Libraries/RevitNodesUI/RevitNodesUI.csproj b/src/Libraries/RevitNodesUI/RevitNodesUI.csproj index dea49474df..b07225acf5 100644 --- a/src/Libraries/RevitNodesUI/RevitNodesUI.csproj +++ b/src/Libraries/RevitNodesUI/RevitNodesUI.csproj @@ -107,7 +107,7 @@ - + False diff --git a/src/SharedUtilities/SharedUtilities.projitems b/src/SharedUtilities/SharedUtilities.projitems deleted file mode 100644 index c670ed84d9..0000000000 --- a/src/SharedUtilities/SharedUtilities.projitems +++ /dev/null @@ -1,17 +0,0 @@ - - - - $(MSBuildAllProjects);$(MSBuildThisFileFullPath) - true - bcfd5d77-45f8-41a4-b60c-582509b9262b - - - SharedUtilities - - - - - - - - \ No newline at end of file diff --git a/src/SharedUtilities/SharedUtilities.shproj b/src/SharedUtilities/SharedUtilities.shproj deleted file mode 100644 index e6c88ece43..0000000000 --- a/src/SharedUtilities/SharedUtilities.shproj +++ /dev/null @@ -1,13 +0,0 @@ - - - - bcfd5d77-45f8-41a4-b60c-582509b9262b - 14.0 - - - - - - - - From 348ffc6fcb4a927c2b32df6cb920834e09b6f14a Mon Sep 17 00:00:00 2001 From: pinzart90 Date: Wed, 21 May 2025 08:47:52 -0400 Subject: [PATCH 52/70] update --- src/DADynamoApp/DAEntrypoint.cs | 14 ++--- src/DynamoRevit/DynamoRevit.cs | 4 +- src/DynamoRevit/DynamoRevitApp.cs | 27 +++++----- src/DynamoRevit/Models/RevitDynamoModel.cs | 20 +++---- src/DynamoRevit/Utilities/ASMPreloader.cs | 4 +- src/DynamoRevitIcons/DynamoRevitIcons.csproj | 11 ---- src/Libraries/RevitNodesUI/Elements.cs | 19 +++---- src/Libraries/RevitNodesUI/RevitDropDown.cs | 6 +-- src/Libraries/RevitNodesUI/Selection.cs | 6 +-- src/Libraries/RevitNodesUI/SiteLocation.cs | 6 +-- src/Libraries/RevitNodesUI/SunPath.cs | 6 +-- .../RevitServices/Events/ApplicationEvents.cs | 52 ------------------- .../RevitServices/Events/EventHandlerProxy.cs | 4 +- .../RevitServices/Properties/AssemblyInfo.cs | 3 +- .../RevitServices/RevitServices.csproj | 5 -- .../RevitSystemTests.csproj | 1 + .../RevitTestServices/RevitNodeTestBase.cs | 3 +- .../RevitTestServices/RevitSystemTestBase.cs | 4 +- 18 files changed, 61 insertions(+), 134 deletions(-) delete mode 100644 src/Libraries/RevitServices/Events/ApplicationEvents.cs diff --git a/src/DADynamoApp/DAEntrypoint.cs b/src/DADynamoApp/DAEntrypoint.cs index 19443bc5e8..239045db77 100644 --- a/src/DADynamoApp/DAEntrypoint.cs +++ b/src/DADynamoApp/DAEntrypoint.cs @@ -47,9 +47,9 @@ public ExternalDBApplicationResult OnShutdown(ControlledApplication application) AppDomain.CurrentDomain.ProcessExit -= CurrentDomain_ProcessExit; AppDomain.CurrentDomain.AssemblyResolve -= CurrentDomain_AssemblyResolve; - controlledApplication.DocumentClosing -= RevitServices.Events.ApplicationEvents.OnApplicationDocumentClosing; - controlledApplication.DocumentClosed -= RevitServices.Events.ApplicationEvents.OnApplicationDocumentClosed; - controlledApplication.DocumentOpened -= RevitServices.Events.ApplicationEvents.OnApplicationDocumentOpened; + controlledApplication.DocumentClosing -= RevitServices.EventHandler.EventHandlerProxy.Instance.OnApplicationDocumentClosing; + controlledApplication.DocumentClosed -= RevitServices.EventHandler.EventHandlerProxy.Instance.OnApplicationDocumentClosed; + controlledApplication.DocumentOpened -= RevitServices.EventHandler.EventHandlerProxy.Instance.OnApplicationDocumentOpened; return ExternalDBApplicationResult.Succeeded; } @@ -96,10 +96,10 @@ public ExternalDBApplicationResult OnStartup(ControlledApplication application) RevitServices.Transactions.TransactionManager.SetupManager(new RevitServices.Transactions.AutomaticTransactionStrategy()); // TODO: do we need element binding in Design Automations? ElementBinder.IsEnabled = true; - - controlledApplication.DocumentClosing += RevitServices.Events.ApplicationEvents.OnApplicationDocumentClosing; - controlledApplication.DocumentClosed += RevitServices.Events.ApplicationEvents.OnApplicationDocumentClosed; - controlledApplication.DocumentOpened += RevitServices.Events.ApplicationEvents.OnApplicationDocumentOpened; + + controlledApplication.DocumentClosing += RevitServices.EventHandler.EventHandlerProxy.Instance.OnApplicationDocumentClosing; + controlledApplication.DocumentClosed += RevitServices.EventHandler.EventHandlerProxy.Instance.OnApplicationDocumentClosed; + controlledApplication.DocumentOpened += RevitServices.EventHandler.EventHandlerProxy.Instance.OnApplicationDocumentOpened; DesignAutomationBridge.DesignAutomationReadyEvent += HandleDesignAutomationReadyEvent; diff --git a/src/DynamoRevit/DynamoRevit.cs b/src/DynamoRevit/DynamoRevit.cs index 363e785b15..86d6a03d2c 100644 --- a/src/DynamoRevit/DynamoRevit.cs +++ b/src/DynamoRevit/DynamoRevit.cs @@ -548,7 +548,9 @@ private static RevitDynamoModel InitializeCoreModel(DynamoRevitCommandData comma // when Dynamo runs on top of Revit we must load the same version of ASM as revit // so tell Dynamo core we've loaded that version. - var loadedLibGVersion = ASMPrealoaderUtils.PreloadAsmFromRevit(DynamoRevitApp.ControlledApplication, DynamoRevitApp.DynamoCorePath); + var asmLocation = DynamoRevitApp.ControlledApplication.SharedComponentsLocation; + + var loadedLibGVersion = ASMPrealoaderUtils.PreloadAsmFromRevit(asmLocation, DynamoRevitApp.DynamoCorePath); return RevitDynamoModel.Start( new RevitDynamoModel.RevitStartConfiguration() diff --git a/src/DynamoRevit/DynamoRevitApp.cs b/src/DynamoRevit/DynamoRevitApp.cs index 8bb23a233f..84786f1625 100644 --- a/src/DynamoRevit/DynamoRevitApp.cs +++ b/src/DynamoRevit/DynamoRevitApp.cs @@ -93,7 +93,6 @@ private static string GetDynamoRoot(string dynamoRevitRoot) private static string dynamopath; private static readonly Queue idleActionQueue = new Queue(10); - private static EventHandlerProxy proxy; private AddInCommandBinding dynamoCommand; private Result loadDependentComponents() @@ -253,7 +252,7 @@ public static void AddIdleAction(Action a) public static EventHandlerProxy EventHandlerProxy { - get { return proxy; } + get { return EventHandlerProxy.Instance; } } // should be handled by the ModelUpdater class. But there are some @@ -284,28 +283,26 @@ private void SubscribeApplicationEvents() { UIControlledApplication.Idling += OnApplicationIdle; - proxy = new EventHandlerProxy(); + UIControlledApplication.ViewActivated += EventHandlerProxy.Instance.OnApplicationViewActivated; + UIControlledApplication.ViewActivating += EventHandlerProxy.Instance.OnApplicationViewActivating; - UIControlledApplication.ViewActivated += proxy.OnApplicationViewActivated; - UIControlledApplication.ViewActivating += proxy.OnApplicationViewActivating; - - ControlledApplication.DocumentClosing += proxy.OnApplicationDocumentClosing; - ControlledApplication.DocumentClosed += proxy.OnApplicationDocumentClosed; - ControlledApplication.DocumentOpened += proxy.OnApplicationDocumentOpened; + ControlledApplication.DocumentClosing += EventHandlerProxy.Instance.OnApplicationDocumentClosing; + ControlledApplication.DocumentClosed += EventHandlerProxy.Instance.OnApplicationDocumentClosed; + ControlledApplication.DocumentOpened += EventHandlerProxy.Instance.OnApplicationDocumentOpened; } private void UnsubscribeApplicationEvents() { UIControlledApplication.Idling -= OnApplicationIdle; - UIControlledApplication.ViewActivated -= proxy.OnApplicationViewActivated; - UIControlledApplication.ViewActivating -= proxy.OnApplicationViewActivating; + UIControlledApplication.ViewActivated -= EventHandlerProxy.Instance.OnApplicationViewActivated; + UIControlledApplication.ViewActivating -= EventHandlerProxy.Instance.OnApplicationViewActivating; - ControlledApplication.DocumentClosing -= proxy.OnApplicationDocumentClosing; - ControlledApplication.DocumentClosed -= proxy.OnApplicationDocumentClosed; - ControlledApplication.DocumentOpened -= proxy.OnApplicationDocumentOpened; + ControlledApplication.DocumentClosing -= EventHandlerProxy.Instance.OnApplicationDocumentClosing; + ControlledApplication.DocumentClosed -= EventHandlerProxy.Instance.OnApplicationDocumentClosed; + ControlledApplication.DocumentOpened -= EventHandlerProxy.Instance.OnApplicationDocumentOpened; - proxy = null; + EventHandlerProxy.Instance = null; } private void SubscribeAssemblyEvents() diff --git a/src/DynamoRevit/Models/RevitDynamoModel.cs b/src/DynamoRevit/Models/RevitDynamoModel.cs index 6304c94dea..d1f78e17c5 100644 --- a/src/DynamoRevit/Models/RevitDynamoModel.cs +++ b/src/DynamoRevit/Models/RevitDynamoModel.cs @@ -517,11 +517,11 @@ private void SubscribeApplicationEvents(DynamoRevitCommandData commandData) return; } - DynamoRevitApp.EventHandlerProxy.ViewActivating += OnApplicationViewActivating; - DynamoRevitApp.EventHandlerProxy.ViewActivated += OnApplicationViewActivated; - DynamoRevitApp.EventHandlerProxy.DocumentClosing += OnApplicationDocumentClosing; - DynamoRevitApp.EventHandlerProxy.DocumentClosed += OnApplicationDocumentClosed; - DynamoRevitApp.EventHandlerProxy.DocumentOpened += OnApplicationDocumentOpened; + RevitServices.EventHandler.EventHandlerProxy.Instance.ViewActivating += OnApplicationViewActivating; + RevitServices.EventHandler.EventHandlerProxy.Instance.ViewActivated += OnApplicationViewActivated; + RevitServices.EventHandler.EventHandlerProxy.Instance.DocumentClosing += OnApplicationDocumentClosing; + RevitServices.EventHandler.EventHandlerProxy.Instance.DocumentClosed += OnApplicationDocumentClosed; + RevitServices.EventHandler.EventHandlerProxy.Instance.DocumentOpened += OnApplicationDocumentOpened; hasRegisteredApplicationEvents = true; } @@ -533,11 +533,11 @@ private void UnsubscribeApplicationEvents(DynamoRevitCommandData commandData) return; } - DynamoRevitApp.EventHandlerProxy.ViewActivating -= OnApplicationViewActivating; - DynamoRevitApp.EventHandlerProxy.ViewActivated -= OnApplicationViewActivated; - DynamoRevitApp.EventHandlerProxy.DocumentClosing -= OnApplicationDocumentClosing; - DynamoRevitApp.EventHandlerProxy.DocumentClosed -= OnApplicationDocumentClosed; - DynamoRevitApp.EventHandlerProxy.DocumentOpened -= OnApplicationDocumentOpened; + RevitServices.EventHandler.EventHandlerProxy.Instance.ViewActivating -= OnApplicationViewActivating; + RevitServices.EventHandler.EventHandlerProxy.Instance.ViewActivated -= OnApplicationViewActivated; + RevitServices.EventHandler.EventHandlerProxy.Instance.DocumentClosing -= OnApplicationDocumentClosing; + RevitServices.EventHandler.EventHandlerProxy.Instance.DocumentClosed -= OnApplicationDocumentClosed; + RevitServices.EventHandler.EventHandlerProxy.Instance.DocumentOpened -= OnApplicationDocumentOpened; hasRegisteredApplicationEvents = false; } diff --git a/src/DynamoRevit/Utilities/ASMPreloader.cs b/src/DynamoRevit/Utilities/ASMPreloader.cs index 078ba87728..24c860cf06 100644 --- a/src/DynamoRevit/Utilities/ASMPreloader.cs +++ b/src/DynamoRevit/Utilities/ASMPreloader.cs @@ -46,10 +46,8 @@ internal static Version PreloadLibGVersion(string preloaderLocation) return new Version(); } - internal static Version PreloadAsmFromRevit(ControlledApplication controlledApplication, string dynamoCorePath) + internal static Version PreloadAsmFromRevit(string asmLocation, string dynamoCorePath) { - var asmLocation = controlledApplication.SharedComponentsLocation; - Version libGVersion = findRevitASMVersion(asmLocation); // Get the corresponding libG preloader location for the target ASM loading version. // If there is exact match preloader version to the target ASM version, use it, diff --git a/src/DynamoRevitIcons/DynamoRevitIcons.csproj b/src/DynamoRevitIcons/DynamoRevitIcons.csproj index ce737eeea4..d5885348e8 100644 --- a/src/DynamoRevitIcons/DynamoRevitIcons.csproj +++ b/src/DynamoRevitIcons/DynamoRevitIcons.csproj @@ -7,16 +7,6 @@ prompt 4 - - full - false - TRACE;DEBUG;ENABLE_DYNAMO_SCHEDULER - - - pdbonly - true - TRACE - true @@ -28,7 +18,6 @@ AssemblyFiles="$(SolutionDir)\AssemblySharedInfoGenerator\bin\AssemblyInfoGenerator.dll"> inPorts, IEnumerable outPorts) : base(inPorts, outPorts) { #if !DESIGN_AUTOMATION - RevitServices.Events.ApplicationEvents.ViewActivated += RevitDynamoModel_RevitDocumentChanged; + RevitServices.EventHandler.EventHandlerProxy.Instance.ViewActivated += RevitDynamoModel_RevitDocumentChanged; #endif - RevitServices.Events.ApplicationEvents.DocumentOpened += RevitDynamoModel_RevitDocumentChanged; + RevitServices.EventHandler.EventHandlerProxy.Instance.DocumentOpened += RevitDynamoModel_RevitDocumentChanged; RevitServicesUpdater.Instance.ElementsUpdated += RevitServicesUpdaterOnElementsUpdated; RevitDynamoModel_RevitDocumentChanged(null, null); @@ -313,9 +306,9 @@ public ElementsInView(IEnumerable inPorts, IEnumerable out public override void Dispose() { #if !DESIGN_AUTOMATION - RevitServices.Events.ApplicationEvents.ViewActivated -= RevitDynamoModel_RevitDocumentChanged; + RevitServices.EventHandler.EventHandlerProxy.Instance.ViewActivated -= RevitDynamoModel_RevitDocumentChanged; #endif - RevitServices.Events.ApplicationEvents.DocumentOpened -= RevitDynamoModel_RevitDocumentChanged; + RevitServices.EventHandler.EventHandlerProxy.Instance.DocumentOpened -= RevitDynamoModel_RevitDocumentChanged; RevitServicesUpdater.Instance.ElementsUpdated -= RevitServicesUpdaterOnElementsUpdated; diff --git a/src/Libraries/RevitNodesUI/RevitDropDown.cs b/src/Libraries/RevitNodesUI/RevitDropDown.cs index 06cb7e4541..f32bebec47 100644 --- a/src/Libraries/RevitNodesUI/RevitDropDown.cs +++ b/src/Libraries/RevitNodesUI/RevitDropDown.cs @@ -48,14 +48,14 @@ public abstract class RevitDropDownBase : DSDropDownBase protected RevitDropDownBase(string value) : base(value) { RevitServicesUpdater.Instance.ElementsUpdated += Updater_ElementsUpdated; - RevitServices.Events.ApplicationEvents.DocumentOpened += Controller_RevitDocumentChanged; + RevitServices.EventHandler.EventHandlerProxy.Instance.DocumentOpened += Controller_RevitDocumentChanged; } [JsonConstructor] public RevitDropDownBase(string value, IEnumerable inPorts, IEnumerable outPorts) : base(value, inPorts, outPorts) { RevitServicesUpdater.Instance.ElementsUpdated += Updater_ElementsUpdated; - RevitServices.Events.ApplicationEvents.DocumentOpened += Controller_RevitDocumentChanged; + RevitServices.EventHandler.EventHandlerProxy.Instance.DocumentOpened += Controller_RevitDocumentChanged; } void Controller_RevitDocumentChanged(object sender, EventArgs e) @@ -90,7 +90,7 @@ private void Updater_ElementsUpdated(object sender, ElementUpdateEventArgs e) public override void Dispose() { RevitServicesUpdater.Instance.ElementsUpdated -= Updater_ElementsUpdated; - RevitServices.Events.ApplicationEvents.DocumentOpened -= Controller_RevitDocumentChanged; + RevitServices.EventHandler.EventHandlerProxy.Instance.DocumentOpened -= Controller_RevitDocumentChanged; base.Dispose(); } diff --git a/src/Libraries/RevitNodesUI/Selection.cs b/src/Libraries/RevitNodesUI/Selection.cs index a2eecc2011..081ab4b91b 100644 --- a/src/Libraries/RevitNodesUI/Selection.cs +++ b/src/Libraries/RevitNodesUI/Selection.cs @@ -161,7 +161,7 @@ protected RevitSelection(SelectionType selectionType, : base(selectionType, selectionObjectType, message, prefix) { RevitServicesUpdater.Instance.ElementsUpdated += Updater_ElementsUpdated; - DynamoRevitApp.EventHandlerProxy.DocumentOpened += Controller_RevitDocumentChanged; + RevitServices.EventHandler.EventHandlerProxy.Instance.DocumentOpened += Controller_RevitDocumentChanged; } [JsonConstructor] @@ -171,7 +171,7 @@ public RevitSelection(SelectionType selectionType, : base(selectionType, selectionObjectType, message, prefix, selectionIdentifier, inPorts, outPorts) { RevitServicesUpdater.Instance.ElementsUpdated += Updater_ElementsUpdated; - DynamoRevitApp.EventHandlerProxy.DocumentOpened += Controller_RevitDocumentChanged; + RevitServices.EventHandler.EventHandlerProxy.Instance.DocumentOpened += Controller_RevitDocumentChanged; } #endregion @@ -192,7 +192,7 @@ public override void Dispose() base.Dispose(); RevitServicesUpdater.Instance.ElementsUpdated -= Updater_ElementsUpdated; - DynamoRevitApp.EventHandlerProxy.DocumentOpened -= Controller_RevitDocumentChanged; + RevitServices.EventHandler.EventHandlerProxy.Instance.DocumentOpened -= Controller_RevitDocumentChanged; if (revitDynamoModel != null) { diff --git a/src/Libraries/RevitNodesUI/SiteLocation.cs b/src/Libraries/RevitNodesUI/SiteLocation.cs index 4dd3a40920..37c720b03b 100644 --- a/src/Libraries/RevitNodesUI/SiteLocation.cs +++ b/src/Libraries/RevitNodesUI/SiteLocation.cs @@ -51,7 +51,7 @@ public SiteLocation() ArgumentLacing = LacingStrategy.Disabled; - RevitServices.Events.ApplicationEvents.DocumentOpened += model_RevitDocumentChanged; + RevitServices.EventHandler.EventHandlerProxy.Instance.DocumentOpened += model_RevitDocumentChanged; RevitServicesUpdater.Instance.ElementsUpdated += RevitServicesUpdater_ElementsUpdated; #if !DESIGN_AUTOMATION @@ -67,7 +67,7 @@ public SiteLocation(IEnumerable inPorts, IEnumerable outPo ArgumentLacing = LacingStrategy.Disabled; - RevitServices.Events.ApplicationEvents.DocumentOpened += model_RevitDocumentChanged; + RevitServices.EventHandler.EventHandlerProxy.Instance.DocumentOpened += model_RevitDocumentChanged; RevitServicesUpdater.Instance.ElementsUpdated += RevitServicesUpdater_ElementsUpdated; #if !DESIGN_AUTOMATION @@ -79,7 +79,7 @@ public SiteLocation(IEnumerable inPorts, IEnumerable outPo public override void Dispose() { - RevitServices.Events.ApplicationEvents.DocumentOpened -= model_RevitDocumentChanged; + RevitServices.EventHandler.EventHandlerProxy.Instance.DocumentOpened -= model_RevitDocumentChanged; RevitServicesUpdater.Instance.ElementsUpdated -= RevitServicesUpdater_ElementsUpdated; base.Dispose(); } diff --git a/src/Libraries/RevitNodesUI/SunPath.cs b/src/Libraries/RevitNodesUI/SunPath.cs index d0d55f2473..82d1dfb2be 100644 --- a/src/Libraries/RevitNodesUI/SunPath.cs +++ b/src/Libraries/RevitNodesUI/SunPath.cs @@ -34,7 +34,7 @@ public SunSettings() RevitServicesUpdater.Instance.ElementsUpdated += Updater_ElementsUpdated; #if !DESIGN_AUTOMATION - DynamoRevitApp.EventHandlerProxy.ViewActivated += CurrentUIApplication_ViewActivated; + RevitServices.EventHandler.EventHandlerProxy.Instance.ViewActivated += CurrentUIApplication_ViewActivated; DynamoRevitApp.AddIdleAction(() => CurrentUIApplicationOnViewActivated()); #endif } @@ -44,7 +44,7 @@ public SunSettings(IEnumerable inPorts, IEnumerable outPor { RevitServicesUpdater.Instance.ElementsUpdated += Updater_ElementsUpdated; #if !DESIGN_AUTOMATION - DynamoRevitApp.EventHandlerProxy.ViewActivated += CurrentUIApplication_ViewActivated; + RevitServices.EventHandler.EventHandlerProxy.Instance.ViewActivated += CurrentUIApplication_ViewActivated; DynamoRevitApp.AddIdleAction(() => CurrentUIApplicationOnViewActivated()); #endif } @@ -53,7 +53,7 @@ public override void Dispose() { RevitServicesUpdater.Instance.ElementsUpdated -= Updater_ElementsUpdated; #if !DESIGN_AUTOMATION - DynamoRevitApp.EventHandlerProxy.ViewActivated -= CurrentUIApplication_ViewActivated; + RevitServices.EventHandler.EventHandlerProxy.Instance.ViewActivated -= CurrentUIApplication_ViewActivated; #endif base.Dispose(); } diff --git a/src/Libraries/RevitServices/Events/ApplicationEvents.cs b/src/Libraries/RevitServices/Events/ApplicationEvents.cs deleted file mode 100644 index 57bf6b57d1..0000000000 --- a/src/Libraries/RevitServices/Events/ApplicationEvents.cs +++ /dev/null @@ -1,52 +0,0 @@ -using Autodesk.Revit.DB.Events; -using System; - -namespace RevitServices.Events -{ - internal static class ApplicationEvents - { - public static event EventHandler DocumentOpened; - public static event EventHandler DocumentClosing; - public static event EventHandler DocumentClosed; -#if !DESIGN_AUTOMATION - public static event EventHandler ViewActivating; - public static event EventHandler ViewActivated; -#endif - - public static void OnApplicationDocumentOpened(object sender, DocumentOpenedEventArgs args) - { - InvokeEventHandler(DocumentOpened, sender, args); - } - - public static void OnApplicationDocumentClosing(object sender, DocumentClosingEventArgs args) - { - InvokeEventHandler(DocumentClosing, sender, args); - } - - public static void OnApplicationDocumentClosed(object sender, DocumentClosedEventArgs args) - { - InvokeEventHandler(DocumentClosed, sender, args); - } - -#if !DESIGN_AUTOMATION - public static void OnApplicationViewActivating(object sender, Autodesk.Revit.UI.Events.ViewActivatingEventArgs args) - { - InvokeEventHandler(ViewActivating, sender, args); - } - - public static void OnApplicationViewActivated(object sender, Autodesk.Revit.UI.Events.ViewActivatedEventArgs args) - { - InvokeEventHandler(ViewActivated, sender, args); - } -#endif - - private static void InvokeEventHandler(EventHandler eventHandler, object sender, T args) where T : EventArgs - { - var tempHandler = eventHandler; - if (tempHandler != null) - { - tempHandler(sender, args); - } - } - } -} diff --git a/src/Libraries/RevitServices/Events/EventHandlerProxy.cs b/src/Libraries/RevitServices/Events/EventHandlerProxy.cs index 8fc79a5f29..e80e72b116 100644 --- a/src/Libraries/RevitServices/Events/EventHandlerProxy.cs +++ b/src/Libraries/RevitServices/Events/EventHandlerProxy.cs @@ -7,7 +7,7 @@ namespace RevitServices.EventHandler /// This is a event handler proxy class to serve as a proxy between the event publisher and /// the event subscriber /// - [Obsolete("Obsolete class, please use RevitServices.Events.ApplicationEvents instead.")] + [Obsolete("This class will be made internal")] public class EventHandlerProxy { public event EventHandler DocumentOpened; @@ -18,6 +18,8 @@ public class EventHandlerProxy public event EventHandler ViewActivated; #endif + internal static EventHandlerProxy Instance = new(); + public void OnApplicationDocumentOpened(object sender, DocumentOpenedEventArgs args) { InvokeEventHandler(DocumentOpened, sender, args); diff --git a/src/Libraries/RevitServices/Properties/AssemblyInfo.cs b/src/Libraries/RevitServices/Properties/AssemblyInfo.cs index 5b948fdf94..a0d3de35aa 100644 --- a/src/Libraries/RevitServices/Properties/AssemblyInfo.cs +++ b/src/Libraries/RevitServices/Properties/AssemblyInfo.cs @@ -12,4 +12,5 @@ [assembly: Guid("026be738-81b6-4a11-bc14-36ee3f718921")] [assembly: InternalsVisibleTo("DADynamoApp")] [assembly: InternalsVisibleTo("RevitNodes")] -[assembly: InternalsVisibleTo("DSRevitNodesUI")] \ No newline at end of file +[assembly: InternalsVisibleTo("DSRevitNodesUI")] +[assembly: InternalsVisibleTo("DynamoRevitDS")] \ No newline at end of file diff --git a/src/Libraries/RevitServices/RevitServices.csproj b/src/Libraries/RevitServices/RevitServices.csproj index 04519efa4c..27c31a3e94 100644 --- a/src/Libraries/RevitServices/RevitServices.csproj +++ b/src/Libraries/RevitServices/RevitServices.csproj @@ -25,11 +25,6 @@ limitations under the License. true - - $(PACKAGESPATH)\DynamoVisualProgramming.DynamoServices\lib\netstandard2.0\DynamoServices.dll - $(DYNAMOBUILDPATH)\DynamoServices.dll - False - $(PACKAGESPATH)\Newtonsoft.Json\lib\netstandard2.0\Newtonsoft.Json.dll False diff --git a/test/Libraries/RevitIntegrationTests/RevitSystemTests.csproj b/test/Libraries/RevitIntegrationTests/RevitSystemTests.csproj index c92fdc62ab..8cc3124a4c 100644 --- a/test/Libraries/RevitIntegrationTests/RevitSystemTests.csproj +++ b/test/Libraries/RevitIntegrationTests/RevitSystemTests.csproj @@ -56,6 +56,7 @@ + diff --git a/test/Libraries/RevitTestServices/RevitNodeTestBase.cs b/test/Libraries/RevitTestServices/RevitNodeTestBase.cs index 1be498945d..360078c97f 100644 --- a/test/Libraries/RevitTestServices/RevitNodeTestBase.cs +++ b/test/Libraries/RevitTestServices/RevitNodeTestBase.cs @@ -43,7 +43,8 @@ public override void Setup() protected override TestSessionConfiguration GetTestSessionConfiguration() { var asmLocation = AppDomain.CurrentDomain.BaseDirectory; - return new TestSessionConfiguration(Dynamo.Applications.DynamoRevitApp.DynamoCorePath, DynamoRevit.PreloadAsmFromRevit()); + Version version = ASMPrealoaderUtils.PreloadAsmFromRevit(DynamoRevitApp.ControlledApplication.SharedComponentsLocation, DynamoRevitApp.DynamoCorePath); + return new TestSessionConfiguration(Dynamo.Applications.DynamoRevitApp.DynamoCorePath, version); } private static void SetupTransactionManager() diff --git a/test/Libraries/RevitTestServices/RevitSystemTestBase.cs b/test/Libraries/RevitTestServices/RevitSystemTestBase.cs index 998a0cf354..86a893f2ab 100644 --- a/test/Libraries/RevitTestServices/RevitSystemTestBase.cs +++ b/test/Libraries/RevitTestServices/RevitSystemTestBase.cs @@ -284,13 +284,13 @@ protected override void StartDynamo(TestSessionConfiguration testConfig) // Init DynamoTestPath to get DynamoSettings.xml which under user data folder PreferenceSettings.DynamoTestPath = string.Empty; //preload ASM and instruct dynamo to load that version of libG. - var requestedLibGVersion = DynamoRevit.PreloadAsmFromRevit(); + var requestedLibGVersion = ASMPrealoaderUtils.PreloadAsmFromRevit(DynamoRevitApp.ControlledApplication.SharedComponentsLocation, testConfig.DynamoCorePath); DynamoRevit.RevitDynamoModel = RevitDynamoModel.Start( new RevitDynamoModel.RevitStartConfiguration() { StartInTestMode = true, - GeometryFactoryPath = DynamoRevit.GetGeometryFactoryPath(testConfig.DynamoCorePath, requestedLibGVersion), + GeometryFactoryPath = ASMPrealoaderUtils.GetGeometryFactoryPath(testConfig.DynamoCorePath, requestedLibGVersion), DynamoCorePath = testConfig.DynamoCorePath, PathResolver = revitTestPathResolver, Context = DynamoRevit.GetRevitContext(commandData), From 2f5e37ce19ff254a6eade3c99a018f1193797fc7 Mon Sep 17 00:00:00 2001 From: pinzart90 Date: Wed, 21 May 2025 08:57:11 -0400 Subject: [PATCH 53/70] Update DAEntrypoint.cs --- src/DADynamoApp/DAEntrypoint.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/DADynamoApp/DAEntrypoint.cs b/src/DADynamoApp/DAEntrypoint.cs index 239045db77..15952475d6 100644 --- a/src/DADynamoApp/DAEntrypoint.cs +++ b/src/DADynamoApp/DAEntrypoint.cs @@ -153,7 +153,7 @@ public void HandleDesignAutomationReadyEvent(object sender, DesignAutomationRead // Local Change //var geometryFactoryPath = @"C:\\Program Files\\Autodesk\\Revit 2025"; - var loadedLibGVersion = ASMPrealoaderUtils.PreloadAsmFromRevit(controlledApplication, DynamoPath); + var loadedLibGVersion = ASMPrealoaderUtils.PreloadAsmFromRevit(controlledApplication.SharedComponentsLocation, DynamoPath); var geometryFactoryPath = ASMPrealoaderUtils.GetGeometryFactoryPath(DynamoPath, loadedLibGVersion); PreInstallPythonDependencies(); From c59fdf6c70fb170864ca4b1de5389cb5ea9342f9 Mon Sep 17 00:00:00 2001 From: pinzart90 Date: Wed, 21 May 2025 09:09:57 -0400 Subject: [PATCH 54/70] update --- src/DADynamoApp/DAEntrypoint.cs | 2 +- src/Libraries/RevitServices/Persistence/DocumentManager.cs | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/DADynamoApp/DAEntrypoint.cs b/src/DADynamoApp/DAEntrypoint.cs index 15952475d6..9a0dd4e586 100644 --- a/src/DADynamoApp/DAEntrypoint.cs +++ b/src/DADynamoApp/DAEntrypoint.cs @@ -148,7 +148,7 @@ public void HandleDesignAutomationReadyEvent(object sender, DesignAutomationRead var userDataFolder = Path.Combine(dynTempDir, "Dynamo Revit"); var commonDataFolder = Path.Combine(dynTempDir, "Dynamo"); - DocumentManager.Instance.PrepareForAutomation(app); + DocumentManager.Instance.PrepareForDesignAutomation(app); // Local Change //var geometryFactoryPath = @"C:\\Program Files\\Autodesk\\Revit 2025"; diff --git a/src/Libraries/RevitServices/Persistence/DocumentManager.cs b/src/Libraries/RevitServices/Persistence/DocumentManager.cs index f95f0e4499..69ef009ac4 100644 --- a/src/Libraries/RevitServices/Persistence/DocumentManager.cs +++ b/src/Libraries/RevitServices/Persistence/DocumentManager.cs @@ -188,7 +188,11 @@ public static void Regenerate() } } - public void PrepareForAutomation(Application app) + /// + /// Setup the CurrentDBDocument and CurrentApplication. + /// + /// + internal void PrepareForDesignAutomation(Application app) { if (app == null) { From 9b3e6bf7da3243f00a7839883a074c62b649a12e Mon Sep 17 00:00:00 2001 From: pinzart90 Date: Wed, 21 May 2025 09:14:42 -0400 Subject: [PATCH 55/70] Update RevitServices.csproj --- src/Libraries/RevitServices/RevitServices.csproj | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/Libraries/RevitServices/RevitServices.csproj b/src/Libraries/RevitServices/RevitServices.csproj index 27c31a3e94..bec2b53a31 100644 --- a/src/Libraries/RevitServices/RevitServices.csproj +++ b/src/Libraries/RevitServices/RevitServices.csproj @@ -25,10 +25,6 @@ limitations under the License. true - - $(PACKAGESPATH)\Newtonsoft.Json\lib\netstandard2.0\Newtonsoft.Json.dll - False - $(REVITAPI)\RevitAPI.dll False From c1ed0fa2afc90cc6368babf6e7f08543ea80d392 Mon Sep 17 00:00:00 2001 From: pinzart90 Date: Wed, 21 May 2025 09:17:43 -0400 Subject: [PATCH 56/70] Update RevitServices.csproj --- src/Libraries/RevitServices/RevitServices.csproj | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/Libraries/RevitServices/RevitServices.csproj b/src/Libraries/RevitServices/RevitServices.csproj index bec2b53a31..2393f73bc4 100644 --- a/src/Libraries/RevitServices/RevitServices.csproj +++ b/src/Libraries/RevitServices/RevitServices.csproj @@ -56,10 +56,7 @@ limitations under the License. - - - - + From c7217ff9e7acaf487f192b37826343a9deff55af Mon Sep 17 00:00:00 2001 From: pinzart90 Date: Wed, 21 May 2025 09:20:01 -0400 Subject: [PATCH 57/70] Update DocumentManager.cs --- src/Libraries/RevitServices/Persistence/DocumentManager.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Libraries/RevitServices/Persistence/DocumentManager.cs b/src/Libraries/RevitServices/Persistence/DocumentManager.cs index 69ef009ac4..6c853e3cf6 100644 --- a/src/Libraries/RevitServices/Persistence/DocumentManager.cs +++ b/src/Libraries/RevitServices/Persistence/DocumentManager.cs @@ -156,7 +156,7 @@ public Document CurrentDBDocument { /// /// Provides the current Application /// - public Application CurrentApplication { get; set; } + internal Application CurrentApplication { get; set; } #if !DESIGN_AUTOMATION /// From 1f3f14ff1dccb3adebfe5593e36690b3d4f80772 Mon Sep 17 00:00:00 2001 From: pinzart90 Date: Tue, 4 Nov 2025 14:38:32 -0500 Subject: [PATCH 58/70] update for latest master --- src/Config/CS_SDK.props | 4 +- src/Config/packages_versions.props | 2 +- src/DADynamoApp/DADynamoApp.csproj | 7 +-- src/DynamoRevit.DA.sln | 60 +++++++++---------- src/DynamoRevit/DynamoRevit.csproj | 4 +- .../RevitNodes/Elements/AdaptiveComponent.cs | 2 +- .../Elements/Views/StructuralPlanView.cs | 2 +- 7 files changed, 40 insertions(+), 41 deletions(-) diff --git a/src/Config/CS_SDK.props b/src/Config/CS_SDK.props index 231c05456e..072b747ad6 100644 --- a/src/Config/CS_SDK.props +++ b/src/Config/CS_SDK.props @@ -4,9 +4,9 @@ x64 false - NET80;NET80_DA;NET100 + NET80;NET10_DA;NET100 net8.0-windows - net8.0-windows + net10.0-windows net10.0-windows 17.0 Preview Release diff --git a/src/Config/packages_versions.props b/src/Config/packages_versions.props index 8dee173b3b..4878314eb8 100644 --- a/src/Config/packages_versions.props +++ b/src/Config/packages_versions.props @@ -14,7 +14,7 @@ 3.0.1.4707 4.0.9405.33709 - net10.0 + net10.0 1.2.2 diff --git a/src/DADynamoApp/DADynamoApp.csproj b/src/DADynamoApp/DADynamoApp.csproj index ba8a99a20c..53db8c326d 100644 --- a/src/DADynamoApp/DADynamoApp.csproj +++ b/src/DADynamoApp/DADynamoApp.csproj @@ -4,7 +4,6 @@ - net8.0-windows enable enable false @@ -27,9 +26,9 @@ - + - + runtime @@ -53,6 +52,6 @@ - + diff --git a/src/DynamoRevit.DA.sln b/src/DynamoRevit.DA.sln index 5ef1122e35..a6c778b0fc 100644 --- a/src/DynamoRevit.DA.sln +++ b/src/DynamoRevit.DA.sln @@ -46,38 +46,38 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DynamoRevit", "DynamoRevit\ EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|NET80_DA = Debug|NET80_DA - Release|NET80_DA = Release|NET80_DA + Debug|NET10_DA = Debug|NET10_DA + Release|NET10_DA = Release|NET10_DA EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {0BC2A611-BD0E-4FCC-A1DE-81F14ED369B2}.Debug|NET80_DA.ActiveCfg = Debug|NET80_DA - {0BC2A611-BD0E-4FCC-A1DE-81F14ED369B2}.Debug|NET80_DA.Build.0 = Debug|NET80_DA - {0BC2A611-BD0E-4FCC-A1DE-81F14ED369B2}.Release|NET80_DA.ActiveCfg = Release|NET80_DA - {0BC2A611-BD0E-4FCC-A1DE-81F14ED369B2}.Release|NET80_DA.Build.0 = Release|NET80_DA - {75940ACC-3708-4526-8D91-7E3365BAF682}.Debug|NET80_DA.ActiveCfg = Debug|NET80_DA - {75940ACC-3708-4526-8D91-7E3365BAF682}.Debug|NET80_DA.Build.0 = Debug|NET80_DA - {75940ACC-3708-4526-8D91-7E3365BAF682}.Release|NET80_DA.ActiveCfg = Release|NET80_DA - {75940ACC-3708-4526-8D91-7E3365BAF682}.Release|NET80_DA.Build.0 = Release|NET80_DA - {E4701F9E-41AB-4044-8166-85D924FEB632}.Debug|NET80_DA.ActiveCfg = Debug|NET80_DA - {E4701F9E-41AB-4044-8166-85D924FEB632}.Debug|NET80_DA.Build.0 = Debug|NET80_DA - {E4701F9E-41AB-4044-8166-85D924FEB632}.Release|NET80_DA.ActiveCfg = Release|NET80_DA - {E4701F9E-41AB-4044-8166-85D924FEB632}.Release|NET80_DA.Build.0 = Release|NET80_DA - {06B9E5B0-7C50-4351-9D88-E159DC25755F}.Debug|NET80_DA.ActiveCfg = Debug|NET80_DA - {06B9E5B0-7C50-4351-9D88-E159DC25755F}.Debug|NET80_DA.Build.0 = Debug|NET80_DA - {06B9E5B0-7C50-4351-9D88-E159DC25755F}.Release|NET80_DA.ActiveCfg = Release|NET80_DA - {06B9E5B0-7C50-4351-9D88-E159DC25755F}.Release|NET80_DA.Build.0 = Release|NET80_DA - {133FC760-5699-46D9-BEA6-E816B5F01016}.Debug|NET80_DA.ActiveCfg = Debug|NET80_DA - {133FC760-5699-46D9-BEA6-E816B5F01016}.Debug|NET80_DA.Build.0 = Debug|NET80_DA - {133FC760-5699-46D9-BEA6-E816B5F01016}.Release|NET80_DA.ActiveCfg = Release|NET80_DA - {133FC760-5699-46D9-BEA6-E816B5F01016}.Release|NET80_DA.Build.0 = Release|NET80_DA - {66A0E1C8-2514-48B7-8406-536983F57F88}.Debug|NET80_DA.ActiveCfg = Debug|NET80_DA - {66A0E1C8-2514-48B7-8406-536983F57F88}.Debug|NET80_DA.Build.0 = Debug|NET80_DA - {66A0E1C8-2514-48B7-8406-536983F57F88}.Release|NET80_DA.ActiveCfg = Release|NET80_DA - {66A0E1C8-2514-48B7-8406-536983F57F88}.Release|NET80_DA.Build.0 = Release|NET80_DA - {BD7126B6-E716-4024-854F-6DA2CFA25B84}.Debug|NET80_DA.ActiveCfg = Debug|NET80_DA - {BD7126B6-E716-4024-854F-6DA2CFA25B84}.Debug|NET80_DA.Build.0 = Debug|NET80_DA - {BD7126B6-E716-4024-854F-6DA2CFA25B84}.Release|NET80_DA.ActiveCfg = Release|NET80_DA - {BD7126B6-E716-4024-854F-6DA2CFA25B84}.Release|NET80_DA.Build.0 = Release|NET80_DA + {0BC2A611-BD0E-4FCC-A1DE-81F14ED369B2}.Debug|NET10_DA.ActiveCfg = Debug|NET10_DA + {0BC2A611-BD0E-4FCC-A1DE-81F14ED369B2}.Debug|NET10_DA.Build.0 = Debug|NET10_DA + {0BC2A611-BD0E-4FCC-A1DE-81F14ED369B2}.Release|NET10_DA.ActiveCfg = Release|NET10_DA + {0BC2A611-BD0E-4FCC-A1DE-81F14ED369B2}.Release|NET10_DA.Build.0 = Release|NET10_DA + {75940ACC-3708-4526-8D91-7E3365BAF682}.Debug|NET10_DA.ActiveCfg = Debug|NET10_DA + {75940ACC-3708-4526-8D91-7E3365BAF682}.Debug|NET10_DA.Build.0 = Debug|NET10_DA + {75940ACC-3708-4526-8D91-7E3365BAF682}.Release|NET10_DA.ActiveCfg = Release|NET10_DA + {75940ACC-3708-4526-8D91-7E3365BAF682}.Release|NET10_DA.Build.0 = Release|NET10_DA + {E4701F9E-41AB-4044-8166-85D924FEB632}.Debug|NET10_DA.ActiveCfg = Debug|NET10_DA + {E4701F9E-41AB-4044-8166-85D924FEB632}.Debug|NET10_DA.Build.0 = Debug|NET10_DA + {E4701F9E-41AB-4044-8166-85D924FEB632}.Release|NET10_DA.ActiveCfg = Release|NET10_DA + {E4701F9E-41AB-4044-8166-85D924FEB632}.Release|NET10_DA.Build.0 = Release|NET10_DA + {06B9E5B0-7C50-4351-9D88-E159DC25755F}.Debug|NET10_DA.ActiveCfg = Debug|NET10_DA + {06B9E5B0-7C50-4351-9D88-E159DC25755F}.Debug|NET10_DA.Build.0 = Debug|NET10_DA + {06B9E5B0-7C50-4351-9D88-E159DC25755F}.Release|NET10_DA.ActiveCfg = Release|NET10_DA + {06B9E5B0-7C50-4351-9D88-E159DC25755F}.Release|NET10_DA.Build.0 = Release|NET10_DA + {133FC760-5699-46D9-BEA6-E816B5F01016}.Debug|NET10_DA.ActiveCfg = Debug|NET10_DA + {133FC760-5699-46D9-BEA6-E816B5F01016}.Debug|NET10_DA.Build.0 = Debug|NET10_DA + {133FC760-5699-46D9-BEA6-E816B5F01016}.Release|NET10_DA.ActiveCfg = Release|NET10_DA + {133FC760-5699-46D9-BEA6-E816B5F01016}.Release|NET10_DA.Build.0 = Release|NET10_DA + {66A0E1C8-2514-48B7-8406-536983F57F88}.Debug|NET10_DA.ActiveCfg = Debug|NET10_DA + {66A0E1C8-2514-48B7-8406-536983F57F88}.Debug|NET10_DA.Build.0 = Debug|NET10_DA + {66A0E1C8-2514-48B7-8406-536983F57F88}.Release|NET10_DA.ActiveCfg = Release|NET10_DA + {66A0E1C8-2514-48B7-8406-536983F57F88}.Release|NET10_DA.Build.0 = Release|NET10_DA + {BD7126B6-E716-4024-854F-6DA2CFA25B84}.Debug|NET10_DA.ActiveCfg = Debug|NET10_DA + {BD7126B6-E716-4024-854F-6DA2CFA25B84}.Debug|NET10_DA.Build.0 = Debug|NET10_DA + {BD7126B6-E716-4024-854F-6DA2CFA25B84}.Release|NET10_DA.ActiveCfg = Release|NET10_DA + {BD7126B6-E716-4024-854F-6DA2CFA25B84}.Release|NET10_DA.Build.0 = Release|NET10_DA EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/DynamoRevit/DynamoRevit.csproj b/src/DynamoRevit/DynamoRevit.csproj index 5257fa49c0..29302bf267 100644 --- a/src/DynamoRevit/DynamoRevit.csproj +++ b/src/DynamoRevit/DynamoRevit.csproj @@ -125,7 +125,7 @@ - - + + \ No newline at end of file diff --git a/src/Libraries/RevitNodes/Elements/AdaptiveComponent.cs b/src/Libraries/RevitNodes/Elements/AdaptiveComponent.cs index aed5db9d5b..772a1ff3af 100644 --- a/src/Libraries/RevitNodes/Elements/AdaptiveComponent.cs +++ b/src/Libraries/RevitNodes/Elements/AdaptiveComponent.cs @@ -570,7 +570,7 @@ private static AdaptiveComponent[] InternalByPoints(Point[][] points, FamilyType throw new Exception(string.Format(Properties.Resources.DesiredNumberOfPoints, i, desiredNumOfPoints, numOfPoints)); } - var creationData = DocumentManager.Instance.CurrentUIApplication.Application.Create. + var creationData = DocumentManager.Instance.CurrentDBDocument.Application.Create. NewFamilyInstanceCreationData(familyType.InternalFamilySymbol, aPoints); if (creationData != null) diff --git a/src/Libraries/RevitNodes/Elements/Views/StructuralPlanView.cs b/src/Libraries/RevitNodes/Elements/Views/StructuralPlanView.cs index a59fd464ff..a0f51fe807 100644 --- a/src/Libraries/RevitNodes/Elements/Views/StructuralPlanView.cs +++ b/src/Libraries/RevitNodes/Elements/Views/StructuralPlanView.cs @@ -72,7 +72,7 @@ private void InitStructuralPlanView(Autodesk.Revit.DB.Level level) /// A StructuralPlanView if successful. public static StructuralPlanView ByLevel(Level level) { - if (!DocumentManager.Instance.CurrentUIApplication.Application.IsStructureEnabled) + if (!DocumentManager.Instance.CurrentDBDocument.Application.IsStructureEnabled) { throw new InvalidOperationException(Properties.Resources.StructuralPlanNotEnabled); } From 12612bfd9a85fb071d14ea2e96077d35f3dbd654 Mon Sep 17 00:00:00 2001 From: pinzart90 Date: Tue, 4 Nov 2025 15:00:45 -0500 Subject: [PATCH 59/70] simplify --- src/DADynamoApp/DAEntrypoint.cs | 61 +++++++- src/DynamoRevit/Models/RevitDynamoModel.cs | 107 ++++++++++++- .../{Utilities => }/RevitPathResolver.cs | 61 +------- .../Utilities/DynamoRevitPythonManager.cs | 146 ------------------ 4 files changed, 166 insertions(+), 209 deletions(-) rename src/DynamoRevit/{Utilities => }/RevitPathResolver.cs (65%) delete mode 100644 src/DynamoRevit/Utilities/DynamoRevitPythonManager.cs diff --git a/src/DADynamoApp/DAEntrypoint.cs b/src/DADynamoApp/DAEntrypoint.cs index 9a0dd4e586..606e089baf 100644 --- a/src/DADynamoApp/DAEntrypoint.cs +++ b/src/DADynamoApp/DAEntrypoint.cs @@ -21,6 +21,65 @@ namespace DADynamoApp { + class DynamoRevitAssemblyResolver + { + /// + /// Handler to the ApplicationDomain's AssemblyResolve event. + /// If an assembly's location cannot be resolved, an exception is + /// thrown. Failure to resolve an assembly will leave Dynamo in + /// a bad state, so we should throw an exception here which gets caught + /// by our unhandled exception handler and presents the crash dialogue. + /// + /// + /// + /// + internal static Assembly ResolveDynamoAssembly(string dynamoCorePath, List additionalPaths, ResolveEventArgs args) + { + var assemblyPath = string.Empty; + var assemblyName = new AssemblyName(args.Name).Name + ".dll"; + + try + { + assemblyPath = Path.Combine(dynamoCorePath, assemblyName); + if (File.Exists(assemblyPath)) + { + return Assembly.LoadFrom(assemblyPath); + } + + if (additionalPaths != null) + { + foreach (var additionalPath in additionalPaths) + { + assemblyPath = Path.Combine(additionalPath, assemblyName); + if (File.Exists(assemblyPath)) + { + return Assembly.LoadFrom(assemblyPath); + } + } + } + + var assemblyLocation = Assembly.GetExecutingAssembly().Location; + var assemblyDirectory = Path.GetDirectoryName(assemblyLocation); + + // Try "Dynamo 0.x\Revit_20xx" folder first... + assemblyPath = Path.Combine(assemblyDirectory, assemblyName); + if (!File.Exists(assemblyPath)) + { + // If assembly cannot be found, try in "Dynamo 0.x" folder. + var parentDirectory = Directory.GetParent(assemblyDirectory); + assemblyPath = Path.Combine(parentDirectory.FullName, assemblyName); + } + + return (File.Exists(assemblyPath) ? Assembly.LoadFrom(assemblyPath) : null); + } + catch (Exception ex) + { + Console.WriteLine(ex.Message + ex.StackTrace); + throw new Exception(string.Format("The location of the assembly, {0} could not be resolved for loading.", assemblyPath), ex); + } + } + } + [Autodesk.Revit.Attributes.Regeneration(Autodesk.Revit.Attributes.RegenerationOption.Manual)] [Autodesk.Revit.Attributes.Transaction(Autodesk.Revit.Attributes.TransactionMode.Manual)] public class DAEntrypoint : IExternalDBApplication @@ -41,7 +100,7 @@ public class DAEntrypoint : IExternalDBApplication public ExternalDBApplicationResult OnShutdown(ControlledApplication application) { - DynamoRevitPythonManager.Cleanup(); + model?.Dispose(); AppDomain.CurrentDomain.UnhandledException -= CurrentDomain_UnhandledException; AppDomain.CurrentDomain.ProcessExit -= CurrentDomain_ProcessExit; diff --git a/src/DynamoRevit/Models/RevitDynamoModel.cs b/src/DynamoRevit/Models/RevitDynamoModel.cs index d1f78e17c5..b2b160d954 100644 --- a/src/DynamoRevit/Models/RevitDynamoModel.cs +++ b/src/DynamoRevit/Models/RevitDynamoModel.cs @@ -233,7 +233,7 @@ private RevitDynamoModel(IRevitStartConfiguration configuration) : SubscribeDocumentManagerEvents(); SubscribeTransactionManagerEvents(); - DynamoRevitPythonManager.SetupPython(Logger); + SetupPython(); } @@ -445,6 +445,108 @@ internal void HandlePostInitialization() InitializeMaterials(); // Initialize materials for preview. } + private PythonServices.EventHandlers.EvaluationStartedEventHandler OnPythonEvalStart; + + /// + /// Setup the python engine so that it can manage Revit data + /// + /// + private void SetupPythonEngine(PythonEngine engine) + { + if (engine != null) + { + try + { + if (engine.HostDataMarshaler is null) + { + var revitDataMarshaler = new DataMarshaler(); + revitDataMarshaler.RegisterMarshaler((Revit.Elements.Element element) => element.InternalElement); + revitDataMarshaler.RegisterMarshaler((Category element) => element.InternalCategory); + engine.HostDataMarshaler = revitDataMarshaler; + engine.RegisterHostDataMarshalers(); + } + + (engine.OutputDataMarshaler as DataMarshaler).RegisterMarshaler((Element element) => element.ToDSType(true)); + engine.EvaluationFinished += OnPythonEvalFinished; + OnPythonEvalStart = (string code, IList bindingValues, PythonServices.EventHandlers.ScopeSetAction scopeSet) => + { + // Turn off element binding during python script execution + ElementBinder.IsEnabled = false; + if (engine.HostDataMarshaler != null) + { + Func unwrap = (engine.HostDataMarshaler as DataMarshaler).Marshal; + // register UnwrapElement method + scopeSet("UnwrapElement", unwrap); + } + }; + + engine.EvaluationStarted += OnPythonEvalStart; + } + catch (FileNotFoundException ex) + { + Logger.Log(ex); + } + } + } + + /// + /// Cleanup all subscribed events and registered marshalers + /// + /// + private void CleanUpPythonEngine(PythonEngine engine) + { + try + { + if (engine != null) + { + (engine.OutputDataMarshaler as DataMarshaler).UnregisterMarshalerOfType(); + engine.EvaluationStarted -= OnPythonEvalStart; + engine.EvaluationFinished -= OnPythonEvalFinished; + } + } + catch (FileNotFoundException ex) + { + Logger.Log(ex); + } + } + + /// + /// Sets up new python engines registered in the available PythonEngine collection + /// + /// + /// + private void OnPythonEngineCollectionChanged(object sender, NotifyCollectionChangedEventArgs e) + { + if (e.Action == NotifyCollectionChangedAction.Add) + { + foreach (var item in e.NewItems) + { + SetupPythonEngine(item as PythonEngine); + } + } + } + + // Python evaluation finished event handler + private void OnPythonEvalFinished(EvaluationState state, string code, IList bindingValues, PythonServices.EventHandlers.ScopeGetAction scopeGet) + { + // Turn on element binding after python script execution + ElementBinder.IsEnabled = true; + } + + private bool setupPython; + + private void SetupPython() + { + if (setupPython) return; + + // Setup engines for all existing python engines + PythonEngineManager.Instance.AvailableEngines.ToList().ForEach(engine => SetupPythonEngine(engine)); + // Setup engines for any python engines that might be registered later on + PythonEngineManager.Instance.AvailableEngines.CollectionChanged += OnPythonEngineCollectionChanged; + + setupPython = true; + } + internal void InitializeDocumentManager() { #if !DESIGN_AUTOMATION @@ -654,7 +756,8 @@ protected override void ShutDownCore(bool shutDownHost) UnsubscribeRevitServicesUpdaterEvents(); UnsubscribeTransactionManagerEvents(); - DynamoRevitPythonManager.Cleanup(); + PythonEngineManager.Instance.AvailableEngines.ToList().ForEach(engine => CleanUpPythonEngine(engine)); + PythonEngineManager.Instance.AvailableEngines.CollectionChanged -= OnPythonEngineCollectionChanged; ElementIDLifecycleManager.DisposeInstance(); } diff --git a/src/DynamoRevit/Utilities/RevitPathResolver.cs b/src/DynamoRevit/RevitPathResolver.cs similarity index 65% rename from src/DynamoRevit/Utilities/RevitPathResolver.cs rename to src/DynamoRevit/RevitPathResolver.cs index 5c009abae7..3acdaf79b8 100644 --- a/src/DynamoRevit/Utilities/RevitPathResolver.cs +++ b/src/DynamoRevit/RevitPathResolver.cs @@ -6,65 +6,6 @@ namespace Dynamo.Applications { - class DynamoRevitAssemblyResolver - { - /// - /// Handler to the ApplicationDomain's AssemblyResolve event. - /// If an assembly's location cannot be resolved, an exception is - /// thrown. Failure to resolve an assembly will leave Dynamo in - /// a bad state, so we should throw an exception here which gets caught - /// by our unhandled exception handler and presents the crash dialogue. - /// - /// - /// - /// - internal static Assembly ResolveDynamoAssembly(string dynamoCorePath, List additionalPaths, ResolveEventArgs args) - { - var assemblyPath = string.Empty; - var assemblyName = new AssemblyName(args.Name).Name + ".dll"; - - try - { - assemblyPath = Path.Combine(dynamoCorePath, assemblyName); - if (File.Exists(assemblyPath)) - { - return Assembly.LoadFrom(assemblyPath); - } - - if (additionalPaths != null) - { - foreach (var additionalPath in additionalPaths) - { - assemblyPath = Path.Combine(additionalPath, assemblyName); - if (File.Exists(assemblyPath)) - { - return Assembly.LoadFrom(assemblyPath); - } - } - } - - var assemblyLocation = Assembly.GetExecutingAssembly().Location; - var assemblyDirectory = Path.GetDirectoryName(assemblyLocation); - - // Try "Dynamo 0.x\Revit_20xx" folder first... - assemblyPath = Path.Combine(assemblyDirectory, assemblyName); - if (!File.Exists(assemblyPath)) - { - // If assembly cannot be found, try in "Dynamo 0.x" folder. - var parentDirectory = Directory.GetParent(assemblyDirectory); - assemblyPath = Path.Combine(parentDirectory.FullName, assemblyName); - } - - return (File.Exists(assemblyPath) ? Assembly.LoadFrom(assemblyPath) : null); - } - catch (Exception ex) - { - Console.WriteLine(ex.Message + ex.StackTrace); - throw new Exception(string.Format("The location of the assembly, {0} could not be resolved for loading.", assemblyPath), ex); - } - } - } - class RevitPathResolver : IPathResolver { private readonly List preloadLibraryPaths; @@ -189,4 +130,4 @@ public IEnumerable GetDynamoUserDataLocations() return paths; } } -} \ No newline at end of file +} diff --git a/src/DynamoRevit/Utilities/DynamoRevitPythonManager.cs b/src/DynamoRevit/Utilities/DynamoRevitPythonManager.cs deleted file mode 100644 index ad2b306691..0000000000 --- a/src/DynamoRevit/Utilities/DynamoRevitPythonManager.cs +++ /dev/null @@ -1,146 +0,0 @@ -using Dynamo.Utilities; -using RevitServices.Persistence; -using System.Collections; -using System.Collections.Specialized; -using Dynamo.Logging; -using PythonEngine = Dynamo.PythonServices.PythonEngine; -using Dynamo.PythonServices; -using System; -using System.IO; -using System.Linq; - -namespace Revit.Elements -{ - internal static class DynamoRevitPythonManager - { - private static DynamoLogger Logger; - - private static Dynamo.PythonServices.EventHandlers.EvaluationStartedEventHandler OnPythonEvalStart; - - /// - /// Setup the python engine so that it can manage Revit data - /// - /// - private static void SetupPythonEngine(PythonEngine engine) - { - if (engine != null) - { - try - { - var property = engine.GetType().GetProperty("HostDataMarshaler", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance); - if (property == null) - { - throw new Exception("Could not find a valid HostDataMarshaler property"); - } - - var hostDataMarshaler = property.GetValue(engine); - if (hostDataMarshaler is null) - { - var revitDataMarshaler = new DataMarshaler(); - revitDataMarshaler.RegisterMarshaler((Revit.Elements.Element element) => element.InternalElement); - revitDataMarshaler.RegisterMarshaler((Category element) => element.InternalCategory); - property.SetValue(engine, revitDataMarshaler); - - var method = engine.GetType().GetMethod("RegisterHostDataMarshalers", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance); - if (method == null) - { - throw new Exception("Could not find a valid RegisterHostDataMarshalers method"); - } - method.Invoke(engine, null); - } - - (engine.OutputDataMarshaler as DataMarshaler).RegisterMarshaler((Autodesk.Revit.DB.Element element) => element.ToDSType(true)); - engine.EvaluationFinished += OnPythonEvalFinished; - OnPythonEvalStart = (string code, IList bindingValues, Dynamo.PythonServices.EventHandlers.ScopeSetAction scopeSet) => - { - hostDataMarshaler = property.GetValue(engine); - // Turn off element binding during python script execution - ElementBinder.IsEnabled = false; - if (hostDataMarshaler != null) - { - Func unwrap = (hostDataMarshaler as DataMarshaler).Marshal; - // register UnwrapElement method - scopeSet("UnwrapElement", unwrap); - } - }; - - engine.EvaluationStarted += OnPythonEvalStart; - } - catch (FileNotFoundException ex) - { - Logger.Log(ex); - } - catch (Exception ex) { - Console.WriteLine(ex.Message + ex.StackTrace); - throw; - } - } - } - - /// - /// Cleanup all subscribed events and registered marshalers - /// - /// - private static void CleanUpPythonEngine(PythonEngine engine) - { - try - { - if (engine != null) - { - (engine.OutputDataMarshaler as DataMarshaler).UnregisterMarshalerOfType(); - engine.EvaluationStarted -= OnPythonEvalStart; - engine.EvaluationFinished -= OnPythonEvalFinished; - } - } - catch (FileNotFoundException ex) - { - Logger.Log(ex); - } - } - - /// - /// Sets up new python engines registered in the available PythonEngine collection - /// - /// - /// - private static void OnPythonEngineCollectionChanged(object sender, NotifyCollectionChangedEventArgs e) - { - Console.WriteLine("Called OnPythonEngineCollectionChanged"); - if (e.Action == NotifyCollectionChangedAction.Add) - { - foreach (var item in e.NewItems) - { - SetupPythonEngine(item as PythonEngine); - } - } - } - - // Python evaluation finished event handler - private static void OnPythonEvalFinished(EvaluationState state, string code, IList bindingValues, Dynamo.PythonServices.EventHandlers.ScopeGetAction scopeGet) - { - // Turn on element binding after python script execution - ElementBinder.IsEnabled = true; - } - - private static bool setupPython; - - internal static void SetupPython(DynamoLogger logger) - { - if (setupPython) return; - - // Setup engines for all existing python engines - PythonEngineManager.Instance.AvailableEngines.ToList().ForEach(engine => SetupPythonEngine(engine)); - // Setup engines for any python engines that might be registered later on - PythonEngineManager.Instance.AvailableEngines.CollectionChanged += OnPythonEngineCollectionChanged; - - Logger = logger; - setupPython = true; - } - - internal static void Cleanup() - { - PythonEngineManager.Instance.AvailableEngines.ToList().ForEach(engine => CleanUpPythonEngine(engine)); - PythonEngineManager.Instance.AvailableEngines.CollectionChanged -= OnPythonEngineCollectionChanged; - } - } -} From 793010c3b9cae05144dc57e106d054db7e632ad5 Mon Sep 17 00:00:00 2001 From: pinzart90 Date: Tue, 4 Nov 2025 15:04:53 -0500 Subject: [PATCH 60/70] update --- src/DADynamoApp/DAEntrypoint.cs | 59 ----------------- ...ernal class DynamoRevitAssemblyResolver.cs | 63 +++++++++++++++++++ 2 files changed, 63 insertions(+), 59 deletions(-) create mode 100644 src/DynamoRevit/Utilities/internal class DynamoRevitAssemblyResolver.cs diff --git a/src/DADynamoApp/DAEntrypoint.cs b/src/DADynamoApp/DAEntrypoint.cs index 606e089baf..cc1331d0d9 100644 --- a/src/DADynamoApp/DAEntrypoint.cs +++ b/src/DADynamoApp/DAEntrypoint.cs @@ -21,65 +21,6 @@ namespace DADynamoApp { - class DynamoRevitAssemblyResolver - { - /// - /// Handler to the ApplicationDomain's AssemblyResolve event. - /// If an assembly's location cannot be resolved, an exception is - /// thrown. Failure to resolve an assembly will leave Dynamo in - /// a bad state, so we should throw an exception here which gets caught - /// by our unhandled exception handler and presents the crash dialogue. - /// - /// - /// - /// - internal static Assembly ResolveDynamoAssembly(string dynamoCorePath, List additionalPaths, ResolveEventArgs args) - { - var assemblyPath = string.Empty; - var assemblyName = new AssemblyName(args.Name).Name + ".dll"; - - try - { - assemblyPath = Path.Combine(dynamoCorePath, assemblyName); - if (File.Exists(assemblyPath)) - { - return Assembly.LoadFrom(assemblyPath); - } - - if (additionalPaths != null) - { - foreach (var additionalPath in additionalPaths) - { - assemblyPath = Path.Combine(additionalPath, assemblyName); - if (File.Exists(assemblyPath)) - { - return Assembly.LoadFrom(assemblyPath); - } - } - } - - var assemblyLocation = Assembly.GetExecutingAssembly().Location; - var assemblyDirectory = Path.GetDirectoryName(assemblyLocation); - - // Try "Dynamo 0.x\Revit_20xx" folder first... - assemblyPath = Path.Combine(assemblyDirectory, assemblyName); - if (!File.Exists(assemblyPath)) - { - // If assembly cannot be found, try in "Dynamo 0.x" folder. - var parentDirectory = Directory.GetParent(assemblyDirectory); - assemblyPath = Path.Combine(parentDirectory.FullName, assemblyName); - } - - return (File.Exists(assemblyPath) ? Assembly.LoadFrom(assemblyPath) : null); - } - catch (Exception ex) - { - Console.WriteLine(ex.Message + ex.StackTrace); - throw new Exception(string.Format("The location of the assembly, {0} could not be resolved for loading.", assemblyPath), ex); - } - } - } - [Autodesk.Revit.Attributes.Regeneration(Autodesk.Revit.Attributes.RegenerationOption.Manual)] [Autodesk.Revit.Attributes.Transaction(Autodesk.Revit.Attributes.TransactionMode.Manual)] public class DAEntrypoint : IExternalDBApplication diff --git a/src/DynamoRevit/Utilities/internal class DynamoRevitAssemblyResolver.cs b/src/DynamoRevit/Utilities/internal class DynamoRevitAssemblyResolver.cs new file mode 100644 index 0000000000..bd9f2acbab --- /dev/null +++ b/src/DynamoRevit/Utilities/internal class DynamoRevitAssemblyResolver.cs @@ -0,0 +1,63 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Reflection; + +internal class DynamoRevitAssemblyResolver +{ + /// + /// Handler to the ApplicationDomain's AssemblyResolve event. + /// If an assembly's location cannot be resolved, an exception is + /// thrown. Failure to resolve an assembly will leave Dynamo in + /// a bad state, so we should throw an exception here which gets caught + /// by our unhandled exception handler and presents the crash dialogue. + /// + /// + /// + /// + internal static Assembly ResolveDynamoAssembly(string dynamoCorePath, List additionalPaths, ResolveEventArgs args) + { + var assemblyPath = string.Empty; + var assemblyName = new AssemblyName(args.Name).Name + ".dll"; + + try + { + assemblyPath = Path.Combine(dynamoCorePath, assemblyName); + if (File.Exists(assemblyPath)) + { + return Assembly.LoadFrom(assemblyPath); + } + + if (additionalPaths != null) + { + foreach (var additionalPath in additionalPaths) + { + assemblyPath = Path.Combine(additionalPath, assemblyName); + if (File.Exists(assemblyPath)) + { + return Assembly.LoadFrom(assemblyPath); + } + } + } + + var assemblyLocation = Assembly.GetExecutingAssembly().Location; + var assemblyDirectory = Path.GetDirectoryName(assemblyLocation); + + // Try "Dynamo 0.x\Revit_20xx" folder first... + assemblyPath = Path.Combine(assemblyDirectory, assemblyName); + if (!File.Exists(assemblyPath)) + { + // If assembly cannot be found, try in "Dynamo 0.x" folder. + var parentDirectory = Directory.GetParent(assemblyDirectory); + assemblyPath = Path.Combine(parentDirectory.FullName, assemblyName); + } + + return (File.Exists(assemblyPath) ? Assembly.LoadFrom(assemblyPath) : null); + } + catch (Exception ex) + { + Console.WriteLine(ex.Message + ex.StackTrace); + throw new Exception(string.Format("The location of the assembly, {0} could not be resolved for loading.", assemblyPath), ex); + } + } +} From bc6c714454de665241f531c4f6c9437841edc1e4 Mon Sep 17 00:00:00 2001 From: pinzart90 Date: Tue, 4 Nov 2025 15:25:42 -0500 Subject: [PATCH 61/70] Update DynamoRevitApp.cs --- src/DynamoRevit/DynamoRevitApp.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/DynamoRevit/DynamoRevitApp.cs b/src/DynamoRevit/DynamoRevitApp.cs index 6f42871c8a..46d5c0cc0c 100644 --- a/src/DynamoRevit/DynamoRevitApp.cs +++ b/src/DynamoRevit/DynamoRevitApp.cs @@ -250,6 +250,7 @@ public static void AddIdleAction(Action a) } } + [Obsolete("This property will be made internal")] public static EventHandlerProxy EventHandlerProxy { get { return EventHandlerProxy.Instance; } From 05422873ae4bad89f434b68ea16c6ea8080aaa11 Mon Sep 17 00:00:00 2001 From: pinzart90 <46732933+pinzart90@users.noreply.github.com> Date: Wed, 19 Nov 2025 06:18:19 -0500 Subject: [PATCH 62/70] Add cloud model support (#3252) What changed: Ability to load Revit Cloud Models ("type":"versions:autodesk.bim360:C4RModel") Documentation https://aps.autodesk.com/blog/new-sample-support-access-revit-cloud-model-revit-design-automation-engine Not implemented yet: Cloud Shared models. Does not work for regular rvt files stored on ACC (only supported in Autocad for now) - https://aps.autodesk.com/en/docs/design-automation/v3/developers_guide/reference-downloading/ TODO: To access cloud models using Automation, you need to provide the user context through a special workitem argument; adsk3LeggedToken, scope=code:all needs to be added to your authorization call. I need to add an example in the scripts/postman collections --- src/DADynamoApp/DADynamoApp.csproj | 2 +- src/DADynamoApp/DAEntrypoint.cs | 86 +++++++++++++++++++++--------- src/DADynamoApp/SetupDARequest.cs | 63 +++++++++++++++++++++- 3 files changed, 122 insertions(+), 29 deletions(-) diff --git a/src/DADynamoApp/DADynamoApp.csproj b/src/DADynamoApp/DADynamoApp.csproj index 53db8c326d..ccace90276 100644 --- a/src/DADynamoApp/DADynamoApp.csproj +++ b/src/DADynamoApp/DADynamoApp.csproj @@ -25,7 +25,7 @@ - + diff --git a/src/DADynamoApp/DAEntrypoint.cs b/src/DADynamoApp/DAEntrypoint.cs index cc1331d0d9..0a6088e680 100644 --- a/src/DADynamoApp/DAEntrypoint.cs +++ b/src/DADynamoApp/DAEntrypoint.cs @@ -13,11 +13,9 @@ using static Dynamo.Models.DynamoModel; using System.Text.RegularExpressions; using Greg.AuthProviders; -using Revit.Elements; using Dynamo.PythonServices; using DSCPython; using Newtonsoft.Json; -using Revit.Transaction; namespace DADynamoApp { @@ -133,10 +131,38 @@ public void HandleDesignAutomationReadyEvent(object sender, DesignAutomationRead var app = e.DesignAutomationData?.RevitApp; Console.WriteLine("<> Preparing Dynamo model. Vers 1"); + SetupDARequest? setupReq = null; + var setupReqPath = Path.Combine(WorkItemFolder, "setup.json"); + if (File.Exists(setupReqPath)) + { + try + { + var setupRequest = File.ReadAllText(setupReqPath); + Console.WriteLine(setupRequest); + + setupReq = JsonConvert.DeserializeObject(setupRequest, new JsonSerializerSettings() { TypeNameHandling = TypeNameHandling.Auto }); + } + catch (Exception ex) + { + Console.WriteLine(ex.Message); + } + } + + Document? doc = null; + var cModel = setupReq?.CloudModel; + if (cModel != null) + { + var cloudModelPath = ModelPathUtils.ConvertCloudGUIDsToCloudPath(cModel.Region, cModel.ProjectGuid, cModel.ModelGuid); + doc = app?.OpenDocumentFile(cloudModelPath, new OpenOptions()); + } + else + { + doc = e.DesignAutomationData?.RevitDoc; + } + // Startup a new project, maybe an option we can have ? //app.NewProjectDocument(Autodesk.Revit.DB.UnitSystem.Metric); - Document? doc = e.DesignAutomationData?.RevitDoc; if (doc == null) throw new InvalidOperationException("Could not open revit document."); var hostloc = typeof(Autodesk.Revit.ApplicationServices.Application).Assembly.Location; @@ -189,25 +215,6 @@ public void HandleDesignAutomationReadyEvent(object sender, DesignAutomationRead var dynHandler = new Handler(playerHost, [new DARunGraphController(controller, model, WorkItemFolder)]); - // Default, save the rvt - bool saveRvt = true; - var setupReqPath = Path.Combine(WorkItemFolder, "setup.json"); - if (File.Exists(setupReqPath)) - { - try - { - var setupRequest = File.ReadAllText(setupReqPath); - Console.WriteLine(setupRequest); - - SetupDARequest setupReq = JsonConvert.DeserializeObject(setupRequest, new JsonSerializerSettings() { TypeNameHandling = TypeNameHandling.Auto}); - saveRvt = setupReq?.SaveRvt ?? saveRvt; - } - catch (Exception ex) - { - Console.WriteLine(ex.Message); - } - } - var runContent = File.ReadAllText(Path.Combine(WorkItemFolder, "run.json")); var testFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); @@ -225,14 +232,41 @@ public void HandleDesignAutomationReadyEvent(object sender, DesignAutomationRead Console.WriteLine(output); File.WriteAllText(Path.Combine(WorkItemFolder, "result.json"), output); + // Default, save the rvt + bool saveRvt = setupReq?.SaveRevitFile ?? true; Console.WriteLine($"{nameof(saveRvt)} is set to {saveRvt}"); if (saveRvt) { try { - RevitServices.Transactions.TransactionManager.Instance.ForceCloseTransaction(); - ModelPath path = ModelPathUtils.ConvertUserVisiblePathToModelPath("result.rvt"); - doc.SaveAs(path, new SaveAsOptions()); + if (doc.IsModelInCloud) + { + if (doc.IsWorkshared) // work-shared/C4R model + { + // Syncronize with central + SynchronizeWithCentralOptions swc = new SynchronizeWithCentralOptions(); + swc.SetRelinquishOptions(new RelinquishOptions(/*relinquishAll*/true));// Should this be configurable? + doc.SynchronizeWithCentral(new TransactWithCentralOptions(), swc); + } + else + {// Single user cloud model + var newLoc = setupReq?.SaveCloudModelLocation; + if (newLoc != null) + { + doc.SaveAsCloudModel(newLoc.AccountId, newLoc.ProjectId, newLoc.FolderId, newLoc.ModelName ?? Path.GetFileName(doc.PathName)); + } + else + { + doc.SaveCloudModel(); + } + } + } + else + {// Save locally + RevitServices.Transactions.TransactionManager.Instance.ForceCloseTransaction(); + ModelPath path = ModelPathUtils.ConvertUserVisiblePathToModelPath("result.rvt"); + doc.SaveAs(path, new SaveAsOptions()); + } } catch (Exception ex) { @@ -301,4 +335,4 @@ private void Model_RunCompleted(object sender, bool success) Console.WriteLine($"Run Completed"); } } -} \ No newline at end of file +} diff --git a/src/DADynamoApp/SetupDARequest.cs b/src/DADynamoApp/SetupDARequest.cs index 497d4a756d..bf8485a6a9 100644 --- a/src/DADynamoApp/SetupDARequest.cs +++ b/src/DADynamoApp/SetupDARequest.cs @@ -2,6 +2,53 @@ namespace DADynamoApp { + /// + /// Configuration details for a cloud model. + /// + internal class CloudModelConfig + { + /// + /// Represents the region where the cloud model is hosted. + /// + public string Region; + + /// + /// Represents the unique identifier for a project. + /// + public Guid ProjectGuid; + + /// + /// Represents the unique identifier for the model. + /// + public Guid ModelGuid; + } + + /// + /// Represents the save location for the current DA work model. + /// + internal class SaveCloudModelLocation + { + /// + /// Gets or sets the unique identifier for the account. + /// + public Guid AccountId { get; set; } + + /// + /// Gets or sets the unique identifier for the project. + /// + public Guid ProjectId { get; set; } + + /// + /// Gets or sets the unique identifier for the folder. + /// + public string FolderId { get; set; } + + /// + /// Gets or sets the name of the model to be created on the save operation. + /// + public string ModelName { get; set; } = string.Empty; + } + /// /// Request body used to setup aspects of the Design Automation environment. /// @@ -10,7 +57,19 @@ internal class SetupDARequest // // Summary: // Save the revit document to the default result.rvt file. - [JsonProperty("saveRvt", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] - public bool SaveRvt { get; set; } = false; + [JsonProperty(nameof(SaveRevitFile), Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] + public bool SaveRevitFile { get; set; } = false; + + /// + /// The location to save the current DA work model. + /// + [JsonProperty(nameof(SaveCloudModelLocation), Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] + public SaveCloudModelLocation? SaveCloudModelLocation { get; set; } = null; + + /// + /// Gets or sets the configuration for the cloud model. + /// + [JsonProperty(nameof(CloudModel), Required = Required.Default, NullValueHandling = NullValueHandling.Ignore)] + public CloudModelConfig? CloudModel { get; set; } = null; } } From a92411d8eaf5a69195eee6957e3c767a109cee20 Mon Sep 17 00:00:00 2001 From: pinzart90 Date: Wed, 19 Nov 2025 12:54:38 -0500 Subject: [PATCH 63/70] Update DAEntrypoint.cs --- src/DADynamoApp/DAEntrypoint.cs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/DADynamoApp/DAEntrypoint.cs b/src/DADynamoApp/DAEntrypoint.cs index 0a6088e680..96a40de8ad 100644 --- a/src/DADynamoApp/DAEntrypoint.cs +++ b/src/DADynamoApp/DAEntrypoint.cs @@ -152,8 +152,15 @@ public void HandleDesignAutomationReadyEvent(object sender, DesignAutomationRead var cModel = setupReq?.CloudModel; if (cModel != null) { - var cloudModelPath = ModelPathUtils.ConvertCloudGUIDsToCloudPath(cModel.Region, cModel.ProjectGuid, cModel.ModelGuid); - doc = app?.OpenDocumentFile(cloudModelPath, new OpenOptions()); + try + { + var cloudModelPath = ModelPathUtils.ConvertCloudGUIDsToCloudPath(cModel.Region, cModel.ProjectGuid, cModel.ModelGuid); + doc = app?.OpenDocumentFile(cloudModelPath, new OpenOptions()); + } + catch (Exception ex) + { + Console.WriteLine(ex.Message); + } } else { From c387e30fe4bc769bb956a8ba3b9df50d082a4273 Mon Sep 17 00:00:00 2001 From: pinzart90 Date: Tue, 24 Feb 2026 09:31:23 -0500 Subject: [PATCH 64/70] update --- src/DADynamoApp/DADynamoApp.csproj | 1 + src/DADynamoApp/DAEntrypoint.cs | 198 +++++++++++++++++++++++++---- src/DADynamoApp/SetupDARequest.cs | 19 ++- 3 files changed, 182 insertions(+), 36 deletions(-) diff --git a/src/DADynamoApp/DADynamoApp.csproj b/src/DADynamoApp/DADynamoApp.csproj index ccace90276..c9631efb7a 100644 --- a/src/DADynamoApp/DADynamoApp.csproj +++ b/src/DADynamoApp/DADynamoApp.csproj @@ -26,6 +26,7 @@ + diff --git a/src/DADynamoApp/DAEntrypoint.cs b/src/DADynamoApp/DAEntrypoint.cs index 96a40de8ad..8ebd2359e2 100644 --- a/src/DADynamoApp/DAEntrypoint.cs +++ b/src/DADynamoApp/DAEntrypoint.cs @@ -1,21 +1,27 @@ -using Autodesk.Revit.ApplicationServices; +using Autodesk.DataManagement; +using Autodesk.DataManagement.Model; +using Autodesk.Revit.ApplicationServices; using Autodesk.Revit.DB; using DesignAutomationFramework; +using DSCPython; +using Dynamo.Applications; +using Dynamo.Migration; using Dynamo.Models; +using Dynamo.PythonServices; +using Dynamo.Scheduler; using DynamoPlayer; -using RevitServices.Persistence; +using Greg.AuthProviders; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; +using ProtoCore.DesignScriptParser; using RevitServices.Elements; +using RevitServices.Persistence; +using System.Diagnostics; using System.Reflection; using System.Runtime.Loader; -using System.Diagnostics; -using Dynamo.Applications; -using Dynamo.Scheduler; -using static Dynamo.Models.DynamoModel; using System.Text.RegularExpressions; -using Greg.AuthProviders; -using Dynamo.PythonServices; -using DSCPython; -using Newtonsoft.Json; +using System.Windows.Controls; +using static Dynamo.Models.DynamoModel; namespace DADynamoApp { @@ -25,7 +31,6 @@ public class DAEntrypoint : IExternalDBApplication { private DynamoModel model; internal static DynamoPlayerLoggerConfiguration logConfig = new DynamoPlayerLoggerConfiguration() { DynamoLogLevel = Dynamo.Logging.LogLevel.Console, LogLevel = DynamoPlayer.LogLevel.Information }; - private AssemblyLoadContext loadContext = AssemblyLoadContext.GetLoadContext(Assembly.GetExecutingAssembly()) ?? AssemblyLoadContext.Default; private string DynamoPath; private string DynamoRevitPath; private ControlledApplication controlledApplication; @@ -120,10 +125,91 @@ private static string GetRevitContext(Autodesk.Revit.ApplicationServices.Applica return r.Replace(app.VersionName, ""); } + /// + /// Extracts the 'token' value from the work item JSON content. + /// This is robust to casing differences and supports BoundArguments as an object. + /// Returns null if token cannot be found. + /// + private string? ExtractTokenFromWorkItem(string workItemContent) + { + if (string.IsNullOrWhiteSpace(workItemContent)) return null; + + try + { + var job = JObject.Parse(workItemContent); + + // Find BoundArguments (case-insensitive) + JToken? boundToken = null; + if (!job.TryGetValue("BoundArguments", out boundToken)) + { + foreach (var prop in job.Properties()) + { + if (string.Equals(prop.Name, "BoundArguments", StringComparison.OrdinalIgnoreCase)) + { + boundToken = prop.Value; + break; + } + } + } + + if (boundToken == null) return null; + + // If it's an object, try direct lookup + if (boundToken.Type == JTokenType.Object) + { + var boundObj = (JObject)boundToken; + + // try exact key 'token' then case-insensitive + if (boundObj.TryGetValue("adsk3LeggedToken", out var tokVal)) + { + return tokVal.Type == JTokenType.String ? tokVal.Value() : tokVal.ToString(); + } + + foreach (var prop in boundObj.Properties()) + { + if (string.Equals(prop.Name, "adsk3LeggedToken", StringComparison.OrdinalIgnoreCase)) + { + return prop.Value.Type == JTokenType.String ? prop.Value.Value() : prop.Value.ToString(); + } + } + } + + // Fallback: convert to dictionary and search case-insensitively + var boundDict = boundToken.ToObject>(); + if (boundDict != null) + { + foreach (var kv in boundDict) + { + if (string.Equals(kv.Key, "adsk3LeggedToken", StringComparison.OrdinalIgnoreCase)) + { + return kv.Value.Type == JTokenType.String ? kv.Value.Value() : kv.Value.ToString(); + } + } + } + } + catch (Exception ex) + { + Console.WriteLine($"ExtractTokenFromWorkItem failed: {ex.Message}"); + } + + return null; + } + public void HandleDesignAutomationReadyEvent(object sender, DesignAutomationReadyEventArgs e) { Console.WriteLine("<> DA event raised."); + var workItemId = Environment.ExpandEnvironmentVariables("%DAS_WORKITEM_ID%"); + + Console.WriteLine($"<> WorkItemId is '{workItemId}'"); + + var workItemFileName = $"{workItemId}_job.das"; + Console.WriteLine($"Looking for WorkItem file at '{workItemFileName}', exists: {File.Exists(workItemFileName)}"); + var workItemContent = File.ReadAllText(workItemFileName); + + var token = ExtractTokenFromWorkItem(workItemContent); + Console.WriteLine($"<> Token is '{token}'"); + // Local Change //WorkItemFolder = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); @@ -149,12 +235,15 @@ public void HandleDesignAutomationReadyEvent(object sender, DesignAutomationRead } Document? doc = null; - var cModel = setupReq?.CloudModel; + var cModel = setupReq?.OpenCloudModelLocation; if (cModel != null) { try { + Console.WriteLine($"Opening cloud model with Region: {cModel.Region}, Project: {cModel.ProjectGuid}, Model: {cModel.ModelGuid}"); + var cloudModelPath = ModelPathUtils.ConvertCloudGUIDsToCloudPath(cModel.Region, cModel.ProjectGuid, cModel.ModelGuid); + Console.WriteLine(doc == null ? $"Cloud model path is {JsonConvert.SerializeObject(cloudModelPath)}" : "doc is not null before opening cloud model"); doc = app?.OpenDocumentFile(cloudModelPath, new OpenOptions()); } catch (Exception ex) @@ -162,6 +251,19 @@ public void HandleDesignAutomationReadyEvent(object sender, DesignAutomationRead Console.WriteLine(ex.Message); } } + else if (setupReq?.LocalFileName != null) + { + try + { + var localModelPath = Path.Combine(WorkItemFolder, setupReq.LocalFileName); + Console.WriteLine($"Opening local model at {localModelPath}"); + doc = app?.OpenDocumentFile(localModelPath); + } + catch (Exception ex) + { + Console.WriteLine(ex.Message); + } + } else { doc = e.DesignAutomationData?.RevitDoc; @@ -240,7 +342,7 @@ public void HandleDesignAutomationReadyEvent(object sender, DesignAutomationRead File.WriteAllText(Path.Combine(WorkItemFolder, "result.json"), output); // Default, save the rvt - bool saveRvt = setupReq?.SaveRevitFile ?? true; + bool saveRvt = setupReq?.GenerateOutputModel ?? true; Console.WriteLine($"{nameof(saveRvt)} is set to {saveRvt}"); if (saveRvt) { @@ -248,8 +350,10 @@ public void HandleDesignAutomationReadyEvent(object sender, DesignAutomationRead { if (doc.IsModelInCloud) { + Console.WriteLine("Document is in cloud."); if (doc.IsWorkshared) // work-shared/C4R model { + Console.WriteLine("Document is C4R."); // Syncronize with central SynchronizeWithCentralOptions swc = new SynchronizeWithCentralOptions(); swc.SetRelinquishOptions(new RelinquishOptions(/*relinquishAll*/true));// Should this be configurable? @@ -257,22 +361,66 @@ public void HandleDesignAutomationReadyEvent(object sender, DesignAutomationRead } else {// Single user cloud model - var newLoc = setupReq?.SaveCloudModelLocation; - if (newLoc != null) - { - doc.SaveAsCloudModel(newLoc.AccountId, newLoc.ProjectId, newLoc.FolderId, newLoc.ModelName ?? Path.GetFileName(doc.PathName)); - } - else + Console.WriteLine("Document is single-user cloud model."); + + // Save the project locally (this will detach the model from the cloud, but we will re-upload at a new location) + doc.SaveAs(setupReq.LocalFileName); + + /* TODO: figure out if we need to make this work and how. + + doc.SaveCloudModel(); + + Console.WriteLine($"uploading with token {token}"); + // TODO: For single-user cloud models, we need to publish the model after saving so that the changes are reflected in the cloud. + var cmPath = doc.GetCloudModelPath(); + var dmClient = new DataManagementClient(null, new StaticAuthenticationProvider(token)); + var projId = "b." + setupReq.SaveCloudModelLocation.AccountId; + + var publishTask = dmClient.ExecutePublishModelAsync(projId, new PublishModelPayload() { - doc.SaveCloudModel(); - } + Type = TypeCommands.Commands, + Attributes = new PublishModelPayloadAttributes() + { + Extension = new PublishModelPayloadAttributesExtension() + { + Type = TypeCommandtypePublishmodel.CommandsautodeskBim360C4RModelPublish, + VarVersion = "1.0.0" + } + }, + Relationships = new PublishModelPayloadRelationships() + { + Resources = new PublishModelPayloadRelationshipsResources() + { + Data = new List + { + new PublishModelPayloadRelationshipsResourcesData() + { + Id = cmPath.GetModelGUID().ToString(), + Type = TypeItem.Items + } + } + } + } + }); + + publishTask.Wait(); + PublishModel respo = publishTask.Result; + Console.WriteLine($"Publish result: {JsonConvert.SerializeObject(respo)}"); + */ } } else - {// Save locally - RevitServices.Transactions.TransactionManager.Instance.ForceCloseTransaction(); - ModelPath path = ModelPathUtils.ConvertUserVisiblePathToModelPath("result.rvt"); - doc.SaveAs(path, new SaveAsOptions()); + { + /* TODO: Figure ou tif this is useful. + var newLoc = setupReq?.SaveCloudModelLocation; + if (newLoc != null) + { + Console.WriteLine($"Saving to new cloud model location with AccountId: {newLoc.AccountId}, ProjectId: {newLoc.ProjectId}, FolderId: {newLoc.FolderId}, ModelName: {newLoc.ModelName}"); + doc.SaveAsCloudModel(newLoc.AccountId, newLoc.ProjectId, newLoc.FolderId, newLoc.ModelName ?? Path.GetFileName(doc.PathName)); + }*/ + + // Save locally + doc.Save(); } } catch (Exception ex) diff --git a/src/DADynamoApp/SetupDARequest.cs b/src/DADynamoApp/SetupDARequest.cs index bf8485a6a9..3d22c87c46 100644 --- a/src/DADynamoApp/SetupDARequest.cs +++ b/src/DADynamoApp/SetupDARequest.cs @@ -5,7 +5,7 @@ namespace DADynamoApp /// /// Configuration details for a cloud model. /// - internal class CloudModelConfig + internal class OpenCloudModelLocation { /// /// Represents the region where the cloud model is hosted. @@ -57,19 +57,16 @@ internal class SetupDARequest // // Summary: // Save the revit document to the default result.rvt file. - [JsonProperty(nameof(SaveRevitFile), Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] - public bool SaveRevitFile { get; set; } = false; + [JsonProperty(nameof(GenerateOutputModel), Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] + public bool GenerateOutputModel { get; set; } = false; /// - /// The location to save the current DA work model. + /// Gets or sets the name of the Revit model file. /// - [JsonProperty(nameof(SaveCloudModelLocation), Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] - public SaveCloudModelLocation? SaveCloudModelLocation { get; set; } = null; + public string LocalFileName { get; set; } = string.Empty; - /// - /// Gets or sets the configuration for the cloud model. - /// - [JsonProperty(nameof(CloudModel), Required = Required.Default, NullValueHandling = NullValueHandling.Ignore)] - public CloudModelConfig? CloudModel { get; set; } = null; + public OpenCloudModelLocation? OpenCloudModelLocation { get; set; } = null; + + public SaveCloudModelLocation? SaveCloudModelLocation { get; set; } = null; } } From 7803436d1ce160004bd947b4840146a3b319f73e Mon Sep 17 00:00:00 2001 From: pinzart90 Date: Mon, 9 Mar 2026 13:22:41 -0400 Subject: [PATCH 65/70] update --- src/DADynamoApp/DAEntrypoint.cs | 16 +++++----------- src/DADynamoApp/SetupDARequest.cs | 2 +- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/src/DADynamoApp/DAEntrypoint.cs b/src/DADynamoApp/DAEntrypoint.cs index 8ebd2359e2..e0744c7909 100644 --- a/src/DADynamoApp/DAEntrypoint.cs +++ b/src/DADynamoApp/DAEntrypoint.cs @@ -40,7 +40,7 @@ public class DAEntrypoint : IExternalDBApplication private readonly string PythonDllFolder = "pythonDependencies"; - public static List Updaters = new List(); + private List Updaters = []; public ExternalDBApplicationResult OnShutdown(ControlledApplication application) { @@ -251,11 +251,11 @@ public void HandleDesignAutomationReadyEvent(object sender, DesignAutomationRead Console.WriteLine(ex.Message); } } - else if (setupReq?.LocalFileName != null) + else if (setupReq?.LocalModelFileName != null) { try { - var localModelPath = Path.Combine(WorkItemFolder, setupReq.LocalFileName); + var localModelPath = Path.Combine(WorkItemFolder, setupReq.LocalModelFileName); Console.WriteLine($"Opening local model at {localModelPath}"); doc = app?.OpenDocumentFile(localModelPath); } @@ -364,7 +364,7 @@ public void HandleDesignAutomationReadyEvent(object sender, DesignAutomationRead Console.WriteLine("Document is single-user cloud model."); // Save the project locally (this will detach the model from the cloud, but we will re-upload at a new location) - doc.SaveAs(setupReq.LocalFileName); + doc.SaveAs(setupReq.LocalModelFileName); /* TODO: figure out if we need to make this work and how. @@ -420,7 +420,7 @@ public void HandleDesignAutomationReadyEvent(object sender, DesignAutomationRead }*/ // Save locally - doc.Save(); + doc.SaveAs(setupReq.LocalModelFileName); } } catch (Exception ex) @@ -429,7 +429,6 @@ public void HandleDesignAutomationReadyEvent(object sender, DesignAutomationRead } } - model.RunCompleted += Model_RunCompleted; e.Succeeded = true; } @@ -484,10 +483,5 @@ private void PreInstallPythonDependencies() Console.WriteLine("Could not setup python " + ex.Message); } } - - private void Model_RunCompleted(object sender, bool success) - { - Console.WriteLine($"Run Completed"); - } } } diff --git a/src/DADynamoApp/SetupDARequest.cs b/src/DADynamoApp/SetupDARequest.cs index 3d22c87c46..ab16a6a8f7 100644 --- a/src/DADynamoApp/SetupDARequest.cs +++ b/src/DADynamoApp/SetupDARequest.cs @@ -63,7 +63,7 @@ internal class SetupDARequest /// /// Gets or sets the name of the Revit model file. /// - public string LocalFileName { get; set; } = string.Empty; + public string LocalModelFileName { get; set; } = string.Empty; public OpenCloudModelLocation? OpenCloudModelLocation { get; set; } = null; From 1bcd3bcb20ad1b07ac19b7b9778efc6e46042683 Mon Sep 17 00:00:00 2001 From: pinzart90 Date: Mon, 9 Mar 2026 13:27:31 -0400 Subject: [PATCH 66/70] update --- src/Libraries/RevitNodes/Elements/CeilingType.cs | 3 ++- src/Libraries/RevitNodes/Elements/FloorType.cs | 3 ++- src/Libraries/RevitNodes/Elements/LinkElement.cs | 3 ++- src/Libraries/RevitNodes/Elements/RoofType.cs | 3 ++- src/Libraries/RevitNodes/Elements/WallType.cs | 3 ++- .../RevitNodes/GeometryConversion/RevitToProtoMesh.cs | 3 ++- 6 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/Libraries/RevitNodes/Elements/CeilingType.cs b/src/Libraries/RevitNodes/Elements/CeilingType.cs index e394aec749..f2d36b0ba2 100644 --- a/src/Libraries/RevitNodes/Elements/CeilingType.cs +++ b/src/Libraries/RevitNodes/Elements/CeilingType.cs @@ -123,7 +123,8 @@ public Dictionary GetThermalProperties() return new Dictionary { { absorptanceOutputPort, thermalProperties.Absorptance }, - { thermalTransmittanceOutputPort, thermalProperties.ThermalTransmittance }, + // TODO: reconcile for Design Automation + //{ thermalTransmittanceOutputPort, thermalProperties.ThermalTransmittance }, { roughnessOutputPort, thermalProperties.Roughness }, { thermalMassOutputPort, thermalProperties.ThermalMass }, { thermalResistanceOutputPort, thermalProperties.ThermalResistance } diff --git a/src/Libraries/RevitNodes/Elements/FloorType.cs b/src/Libraries/RevitNodes/Elements/FloorType.cs index 6179e61adf..42664b6299 100644 --- a/src/Libraries/RevitNodes/Elements/FloorType.cs +++ b/src/Libraries/RevitNodes/Elements/FloorType.cs @@ -144,7 +144,8 @@ public Dictionary GetThermalProperties() return new Dictionary { { absorptanceOutputPort, thermalProperties.Absorptance }, - { thermalTransmittanceOutputPort, thermalProperties.ThermalTransmittance }, + // TODO: reconcile for Design Automation + //{ thermalTransmittanceOutputPort, thermalProperties.ThermalTransmittance }, { roughnessOutputPort, thermalProperties.Roughness }, { thermalMassOutputPort, thermalProperties.ThermalMass }, { thermalResistanceOutputPort, thermalProperties.ThermalResistance } diff --git a/src/Libraries/RevitNodes/Elements/LinkElement.cs b/src/Libraries/RevitNodes/Elements/LinkElement.cs index 1337e9c112..514bb95c1c 100644 --- a/src/Libraries/RevitNodes/Elements/LinkElement.cs +++ b/src/Libraries/RevitNodes/Elements/LinkElement.cs @@ -216,7 +216,8 @@ public static object GetGeometry(Element linkedElement, string detailLevel = "Me newVertList.Add(transformedVertex); } - var newMesh = Autodesk.DesignScript.Geometry.Mesh.ByPointsIndexGroups(newVertList, meshIndices); + // TODO: reconcile for Design Automation + Autodesk.DesignScript.Geometry.Mesh newMesh = null;// Autodesk.DesignScript.Geometry.Mesh.ByPointsIndexGroups(newVertList, meshIndices); geoSet.Add(newMesh); break; case GeometryInstance gi: diff --git a/src/Libraries/RevitNodes/Elements/RoofType.cs b/src/Libraries/RevitNodes/Elements/RoofType.cs index 8a7bb56f95..ff7c62a746 100644 --- a/src/Libraries/RevitNodes/Elements/RoofType.cs +++ b/src/Libraries/RevitNodes/Elements/RoofType.cs @@ -123,7 +123,8 @@ public Dictionary GetThermalProperties() return new Dictionary { { absorptanceOutputPort, thermalProperties.Absorptance }, - { thermalTransmittanceOutputPort, thermalProperties.ThermalTransmittance }, + // TODO: reconcile for Design Automation + //{ thermalTransmittanceOutputPort, thermalProperties.ThermalTransmittance }, { roughnessOutputPort, thermalProperties.Roughness }, { thermalMassOutputPort, thermalProperties.ThermalMass }, { thermalResistanceOutputPort, thermalProperties.ThermalResistance } diff --git a/src/Libraries/RevitNodes/Elements/WallType.cs b/src/Libraries/RevitNodes/Elements/WallType.cs index 9eeb873298..46d8569c01 100644 --- a/src/Libraries/RevitNodes/Elements/WallType.cs +++ b/src/Libraries/RevitNodes/Elements/WallType.cs @@ -140,7 +140,8 @@ public Dictionary GetThermalProperties() return new Dictionary { { absorptanceOutputPort, thermalProperties.Absorptance }, - { thermalTransmittanceOutputPort, thermalProperties.ThermalTransmittance }, + // TODO: reconcile for Design Automation + //{ thermalTransmittanceOutputPort, thermalProperties.ThermalTransmittance }, { roughnessOutputPort, thermalProperties.Roughness }, { thermalMassOutputPort, thermalProperties.ThermalMass }, { thermalResistanceOutputPort, thermalProperties.ThermalResistance } diff --git a/src/Libraries/RevitNodes/GeometryConversion/RevitToProtoMesh.cs b/src/Libraries/RevitNodes/GeometryConversion/RevitToProtoMesh.cs index f54d3ce833..3933035e91 100644 --- a/src/Libraries/RevitNodes/GeometryConversion/RevitToProtoMesh.cs +++ b/src/Libraries/RevitNodes/GeometryConversion/RevitToProtoMesh.cs @@ -18,7 +18,8 @@ public static Autodesk.DesignScript.Geometry.Mesh ToProtoType(this Autodesk.Revi .Select(mesh.get_Triangle) .Select(tri => IndexGroup.ByIndices(tri.get_Index(0), tri.get_Index(1), tri.get_Index(2))); - return Autodesk.DesignScript.Geometry.Mesh.ByPointsIndexGroups(pts, tris); + // TODO: reconcile for Design Automation + return null;// Autodesk.DesignScript.Geometry.Mesh.ByPointsIndexGroups(pts, tris); } From d544dc8f9e8d3b25d4c69946e82630b6071860a7 Mon Sep 17 00:00:00 2001 From: pinzart90 Date: Mon, 9 Mar 2026 13:38:41 -0400 Subject: [PATCH 67/70] update for 2026 Temporary changes until we rebase to 2026 or use revit 2027 --- src/Config/CS_SDK.props | 2 +- src/Config/packages_versions.props | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Config/CS_SDK.props b/src/Config/CS_SDK.props index 072b747ad6..f478bc7e19 100644 --- a/src/Config/CS_SDK.props +++ b/src/Config/CS_SDK.props @@ -6,7 +6,7 @@ false NET80;NET10_DA;NET100 net8.0-windows - net10.0-windows + net8.0-windows net10.0-windows 17.0 Preview Release diff --git a/src/Config/packages_versions.props b/src/Config/packages_versions.props index 4878314eb8..2187ff04b4 100644 --- a/src/Config/packages_versions.props +++ b/src/Config/packages_versions.props @@ -2,7 +2,7 @@ - 4.0.0-beta2972 + 3.5.0.8300 $(DYNAMOCORE_VERSION) $(DYNAMOCORE_VERSION) @@ -13,8 +13,8 @@ net10.0 3.0.1.4707 - 4.0.9405.33709 - net10.0 + 3.0.9229.39980 + net8.0 1.2.2 From 3e68a286330fe30a55be0672d2f5331771ab41fb Mon Sep 17 00:00:00 2001 From: Michael Kirschner <508936+mjkkirschner@users.noreply.github.com> Date: Fri, 13 Mar 2026 13:03:12 -0400 Subject: [PATCH 68/70] WIP - unify log output between DA appbundle and daas | 2026 (#3296) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ~~⚠️ do not merge while this branch targets net8 / dynamo 3.5 - can only ref dynamo 4.0~~ Retargeted to work in Revit 2026 / Dynamo 3.5. I will send another PR and create a new branch for D4R_DA_2027 untested! * `service mode` already redirects logger to std out. * we inject some profiling and send them to std out so they are captured in da logs. * test * added daapp.csproj to revit.all.sln - but unsure on this. * added a TODO file because I think there is a lot of cleanup required in this repo. @pinzart @pinzart90 I am thinking this branch (`D4R_DA`) gets renamed to D4R_DA_2026 and we rip out all the NET10 stuff - sound good? --- src/BUILDSYSTEM_TODO.md | 106 +++++++++++++ src/Config/CS_SDK.props | 2 +- src/DADynamoApp/DAEntrypoint.cs | 94 +++++++++++ src/DADynamoApp/DALogger.cs | 149 ++++++++++++++++++ src/DynamoRevit.All.sln | 10 ++ .../RevitIntegrationTests/DALoggerTests.cs | 68 ++++++++ .../RevitSystemTests.csproj | 2 +- .../Elements/DirectShapeTests.cs | 6 +- 8 files changed, 432 insertions(+), 5 deletions(-) create mode 100644 src/BUILDSYSTEM_TODO.md create mode 100644 src/DADynamoApp/DALogger.cs create mode 100644 test/Libraries/RevitIntegrationTests/DALoggerTests.cs diff --git a/src/BUILDSYSTEM_TODO.md b/src/BUILDSYSTEM_TODO.md new file mode 100644 index 0000000000..16e424ec3d --- /dev/null +++ b/src/BUILDSYSTEM_TODO.md @@ -0,0 +1,106 @@ +# Build System Cleanup — Open Questions & TODOs + +These are known issues and open design questions in the build system that need +to be resolved, particularly for the `D4R_DA_2026` branch targeting Revit 2026 / net8. + +--- + +## 1. Platform naming is confusing and redundant + +`CS_SDK.props` defines three platforms: + +| Platform | TargetFramework | Notes | +|------------|---------------------|-------| +| `NET80` | `net8.0-windows` | Interactive Revit build | +| `NET10_DA` | `net8.0-windows` | **Same as NET80 — name implies net10 but it's net8** | +| `NET100` | `net10.0-windows` | Future Revit targeting net10 | + +For the `D4R_DA_2026` branch (Revit 2026), only `net8.0-windows` is relevant. +`NET100` adds noise and `NET10_DA` is actively misleading. + +**Important:** `_DA` in the platform name is a meaningful build profile — it is not just a +TFM alias. Any platform whose name contains `_DA` triggers these behaviours across multiple projects: + +| Project | What `_DA` removes | +|---|---| +| `CS_SDK.props` | Defines `DESIGN_AUTOMATION` compile constant | +| `DynamoRevit.csproj` | Removes `DynamoRevit.cs`, `DynamoRevitApp.cs`, entire `ViewModel/` (interactive startup + ribbon) | +| `RevitNodesUI.csproj` | Removes all WPF controls, selection dialogs, XAML pages | +| `RevitServices.csproj` | Removes `Threading/*.cs` (UI thread marshalling, not needed in headless DA) | + +So the `_DA` suffix carries real semantic weight. The problem is solely the `NET10` prefix, +which implies net10 when the TFM is actually net8. Renaming `NET10_DA` → `NET80_DA` everywhere +would fix the confusion without changing any build behaviour. + +**Questions:** +- Should `D4R_DA_2026` drop `NET100` entirely and only expose `NET80`? +- Was `NET10_DA` ever actually net10 and got downgraded, or has it always been net8? +- Should DA just use `NET80` with a separate property/flag to denote DA vs interactive, + rather than a separate platform name? +- If `NET10_DA` stays, should it be renamed (e.g. `NET80_DA`) to reflect actual TFM? + +--- + +## 2. Solution file responsibilities are unclear + +| Solution | Projects included | Typical build command | +|-----------------------|--------------------------------|-----------------------| +| `DynamoRevit.DA.sln` | DADynamoApp + deps only | `/p:Platform=NET10_DA` | +| `DynamoRevit.All.sln` | Everything incl. tests | `/p:Platform=NET80` or `NET100` | + +`DADynamoApp` is **not** listed explicitly in `All.sln` — it is pulled in as a +transitive project reference from `RevitSystemTests`. This causes the solution to +build it without a proper platform mapping, which leads to build errors under +`dotnet build` with .NET SDK 10 (see issue 3 below). + +A workaround was added: explicit `DADynamoApp` entry in `All.sln` mapping +`NET80`/`NET100` → `NET10_DA`. But this is a band-aid. + +**Questions:** +- Should `DADynamoApp` be a first-class explicit project in `All.sln`? +- Should `DA.sln` be a proper subset configuration of `All.sln`, or kept fully separate? +- Is there a reason DA uses `NET10_DA` platform instead of `NET80`? If not, unify them + and remove the extra platform. + +--- + +## 3. `dotnet build` vs VS MSBuild inconsistency + +`DynamoRevit.All.sln` builds cleanly with VS MSBuild: +``` +& "C:\Program Files\Microsoft Visual Studio\18\Professional\MSBuild\Current\Bin\MSBuild.exe" DynamoRevit.All.sln -p:Configuration=Debug -p:Platform=NET80 -m +``` + +But fails with `dotnet build` using .NET SDK 10: +``` +dotnet build DynamoRevit.All.sln -c Debug /p:Platform=NET80 +``` + +Two known `dotnet build`-only failures: + +**a) `DADynamoApp` — `MSB3992: 'RootElementName' is not set`** +- Root cause: `EnableDynamicLoading=true` causes SDK 10 to set + `UseAttributeForTargetFrameworkInfoPropertyNames=true`, which requires + `RootElementName` to be set explicitly. VS MSBuild does not have this requirement. +- Possible fixes: set `false`, + or set `DADynamoApp` explicitly. + +**b) `DynamoRevitIcons` — `ResGen.exe not supported on .NET Core MSBuild`** +- Pre-existing issue. The `.resx` code generation step uses ResGen.exe which is + not available in the .NET Core MSBuild toolchain. +- Possible fix: migrate resource generation to use `` without + ResGen, or exclude from `dotnet build` paths. + +**Question:** Is `dotnet build` a supported/required path in CI, or does CI always +use VS MSBuild? The `Jenkinsfile` delegates to `DynamoRevitUtils` — need to check +those build scripts to confirm. + +--- + +## 4. Research needed / action items + +- [ ] Check `DynamoRevitUtils` Jenkins scripts: which solution, which platform, `dotnet` or VS MSBuild? +- [ ] Confirm whether `NET100` is used in any CI job for this branch +- [ ] Decide on NET10_DA rename/merge with NET80 +- [ ] Decide whether All.sln should be the canonical "build everything" solution +- [ ] Fix `dotnet build` compatibility if CI requires it (MSB3992 + ResGen) diff --git a/src/Config/CS_SDK.props b/src/Config/CS_SDK.props index f478bc7e19..655026b85f 100644 --- a/src/Config/CS_SDK.props +++ b/src/Config/CS_SDK.props @@ -9,7 +9,7 @@ net8.0-windows net10.0-windows 17.0 - Preview Release + 2026 $(SolutionDir)packages $(SolutionDir)..\extern $(SolutionDir)..\lib\Revit $(RevitVersionNumber)\$(DCoreLibSubFolder) diff --git a/src/DADynamoApp/DAEntrypoint.cs b/src/DADynamoApp/DAEntrypoint.cs index e0744c7909..9586f3adf9 100644 --- a/src/DADynamoApp/DAEntrypoint.cs +++ b/src/DADynamoApp/DAEntrypoint.cs @@ -5,6 +5,8 @@ using DesignAutomationFramework; using DSCPython; using Dynamo.Applications; +using Dynamo.Graph.Nodes; +using Dynamo.Graph.Workspaces; using Dynamo.Migration; using Dynamo.Models; using Dynamo.PythonServices; @@ -35,6 +37,13 @@ public class DAEntrypoint : IExternalDBApplication private string DynamoRevitPath; private ControlledApplication controlledApplication; + // Store event handler references for cleanup + private readonly Dictionary evaluationStartedHandler, + EventHandler evaluationCompletedHandler, + Dictionary[]> nodeHandlers)> + workspaceHandlers = []; + private string LoadMessage; private string WorkItemFolder; private readonly string PythonDllFolder = "pythonDependencies"; @@ -310,6 +319,8 @@ public void HandleDesignAutomationReadyEvent(object sender, DesignAutomationRead LoadMessage = model != null ? "loaded" : "no loaded"; + SetupProfilingHandlers(model); + var playerHost = new PlayerHostDynamoDefault(model, new DynamoPlayerLogger(logConfig)); var workflows = new DynamoModelWorkflows( playerHost, @@ -432,6 +443,89 @@ public void HandleDesignAutomationReadyEvent(object sender, DesignAutomationRead e.Succeeded = true; } + internal void SetupProfilingHandlers(DynamoModel model) + { + model.WorkspaceOpened += ws => + { + if (ws is not HomeWorkspaceModel homeWorkspace) return; + + var nodeHandlers = new Dictionary[]>(); + + EventHandler evaluationStartedHandler = (sender, args) => + { + homeWorkspace.EngineController.EnableProfiling(true, homeWorkspace, homeWorkspace.Nodes); + Console.WriteLine($"{DateTime.UtcNow:u} : Profiling enabled for {homeWorkspace.Name} dynamo workspace"); + }; + + EventHandler evaluationCompletedHandler = (sender, args) => + { + if (workspaceHandlers.TryGetValue(homeWorkspace, out var handlers)) + { + CleanupWorkspaceHandlers(homeWorkspace, handlers.evaluationStartedHandler, handlers.evaluationCompletedHandler, handlers.nodeHandlers); + } + }; + + foreach (var node in homeWorkspace.Nodes) + { + Action beginHandler = nm => + { + Console.WriteLine($"{DateTime.UtcNow:u} : Node {nm.Name} started execution."); + }; + + Action endHandler = nm => + { + var outputSummary = DALogger.SerializeNodeOutputs(nm, homeWorkspace.EngineController); + if (!string.IsNullOrEmpty(outputSummary)) + Console.WriteLine($"{DateTime.UtcNow:u} : Node {nm.Name} outputs: {outputSummary}"); + + var runtimeStatus = homeWorkspace.EngineController.LiveRunnerRuntimeCore.RuntimeStatus; + var nodeMessages = DALogger.GetNodeMessages(runtimeStatus, nm.GUID); + if (!string.IsNullOrEmpty(nodeMessages)) + Console.WriteLine($"{DateTime.UtcNow:u} : Node {nm.Name} messages: {nodeMessages}"); + + Console.WriteLine($"{DateTime.UtcNow:u} : Node {nm.Name} finished execution."); + }; + + node.NodeExecutionBegin += beginHandler; + node.NodeExecutionEnd += endHandler; + + nodeHandlers[node] = [beginHandler, endHandler]; + } + + homeWorkspace.EvaluationStarted += evaluationStartedHandler; + homeWorkspace.EvaluationCompleted += evaluationCompletedHandler; + + workspaceHandlers[homeWorkspace] = (evaluationStartedHandler, evaluationCompletedHandler, nodeHandlers); + }; + } + + private void CleanupWorkspaceHandlers( + HomeWorkspaceModel workspace, + EventHandler? evaluationStartedHandler, + EventHandler? evaluationCompletedHandler, + Dictionary[]> nodeHandlers) + { + if (evaluationStartedHandler != null) + workspace.EvaluationStarted -= evaluationStartedHandler; + + if (evaluationCompletedHandler != null) + workspace.EvaluationCompleted -= evaluationCompletedHandler; + + foreach (var kvp in nodeHandlers) + { + var node = kvp.Key; + var nodeHandlerArray = kvp.Value; + + if (nodeHandlerArray.Length >= 2) + { + node.NodeExecutionBegin -= nodeHandlerArray[0]; + node.NodeExecutionEnd -= nodeHandlerArray[1]; + } + } + + workspaceHandlers.Remove(workspace); + } + private void PreInstallPythonDependencies() { try diff --git a/src/DADynamoApp/DALogger.cs b/src/DADynamoApp/DALogger.cs new file mode 100644 index 0000000000..7c901150b1 --- /dev/null +++ b/src/DADynamoApp/DALogger.cs @@ -0,0 +1,149 @@ +using Dynamo.Graph.Nodes; +using ProtoCore; +using System.Reflection; +using System.Text.Json; + +[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("RevitSystemTests")] + +namespace DADynamoApp; + +/// +/// Utility helpers for DynamoRevit Design Automation profiling output. +/// All Dynamo internal logging is already redirected to stdout by IsServiceMode=true. +/// This class provides node output serialization via reflection into DynamoPlayer. +/// +internal static class DALogger +{ + // Cached reflection members for Player's WatchNodeHandler methods + private static MethodInfo? getNodeValueMethod; + private static MethodInfo? processWatchTreeMethod; + + private static readonly JsonSerializerOptions jsonOptions = new JsonSerializerOptions + { + WriteIndented = true, + DefaultIgnoreCondition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault + }; + + /// + /// Serializes node output values by getting data from the runtime mirror + /// and using Player's serialization logic via reflection. + /// + public static string SerializeNodeOutputs(NodeModel node, Dynamo.Engine.EngineController engineController, int maxLength = 2000) + { + try + { + var variableName = node.AstIdentifierForPreview.Value; + if (string.IsNullOrEmpty(variableName)) return string.Empty; + + var runtimeMirror = engineController.GetMirror(variableName); + if (runtimeMirror == null) return string.Empty; + + var mirrorData = runtimeMirror.GetData(); + if (mirrorData == null) return string.Empty; + + var valueContainer = GetNodeValueStringFromMirrorData(mirrorData); + if (valueContainer == null) return string.Empty; + + var valueString = JsonSerializer.Serialize(valueContainer, jsonOptions); + if (string.IsNullOrEmpty(valueString)) return string.Empty; + + if (valueString.Length > maxLength) + valueString = valueString.Substring(0, maxLength) + $"... (truncated from {valueString.Length} chars)"; + + return valueString; + } + catch (Exception ex) + { + Console.WriteLine($"Error serializing node outputs: {ex}"); + return string.Empty; + } + } + + private static object? GetNodeValueStringFromMirrorData(object mirrorData) + { + try + { + var obj = GetNodeValueViaReflection(mirrorData); + if (obj == null) return null; + + if (obj is System.Collections.IList list && list.Count == 0) + return new { Value = "Empty List" }; + + if (obj is System.Collections.IDictionary dict && dict.Count == 0) + return new { Value = "Empty Dictionary" }; + + return ProcessWatchTreeViaReflection(obj); + } + catch (Exception ex) + { + Console.WriteLine($"Error in GetNodeValueStringFromMirrorData: {ex}"); + return null; + } + } + + private static object? GetNodeValueViaReflection(object mirrorData) + { + if (getNodeValueMethod == null) + { + var assembly = AppDomain.CurrentDomain.GetAssemblies() + .FirstOrDefault(a => a.GetName().Name == "DynamoPlayer.Workflows") + ?? throw new InvalidOperationException("DynamoPlayer.Workflows assembly not found"); + + var type = assembly.GetType("DynamoPlayer.WatchNodeHandler") + ?? throw new InvalidOperationException("WatchNodeHandler type not found"); + + getNodeValueMethod = type.GetMethod("GetNodeValue", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static) + ?? throw new InvalidOperationException("GetNodeValue method not found"); + } + + try + { + return getNodeValueMethod.Invoke(null, [mirrorData]); + } + catch (TargetInvocationException ex) + { + throw new InvalidOperationException($"GetNodeValue invocation failed: {ex.InnerException?.Message}", ex.InnerException); + } + } + + private static object? ProcessWatchTreeViaReflection(object obj) + { + if (processWatchTreeMethod == null) + { + var assembly = AppDomain.CurrentDomain.GetAssemblies() + .FirstOrDefault(a => a.GetName().Name == "DynamoPlayer.Workflows") + ?? throw new InvalidOperationException("DynamoPlayer.Workflows assembly not found"); + + var type = assembly.GetType("DynamoPlayer.WatchNodeHandler") + ?? throw new InvalidOperationException("WatchNodeHandler type not found"); + + processWatchTreeMethod = type.GetMethod("ProcessWatchTree", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static) + ?? throw new InvalidOperationException("ProcessWatchTree method not found"); + } + + try + { + return processWatchTreeMethod.Invoke(null, [obj, null]); + } + catch (TargetInvocationException ex) + { + throw new InvalidOperationException($"ProcessWatchTree invocation failed: {ex.InnerException?.Message}", ex.InnerException); + } + } + + /// + /// Gets runtime warnings for a specific node as a JSON string. + /// + public static string GetNodeMessages(RuntimeStatus runtimeStatus, Guid nodeId) + { + var warnings = new List(); + + foreach (var warning in runtimeStatus.Warnings) + { + if (warning.GraphNodeGuid == nodeId) + warnings.Add(warning.Message); + } + + return JsonSerializer.Serialize(new { warnings = warnings.Count > 0 ? warnings : null }, jsonOptions); + } +} diff --git a/src/DynamoRevit.All.sln b/src/DynamoRevit.All.sln index 24a8bd7a44..4237e0644a 100644 --- a/src/DynamoRevit.All.sln +++ b/src/DynamoRevit.All.sln @@ -50,6 +50,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AssemblyInfoGenerator", "As EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RevitSystemTests", "..\test\Libraries\RevitIntegrationTests\RevitSystemTests.csproj", "{9ADADC68-36A3-4A21-9B54-298154A88720}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DADynamoApp", "DADynamoApp\DADynamoApp.csproj", "{B3F7C2D1-4E8A-4B6C-A9D2-6F1E8C3B7A05}" +EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{4466E6F6-F644-43AB-96B3-5ECE1622E711}" ProjectSection(SolutionItems) = preProject ..\.version = ..\.version @@ -191,6 +193,14 @@ Global {9ADADC68-36A3-4A21-9B54-298154A88720}.Release|NET100.Build.0 = Release|NET100 {9ADADC68-36A3-4A21-9B54-298154A88720}.Release|NET80.ActiveCfg = Release|NET80 {9ADADC68-36A3-4A21-9B54-298154A88720}.Release|NET80.Build.0 = Release|NET80 + {B3F7C2D1-4E8A-4B6C-A9D2-6F1E8C3B7A05}.Debug|NET100.ActiveCfg = Debug|NET10_DA + {B3F7C2D1-4E8A-4B6C-A9D2-6F1E8C3B7A05}.Debug|NET100.Build.0 = Debug|NET10_DA + {B3F7C2D1-4E8A-4B6C-A9D2-6F1E8C3B7A05}.Debug|NET80.ActiveCfg = Debug|NET10_DA + {B3F7C2D1-4E8A-4B6C-A9D2-6F1E8C3B7A05}.Debug|NET80.Build.0 = Debug|NET10_DA + {B3F7C2D1-4E8A-4B6C-A9D2-6F1E8C3B7A05}.Release|NET100.ActiveCfg = Release|NET10_DA + {B3F7C2D1-4E8A-4B6C-A9D2-6F1E8C3B7A05}.Release|NET100.Build.0 = Release|NET10_DA + {B3F7C2D1-4E8A-4B6C-A9D2-6F1E8C3B7A05}.Release|NET80.ActiveCfg = Release|NET10_DA + {B3F7C2D1-4E8A-4B6C-A9D2-6F1E8C3B7A05}.Release|NET80.Build.0 = Release|NET10_DA {A31E274C-524A-40CA-85FF-595D3DB53777}.Debug|NET100.ActiveCfg = Debug|NET100 {A31E274C-524A-40CA-85FF-595D3DB53777}.Debug|NET100.Build.0 = Debug|NET100 {A31E274C-524A-40CA-85FF-595D3DB53777}.Debug|NET80.ActiveCfg = Debug|NET80 diff --git a/test/Libraries/RevitIntegrationTests/DALoggerTests.cs b/test/Libraries/RevitIntegrationTests/DALoggerTests.cs new file mode 100644 index 0000000000..4387568d48 --- /dev/null +++ b/test/Libraries/RevitIntegrationTests/DALoggerTests.cs @@ -0,0 +1,68 @@ +using System; +using System.IO; +using DADynamoApp; +using NUnit.Framework; +using RevitTestServices; +using RTF.Framework; + +namespace RevitSystemTests +{ + [TestFixture] + class DALoggerTests : RevitSystemTestBase + { + private StringWriter capturedOutput; + private TextWriter originalOutput; + + [SetUp] + public override void Setup() + { + base.Setup(); + capturedOutput = new StringWriter(); + originalOutput = Console.Out; + Console.SetOut(capturedOutput); + } + + [TearDown] + public override void TearDown() + { + Console.SetOut(originalOutput); + capturedOutput?.Dispose(); + base.TearDown(); + } + + // TODO: Refactor DAEntrypoint so that all post-model-startup logic lives in a separate + // internal DAApp class that accepts a DynamoModel in its constructor. DAEntrypoint would + // just create the model and hand it to new DAApp(model). This test could then do: + // var app = new DAApp(ViewModel.Model); + // app.SetupProfilingHandlers(); + // ...which tests the actual DA code path without needing to create a DAEntrypoint at all, + // and makes it straightforward to test graph running too (pass a work item folder). + + /// + /// Verifies that DAEntrypoint.SetupProfilingHandlers wires up node execution events that + /// call DALogger.SerializeNodeOutputs and write profiling output to stdout. + /// + [Test] + [TestModel(@".\empty.rfa")] + public void SetupProfilingHandlers_WritesNodeOutputToStdout() + { + // Use the actual production method — SetupProfilingHandlers subscribes to WorkspaceOpened + // and wires all the profiling/serialization handlers on the model we already have. + var entrypoint = new DAEntrypoint(); + entrypoint.SetupProfilingHandlers(Model); + + string dynPath = Path.GetFullPath(Path.Combine(workingDirectory, @".\Core\SanityCheck.dyn")); + ViewModel.OpenCommand.Execute(dynPath); + RunCurrentModel(); + + var output = capturedOutput.ToString(); + + // Profiling start/end lines must appear + StringAssert.Contains("Node Point.ByCoordinates started execution.", output); + StringAssert.Contains("Node Point.ByCoordinates finished execution.", output); + + // DALogger.SerializeNodeOutputs must have returned something for the Point node + StringAssert.Contains("Node Point.ByCoordinates outputs:", output); + } + } +} diff --git a/test/Libraries/RevitIntegrationTests/RevitSystemTests.csproj b/test/Libraries/RevitIntegrationTests/RevitSystemTests.csproj index 4832393825..8a8ef3ddaa 100644 --- a/test/Libraries/RevitIntegrationTests/RevitSystemTests.csproj +++ b/test/Libraries/RevitIntegrationTests/RevitSystemTests.csproj @@ -54,10 +54,10 @@ + - diff --git a/test/Libraries/RevitNodesTests/Elements/DirectShapeTests.cs b/test/Libraries/RevitNodesTests/Elements/DirectShapeTests.cs index 3353d12176..ce95e3d909 100644 --- a/test/Libraries/RevitNodesTests/Elements/DirectShapeTests.cs +++ b/test/Libraries/RevitNodesTests/Elements/DirectShapeTests.cs @@ -54,7 +54,7 @@ private int CheckNumTriangles(DirectShape ds) private static DirectShape CreateDirectShapeFromQuadPoints(Point p1, Point p2, Point p3, Point p4) { var index = IndexGroup.ByIndices(0, 1, 2, 3); - var mesh = Mesh.ByPointsIndexGroups(new List() { p1, p2, p3, p4 }, new List() { index }); + var mesh = Mesh.ByPointsFaceIndices(new List() { p1, p2, p3, p4 }, new List() { index }); var mat = DocumentManager.Instance.ElementsOfType().First(); var ds = DirectShape.ByMesh(mesh, Category.ByName("OST_GenericModel"), Material.ByName(mat.Name), "a mesh"); mesh.Dispose(); @@ -191,7 +191,7 @@ public void ByMeshNameCategoryMaterial_ValidInput() var index1 = IndexGroup.ByIndices(0,1,2); - var mesh= Mesh.ByPointsIndexGroups(new List() { p1, p2, p3 }, new List() { index1 }); + var mesh= Mesh.ByPointsFaceIndices(new List() { p1, p2, p3 }, new List() { index1 }); var mat = DocumentManager.Instance.ElementsOfType().First(); var ds = DirectShape.ByMesh(mesh, Category.ByName("OST_GenericModel"), Material.ByName(mat.Name), "a mesh"); @@ -220,7 +220,7 @@ public void ByMeshAndBySurfaceBothLocatedSameMetric() var index1 = IndexGroup.ByIndices(0, 1, 2); - var mesh = Mesh.ByPointsIndexGroups(new List() { p1, p2, p3 }, new List() { index1 }); + var mesh = Mesh.ByPointsFaceIndices(new List() { p1, p2, p3 }, new List() { index1 }); var surf = Surface.ByPerimeterPoints(new List() { p1, p2, p3 }); var mat = DocumentManager.Instance.ElementsOfType().First(); From c484e664aa2c6b6ccd35f96b087397c5f5150956 Mon Sep 17 00:00:00 2001 From: pinzart90 <46732933+pinzart90@users.noreply.github.com> Date: Mon, 16 Mar 2026 13:07:45 -0400 Subject: [PATCH 69/70] Isolate the DA Application class (#3299) ISolate the DA Application class from the rest of the implementation so that we can handle setup an Assembly resolver before all the dependencies need to get solved. 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. ### Purpose (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. ### Declarations 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. ### Reviewers (FILL ME IN) Reviewer 1 (If possible, assign the Reviewer for the PR) (FILL ME IN, optional) Any additional notes to reviewers or testers. ### FYIs (FILL ME IN, Optional) Names of anyone else you wish to be notified of --- src/DADynamoApp/DAApplication.cs | 66 ++++++++++++++++++++++++++++++++ src/DADynamoApp/DAEntrypoint.cs | 32 +--------------- 2 files changed, 67 insertions(+), 31 deletions(-) create mode 100644 src/DADynamoApp/DAApplication.cs diff --git a/src/DADynamoApp/DAApplication.cs b/src/DADynamoApp/DAApplication.cs new file mode 100644 index 0000000000..d69b2fef7a --- /dev/null +++ b/src/DADynamoApp/DAApplication.cs @@ -0,0 +1,66 @@ +namespace DADynamoApp +{ + using Autodesk.Revit.ApplicationServices; + using Autodesk.Revit.DB; + using System.Diagnostics; + using System.Reflection; + + namespace DADynamoApp + { + [Autodesk.Revit.Attributes.Regeneration(Autodesk.Revit.Attributes.RegenerationOption.Manual)] + [Autodesk.Revit.Attributes.Transaction(Autodesk.Revit.Attributes.TransactionMode.Manual)] + public class DAApplication : IExternalDBApplication + { + private string ParentPath; + private string CurrentDirectory; + private readonly string PythonDllFolder = "pythonDependencies"; + + private DAEntrypoint daEntryPoint; + + public ExternalDBApplicationResult OnShutdown(ControlledApplication application) + { + AppDomain.CurrentDomain.UnhandledException -= CurrentDomain_UnhandledException; + AppDomain.CurrentDomain.ProcessExit -= CurrentDomain_ProcessExit; + AppDomain.CurrentDomain.AssemblyResolve -= CurrentDomain_AssemblyResolve; + return daEntryPoint.OnShutdown(application); + } + + public ExternalDBApplicationResult OnStartup(ControlledApplication application) + { + AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; + AppDomain.CurrentDomain.ProcessExit += CurrentDomain_ProcessExit; + AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve; + + CurrentDirectory = Directory.GetCurrentDirectory(); + ParentPath = Directory.GetParent(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)).FullName; + + Console.WriteLine("<> Starting to load DAEntrypoint"); + + daEntryPoint ??= new DAEntrypoint(); + + return daEntryPoint.OnStartup(application); + } + + private static void CurrentDomain_ProcessExit(object? sender, EventArgs e) + { + Process proc = Process.GetCurrentProcess(); + Console.WriteLine($"Dynamo exiting with Peak physical memory {proc.PeakWorkingSet64} bytes"); + if (proc.HasExited) + { + Console.WriteLine($"Dynamo exiting with code {proc.ExitCode}"); + } + } + + private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) + { + Console.WriteLine($"Unhandled exception: {e}"); + } + + private Assembly? CurrentDomain_AssemblyResolve(object? sender, ResolveEventArgs args) + { + return DynamoRevitAssemblyResolver.ResolveDynamoAssembly(ParentPath, [Path.Combine(CurrentDirectory, PythonDllFolder)], args); + } + } + } + +} diff --git a/src/DADynamoApp/DAEntrypoint.cs b/src/DADynamoApp/DAEntrypoint.cs index 9586f3adf9..62e2d0b8f5 100644 --- a/src/DADynamoApp/DAEntrypoint.cs +++ b/src/DADynamoApp/DAEntrypoint.cs @@ -27,9 +27,7 @@ namespace DADynamoApp { - [Autodesk.Revit.Attributes.Regeneration(Autodesk.Revit.Attributes.RegenerationOption.Manual)] - [Autodesk.Revit.Attributes.Transaction(Autodesk.Revit.Attributes.TransactionMode.Manual)] - public class DAEntrypoint : IExternalDBApplication + public class DAEntrypoint { private DynamoModel model; internal static DynamoPlayerLoggerConfiguration logConfig = new DynamoPlayerLoggerConfiguration() { DynamoLogLevel = Dynamo.Logging.LogLevel.Console, LogLevel = DynamoPlayer.LogLevel.Information }; @@ -55,10 +53,6 @@ public ExternalDBApplicationResult OnShutdown(ControlledApplication application) { model?.Dispose(); - AppDomain.CurrentDomain.UnhandledException -= CurrentDomain_UnhandledException; - AppDomain.CurrentDomain.ProcessExit -= CurrentDomain_ProcessExit; - AppDomain.CurrentDomain.AssemblyResolve -= CurrentDomain_AssemblyResolve; - controlledApplication.DocumentClosing -= RevitServices.EventHandler.EventHandlerProxy.Instance.OnApplicationDocumentClosing; controlledApplication.DocumentClosed -= RevitServices.EventHandler.EventHandlerProxy.Instance.OnApplicationDocumentClosed; controlledApplication.DocumentOpened -= RevitServices.EventHandler.EventHandlerProxy.Instance.OnApplicationDocumentOpened; @@ -66,21 +60,6 @@ public ExternalDBApplicationResult OnShutdown(ControlledApplication application) return ExternalDBApplicationResult.Succeeded; } - private static void CurrentDomain_ProcessExit(object? sender, EventArgs e) - { - Process proc = Process.GetCurrentProcess(); - Console.WriteLine($"Dynamo exiting with Peak physical memory {proc.PeakWorkingSet64} bytes"); - if (proc.HasExited) - { - Console.WriteLine($"Dynamo exiting with code {proc.ExitCode}"); - } - } - - private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) - { - Console.WriteLine($"Unhandled exception: {e}"); - } - public ExternalDBApplicationResult OnStartup(ControlledApplication application) { controlledApplication = application; @@ -94,10 +73,6 @@ public ExternalDBApplicationResult OnStartup(ControlledApplication application) var hostloc = typeof(Autodesk.Revit.ApplicationServices.Application).Assembly.Location; var hostDir = Path.GetDirectoryName(hostloc); - AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; - AppDomain.CurrentDomain.ProcessExit += CurrentDomain_ProcessExit; - AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve; - Console.WriteLine("<> Starting to load D4DA"); try @@ -123,11 +98,6 @@ public ExternalDBApplicationResult OnStartup(ControlledApplication application) } } - private Assembly? CurrentDomain_AssemblyResolve(object? sender, ResolveEventArgs args) - { - return DynamoRevitAssemblyResolver.ResolveDynamoAssembly(DynamoPath, [Path.Combine(WorkItemFolder, PythonDllFolder)], args); - } - private static string GetRevitContext(Autodesk.Revit.ApplicationServices.Application app) { var r = new Regex(@"\b(Autodesk |Structure |MEP |Architecture )\b"); From d99b3d7b9d8acd20e52faf957e4a62fb1a32e62b Mon Sep 17 00:00:00 2001 From: pinzart90 <46732933+pinzart90@users.noreply.github.com> Date: Wed, 25 Mar 2026 06:46:48 -0400 Subject: [PATCH 70/70] update for transactions (#3303) ### Purpose https://jira.autodesk.com/browse/DYN-10310 Cannot save rvt after running graph ### Declarations 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. ### Reviewers (FILL ME IN) Reviewer 1 (If possible, assign the Reviewer for the PR) (FILL ME IN, optional) Any additional notes to reviewers or testers. ### FYIs (FILL ME IN, Optional) Names of anyone else you wish to be notified of --- src/DADynamoApp/DAApplication.cs | 97 ++++++++++++++++---------------- src/DADynamoApp/DAEntrypoint.cs | 30 +++++++--- 2 files changed, 69 insertions(+), 58 deletions(-) diff --git a/src/DADynamoApp/DAApplication.cs b/src/DADynamoApp/DAApplication.cs index d69b2fef7a..834c3415c8 100644 --- a/src/DADynamoApp/DAApplication.cs +++ b/src/DADynamoApp/DAApplication.cs @@ -1,66 +1,63 @@ -namespace DADynamoApp -{ - using Autodesk.Revit.ApplicationServices; - using Autodesk.Revit.DB; - using System.Diagnostics; - using System.Reflection; + +using Autodesk.Revit.ApplicationServices; +using Autodesk.Revit.DB; +using System.Diagnostics; +using System.Reflection; - namespace DADynamoApp +namespace DADynamoApp +{ + [Autodesk.Revit.Attributes.Regeneration(Autodesk.Revit.Attributes.RegenerationOption.Manual)] + [Autodesk.Revit.Attributes.Transaction(Autodesk.Revit.Attributes.TransactionMode.Manual)] + public class DAApplication : IExternalDBApplication { - [Autodesk.Revit.Attributes.Regeneration(Autodesk.Revit.Attributes.RegenerationOption.Manual)] - [Autodesk.Revit.Attributes.Transaction(Autodesk.Revit.Attributes.TransactionMode.Manual)] - public class DAApplication : IExternalDBApplication - { - private string ParentPath; - private string CurrentDirectory; - private readonly string PythonDllFolder = "pythonDependencies"; + private string ParentPath; + private string CurrentDirectory; + private readonly string PythonDllFolder = "pythonDependencies"; - private DAEntrypoint daEntryPoint; + private DAEntrypoint daEntryPoint; - public ExternalDBApplicationResult OnShutdown(ControlledApplication application) - { - AppDomain.CurrentDomain.UnhandledException -= CurrentDomain_UnhandledException; - AppDomain.CurrentDomain.ProcessExit -= CurrentDomain_ProcessExit; - AppDomain.CurrentDomain.AssemblyResolve -= CurrentDomain_AssemblyResolve; - return daEntryPoint.OnShutdown(application); - } + public ExternalDBApplicationResult OnShutdown(ControlledApplication application) + { + AppDomain.CurrentDomain.UnhandledException -= CurrentDomain_UnhandledException; + AppDomain.CurrentDomain.ProcessExit -= CurrentDomain_ProcessExit; + AppDomain.CurrentDomain.AssemblyResolve -= CurrentDomain_AssemblyResolve; + return daEntryPoint.OnShutdown(application); + } - public ExternalDBApplicationResult OnStartup(ControlledApplication application) - { - AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; - AppDomain.CurrentDomain.ProcessExit += CurrentDomain_ProcessExit; - AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve; + public ExternalDBApplicationResult OnStartup(ControlledApplication application) + { + AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; + AppDomain.CurrentDomain.ProcessExit += CurrentDomain_ProcessExit; + AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve; - CurrentDirectory = Directory.GetCurrentDirectory(); - ParentPath = Directory.GetParent(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)).FullName; + CurrentDirectory = Directory.GetCurrentDirectory(); + ParentPath = Directory.GetParent(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)).FullName; - Console.WriteLine("<> Starting to load DAEntrypoint"); + Console.WriteLine("<> Starting to load DAEntrypoint"); - daEntryPoint ??= new DAEntrypoint(); + daEntryPoint ??= new DAEntrypoint(); - return daEntryPoint.OnStartup(application); - } + return daEntryPoint.OnStartup(application); + } - private static void CurrentDomain_ProcessExit(object? sender, EventArgs e) + private static void CurrentDomain_ProcessExit(object? sender, EventArgs e) + { + Process proc = Process.GetCurrentProcess(); + Console.WriteLine($"Dynamo exiting with Peak physical memory {proc.PeakWorkingSet64} bytes"); + if (proc.HasExited) { - Process proc = Process.GetCurrentProcess(); - Console.WriteLine($"Dynamo exiting with Peak physical memory {proc.PeakWorkingSet64} bytes"); - if (proc.HasExited) - { - Console.WriteLine($"Dynamo exiting with code {proc.ExitCode}"); - } + Console.WriteLine($"Dynamo exiting with code {proc.ExitCode}"); } + } - private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) - { - Console.WriteLine($"Unhandled exception: {e}"); - } + private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) + { + Console.WriteLine($"Unhandled exception: {e}"); + } - private Assembly? CurrentDomain_AssemblyResolve(object? sender, ResolveEventArgs args) - { - return DynamoRevitAssemblyResolver.ResolveDynamoAssembly(ParentPath, [Path.Combine(CurrentDirectory, PythonDllFolder)], args); - } + private Assembly? CurrentDomain_AssemblyResolve(object? sender, ResolveEventArgs args) + { + return DynamoRevitAssemblyResolver.ResolveDynamoAssembly(ParentPath, [Path.Combine(CurrentDirectory, PythonDllFolder)], args); } } - -} +} \ No newline at end of file diff --git a/src/DADynamoApp/DAEntrypoint.cs b/src/DADynamoApp/DAEntrypoint.cs index 62e2d0b8f5..31eafcd84f 100644 --- a/src/DADynamoApp/DAEntrypoint.cs +++ b/src/DADynamoApp/DAEntrypoint.cs @@ -177,17 +177,24 @@ private static string GetRevitContext(Autodesk.Revit.ApplicationServices.Applica public void HandleDesignAutomationReadyEvent(object sender, DesignAutomationReadyEventArgs e) { Console.WriteLine("<> DA event raised."); - + var workItemId = Environment.ExpandEnvironmentVariables("%DAS_WORKITEM_ID%"); Console.WriteLine($"<> WorkItemId is '{workItemId}'"); var workItemFileName = $"{workItemId}_job.das"; - Console.WriteLine($"Looking for WorkItem file at '{workItemFileName}', exists: {File.Exists(workItemFileName)}"); - var workItemContent = File.ReadAllText(workItemFileName); - - var token = ExtractTokenFromWorkItem(workItemContent); - Console.WriteLine($"<> Token is '{token}'"); + var workItemExists = File.Exists(workItemFileName); + Console.WriteLine($"Looking for WorkItem file at '{workItemFileName}', exists: {workItemExists}"); + if (workItemExists) + { + var workItemContent = File.ReadAllText(workItemFileName); + + var token = ExtractTokenFromWorkItem(workItemContent); + if (!string.IsNullOrEmpty(token)) + { + Console.WriteLine($"<> Extracted token from workItem content."); + } + } // Local Change //WorkItemFolder = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); @@ -265,7 +272,7 @@ public void HandleDesignAutomationReadyEvent(object sender, DesignAutomationRead DocumentManager.Instance.PrepareForDesignAutomation(app); // Local Change - //var geometryFactoryPath = @"C:\\Program Files\\Autodesk\\Revit 2025"; + //var geometryFactoryPath = @"C:\\Program Files\\Autodesk\\Revit 2026"; var loadedLibGVersion = ASMPrealoaderUtils.PreloadAsmFromRevit(controlledApplication.SharedComponentsLocation, DynamoPath); var geometryFactoryPath = ASMPrealoaderUtils.GetGeometryFactoryPath(DynamoPath, loadedLibGVersion); @@ -313,6 +320,13 @@ public void HandleDesignAutomationReadyEvent(object sender, DesignAutomationRead { var res = dynHandler.HandleRoute("POST", "/v1/graph/run", runContent); output = res.Result; + + // Force transaction close for now. + // This is already called on RevitDynamoModel.OnEvaluationCompleted. + // TODO: figure out if this is required here (I noticed, a couple of times, saving the rvt failed after running a graph) + // ex. Operation is not permitted when there is any open sub-transaction, transaction, or transaction group. + // DYN-10310 + RevitServices.Transactions.TransactionManager.Instance?.ForceCloseTransaction(); } catch (Exception ex) { @@ -345,7 +359,7 @@ public void HandleDesignAutomationReadyEvent(object sender, DesignAutomationRead Console.WriteLine("Document is single-user cloud model."); // Save the project locally (this will detach the model from the cloud, but we will re-upload at a new location) - doc.SaveAs(setupReq.LocalModelFileName); + doc.SaveAs(Path.Combine(WorkItemFolder, setupReq.LocalModelFileName)); /* TODO: figure out if we need to make this work and how.