HelixTonolkit.Wpf.SharpDX
Hello to all programmer friends. I am in despair.I have the following problem: I have added 3 boxes to a MeshGeometry3D with messbuilder.
Now I want to move the positions of each box. But not with the mouse but with CodeBehind. How can I find the individual boxes without the mouse? It is written again and again one should search in the examples but one finds nothing about it always only mouse mouse mouse!
Code:
meshbuilder = new MeshBuilder();
messbuilder.AddBox(......);
messbuilder.AddBox(......);
messbuilder.AddBox(......);
PlatesGeometry = meshBuilder.ToMeshGeometry3D();
At the moment I switched to toolkit.wpf there is ItemSource:
so I can add objects at runtime and access them later. But with DX I have no idea how to do that:
If you can show me the alleged example where I can add a box at runtime and then move that box in the codebehind at any time I would donate you a case of beer!
View:
<h:HelixViewport3D ItemsSource="{Binding Wpf3Objects}" Height="300" Background="{h:LinearGradientBrush Gray, White}"></h:HelixViewport3D>
ViewModel
private ObservableCollection<Geometry3D> _geometryOc;
public ObservableCollection<Geometry3D> GeometryOc.
{
get { return _geometryOc ?? (_geometryOc = new ObservableCollection<Geometry3D>()); }
set
{
SetProperty(ref _geometryOc, value);
}
}
var myTransform = new Transform3DGroup();
TranslateTransform3D myTranslate = new TranslateTransform3D(loads.PosY, loads.PosX, loads.PosZ);
myTransform.Children.Add(myTranslate);
BoxVisual3D boxi = new BoxVisual3D();
boxi.Height = thickness;
boxi.Length = lenght;
boxi.Width = width;
boxi.Transform = myTransform;
Wpf3Objects.Add(boxi);
Translate
TranslateTransform3D myTranslate = new TranslateTransform3D(x, y, z);
Wpf3Objects[ooo + 1].Transform = myTranslate;
Translated with www.DeepL.com/Translator (free version)
EnableUnLit = true
to use unlit