question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

SceneNode to MeshGeometryModel3D

See original GitHub issue

It seems the examples show to get a MeshGeometryModel3D from a HelixToolkitScene one would do this:

if(helixScene.Root.Items[0] is MeshNode mesh)
{
    var model = new MeshGeometryModel3D()
        {
            Geometry = mesh.Geometry,
            Material = mesh.Material
        }
}

But with UWP when trying to create the MeshNode mesh variable it does not work. I get the following error:

An expression of ‘SceneNode’ cannot be handled by a pattern of type ‘MeshNode’.

I’m getting everything I need. If I use it as a SceneNode I can assign it to a object type property and bind to that property from the Viewport using a converter to show it. But I’d like to “convert” it to a MeshGeometryModel3D because all the examples use MeshGeometryModel3D and it’s quite confusing trying to follow the examples but then failing because it’s not the same type.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
JuandreGcommented, Feb 8, 2021

I need to do xaml bindings yes.

0reactions
jeromegoldcommented, Aug 21, 2021

Hi @chrkon and @KvardekDu. Thanks for the replies. So my experience with .net 5.0 and a wpf app has been the following:

I used the HelixToolkit.SharpDX.WPF package for the wpf app. (not the core) I had to individually install each of the SharpDX packages eg. SharpDX.mathematics, etc. And this seemed to work and in my xaml I could use Viewport3DX>, etc and render a scene. Basically the HelixToolkit.ShaprDx.Wpf was using the older .NETFramework to run off and was doing this automatically, even though the target framework under project settings for my app is .NET 5.0…

But then I ran into a problem. I wanted to load my models using assimp but nuget kept installing the Core 3.1 version Helixtoolkit.SharpDx.Assimp and this didn’t work with my Helixtoolkit.SharpDx.Wpf scenenode.

I did some reading and nuget seems to make the decision by itself which version of a package to install. I wanted the net45 version of Helixtoolkit.SharpDx.Assimp but it kept installing core 3.1.

So I first tried uninstalling all the HelixToolKit.SharpDx.Wpf packages and the other SharpDX packages and went to install HelixToolkit.SharpDX.Core.WPF. But the Core.WPF didn’t seem to work with my .NET 5.0 app. I tried a few times with .NET Core Wpf but ccouldn’t seem to make things work. I feel like I probably could try a few other things to test if Core.WPF really doesn’t work witn .NET 5.0 (eg. try a barebones WPF .NET 5.0 project) but kind of gave up after a whiile.

I tried other ways of installing the net45 version of Helixtoolkit.SharpDx.Assimp eg. in the .csproj file you can specify the packages you want to install and make a condition on the target framework, but this didn’t work.

Even though nuget forced Helixtoolkit.SharpDx.Assimp to target Core 3.1 when nuget installs the package, it installs all the versions in different subfolders. So the net45 subfolder existed on my machine, and I just created a reference to that and got things working.

In case anyone runs into the same prob.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How is a Scene Node bound to MeshGeometryModel3D ...
the SceneNode is some kind of data structure with all the meshes. The separate meshes can then be put into an array geometry...
Read more >
MeshGeometryModel3D, HelixToolkit.Wpf.SharpDX ...
Wpf.SharpDX MeshGeometryModel3D - 15 examples found. ... MeshGeometryModel3D extracted from open source projects. ... Add(arrowMeshModel); SceneNode.
Read more >
Use Element3D or SceneNode under WPF.SharpDX or UWP
SceneNode provides a Tag property, this property can be used to hold custom ViewModel and developer can use custom ViewModel to manipulate the ......
Read more >
Announcements · Helix Toolkit
Scene Node serves as complete Scene Graph for traversal inside render host. Element3D will only be used as a wrapper to manipulate scene...
Read more >
helix-toolkit
I have a HelixToolkit.Wpf.SharpDX.Model.Scene.MeshNode called mesh that i want to export to file. I tried obj format but it is not important at...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found