Closed AHSss closed 1 year ago
So what it looks like is that there's a version of HelixToolkit running in Revit that's not compatible with the version that Xbim.Presentation is expecting.
What may be happening is another Revit addin is providing an incompatible version of HelixToolkit (or possibly a downstream dependency). Bear in mind with a Revit plugin you are sharing the same application domain with Revit and any other Addin code.
Does the viewer work at all? it's not immediately clear if this is failing during interaction with the model, or just when the Drawing3DControl is initialising.
Try setting DrawingControl3D.SelectionHighlightMode to SelectionHighlightModes.WholeMesh
If no luck, you'll have to provide some more details ideally a repo with some code.
@andyward
I had try to use the version 2.14.0.0 of HelixToolkit.Wpf which is in the Xbim.WindowsUI's Nuget packages to create an element in my xaml-file,it can normal start in the Revit.But I used the Xbim.Presentation's DrawingControl3D which both have the same version of HelixToolkit.Wpf to create an element in my xaml-file,it at once can't start in the Revit and show me the "System.MissingMethodException:can't find Void HelixToolkit.Wpf.MeshBuilder.AddTube.....“.Here is my code and the screenshot.Could you please help me to solve this problem.
WPF4Xbim.zip
Really hard to say without the full revit Addin code and especially the code you're using for Xbim.Presentation. You shouldn't need to include HelixToolkit yourself - Xbim.Presentation brings it in for you.
Why don't you use the new style SDK csproj format? - it's a lot simpler to see dependencies. I created a fork at https://github.com/andyward/WPF4Xbim
Here's Helix and the Xbim DrawingControl3D running side by side with the Revit assemblies
Sorry, I'd not made it public. Try now.
@andyward
Thank you very much for help me to solve this problem ! I had try your fork . It can running side by side with the Revit . But I really want it running inside the Revit Add-in Manager . In my code , I had write the method for it running in the Revit .
But When I was try it , only can running the Helix one , if there has Xbim DrawingControl3D , the Revit will show me the error .
I know the Xbim.Presentation include Helix , why Helix can work right , but DrawingControl3D is not ? In the errorMassage , It ponited the function-HelixToolkit.Wpf.MeshBuilder.AddTube is not found .It's the problem? Is there a way to solve it ? I just want XbimWindowUI can running in the Revit ! Anyway , thank you again for your hlep !
Sorry can't really help unless you can provide a repro I can look at (no zip files please).
I've just tested opening Xbim.WindowsUI 5.1.228 in a Revit 2023 plugin and all is fine.
I see you're in Revit 2019 - Have you tried other Revit versions?
Other suggestions:
e.g. note I have 2.17.0 running. It seems that Dynamo for Revit also ships a version of HelixToolkit.WPF
If there's a collision it's possible you can use a Custom Assembly Resolver to ensure the correct version is loaded in. See https://forums.autodesk.com/t5/revit-api-forum/proper-way-to-handle-app-config-bindingredirects-in-revit-add-in/td-p/5692149
@andyward Hi Andy, Thank you very much ! I have solved this problem . As you said , There was a too old version of HelixToolkit in my Dynamo for Revit . I covered it with the HelixToolkit.Wpf.dll which is in Nuget packages . Finally it can be work OK ! Thanks! You do hlep me a lot .
When I used the RevitAPI to load the wpf-window which has the DrawingControl3D element,it was show me the "System.MissingMethodException“,such like this:
Without the Revit,the wpf-window which has the DrawingControl3D element can normal operate.But I hope load it in the Revit.
How can I open the DrawingControl3D in Revit?Please show me the way.Thanks very much!