Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set DrawingControl3D.SelectionColor with latest version of HelixToolkit #202

Open
christianstroh opened this issue Apr 12, 2023 · 4 comments

Comments

@christianstroh
Copy link

If i set the property SelectionColor of the class DrawingControl3D in my XAML file, i get this exception:

Method not found:
"Void HelixToolkit.Wpf.MeshBuilder.AddTube(System.Collections.Generic.IList`1<System.Windows.Media.Media3D.Point3D>, Double, Int32, Boolean, Boolean, Boolean)".

In the Xbim.WindowsUI package, the setter of this property calls the method HighlighSelected(), which calls AddTube from the HelixToolkit package.
I guess in the latest stable version of the HelixToolkit.Wpf package there is no method overload with this signature.
When i clone the Xbim.WindowsUI git repository, Visual Studio automatically installs HelixToolkit and HelixToolkit.WPF
version 2.14.0.

@andyward
Copy link
Member

We've seen something similar before in #200 - Are you loading Xbim.Windows UI in Revit? Or another 3rd party application?

Basically it's likely environmental - HelixToolkit seemingly broke an API in a minor release, and when another library brings in a different version of Helix, and the app resolves via binding redirects etc - it's loading in an incompatible version.

We could look to upgrade to the latest version. 2.23 - but I don't know if that would help if you're bringing in another older version somehow. Perhaps you can see what is loaded as per the comment in #200

Equally I have a branch that I hope will be merged soon that uses Helix.Core.WPF which may help (it uses the new netcore Engine and related net6 branches)

@christianstroh
Copy link
Author

Thank you for your response.

I'm using Xbim.WindowsUI in a .NET Framework 4.8 Windows Application (Visual Studio),
the DrawingControl3D is embedded in the main window (xaml file).

For the time being I can do without setting the property or try an older version of the HelixToolkit, not the latest version 2.23. And I will try Helix.Core.WPF when your branch is merged.

@andyward
Copy link
Member

andyward commented Apr 13, 2023

If you use the version of Helix we've built against (2.14.0) you should be fine?

<PackageReference Include="HelixToolkit.Wpf" Version="2.14.0" />

@christianstroh
Copy link
Author

When i don't set the property SelectionColor via WPF data binding, the application starts with HelixToolkit.Wpf 2.14.0.
But when i bind the property, a ArgumentNullException is thrown with this stack trace:

at System.Linq.GroupedEnumerable3..ctor(IEnumerable1 source, Func2 keySelector, Func2 elementSelector, IEqualityComparer`1 comparer)
at Xbim.Presentation.WpfMeshGeometry3D.GetGeometry(EntitySelection selection, XbimModelPositioningCollection positions, Material mat)
at Xbim.Presentation.DrawingControl3D.GetSelectionGeometry(IPersistEntity newVal, WpfMaterial mat)
at Xbim.Presentation.DrawingControl3D.HighlighSelected(IPersistEntity newVal)
at Xbim.Presentation.DrawingControl3D.set_SelectionColor(Color value)

I think its because the property Selection is still null at this call:
m = WpfMeshGeometry3D.GetGeometry(Selection, ModelPositions, mat);
When i set this property to a new EntitySelection, another exception occurs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants