The units information from a Navisworks model can be retrieved using the Document.Units property.
The Origin/Location values have not been exposed with the .NET API yet. As workaround, we can use the COM API bridge to access the transforms on the partitions. The code is included below.
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using System.Text;
using Autodesk.Navisworks.Api;
using Autodesk.Navisworks.Api.Plugins;
using ComApi = Autodesk.Navisworks.Api.Interop.ComApi;
using ComApiBridge = Autodesk.Navisworks.Api.ComApi;
namespace BasicPlugIn
{
[PluginAttribute("BasicPlugIn.ABasicPlugin",
"ADSK",
ToolTip = "BasicPlugIn.ABasicPlugin tool tip",
DisplayName = "Hello World Plugin")]
public class ABasicPlugin : 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 m = tra.Matrix;
}
}
return 0;
}
}
}
Please do note that this attribute on partition does not exist by default. It will be added only after the transformation is modified. You can assume the identity matrix if there is no transform attribute in the collection, otherwise, you can look for an attribute of object type InwOaTransform.