ModelVisual3D内容未更新

问题描述

我真的是WPF HelixToolkit的新手。对于我的应用程序,我使用的是Helixtoolkit,在其中我将Robot作为来自viewPort3d中另一个类的实例加载。机器人对象作为一组Model3D加载。

public partial class View3DControl : UserControl,INotifyPropertyChanged
{
public View3DControl()
{
    InitializeComponent();
    if (!DesignerProperties.GetIsInDesignMode(this))
       RobotModel = MainWindow.Instance.RobotModel;  
}

public Robot3DModel RobotModel
{
    get
    {   return _robot3DModel;  }
    set
    {
        _robot3DModel = value;
        if (_robot3DModel != null)
            modelVisual3d.Content = _robot3DModel.Model3D;
    }
}

这是我的Viewport Xaml

<helix:HelixViewport3D   x:Name="viewPort3d" ZoomExtentsWhenLoaded="false" ShowCoordinateSystem="True" Background="{helix:LinearGradientBrush Gray,White}"   ShowCameraInfo="{Binding ShowCameraInfo}">
    <helix:HelixViewport3D.DefaultCamera>
        <PerspectiveCamera Position="1.386 0 0.351" LookDirection="-1.386 0 0" UpDirection="0.78 0 0.625"/>
    </helix:HelixViewport3D.DefaultCamera>
    <helix:DefaultLights/>
    <helix:GridLinesVisual3D MinorDistance="0.5" Thickness="0.005" />
    <ModelVisual3D x:Name="modelVisual3d"  />
</helix:HelixViewport3D>

我有一堂课,我用几个WPF滑块旋转机器人关节。现在,我的目标是通过单击鼠标来选择机器人模型零件,并通过鼠标拖动来旋转所选零件。我正在使用VisualTreeHelper.HitTest通过匹配机器人对象和测试结果之间的绑定值来选择模型零件。模型已正确加载,并且当机器人处于默认位置(笔直向前)时,我可以通过单击鼠标来选择机器人零件。但是,当我通过滑块类旋转机器人时,HitTest结果不会给出旋转的绑定值。它总是给出默认位置的结果。尽管在视图中显示了旋转的模型,但看起来好像没有更改modelVisual3D的内容。我如何使它工作有帮助吗?还是有人可以建议其他方法?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...