Community
Navisworks API
Welcome to Autodesk’s Navisworks API Forums. Share your knowledge, ask questions, and explore popular Navisworks API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

some question about 2013 .net api

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
sd1036770
1129 Views, 5 Replies

some question about 2013 .net api

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~~~

Tags (1)
5 REPLIES 5
Message 2 of 6
xiaodong_liang
in reply to: sd1036770

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 🙂

Message 3 of 6
sd1036770
in reply to: xiaodong_liang

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();
                }

Message 4 of 6
xiaodong_liang
in reply to: sd1036770

hi,

 

- yes, COM API to zoom. I have replied you in the other thread:

  how to zoom to the modelitem

 

- 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.

Message 5 of 6
sd1036770
in reply to: xiaodong_liang

Mr.Liang Thanks for your help.I have resolve this problem,but here is another new question about clash,the code is below Document document = Autodesk.Navisworks.Api.Application.MainDocument; if (document == null || document.IsClear) { return; } DocumentClash documentClash = DocumentExtensions.GetClash(document); if (documentClash == null || documentClash.TestsData == null) { return; } the program catch an exception 未能加载文件或程序集"AutoDesk.Navisworks.Clash.dll"或它的某一个依赖项。找不到指定的模块 the screenshot is in the attachment,please help TKS
Message 6 of 6
xiaodong_liang
in reply to: sd1036770

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.

 

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Rail Community


Autodesk Design & Make Report