Need help with modelImport with large complex STL (= 3D scans etc )

Johnny 9 months ago • updated 9 months ago 2

I have developed a WindowsFileExplorerShellExtension using HelixToolkit to show STL files in the Windows File explorer.

Everythings works fine with normal "human made" STL-files, but scanned 3D models converted to STL becomes large and I get OutOfMemory violation at modelimporter.

I have a simplified VS 2017 solution that contains a simple testapplication and a simple STL viewer that popsup when a file is coosen or Drag-n-Droped.

This is the method I have used to create the model

QUESTION?? Is there a better way to create a model from a STL file??

 public void ViewNewStl(string filename)
            // WTF!! No file
            if (!File.Exists(filename)) return;

            // Check the file extension to be STL
            FileInfo fileInfo = new FileInfo(filename);
            if (fileInfo.Extension.ToLower() != ".stl") return;

            ModelColor = "Blue";HelixToolkitTestApplication.ziptestapplication

            Filename = filename;

            // Create a model of the STL file

                ModelImporter modellImporter = new ModelImporter();
                modellImporter.DefaultMaterial =
                    new DiffuseMaterial(
                        new SolidColorBrush((Color)ColorConverter.ConvertFromString(modellColor)));
                Model3DGroup model3DGroup = modellImporter.Load(filename);

                StlModel.Content = model3DGroup;


            catch (Exception e)
                Debug.WriteLine($"modelimporter crash {e.Message}");



I cant add the Zip file with the project.. I also want to include some files that works and some files that crashes.
How do I do that??

Somehow I manage to get a link to the testapplication..

;HelixToolkitTestApplication.zip testapplication