ChFi2d
OCCT package ChFi2d: ChFi2d, ChFi2d_AnaFilletAlgo, ChFi2d_Builder, ChFi2d_ChamferAPI, and 4 more bound classes.
ChFi2d
This package contains the algorithms used to build fillets or chamfers on planar wire.
This package provides two algorithms for 2D fillets: ChFi2d_Builder - it constructs a fillet or chamfer for linear and circular edges of a face. ChFi2d_FilletAPI - it encapsulates two algorithms: ChFi2d_AnaFilletAlgo - analytical constructor of the fillet.
It works only for linear and circular edges, having a common point. ChFi2d_FilletAlgo - iteration recursive method constructing the fillet edge for any type of edges including ellipses and b-splines. The edges may even have no common point. ChFi2d_ChamferAPI - an algorithm for construction of chamfers between two linear edges of a plane.
The algorithms ChFi2d_AnaFilletAlgo and ChFi2d_FilletAlgo may be used directly or via the interface class ChFi2d_FilletAPI.
Constructors(1)
Static methods(2)
- CommonVertex(E1: TopoDS_Edge, E2: TopoDS_Edge, V: TopoDS_Vertex): booleanParameters (3)
E1E2V
- FindConnectedEdges(F: TopoDS_Face, V: TopoDS_Vertex, E1: TopoDS_Edge, E2: TopoDS_Edge): ChFi2d_ConstructionErrorParameters (4)
FVE1E2
ChFi2d_AnaFilletAlgo
An analytical algorithm for calculation of the fillets. It is implemented for segments and arcs of circle only.
Constructors(3)
An empty constructor. Use the method
Init()to initialize the class.- constructor(theWire: TopoDS_Wire, thePlane: gp_Pln): ChFi2d_AnaFilletAlgo
A constructor. It expects a wire consisting of two edges of type (any combination of):
- segment
- arc of circle.
Parameters (2)theWirethePlane
- constructor(theEdge1: TopoDS_Edge, theEdge2: TopoDS_Edge, thePlane: gp_Pln): ChFi2d_AnaFilletAlgo
A constructor. It expects two edges having a common point of type:
- segment
- arc of circle.
Parameters (3)theEdge1theEdge2thePlane
Instance methods(4)
- Init(theWire: TopoDS_Wire, thePlane: gp_Pln): void
Initializes the class by a wire consisting of two edges.
Parameters (2)theWirethePlane
- Init(theEdge1: TopoDS_Edge, theEdge2: TopoDS_Edge, thePlane: gp_Pln): void
Initializes the class by two edges.
Parameters (3)theEdge1theEdge2thePlane
- Perform(radius: number): boolean
Calculates a fillet.
Parameters (1)radius
- Result(e1: TopoDS_Edge, e2: TopoDS_Edge): TopoDS_Edge
Retrieves a result (fillet and shrinked neighbours).
Parameters (2)e1—Mutated in place; read the updated value from this argument after the call.e2—Mutated in place; read the updated value from this argument after the call.
ChFi2d_Builder
This class contains the algorithm used to build fillet on planar wire.
Constructors(2)
The face <F> can be build on a closed or an open wire.
Parameters (1)F
Instance methods(20)
- Init(F: TopoDS_Face): voidParameters (1)
F
- Init(RefFace: TopoDS_Face, ModFace: TopoDS_Face): voidParameters (2)
RefFaceModFace
- AddFillet(V: TopoDS_Vertex, Radius: number): TopoDS_Edge
Add a fillet of radius <Radius> on the wire between the two edges connected to the vertex <V>. <AddFillet> returns the fillet edge. The returned edge has sense only if the status <status> is <IsDone>.
Parameters (2)VRadius
- ModifyFillet(Fillet: TopoDS_Edge, Radius: number): TopoDS_Edge
modify the fillet radius and return the new fillet edge. this edge has sense only if the status <status> is <IsDone>.
Parameters (2)FilletRadius
- RemoveFillet(Fillet: TopoDS_Edge): TopoDS_Vertex
removes the fillet <Fillet> and returns the vertex connecting the two adjacent edges to this fillet.
Parameters (1)Fillet
- AddChamfer(E1: TopoDS_Edge, E2: TopoDS_Edge, D1: number, D2: number): TopoDS_Edge
Add a chamfer on the wire between the two edges connected <E1> and <E2>. <AddChamfer> returns the chamfer edge. This edge has sense only if the status <status> is <IsDone>.
Parameters (4)E1E2D1D2
- AddChamfer(E: TopoDS_Edge, V: TopoDS_Vertex, D: number, Ang: number): TopoDS_Edge
Add a chamfer on the wire between the two edges connected to the vertex <V>. The chamfer will make an angle <Ang> with the edge <E>, and one of its extremities will be on <E> at distance <D>. The returned edge has sense only if the status <status> is <IsDone>. Warning: The value of <Ang> must be expressed in Radian.
Parameters (4)EVDAng
- ModifyChamfer(Chamfer: TopoDS_Edge, E1: TopoDS_Edge, E2: TopoDS_Edge, D1: number, D2: number): TopoDS_Edge
modify the chamfer <Chamfer> and returns the new chamfer edge. This edge as sense only if the status <status> is <IsDone>.
Parameters (5)ChamferE1E2D1D2
- ModifyChamfer(Chamfer: TopoDS_Edge, E: TopoDS_Edge, D: number, Ang: number): TopoDS_Edge
modify the chamfer <Chamfer> and returns the new chamfer edge. This edge as sense only if the status <status> is <IsDone>. Warning: The value of <Ang> must be expressed in Radian.
Parameters (4)ChamferEDAng
- RemoveChamfer(Chamfer: TopoDS_Edge): TopoDS_Vertex
removes the chamfer <Chamfer> and returns the vertex connecting the two adjacent edges to this chamfer.
Parameters (1)Chamfer
returns the modified face
- IsModified(E: TopoDS_Edge): booleanParameters (1)
E
returns the list of new edges
- NbFillet(): number
returns the list of new edges
- NbChamfer(): number
- HasDescendant(E: TopoDS_Edge): booleanParameters (1)
E
returns the modified edge if <E> has descendant or <E> in the other case.
Parameters (1)E
Returns the parent edge of <E> Warning: If <E>is a basis edge, the returned edge would be equal to <E>.
Parameters (1)E
ChFi2d_ChamferAPI
A class making a chamfer between two linear edges.
Constructors(3)
An empty constructor.
- constructor(theWire: TopoDS_Wire): ChFi2d_ChamferAPI
A constructor accepting a wire consisting of two linear edges.
Parameters (1)theWire
- constructor(theEdge1: TopoDS_Edge, theEdge2: TopoDS_Edge): ChFi2d_ChamferAPI
A constructor accepting two linear edges.
Parameters (2)theEdge1theEdge2
Instance methods(4)
- Init(theWire: TopoDS_Wire): void
Initializes the class by a wire consisting of two libear edges.
Parameters (1)theWire
- Init(theEdge1: TopoDS_Edge, theEdge2: TopoDS_Edge): void
Initializes the class by two linear edges.
Parameters (2)theEdge1theEdge2
- Perform(): boolean
Constructs a chamfer edge. Returns true if the edge is constructed.
- Result(theEdge1: TopoDS_Edge, theEdge2: TopoDS_Edge, theLength1: number, theLength2: number): TopoDS_EdgeParameters (4)
theEdge1theEdge2theLength1theLength2
ChFi2d_ConstructionError
Properties(13)
ChFi2d_FilletAlgo
Algorithm that creates fillet edge: arc tangent to two edges in the start and in the end vertices. Initial edges must be located on the plane and must be connected by the end or start points (shared vertices are not obligatory). Created fillet arc is created with the given radius, that is useful in sketcher applications.
The algorithm is iterative that allows to create fillet on any curves of initial edges, that supports projection of point and C2 continuous. Principles of algorithm can de reduced to the Newton method:
- Splitting initial edge into N segments where probably only 1 root can be found. N depends on the complexity of the underlying curve.
- On each segment compute value and derivative of the function:argument of the function is the parameter on the curvetake point on the curve by the parameter: point of tangencymake center of fillet: perpendicular vector from the point of tagencymake projection from the center to the second curvelength of the projection minus radius of the fillet is result of the functionderivative of this function in the point is computed by value in point with small shift
- Using Newton search method take the point on the segment where function value is most close to zero. If it is not enough close, step 2 and 3 are repeated taking as start or end point the found point.
- If solution is found, result is created on point on root of the function (as a start point), point of the projection onto second curve (as an end point) and center of arc in found center. Initial edges are cut by the start and end point of tangency.
Constructors(3)
An empty constructor of the fillet algorithm. Call a method
Init()to initialize the algorithm before calling of aPerform()method.- constructor(theWire: TopoDS_Wire, thePlane: gp_Pln): ChFi2d_FilletAlgo
A constructor of a fillet algorithm: accepts a wire consisting of two edges in a plane.
Parameters (2)theWirethePlane
- constructor(theEdge1: TopoDS_Edge, theEdge2: TopoDS_Edge, thePlane: gp_Pln): ChFi2d_FilletAlgo
A constructor of a fillet algorithm: accepts two edges in a plane.
Parameters (3)theEdge1theEdge2thePlane
Instance methods(5)
- Init(theWire: TopoDS_Wire, thePlane: gp_Pln): void
Initializes a fillet algorithm: accepts a wire consisting of two edges in a plane.
Parameters (2)theWirethePlane
- Init(theEdge1: TopoDS_Edge, theEdge2: TopoDS_Edge, thePlane: gp_Pln): void
Initializes a fillet algorithm: accepts two edges in a plane.
Parameters (3)theEdge1theEdge2thePlane
- Perform(theRadius: number): boolean
Constructs a fillet edge. Returns true, if at least one result was found.
Parameters (1)theRadius
Returns number of possible solutions. <thePoint> chooses a particular fillet in case of several fillets may be constructed (for example, a circle intersecting a segment in 2 points). Put the intersecting (or common) point of the edges.
Parameters (1)thePoint
- Result(thePoint: gp_Pnt, theEdge1: TopoDS_Edge, theEdge2: TopoDS_Edge, iSolution: number): TopoDS_Edge
Returns result (fillet edge, modified edge1, modified edge2), nearest to the given point <thePoint> if iSolution == -1. <thePoint> chooses a particular fillet in case of several fillets may be constructed (for example, a circle intersecting a segment in 2 points). Put the intersecting (or common) point of the edges.
Parameters (4)thePointtheEdge1—Mutated in place; read the updated value from this argument after the call.theEdge2—Mutated in place; read the updated value from this argument after the call.iSolution
ChFi2d_FilletAPI
An interface class for 2D fillets.
Open CASCADE provides two algorithms for 2D fillets: ChFi2d_Builder - it constructs a fillet or chamfer for linear and circular edges of a face. ChFi2d_FilletAPI - it encapsulates two algorithms: ChFi2d_AnaFilletAlgo - analytical constructor of the fillet.
It works only for linear and circular edges, having a common point. ChFi2d_FilletAlgo - iteration recursive method constructing the fillet edge for any type of edges including ellipses and b-splines. The edges may even have no common point.
The algorithms ChFi2d_AnaFilletAlgo and ChFi2d_FilletAlgo may be used directly or via this ChFi2d_FilletAPI class. This class chooses an appropriate algorithm analyzing the arguments (a wire or two edges).
Constructors(3)
An empty constructor of the fillet algorithm. Call a method
Init()to initialize the algorithm before calling of aPerform()method.- constructor(theWire: TopoDS_Wire, thePlane: gp_Pln): ChFi2d_FilletAPI
A constructor of a fillet algorithm: accepts a wire consisting of two edges in a plane.
Parameters (2)theWirethePlane
- constructor(theEdge1: TopoDS_Edge, theEdge2: TopoDS_Edge, thePlane: gp_Pln): ChFi2d_FilletAPI
A constructor of a fillet algorithm: accepts two edges in a plane.
Parameters (3)theEdge1theEdge2thePlane
Instance methods(5)
- Init(theWire: TopoDS_Wire, thePlane: gp_Pln): void
Initializes a fillet algorithm: accepts a wire consisting of two edges in a plane.
Parameters (2)theWirethePlane
- Init(theEdge1: TopoDS_Edge, theEdge2: TopoDS_Edge, thePlane: gp_Pln): void
Initializes a fillet algorithm: accepts two edges in a plane.
Parameters (3)theEdge1theEdge2thePlane
- Perform(theRadius: number): boolean
Constructs a fillet edge. Returns true if at least one result was found.
Parameters (1)theRadius
Returns number of possible solutions. <thePoint> chooses a particular fillet in case of several fillets may be constructed (for example, a circle intersecting a segment in 2 points). Put the intersecting (or common) point of the edges.
Parameters (1)thePoint
- Result(thePoint: gp_Pnt, theEdge1: TopoDS_Edge, theEdge2: TopoDS_Edge, iSolution: number): TopoDS_Edge
Returns result (fillet edge, modified edge1, modified edge2), nearest to the given point <thePoint> if iSolution == -1 <thePoint> chooses a particular fillet in case of several fillets may be constructed (for example, a circle intersecting a segment in 2 points). Put the intersecting (or common) point of the edges.
Parameters (4)thePointtheEdge1—Mutated in place; read the updated value from this argument after the call.theEdge2—Mutated in place; read the updated value from this argument after the call.iSolution
FilletPoint
Private class. Corresponds to the point on the first curve, computed fillet function and derivative on it.
Constructors(1)
- constructor(theParam: number): FilletPoint
Creates a point on a first curve by parameter on this curve.
Parameters (1)theParam
Instance methods(18)
- setParam(theParam: number): void
Changes the point position by changing point parameter on the first curve.
Parameters (1)theParam
- getParam(): number
Returns the point parameter on the first curve.
- getNBValues(): number
Returns number of found values of function in this point.
- getValue(theIndex: number): number
Returns value of function in this point.
Parameters (1)theIndex
- getDiff(theIndex: number): number
Returns derivatives of function in this point.
Parameters (1)theIndex
- isValid(theIndex: number): boolean
Returns true if function is valid (rediuses vectors of fillet do not intersect any curve).
Parameters (1)theIndex
- getNear(theIndex: number): number
Returns the index of the nearest value.
Parameters (1)theIndex
- setParam2(theParam2: number): void
Defines the parameter of the projected point on the second curve.
Parameters (1)theParam2
- getParam2(): number
Returns the parameter of the projected point on the second curve.
Center of the fillet.
Parameters (1)thePoint
Center of the fillet.
- appendValue(theValue: number, theValid: boolean): void
Appends value of the function.
Parameters (2)theValuetheValid
- calculateDiff(argNo0: FilletPoint): boolean
Computes difference between this point and the given. Stores difference in myD.
Parameters (1)argNo0
- FilterPoints(argNo0: FilletPoint): void
Filters out the values and leaves the most optimal one.
Parameters (1)argNo0
- Copy(): FilletPoint
Returns a pointer to created copy of the point warning: this is not the full copy! Copies only: myParam, myV, myD, myValid.
- hasSolution(theRadius: number): number
Returns the index of the solution or zero if there is no solution.
Parameters (1)theRadius
- LowerValue(): number
For debug only.
- remove(theIndex: number): void
Removes the found value by the given index.
Parameters (1)theIndex