Navisworks Connector - PreAlpha contributions requested

ConnectorNavisworks

I have nearly wrapped up an alpha release of a Navisworks > Speckle :speckle: connector.

Mostly, I only need to finesse a currently makeshift UI/UX. There are a few options that I have built in that should be optional.

When moving from Alpha to Beta I will attempt to adopt the Speckle UI properly but may lean on The Specklersā„¢ for help with that.

Call for contributions

In the meantime, Iā€™m looking to source NWDs for test conversions to a collaborative stream. By test, I mean also looking for help with the review of the conversions.

If you can share anything, you would then be happy (and permitted) to:

  • QA review
  • view online
  • try downloading to Blender/Rhino/Notion etc.

I propose to assemble a closed stream and add all who offer submission as collaborators. This is my best attempt at reaching wide for material that is ok to be shared. I have plenty of my clientsā€™ material but canā€™t really share them.

I hope this is of interest to folks. :crossed_fingers:


I share a lot on Twitter but would like to keep this between us for now. :smiley:


Donā€™t fret, my Windows are activated - itā€™s a BootCamp thing.

6 Likes

Fantastic work! :tada:

@bcall we just discussed a Navis connector recently :slight_smile:

@jonathon , I would love to contribute some NWDā€™s to help with this! Let me know what all you need!

@teocomi Thank you for pointing me to this!

2 Likes

Great! :smiling_face_with_three_hearts:

Let me know what all you need!

Nothing specific, and can be as simple or as tricky as you like.


As a caveat, solids convert but not linework geometry; embedded CAD will be discarded and not added as cruft. I have stress-tested the conversions a bunch (Big models === Slow) and sadly still experience occasional inexplicable crashes ĀÆ\(惄)/ĀÆ. Because Navis models are always from someplace else, sometimes odd quirks arise that need ironing out.

Essentially, If you share an example file(s), Iā€™ll run a few different conversions from the options UI Iā€™m still working on:

  • full conversion (again, big can be a pain)
  • by layers,
  • by selection sets
  • by search sets,
  • colour overrides (temporary or permanent),
  • move-to-zero or real location.

All these are working just need to convert from flags embedded in code to sensible UI options. :robot:

Iā€™ll make a branch per contribution and probably sub-branches to that which describe what selection or transformation options have been applied. Using all the Speckle :speckle: commenting goodness.

I have another thread where I have been thinking in public about what the object model should be and have settled on something I think works well (based only on my own needs for data QA really)

If you have other ideas :thinking: :cloud: - Iā€™m also gathering those and super keen to receive them too.

DM me to share links here or jonathon @ stardotbmp . com

Basically, these, but too often to be funny.

Always when dealing with some of Navisworks crusty old c++ COM interop functions

1 Like

Count me in with the testing! im based in Chile so i can provide nwds federated from some of the most used softwares around here. have been thinking for a while on how speckle could help with AWP in some mining projects im part of.

2 Likes

Because building an embedded UI should be easy right?

It probably would be in daylight hours :smiley: nothing of progress to see here, just pleased with myself getting vue-devtools to look at the embedded plugin :exploding_head:


Behold my clacky keyboard and post-bedtime chillout choons

1 Like

Ha, nice - something iā€™ve never achieved! Out of pure curiousity, have you tried using WebView2 in there (or are you already!!!) vs CefSharp?

Nope. Cefsharp for now, just because I know it. (ish)

1 Like

Happy to look at integrating it with Desktop UI anytime!

2 Likes

Soon. Soon. :hot_face::sunglasses:

Appreciate it.

3 Likes

image

Iā€™m curious if these options mean the same to others as they do to me. Iā€™ve tussled with trying to avoid needing to type negative numbers?

2 Likes

What else are Friday nights for?

2 Likes

Thanks to @Ricardo_Zepedaā€™s contribution, I have found a bunch of places where the conversion is broken. Obviously, that sucks in some ways but is AWESOME in others.

The nature of the suckage is problematic:
image

After quite a lot of digging (some of it in unofficial sources), most errors appear to stem from ADSKā€™s own .NET wrappers around its legacy COM interface to the underlying code.

My conjecture
It seems it is suffering from pre-emptive garbage collection. This may explain why all the errors are associated with memory access. If an object has been garbage collected, it is logical that accessing its properties will no longer be possibleā€¦

When the conversion routines were simple loops, this wasnā€™t occurring as garbage collection while debugging is less vigorous/strict to allow for stack traces to work etc. When trying to improve efficiency with multithreading, it becomes a bigger issue - or worse, occurring in Release, not Debug, with no other changes.

Solution (attempt 1)
I am porting the conversion to use more and more of the crusty old COM API Ā¹. Handling the GC better and using more primitive types. This is with 2 objectives in mind:

  • have the bugger, not crash (probably)
  • speed up the conversion (hopeful)

image

A long way of saying: bear with me, peeps.


Ā¹ Largely undocumented, because of course it is.

3 Likes

Todayā€™s unhelpful update:

List<Task> Tasks = new List<Task>();
ConcurrentStack<bool> stack = new ConcurrentStack<bool>();
        
foreach ( var thing in NavisArseholeObjectsColl) {      
    Tasks.Add( Task.Run( () => {    
        ForegroundWorker fw = new ForegroundWorker();
        _ = fw.Send( o => {
            stack.Push( true );
 
            fw.Response = Autodesk.Navisworks.Api.Application 
              .ActiveDocument.CrazyThreadUnsafeCollection
              .DoThingWithEvneIfItIsJustARead( thing );

        }, this.Context );

        _ = fw.Send( o => {
            var hWnd = Autodesk.Navisworks.Api.Application.Gui.MainWindow.Handle;
            UpdateWindow( hWnd );
        }, this.Context );

        Console.WriteLine( $"{fw.Response}" );
     } ) );
 }

GC.KeepAlive(NavisArseholeObjectsColl);
await Task.WhenAll( Tasks );

Where Context is SynchronizationContext

and ForegroundWorker is a magic class I made to wrap around Context.Send and have it fake a return.

Seems to help ā€¦ sometimes. ĀÆ\(惄)/ĀÆ

3 Likes

Love the variable name NavisArseholeObjectsColl :sweat_smile:

In my experience most of these AEC API are not capable of handling multithreading well so, maybe itā€™s the case to avoid it?

2 Likes

Yeah, you ARE right; itā€™s one last roll of the dice.

Thing is, the APIs are semi able but unstable, some work and some donā€™t. Those that donā€™t fail hard so itā€™s not worth trying. Some that do sometimes (property reads for example) are tantalisingly close to making it worth trying and for the times that the call fails falling back to a main thread read.*

As you might know, iterating over 1000s of nested objects is slow. Multi-threading massively helps of course.

If this doesnā€™t work (the example loop is kinda dumb) Iā€™ll abandon it for the alpha and open the hacky code to yā€™all and the internet to help.

For now Iā€™m bitten by the ā€œI will make it work, I mustā€ bug.

2 Likes

Some of this, of course, is me learning by doing. So nothing is wasted.

Also some is just weirdness brought about by WPF and not Tasks

:smiley: :smiley: :smiley:

1 Like