Class BRepOperation
- Namespace
- CADability
- Assembly
- CADability.dll
The boolean operations on BRep shells: union, intersection and difference of two closed shells, splitting a shell by a plane or a face, clipping a face by a shell and connecting a set of intersecting faces to shells. It is an OctTree<T> of BRepItems: the vertices, edges and faces of both shells are inserted so that only nearby edge/face pairs are intersected; the intersection edges split the faces, the parts are classified as inside or outside the other shell and recombined to the resulting shells according to the BRepOperation.Operation passed to the constructor. Create one with the two shells and the operation and call Result() for the resulting shells. Applications usually call it through Unite(Solid, Solid), Intersect(Solid, Solid), Subtract(Solid, Solid) and the static methods SplitByPlane(Shell, Plane), SplitByFace(Shell, Face), RoundEdges(Shell, Edge[], double), ChamferEdges(Face, Edge[], double, double) and ClipFace(Face, Shell).
public class BRepOperation : OctTree<BRepItem>
- Inheritance
-
BRepOperation
- Inherited Members
Constructors
BRepOperation(Face, Shell)
public BRepOperation(Face toClip, Shell clipBy)
Parameters
BRepOperation(Shell, Face)
Split the shell toSplit by a face. The face splitBy must split the shell into two or more parts
It may not enter the shell without cutting through
public BRepOperation(Shell toSplit, Face splitBy)
Parameters
BRepOperation(Shell, Shell, Operation)
public BRepOperation(Shell s1, Shell s2, BRepOperation.Operation operation)
Parameters
s1Shells2ShelloperationBRepOperation.Operation
BRepOperation(Shell, Shell, Dictionary<Edge, Tuple<Face, Face>>, Operation)
public BRepOperation(Shell s1, Shell s2, Dictionary<Edge, Tuple<Face, Face>> knownIntersections, BRepOperation.Operation operation)
Parameters
s1Shells2ShellknownIntersectionsDictionary<Edge, Tuple<Face, Face>>operationBRepOperation.Operation
BRepOperation(Shell, Shell, HashSet<(Edge, Face)>, Operation)
This is a constructor for connecting and intersecting (open) shells, where we have a set of edge-face pairs, which should not be used for intersecting
public BRepOperation(Shell s1, Shell s2, HashSet<(Edge, Face)> dontIntersect, BRepOperation.Operation operation)
Parameters
BRepOperation(Shell, Plane)
Prepare a brep operation for splitting a (closed) shell with a plane. Or for returning the compound shapes on the specified plane. Here we assume that "toSplit" is properly oriented and han no periodic faces (no seams)
public BRepOperation(Shell toSplit, Plane splitBy)
Parameters
BRepOperation(IEnumerable<Face>)
Connect all provided faces, remove the overhangs. Used by Shell.GetOffset.
public BRepOperation(IEnumerable<Face> facesToConnect)
Parameters
facesToConnectIEnumerable<Face>the faces to connect; they are used directly, not cloned
Properties
AllowOpenEdges
public bool AllowOpenEdges { set; }
Property Value
DebugEdgesToSplit
public GeoObjectList DebugEdgesToSplit { get; }
Property Value
DontCombineConnectedFaces
public bool DontCombineConnectedFaces { set; }
Property Value
IntersectingFaces
Get all face pairs, which intersect each other
public HashSet<(Face, Face)> IntersectingFaces { get; }
Property Value
Unchanged
public bool Unchanged { get; }
Property Value
UnusedFaces
public List<Face> UnusedFaces { get; }
Property Value
Methods
ChamferEdges(Face, Edge[], double, double)
Chamfer or bevel the provided edges. the edges must be connected and only two edges may have a common vertex. The edges must build a path.
We have two distances from the edge to make chamfers with different angles. All edges must belong to the primaryFace.
The first distance is on the primary face, the second on the other face (in most cases the distances are equal).
public static Shell ChamferEdges(Face primaryFace, Edge[] edges, double primaryDist, double secondaryDist)
Parameters
Returns
ClipFace(Face, Shell)
public static Face[] ClipFace(Face toClip, Shell clipBy)
Parameters
Returns
- Face[]
GetOverlappingFaces(out Face[], out Face[], out ModOp2D[])
Returns the pairs of faces of the two shells that lie on the same surface and overlap (or coincide), as found when the operation was prepared. Such faces are not intersected with each other but handled separately.
public int GetOverlappingFaces(out Face[] onShell1, out Face[] onShell2, out ModOp2D[] firstToSecond)
Parameters
onShell1Face[]The overlapping faces belonging to the first shell
onShell2Face[]The corresponding faces belonging to the second shell, in the same order as
onShell1firstToSecondModOp2D[]For each pair the 2d transformation that maps the parameter space of the face on the first shell to the parameter space of the face on the second shell
Returns
- int
The number of overlapping face pairs, i.e. the length of the three arrays
Intersect(out GeoPoint)
Checks whether the two shells intersect each other
public bool Intersect(out GeoPoint anyIntersectionPoint)
Parameters
anyIntersectionPointGeoPoint
Returns
IsSameFace(HashSet<Edge>, HashSet<Vertex>, Face, double)
public static bool IsSameFace(HashSet<Edge> edges, HashSet<Vertex> vertices, Face fce, double precision)
Parameters
Returns
Result()
public Shell[] Result()
Returns
- Shell[]
RoundEdges(Shell, Edge[], double)
public static Shell RoundEdges(Shell toRound, Edge[] edges, double radius)
Parameters
Returns
SplitByFace(Shell, Face)
public static (Shell[] upperPart, Shell[] lowerPart) SplitByFace(Shell toSplit, Face splitBy)
Parameters
Returns
SplitByPlane(Shell, Plane)
public static (Shell[] upperPart, Shell[] lowerPart) SplitByPlane(Shell shell, Plane pln)
Parameters
Returns
SplitNode(Node<BRepItem>, BRepItem)
Criterion whether to split a node when it contains too many leaves. The default implemenation yield a dynamically balanced tree which allows more leaves in deeper nodes.
protected override bool SplitNode(OctTree<BRepItem>.Node<BRepItem> node, BRepItem objectToAdd)
Parameters
nodeOctTree<BRepItem>.Node<BRepItem>The node beeing checked
objectToAddBRepItemThe object beeing added
Returns
- bool
true, if node should be splitted, false otherwise
SplitResult()
public CompoundShape SplitResult()
Returns
TryFindIntersectingEdges(IEnumerable<Edge>, out Edge, out Edge, out Edge)
Looks for three edges which share three faces. These edges probably have a common intersection point
public static bool TryFindIntersectingEdges(IEnumerable<Edge> edges, out Edge e1, out Edge e2, out Edge e3)
Parameters
edgesIEnumerable<Edge>e1Edgee2Edgee3Edge