Reputation: 11
I successfully cut an STL model, but I can't change the position of the cut plane. Structure: Viewport -> CuttingPlaneGroup -> CuttingPlanes -> Plane3D. The STL model is in the CuttingPlaneGroup.
Does anyone know how to dynamically change the cut plane position with a slider? If I change the position of the Plane, nothing happens.
var nj = sender as Slider;
cutPlane.Position.Offset(0, nj.Value, 0);
It seems that once you cut the STL, you can't change it anymore. Do I have to delete the STL and reload it? That would be harsh. The STL model is not frozen nor sealed.
EDIT:
In the source code I found if you change the "Operation" or "IsEnabled" property, it forces the model to update. Changing the normal and operation is nearly 2x faster executing than changing the IsEnabled. Still, it takes 400-500 ms to update.
EDIT2:
I took the source code and exposed private void ApplyCuttingGeometries(bool forceUpdate = false)
to public void
. The result is same as changing the operation (~400ms).
The code now looks like:
var nj = sender as Slider;
cp.Position = new Point3D(0, nj.Value, 0); // cp = Plane3D
ctp.ApplyCuttingGeometries(true); //ctp = CuttingPlaneGroup
Any better solution?
Upvotes: 1
Views: 700
Reputation: 954
The cut plane in wpf version is basically create a new cut model every time.
You don't need to use cutting group. You can take a look the cut plane group source code and implement the model update yourself.
Upvotes: 1