It has been known by how to Get primitive from solid of Navisworks. Because there is not native NET API, we will need to take advantage of COM Interop. While COM Interop means managed-native transitions, which will cause lot of the slowness when the model is huge. So geometry extraction should be faster if it is all pure COM code. In another word, some unmanaged COM code could potentially be quicker.
So I tried to make some codes. These are two plugins, one is written C++/CLI code (by raw COM), another is NET code (by COM Interop). The stats of some sample Navisworks models and one customer specific model.
https://github.com/xiaodongliang/Navisworks-Geometry-Primitives
Model | Geometry Nodes Count | Fragments Count | Time to Extract Primitive (ms) |
ClashTest.nwd | 318 | 840 | NET(334) COM(227) |
GateHouse.nwd | 1354 | 2386 | NET(688) COM(412) |
One Customer Model | 225360 | 353341 | NET(2,186,333) COM(872,978) |
The projects are built on Visual Studio 2017 (v15.7.5), Navisworks 2018, Win 10 in Windows Parallel of macOS Sierra version 10.12.6
Note: with pure COM project, build it and execute the button in release mode. This is typical for performance testing. If in debugging mode, it will be extremely slow.