I understand how create a sphere or a box, but is not my question.
I have a STL file with many meshes inside and i have to manipulate (rotate, move, change material) them, not create a new mesh.
I don't find any examples on existing mesh manipulation
Is it possible?
I can't attach my stl file because it's too big... (7000kb)
There is no such sample yet. But you can get some pieces from multiple samples.
First you need to read the stl in code so you will get better access to the hierarchy of objects - using Model3DGroup (see link that I posted last time to get known with the WPF 3D objects).
Then show the 3D model (create a ModelVisual3D object, add your Model3DGroup to its Content and then add ModelVisual3D to Viewport3D.Children).
Because user can select any individual part of the 3D object, it is not good to use EventManager3D. Instead subscribe to MouseDown (or LeftMouseDown) and MouseUp events on Viewport3D (or event better on parent Border - see samples where usually Viewport3D is a child of a Border). In MouseDown handler use standard WPF hit testing:
var hitTestResult = VisualTreeHelper.HitTest(MainViewport, mousePosition) as RayMeshGeometry3DHitTestResult;
(if you want to skip some hit results, you can also use the HitTest method that takes hitTestCallback). Search the samples for ".HitTest" to get some sample code.
In the hitTestResult check which GeomeryModel3D is hit.
Now you can decide what to do:
- there are many options on how to select this part (change material, show WireBoxVisual3D, ... - see samples for options).
- if you want to move this part around, see ModelMover samples in the Utilities section.
To correctly position selection box or ModelMover, you will need to get the correct transformation of the selected object - in case when the selected object is deep in the objects hierarchy, you can get the total transformation with using Ab3d.Utilities.TransformationsHelper.GetModelTotalTransform method.
This should be your basic plan.