1

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?

Niko Leben
  • 11
  • 5

1 Answers1

1

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.

Lance H
  • 886
  • 1
  • 9
  • 14
  • Thank you for your answer. I will take a look in there. What about the WPF.SharpDX? – Niko Leben Feb 02 '19 at 06:53
  • SharpDX version is using GPU for cut plane. – Lance H Feb 02 '19 at 16:12
  • Is the update solved differently there? And that would probably be faster than CPU calculation. I have an i7-2571QE without hyperthreading and Intel HD graphics 3000. What do you think? Would it be worth it to move to SharpDX? – Niko Leben Feb 03 '19 at 06:00
  • If you really care about performance, use SharpDX version is the only way. SharpDX version is using shader for cut plane, you can try the cut plane demo in SharpDX version. – Lance H Feb 03 '19 at 11:17