From dd0f185c09af36f7744cd3fd06d2a332c597aa61 Mon Sep 17 00:00:00 2001 From: Chuong Ho <31106432+chuongmep@users.noreply.github.com> Date: Fri, 22 Apr 2022 16:28:02 +0700 Subject: [PATCH] Create GetFileUnit.cs --- Test/GetFileUnit.cs | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 Test/GetFileUnit.cs diff --git a/Test/GetFileUnit.cs b/Test/GetFileUnit.cs new file mode 100644 index 0000000..3b72809 --- /dev/null +++ b/Test/GetFileUnit.cs @@ -0,0 +1,44 @@ +using System.Windows; +using Autodesk.Navisworks.Api.Plugins; +using ComApi = Autodesk.Navisworks.Api.Interop.ComApi; +using ComApiBridge = Autodesk.Navisworks.Api.ComApi; + +namespace Test; + +//https://adndevblog.typepad.com/aec/2012/06/accessing-the-file-units-and-location-information-using-navisworks-net-api.html +public class GetFileUnit : AddInPlugin +{ + public override int Execute(params string[] parameters) + { + ComApi.InwOpState10 state; + + state = ComApiBridge.ComApiBridge.State; + ComApi.InwOaPartition part; + + part = state.CurrentPartition; + + + ComApi.InwNodeAttributesColl atts; + + atts = part.Attributes(); + + + foreach (ComApi.InwOaAttribute att in atts) + + { + ComApi.InwOaTransform trans = att as ComApi.InwOaTransform; + + if (null != trans) + + { + ComApi.InwLTransform3f tra = trans.GetTransform(); + + object traMatrix = tra.Matrix; + MessageBox.Show(traMatrix.GetType().ToString()); + break; + } + } + + return 0; + } +} \ No newline at end of file