【发布时间】:2017-04-12 06:32:16
【问题描述】:
您好,我正在开发显示 3D 模型的项目,并且我使用 helix 3D 工具包,所以这里有 xaml 代码:
<h:HelixViewport3D Name="hlx" ZoomExtentsWhenLoaded="True" RotateAroundMouseDownPoint="False" ShowViewCube="False" Opacity="0.8" Grid.Column="4" Grid.ColumnSpan="2" Grid.Row="4" Grid.RowSpan="3">
<h:DefaultLights/>
</h:HelixViewport3D>
这里是 C# 代码:
void C()
{
ModelVisual3D model = new ModelVisual3D();
model.Content = Display3d(@"D:\tests for projects\Em organic compounds\Em organic compounds\Car.3DS");
hlx.Children.Add(model);
}
private Model3D Display3d(string mdl)
{
Model3D device = null;
try
{
hlx.RotateGesture = new MouseGesture(MouseAction.LeftClick);
ModelImporter import = new ModelImporter();
device = import.Load(mdl);
}
catch (Exception e)
{
MessageBox.Show("Exception Error : " + e.StackTrace);
}
return device;
}
效果很好。问题是我想像汽车陈列室一样将 3D 模型旋转 360 度,但我不知道该怎么做。
【问题讨论】:
标签: c# wpf 3d helix-3d-toolkit