Skip to content

Commit

Permalink
Create GetFileUnit.cs
Browse files Browse the repository at this point in the history
chuongmep committed Apr 22, 2022
1 parent d7d54bb commit dd0f185
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions Test/GetFileUnit.cs
Original file line number Diff line number Diff line change
@@ -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;
}
}

0 comments on commit dd0f185

Please sign in to comment.