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: 

Getting a running instance of Navisworks

4 REPLIES 4
Reply
Message 1 of 5
JanneTS
1258 Views, 4 Replies

Getting a running instance of Navisworks

In my Autocad .NET program I want to get a running instance of Navisworks and execute a Navisworks plugin. I have Navisworks running, but when I execute my Autocad .NET command, getting the running instance works very poorly.

 

Autodesk.Navisworks.Api.Automation.NavisworksApplication.TryGetRunningInstance()

never works.

 

Autodesk.Navisworks.Api.Automation.NavisworksApplication.GetRunningInstance()

works only the first time I execute the Autocad .NET command, even though Navisworks continues to run normally.

 

Any ideas / experience on this?

 

 

 

4 REPLIES 4
Message 2 of 5
Anonymous
in reply to: JanneTS

Has ANYONE solved this? I am writing in Jan 2016 for NW Simulate 2013!!!! I have the same issue. - it runs once, but never again (it returns null) until you restart NW Simulate (roamer.exe) and again, it works only the first time. Now I'm using the VBA COM object. It was working last month, and one weekend later - it only runs the furst time.

 

After much digging, there is an entry in the ROT table like !{_insert_class_guid_here} - a microsoft ActiveX thing that heklps you grab the running instance. All apps run there, like Excel and keep an entry in there even after you r routine exits or the object is set to null. I cannot use the .quit (or equiv) because... I don't want it to quit. HOWEVER - the ROT entry is removed after the VBA COM component is completed running. This shoudl not be. A full uninstall-reinstall does NOT fix this. Neither does a repair. Many machines are "broken". Many are not - same company installs.

 

Anyone?

Message 3 of 5
Anonymous
in reply to: Anonymous

[VBA COM SOLVED] Would this solve your issue? OK - If you read about making Active X apps - most apps are registered in this ROT table (microsoft thing) and can be registered with a weak or a strong reference. Strong ones stay there, weak ones disappear. BUT ... There is a flag in MS Office Active X to make the weak turn into a strong reference ... and guess what ... I thought I would peek at the .Document object - oh my - THERE IS ONE. Run the .StayOpen on the document object and ... IT WORKS EVERY TIME NOW. From your command .. I think it using this table. I made my own ROT checker in c# and ... it behaves now. Hours and hours of reading. Sure enough, I look for stay open and a one code example uses it ... it is hidden at the very end. http://adndevblog.typepad.com/aec/2012/07/changing-background-for-publishing-file-using-script-autom...
Message 4 of 5
yh498712202
in reply to: Anonymous

it works very well 

in .net Api

it looks like this

 

using (var app = Autodesk.Navisworks.Api.Automation.NavisworksApplication.GetRunningInstance())
{

//your logic
app.StayOpen();
}

Message 5 of 5
JanneTS
in reply to: yh498712202

Yes, has worked for me like that in versions 2011-2021. But it stopped working in NavisWorks version 2022. 

Any ideas how to make it work in version 2022?

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

Post to forums  

Rail Community


 

Autodesk Design & Make Report