UpdateFiles vs Update only specific file in a NWF

UpdateFiles vs Update only specific file in a NWF

alexisDVJML
Collaborator Collaborator
2,765 Views
8 Replies
Message 1 of 9

UpdateFiles vs Update only specific file in a NWF

alexisDVJML
Collaborator
Collaborator

In our Navisworks plugin, we need to force a refresh of only a specific model file (a .NWC) that is included in the currently opened model since we know only this file has changed and this file is small vs the main model file(s).

 

For now I'm using the API document function UpdateFiles, but this takes too long for our purpose since Navisworks reload, combine and re-optimize all included files.

 

Any alternative, even if low level or not documented?

 

Thanks in advance.

Main Scientist, Full Stack Developer & When Time Permits Director of IDIGO ► On your marks, Set, Go
0 Likes
2,766 Views
8 Replies
Replies (8)
Message 2 of 9

ulski1
Collaborator
Collaborator
As I haven't seen your code the is just guessing. You should just tryload the nwf file and Navisworks should automatically load the files linked to the nwf into memory - there should be no need to "update" anything if you after loading the nwf files want to add more files you just du a append and a save of the nwf file. Perhaps I'm misunderstanding the issue here - because there is not a lot of info in your post

Br
Ulrik
0 Likes
Message 3 of 9

alexisDVJML
Collaborator
Collaborator

Hi Ulrik,

 

Thanks for reply.

 

The reason we need to programmatically ask Navisworks to update one specific linked file at a specific time and not just at file opening is because our Plug-In call an external application that changes said file 😉

Using NWA.ActiveDocument.RefreshFiles works and is OK as a temporary solution, but due to its long running time would not be acceptable (at least by my standards) for the commercial solution we are developing.

 

I also tried to delete and re-append said file but it's even worst re: running time 😞

Unfortunately the class Model does not have an Update method, so I'm starting to run out of ideas...

Main Scientist, Full Stack Developer & When Time Permits Director of IDIGO ► On your marks, Set, Go
0 Likes
Message 4 of 9

ulski1
Collaborator
Collaborator
I understand better now.
I just tested a nwf file containing 79 nwd files - an update of the nwf here via the GUI update files button takes 1-2seconds
0 Likes
Message 5 of 9

alexisDVJML
Collaborator
Collaborator

Hi,

 

Thanks for continued feedback on this.

In my case I have only 2 models in my typical .nwf [see attached image]:

- typical end user model, .nwd, containing in the range of million(s) of items
- our generated .nwc which typically contains less than 1,000 items.

So the number of appended models is not the key factor here.

 

In my case the UpdateFiles takes typically around 1mn or more.

I tried manually by changing the .nwc and using the GUI Refresh button and I get similar execution time so I guess the GUI use the same API function.

Wondering how to let Navisworks know that only my .nwc has changed? Should UpdateFiles at least have the option to check for timestamp or something similar?

Main Scientist, Full Stack Developer & When Time Permits Director of IDIGO ► On your marks, Set, Go
0 Likes
Message 6 of 9

ulski1
Collaborator
Collaborator
For now I don't have any solid advise. Did you check that your PC is not struggling with memory bottlenecks? The only thing I can think off is that you could try to adjust some of the default settings via options editor. One setting which might affect the update duration is Model -> Performance -> Merge duplicates "On load" / "On Append" and "Optimise On load". The down side is that these settings are normally the end-users personal settings and therefore not something a plugin should alter. If you disable merge duplicates on load / on append you should see that the update goes faster, but the downside is the memory footprint / data structure of the 3d model will be larger and the "general 3d performance" will be somewhat slower.
0 Likes
Message 7 of 9

alexisDVJML
Collaborator
Collaborator

Solid and correct advises.

 

I tried and quickly benchmarked these options.

The ones you recommend slightly reduce the update time, in my typical case by around 20%.

But as you said I would prefer to tweaking these on behalf of the user.

 

It's little bit sad since it take our separate app less than 3 seconds to generate the appended .nwc and I can probably bring this down to less than 1s and thus could be done near real-time provided we settle this file refresh issue.

 

For now, I have to implement some very basic preview of the selected item using a RenderPlugin to get some kind of user feedback.

Not only this is messy code, it can't beat native Navisworks Geometry and will not scale for hundreds of shapes.

 

BTW, Is there an official channel to submit API wishes/changes/bugs to Autodesk? [I will have a few haha]

 

Anyway thanks a lot for all your on-target suggestions.

 

Hopefully we can reveal a little more about what we are working on by end of this year 🙂

Main Scientist, Full Stack Developer & When Time Permits Director of IDIGO ► On your marks, Set, Go
0 Likes
Message 8 of 9

ulski1
Collaborator
Collaborator
There is a undocumented dirty trick I use sometimes you could look at.
If you rename the updated file before you call the update (if that is possible - depending of no file locks etc) then Navis will be unable to find the nwd file when you ask for the update and that is an instant way of removing a nwd instead of "deleting" it via the com api - and then you append the new (updated) nwd file which should be faster than an update.
Br
Ulrik

0 Likes
Message 9 of 9

alexisDVJML
Collaborator
Collaborator

Excellent idea !

Was also thinking of this and catching the related event 😉

 

Let me implement it and revert 😉

Main Scientist, Full Stack Developer & When Time Permits Director of IDIGO ► On your marks, Set, Go
0 Likes