//预定义
using ComApi = Autodesk.Navisworks.Api.Interop.ComApi;
using ComApiBridge = Autodesk.Navisworks.Api.ComApi;
{
//获取state
ComApi.InwOpState oState = ComApiBridge.ComApiBridge.State;
//访问selection sets
InwSelectionSetColl sets = state.SelectionSets();
foreach
(InwOpSelectionSet set in sets)
{
}
//COM的结果转换为.NET API对象
InwOpSelectionSet set = (InwOpSelectionSet)sets[1];
ModelItemCollection items =
ComApiBridge.ToModelItemCollection(set.selection); Application.ActiveDocument.CurrentSelection.CopyFrom(items);
}
参考\api\net\examples\Basic
Examples\CSharp\APICallsCOMPlugin
api\net\examples\Basic
Examples\CSharp\ControlsAndCOM