Trimming curves implies that we split the curves and dump one of their remaining segments. Thus, we have to define the cutter and also, which side of the boundary contains the objects that will be disposed. The object can relate to the cutter in three ways:
- The object is completely inside the trimming area.
- The object has an intersection with the cutter.
- The object is completely outside the trimming area.
The first step of trimming is to split all curves that have an intersection with
the cutting shape, which is explained in the how-to Split curves.
Then, we should combine all curves (cut and uncut) in a single data tree, which
can be achieved with Combine DataInputs Input 0 (0) Data to combine Input 1 (1) Data to combine Outputs Result (R) Resulting data with as few nulls as possible Index (I) Index of input that was copied into result
To check, whether a curve should be kept or disposed, we will retrieve its
midpoint and then check if this point is inside or outside the trimming area.
The midpoints are generated with Point On CurveInputs Curve (C) Curve for mid-point. Outputs Midpoint (M) Point in the middle of the curve Inputs Curve (C) Curve for mid-point. Outputs Midpoint (M) Point in the middle of the curve
Trim curves with a plane
After splitting the curves with an XY PlaneInputs Origin (O) Origin of plane Outputs Plane (P) World XY plane Inputs Point (P) Input point Outputs X component (X) Point {x} component Y component (Y) Point {y} component Z component (Z) Point {z} component Inputs First Number (A) Number to test Second Number (B) Number to test against Outputs Larger than (>) True if A > B … or Equal to (>=) True if A >= B 0
). We can use DispatchInputs List (L) List to filter Dispatch pattern (P) Dispatch pattern Outputs List A (A) Dispatch target for True values List B (B) Dispatch target for False values
If we have an XZ PlaneInputs Origin (O) Origin of plane Outputs Plane (P) World XZ plane Inputs Origin (O) Origin of plane Outputs Plane (P) World YZ plane Inputs Point (P) Input point Outputs X component (X) Point {x} component Y component (Y) Point {y} component Z component (Z) Point {z} component Inputs First Number (A) Number to test Second Number (B) Number to test against Outputs Larger than (>) True if A > B … or Equal to (>=) True if A >= B
If we use a construction plane that is tilted in space, we can use Project PointInputs Point (P) Point to project Direction (D) Projection direction Geometry (G) Geometry to project onto Outputs Point (P) Projected point Index (I) Index of object that was projected onto 0
or -1
depending on whether a point hits the plane with the given
direction. This output can be used with DispatchInputs List (L) List to filter Dispatch pattern (P) Dispatch pattern Outputs List A (A) Dispatch target for True values List B (B) Dispatch target for False values
Trim curves with a cutting curve
When we need to trim curves that are inside or outside a boundary curve, we
can use a closed cutting curve (as in the schematic sketch at the beginning).
Again we use Point On CurveInputs Point (P) Point for region inclusion test Curve (C) Boundary region (closed curves only) Outputs Relationship (R) Point/Region relationship (0 = outside, 1 = coincident, 2 = inside) Point (P') Point projected on region plane. Inputs List (L) List to sift Sift Pattern (P) Sifting pattern Outputs Output 0 (0) Output for sift index 0 Output 1 (1) Output for sift index 1
Trim curves with a cutting solid
In cases where all curves are arbitrarily orientated in the three-dimensional
space, we can use a solid as boundary for the trim. To check if a midpoint is
inside a solid (here a Domain Box), we use Point In BrepInputs Brep (B) Brep for inclusion test Point (P) Point for inclusion test Strict (S) If true, then the inclusion is strict Outputs Inside (I) True if point is on the inside of the Brep. Inputs List (L) List to filter Dispatch pattern (P) Dispatch pattern Outputs List A (A) Dispatch target for True values List B (B) Dispatch target for False values