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:Ā 

Navisworks accessing ActiveDocument from Automation API

6 REPLIES 6
Reply
Message 1 of 7
jbiaggini
2079 Views, 6 Replies

Navisworks accessing ActiveDocument from Automation API

It seems that the only way to get access to the power of the Autodesk.Navisworks.Api from Autodesk.Navisworks.Api.Automation is by calling a plugin. This requires the plugin to be created, compiled and deployed through a separate VS project. Is there another way? I would like to be able to do something like this:

 

NavisworksApplication automationApplication = new Autodesk.Navisworks.Api.Automation.NavisworksApplication();
automationApplication.OpenFile("c:\\myModel.nwd");
Autodesk.Navisworks.Api.Application.ActiveDocument.SaveFile("c:\\myMode_2010l.nwd", DocumentFileVersion.Navisworks2010);

 The above code fails because the ActiveDocument is not set.

 

Thanks

6 REPLIES 6
Message 2 of 7
xiaodong_liang
in reply to: jbiaggini

Hi,

 

This is as designed. 

 

The Automation part of the .NET API is a small assembly that can be referenced by developer applications. It contains enough to start Navisworks and perform some basic actions; however complex actions should be achieved using a plug-in which can still be called through Automation. 

 

About your code above, why you did not use automationApplication.SaveFile directly? Currently, Navisworks is still single doucument. So after opening the file by automationApplication.OpenFile, it is the active document.

Message 3 of 7
jbiaggini
in reply to: xiaodong_liang

I need to save as an older version of Navisowrks. The Automation API SaveFile method does not allow me to specify a Navisworks Document Version.

 

In any case, that was just a simple example. There is more complex functionality (like property based coloring) that I want to implement. I wanted to do it without having to create a separate plugin, but it seems it is not possible. This imposes a severe limitation on the design of my application. If only I could get an instance of the ActiveDocument from the Automation API, that would solve the problem. Do  you know if Autodesk has any plans of doing something like this?

Message 4 of 7
xiaodong_liang
in reply to: jbiaggini

Hi jbiaggini ,

 

Sorry I do not see a plan. Before logging a wish, I'd like to collect more requirement that is could be done by automation only. Basically, automation is to manipulate in application / document level such as you want to save to a lower version. I cannot guarantee this would be implemented, but  please feel free to raise more what you think are fine to be exposed in automation.

Message 5 of 7
jbiaggini
in reply to: jbiaggini

After loading a document using the Automation API, I would like to be able to get an instance of the Autodesk.Navisworks.Api.ActiveDocument from the Automation API without having to call a plugin.

Message 6 of 7
xiaodong_liang
in reply to: jbiaggini

Thank you jbiaggini. I logged a wish to access ActiveDocument by automation, at least to expose the method SaveAs with file version.

Message 7 of 7

Can it be accessed through NavisWorks 2019 at this moment? 

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

Post to forums  

Rail Community


Ā 

Autodesk Design & Make Report

Ā