AB4D Forum

Full Version: MeshBooleanOperations.Subtract
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Why the follow method don't work with Ab3d.Visuals.LineVisual3D as first parameter? 

public static void Subtract(
    ModelVisual3D modelVisual3D,
    MeshGeometry3D meshGeometry3D,
    Transform3D parentTransform3D = null
I'm trying to subtract some meshGeometry3D from a line, but without results.

Thank you.

3D lines are generated in such a way that for each line a rectangle (2 triangles) is generated so that the rectangle is facing the camera and that it has the specified line thickness on the screen. This means that on each camera change or change or the line positions, the line's MeshGeometry3D needs to be regenerated. Therefore you cannot do Boolean operations on the lines.

But instead of using LineVisual3D object (or any other Visual3D that is derived from BaseLineVisual3D) you can use TubeLineVisual3D - this object creates a tube MeshGeometry3D for each line. This MeshGeometry3D is fixed and therefore you can use Boolean operations on it. Also note, then for TubeLineVisual3D you do not specify the line thickness in screen coordinates but you specify the tube's Radius that is in world coordinates.

Anyway, I am curious why you need to use Boolean operations on 3D lines. Maybe you could split the line into multiple lines instead - using MultiLineVisual3D or multiple LineVisual3D objects to show parts of the line.
Hi abenedik
Thank you for the tip.

To satisfy your curiosity: My software draw some mechanicals components with a custom wireframes created with LineVisual3D class (not wireframes provided from AB3D features).
Software users are enabled to create holes in those components, then, I use Boolean operations to create those holes.
Sometime, the holes can be positioned on wireframe, then, I need to cut the wireframe.

Thanks for the information.

So you probably also do Boolean operations on the solid model3D object. In this case you could also regenerate the lines for the wireframe.

One more tip: if have a lot of LineVisual3D objects and you want to improve the performance of your application, then you can use MultiLineVisual3D instead of multiple LineVisual3D objects. You are less flexible with a MultiLineVisual3D and also need to use a single color for all lines in MultiLineVisual3D, but the performance will be better.

Rendering many 3D lines with Ab3d.PowerToys and WPF 3D rendering can be slow because the geometry for all the lines need to be generated on the CPU. Consider using Ab3d.DXEngine as it can render millions of 3D lines because full hardware acceleration is used there. With Ab3d.DXEngine you can also set different colors for line positions - so you can render multiple lines with different colors with one object (draw call).
Thank you Abenedik!