Solved in the meantime: First of all I realized that the issue is actually connected to WPF and not the HelixToolkit, sorry for that. Then I used the inherited members from the base class ModelVisual3D (e.g. myAxisInstance.Children.Add). My initial class to represent an axis now looks as follows:
using System.Windows;
using System.Windows.Media.Media3D;
using PropertyTools.DataAnnotations;
using BrowsableAttribute = System.ComponentModel.BrowsableAttribute;
using HelixToolkit.Wpf;
namespace Vizualizer_WPF
{
class MachineAxis3D: ModelVisual3D
{
public static DependencyProperty RotationAngleProperty = DependencyPropertyEx.Register<double, machineaxis3d="">("RotationAngle", 0, (s, e) => s.AppearanceChanged());
public static readonly DependencyProperty PrincipalDirectionProperty = DependencyPropertyEx.Register<vector3d, machineaxis3d="">("PrincipalDirection", new Vector3D(1, 0, 0), (s, e) => s.AppearanceChanged());
public MachineAxis3D()
{
}
[Category("AxisProperties")]
[Slidable(0, 360)]
[Browsable(true)]
public double RotationAngle
{
get
{
return (double)this.GetValue(RotationAngleProperty);
}
set
{
this.SetValue(RotationAngleProperty, value);
}
}
public Vector3D PrincipalDirection
{
get
{
return (Vector3D)this.GetValue(PrincipalDirectionProperty);
}
set
{
this.SetValue(PrincipalDirectionProperty, value);
}
}
// handles the rotation of the axis
private void AppearanceChanged()
{
var tg = new Transform3DGroup();
tg.Children.Add(new RotateTransform3D(new AxisAngleRotation3D(PrincipalDirection, RotationAngle)));
Transform = tg;
}
}
}
Solved in the meantime: First of all I realized that the issue is actually connected to WPF and not the HelixToolkit, sorry for that. Then I used the inherited members from the base class ModelVisual3D (e.g. myAxisInstance.Children.Add). My initial class to represent an axis now looks as follows: