Hello,I hava some question about Navisworks 2013 .Net API,please help me
1.I have *.nwd file,I can open it with Navisworks,but I can't open it with .Net API or COM API,is .NET api can only open special type file?
2.Is there any api about View Cube,NavigationBar and Steering Wheel just like Navisworks in .NET API,the View Cube is a greate tool,i want it
TKS~~~
Solved! Go to Solution.
Solved by xiaodong_liang. Go to Solution.
Hi,
1. nwd is the native format of Navisworks. the API should work. Could you share a demo code to reproduce the problem?
2. no API for view cube, NavigationBar and Steering Wheel. I agree they are nice 🙂 but no API. However, API allows you to manipulate navigation mode and camera. So you will just need to implement your own interfaces with the corresponding abilities. I even believe your interfaces would be more cool than Navisworks 🙂
Hello,Mr.Liang,can i ask you some other questions?
i want search some modelitems and i find them ,then i want to zoom to the modelitem,but i find .NET api has no related api ,the com api has ,so i use ComApiBridge to use the com api but it throw a exception called
"Application::MainDocument is Null,COM API not available",what's wrong?
i find the Autodesk.Navisworks.Api.Application.MainDocument is always null,how to solve this problem
the code is below,the project is in attachment
Search s = new Search();
s.SearchConditions.Add(SearchCondition.HasCategoryByName("LcRevitId"));
s.SearchConditions.Add(SearchCondition.HasPropertyByName("LcRevitId", "LcOaNat64AttributeValue").EqualValue(VariantData.FromDisplayString(txtModelID.Text.Trim())));
s.Selection.SelectAll();
s.Locations = SearchLocations.DescendantsAndSelf;
ModelItemCollection mic = s.FindAll(Autodesk.Navisworks.Api.Application.ActiveDocument, false);
if (mic == null || mic.Count == 0)
{
MessageBox.Show("没有对应ID的元素");
}
else
{
ModelItem item = mic.First();
Autodesk.Navisworks.Api.Application.ActiveDocument.CurrentSelection.Clear();
Autodesk.Navisworks.Api.Application.ActiveDocument.CurrentSelection.Add(item);
InwOpState10 oState = ComApiBridge.State;
//InwOaPath3 path = ComApiBridge.ToInwOaPath(item) as InwOaPath3;
//oState.ZoomInCurViewOnBoundingBox(path.GetBoundingBox(), 1);
oState.ZoomInCurViewOnCurSel();
}
hi,
- yes, COM API to zoom. I have replied you in the other thread:
- see API help reference:
The Application's MainDocument property is null until SetAsMainDocument is called. However SetAsMainDocument must only be called once during the runtime of applications as there can only be one main document running at a time. The DocumentControl which has the Main Document assigned must not be disposed until the end of the application.
In addition, remember to take a look at API samples! There are some demos of .NET control. If you have taken a look, you would have found the reason above yourself.
Hi,
It is best you log a new post for new question, instead of adding new questions more and more within one thread. Glad to see you have logged a new case. I will reply you there.