简体   繁体   English

如何在 WPF 应用程序中加载到 HELIX 的视口 3D 后最小化 STL 文件

[英]how to minimize STL file after loading to the viewport 3D of HELIX in a WPF application

Hello I made an application through which user can import an STL file, I have made it as WPF application and trying to open the file using Helix 3D tool kit but the problem is when I'm trying to open my STL file the image gets enlarged and I'm unable to minimize its size /keep it fit in the center.您好,我制作了一个应用程序,用户可以通过该应用程序导入 STL 文件,我已将其制作为 WPF 应用程序并尝试使用 Helix 3D 工具包打开该文件,但问题是当我尝试打开 STL 文件时,图像被放大而且我无法最小化它的大小/让它保持在中心位置。 enter code here Please find the attached code I have written for opening STL file.在此处输入代码 请找到我为打开 STL 文件编写的附加代码。 MainWindow.XAML//imported helix 3d toolkit for opening STL files MainWindow.XAML//导入的打开STL文件的helix 3d工具包

helix:HelixViewport3D x:Name="viewPort3d" ZoomExtentsWhenLoaded="True" CoordinateSystemHeight="100" Margin="0,50,0,0" helix:HelixViewport3D x:Name="viewPort3d" ZoomExtentsWhenLoaded="True" CoordinateSystemHeight="100" Margin="0,50,0,0"

MainWindow.XAML,cs File// on button click I'm importing the STL file. MainWindow.XAML,cs File//在按钮上单击我正在导入 STL 文件。

            string filename = dlg.FileName;
            FileNameTextBox.Text = filename;                
            ModelVisual3D device3D = new ModelVisual3D();             
            device3D.Content = Display3d(filename );              
            viewPort3d.Children.Add(device3D);  //here iam loading the stl file to the   helix:HelixViewport3D  

please find the below images for better understanding请找到下面的图片以便更好地理解

my output enter image description here我的输出在这里输入图像描述

Desired Output enter image description here所需的输出在此处输入图像描述

can you please help me how to minimize the STL file size after loading to the viewport3D.你能帮我在加载到 viewport3D 后如何最小化 STL 文件的大小吗?

Thanks in advance提前致谢

Simply using viewPort3d.ZoomExtents();只需使用viewPort3d.ZoomExtents(); should work.应该管用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM