wpf 在Visual Studio 2017中使用3D Wavefront OBJ / STL

m4pnthwp  于 2023-10-22  发布在  其他
关注(0)|答案(1)|浏览(108)

我想将Wavefront OBJSTL文件导入到C# WPF应用程序中。
在旧的职位是演练,我不能再使用。

是否不再可以“轻松”导入这些文件并在VisualStudio / Blend 2017中使用?
我找到了一个HelixToolkit.WPF的教程,并成功导入了一些文件:

但这对我来说似乎不是完美的方式。我想做的是从SolidWorks导出机器的零件,将它们放入我的应用程序中,并创建我的机器的3d可视化。
应该可以在designTime中看到我的对象!

jckbn6z7

jckbn6z71#

我使用Scichart WPF导入一些Solidworks零件到WPF中,使用起来有点棘手,但你会得到你想要的,但scichart不能制作动画,你只能有30天的试用期。下面是一个示例:

<s3D:SciChart3DSurface Name="sciChart3DSurface"
                       Grid.Column="1"
                       WorldDimensions="250,1,250">
 
    <s3D:SciChart3DSurface.Resources>
        <!--  The 3D chess objects models which are used in this example were created by Fabio Valle, objects are used for  -->
        <!--  demonstrating purposes only to show possibility how to load and manipulate the 3D objects on 3D scene. Fabio's email: [email protected]  -->
        <object:ObjectModelSource x:Key="PawnLowObj3DSource" Source="pack://application:,,,/SciChart.Examples.ExternalDependencies;component/Resources/Objects/Pawn_Low.obj"/>
        <object:ObjectModelSource x:Key="BishopLowObj3DSource" Source="pack://application:,,,/SciChart.Examples.ExternalDependencies;component/Resources/Objects/Bishop_Low.obj"/>
        <object:ObjectModelSource x:Key="KingLowObj3DSource" Source="pack://application:,,,/SciChart.Examples.ExternalDependencies;component/Resources/Objects/King_Low.obj"/>
        <object:ObjectModelSource x:Key="KnightLowObj3DSource" Source="pack://application:,,,/SciChart.Examples.ExternalDependencies;component/Resources/Objects/Knight_Low.obj"/>
        <object:ObjectModelSource x:Key="QueenLowObj3DSource" Source="pack://application:,,,/SciChart.Examples.ExternalDependencies;component/Resources/Objects/Queen_Low.obj"/>
        <object:ObjectModelSource x:Key="RookLowObj3DSource" Source="pack://application:,,,/SciChart.Examples.ExternalDependencies;component/Resources/Objects/Rook_Low.obj"/>
        <object:Rotation3D x:Key="ObjRotationState" Axis="YAxis" Angle="180" />
        <object:TextureSource x:Key="BlackTexture" Source="pack://application:,,,/SciChart.Examples.ExternalDependencies;component/Resources/Objects/BlackWoodTexture.jpg" />
        <object:TextureSource x:Key="WhiteTexture" Source="pack://application:,,,/SciChart.Examples.ExternalDependencies;component/Resources/Objects/WhiteWoodTexture.jpg" />
    </s3D:SciChart3DSurface.Resources>
   
    <s3D:SciChart3DSurface.SceneObjects>
        <!--  The 3D chess objects models which are used in this example were created by Fabio Valle, objects are used for  -->
        <!--  demonstrating purposes only to show possibility how to load and manipulate the 3D objects on 3D scene. Fabio's email: [email protected]  -->
        ...
        <object:ObjectModel3D TextureSource="{StaticResource BlackTexture}" Source="{StaticResource RookLowObj3DSource}" Position="0.0625, 0.6, 0.9375" CoordinateMode="Relative" Scale="0.2, 0.2, 0.2"/>
        <object:ObjectModel3D TextureSource="{StaticResource BlackTexture}" Source="{StaticResource KnightLowObj3DSource}" Position="0.0625, 0.6, 0.8125" CoordinateMode="Relative" Scale="0.2, 0.2, 0.2" Rotation="{StaticResource ObjRotationState}"/>
        <object:ObjectModel3D TextureSource="{StaticResource BlackTexture}" Source="{StaticResource BishopLowObj3DSource}" Position="0.4375, 0.6, 0.3125" CoordinateMode="Relative" Scale="0.2, 0.2, 0.2" Rotation="{StaticResource ObjRotationState}"/>
        <object:ObjectModel3D TextureSource="{StaticResource BlackTexture}" Source="{StaticResource KingLowObj3DSource}" Position="0.0625, 0.6, 0.5625" CoordinateMode="Relative" Scale="0.2, 0.2, 0.2"/>
        <object:ObjectModel3D TextureSource="{StaticResource BlackTexture}" Source="{StaticResource QueenLowObj3DSource}" Position="0.0625, 0.6, 0.4375" CoordinateMode="Relative" Scale="0.2, 0.2, 0.2" Rotation="{StaticResource ObjRotationState}"/>
        <object:ObjectModel3D TextureSource="{StaticResource BlackTexture}" Source="{StaticResource BishopLowObj3DSource}" Position="0.0625, 0.6, 0.3125" CoordinateMode="Relative" Scale="0.2, 0.2, 0.2" Rotation="{StaticResource ObjRotationState}"/>
        <object:ObjectModel3D DrawBoundingBox="True" BoundingBoxStroke="White" TextureSource="{StaticResource BlackTexture}" Source="{StaticResource KnightLowObj3DSource}" Position="0.3125, 0.6, 0.3125" CoordinateMode="Relative" Scale="0.2, 0.2, 0.2" Rotation="{StaticResource ObjRotationState}"/>
        <object:ObjectModel3D TextureSource="{StaticResource BlackTexture}" Source="{StaticResource RookLowObj3DSource}" Position="0.0625, 0.6, 0.0625" CoordinateMode="Relative" Scale="0.2, 0.2, 0.2"/>
        ...
    </s3D:SciChart3DSurface.SceneObjects>
</s3D:SciChart3DSurface>

下面是一个demo pic:

相关问题