OCC.Geom2dAPI module

The Geom2dAPI package provides an ApplicationProgramming Interface for the Geometry.The API is a set of classes aiming to provide :* High level and simple calls for the most commonoperations.* Keeping an access on the low-levelimplementation of high-level calls.The API provides classes to call the algorithmesof the Geometry* The constructors of the classes provides thedifferent constructions methods.* The class keeps as fields the different toolsused by the algorithmes* The class provides a casting method to getautomatically the result with a function-likecall.For example to evaluate the distance <D> between apoint <P> and a curve <C>, one can writes :D = Geom2dAPI_ProjectPointOnCurve(P,C);orGeom2dAPI_ProjectPointOnCurve PonC(P,C);D = PonC.LowerDistance();

class Geom2dAPI_ExtremaCurveCurve(*args)

Bases: object

  • Computes the extrema between - the portion of the curve C1 limited by the two points of parameter (U1min,U1max), and - the portion of the curve C2 limited by the two points of parameter (U2min,U2max). Warning Use the function NbExtrema to obtain the number of solutions. If this algorithm fails, NbExtrema returns 0.
Parameters:
  • C1 (Handle_Geom2d_Curve &) –
  • C2 (Handle_Geom2d_Curve &) –
  • U1min (Quantity_Parameter) –
  • U1max (Quantity_Parameter) –
  • U2min (Quantity_Parameter) –
  • U2max (Quantity_Parameter) –
Return type:

None

Distance()
  • Computes the distance between the end points of the extremum of index Index computed by this algorithm. Exceptions Standard_OutOfRange if Index is not in the range [ 1,NbExtrema ], where NbExtrema is the number of extrema computed by this algorithm.
Parameters:Index (int) –
Return type:Quantity_Length
Extrema()
Return type:Extrema_ExtCC2d
LowerDistance()
  • Computes the distance between the end points of the shortest extremum computed by this algorithm. Exceptions - StdFail_NotDone if this algorithm fails.
Return type:Quantity_Length
LowerDistanceParameters()
  • Returns the parameters U1 of the point on the first curve and U2 of the point on the second curve, which are the ends of the shortest extremum computed by this algorithm. Exceptions StdFail_NotDone if this algorithm fails.
Parameters:
  • U1 (Quantity_Parameter &) –
  • U2 (Quantity_Parameter &) –
Return type:

None

NbExtrema()
  • Returns the number of extrema computed by this algorithm. Note: if this algorithm fails, NbExtrema returns 0.
Return type:int
NearestPoints()
  • Returns the points P1 on the first curve and P2 on the second curve, which are the ends of the shortest extremum computed by this algorithm. Exceptions StdFail_NotDone if this algorithm fails.
Parameters:
Return type:

None

Parameters()
  • Returns the parameters U1 of the point on the first curve and U2 of the point on the second curve, which are the ends of the extremum of index Index computed by this algorithm. Exceptions Standard_OutOfRange if Index is not in the range [ 1,NbExtrema ], where NbExtrema is the number of extrema computed by this algorithm.
Parameters:
  • Index (int) –
  • U1 (Quantity_Parameter &) –
  • U2 (Quantity_Parameter &) –
Return type:

None

Points()
  • Returns the points P1 on the first curve and P2 on the second curve, which are the ends of the extremum of index Index computed by this algorithm. Exceptions Standard_OutOfRange if Index is not in the range [ 1,NbExtrema ], where NbExtrema is the number of extrema computed by this algorithm.
Parameters:
Return type:

None

thisown

The membership flag

class Geom2dAPI_InterCurveCurve(*args)

Bases: object

  • Create an empty intersector. Use the function Init for further initialization of the intersection algorithm by curves or curve.
Return type:None
  • Creates an object and computes the intersections between the curves C1 and C2.
Parameters:
  • C1 (Handle_Geom2d_Curve &) –
  • C2 (Handle_Geom2d_Curve &) –
  • Tol (float) – default value is 1.0e-6
Return type:

None

  • Creates an object and computes self-intersections of the curve C1. Tolerance value Tol, defaulted to 1.0e-6, defines the precision of computing the intersection points. In case of a tangential intersection, Tol also defines the size of intersection segments (limited portions of the curves) where the distance between all points from two curves (or a curve in case of self-intersection) is less than Tol. Warning Use functions NbPoints and NbSegments to obtain the number of solutions. If the algorithm finds no intersections NbPoints and NbSegments return 0.
Parameters:
  • C1 (Handle_Geom2d_Curve &) –
  • Tol (float) – default value is 1.0e-6
Return type:

None

Init()
  • Initializes an algorithm with the given arguments and computes the intersections between the curves C1. and C2.
Parameters:
  • C1 (Handle_Geom2d_Curve &) –
  • C2 (Handle_Geom2d_Curve &) –
  • Tol (float) – default value is 1.0e-6
Return type:

None

  • Initializes an algorithm with the given arguments and computes the self-intersections of the curve C1. Tolerance value Tol, defaulted to 1.0e-6, defines the precision of computing the intersection points. In case of a tangential intersection, Tol also defines the size of intersection segments (limited portions of the curves) where the distance between all points from two curves (or a curve in case of self-intersection) is less than Tol. Warning Use functions NbPoints and NbSegments to obtain the number of solutions. If the algorithm finds no intersections NbPoints and NbSegments return 0.
Parameters:
  • C1 (Handle_Geom2d_Curve &) –
  • Tol (float) – default value is 1.0e-6
Return type:

None

Intersector()
  • return the algorithmic object from Intersection.
Return type:Geom2dInt_GInter
NbPoints()
  • Returns the number of intersection-points in case of cross intersections. NbPoints returns 0 if no intersections were found.
Return type:int
NbSegments()
  • Returns the number of tangential intersections. NbSegments returns 0 if no intersections were found
Return type:int
Point()
  • Returns the intersection point of index Index. Intersection points are computed in case of cross intersections with a precision equal to the tolerance value assigned at the time of construction or in the function Init (this value is defaulted to 1.0e-6). Exceptions Standard_OutOfRange if index is not in the range [ 1,NbPoints ], where NbPoints is the number of computed intersection points
Parameters:Index (int) –
Return type:gp_Pnt2d
Segment()
  • Use this syntax only to get solutions of tangential intersection between two curves. Output values Curve1 and Curve2 are the intersection segments on the first curve and on the second curve accordingly. Parameter Index defines a number of computed solution. An intersection segment is a portion of an initial curve limited by two points. The distance from each point of this segment to the other curve is less or equal to the tolerance value assigned at the time of construction or in function Init (this value is defaulted to 1.0e-6). Exceptions Standard_OutOfRange if Index is not in the range [ 1,NbSegments ], where NbSegments is the number of computed tangential intersections. Standard_NullObject if the algorithm is initialized for the computing of self-intersections on a curve.
Parameters:
  • Index (int) –
  • Curve1 (Handle_Geom2d_Curve &) –
  • Curve2 (Handle_Geom2d_Curve &) –
Return type:

None

  • Use this syntax to get solutions of tangential intersections only in case of a self-intersected curve. Output value Curve1 is the intersection segment of the curve defined by number Index. An intersection segment is a portion of the initial curve limited by two points. The distance between each point of this segment to another portion of the curve is less or equal to the tolerance value assigned at the time of construction or in the function Init (this value is defaulted to 1.0e-6). Exceptions Standard_OutOfRange if Index is not in the range [ 1,NbSegments ], where NbSegments is the number of computed tangential intersections.
Parameters:
  • Index (int) –
  • Curve1 (Handle_Geom2d_Curve &) –
Return type:

None

thisown

The membership flag

class Geom2dAPI_Interpolate(*args)

Bases: object

  • Tolerance is to check if the points are not too close to one an other It is also used to check if the tangent vector is not too small. There should be at least 2 points if PeriodicFlag is True then the curve will be periodic.
Parameters:
Return type:

None

  • if PeriodicFlag is True then the curve will be periodic Warning: There should be as many parameters as there are points except if PeriodicFlag is True : then there should be one more parameter to close the curve
Parameters:
Return type:

None

Curve()
  • Returns the computed BSpline curve. Raises StdFail_NotDone if the interpolation fails.
Return type:Handle_Geom2d_BSplineCurve
IsDone()
  • Returns true if the constrained BSpline curve is successfully constructed. Note: in this case, the result is given by the function Curve.
Return type:bool
Load()
  • Assigns this constrained BSpline curve to be tangential to vectors InitialTangent and FinalTangent at its first and last points respectively (i.e. the first and last points of the table of points through which the curve passes, as defined at the time of initialization).
Parameters:
Return type:

None

  • Assigns this constrained BSpline curve to be tangential to vectors defined in the table Tangents, which is parallel to the table of points through which the curve passes, as defined at the time of initialization. Vectors in the table Tangents are defined only if the flag given in the parallel table TangentFlags is true: only these vectors are set as tangency constraints.
Parameters:
Return type:

None

Perform()
  • Computes the constrained BSpline curve. Use the function IsDone to verify that the computation is successful, and then the function Curve to obtain the result.
Return type:None
thisown

The membership flag

class Geom2dAPI_PointsToBSpline(*args)

Bases: object

  • Constructs an empty approximation algorithm. Use an Init function to define and build the BSpline curve.
Return type:None
  • Approximate a BSpline Curve passing through an array of Point. The resulting BSpline will have the following properties: 1- his degree will be in the range [Degmin,Degmax] 2- his continuity will be at least <Continuity> 3- the distance from the point <Points> to the BSpline will be lower to Tol2D
Parameters:
  • Points (TColgp_Array1OfPnt2d) –
  • DegMin (int) – default value is 3
  • DegMax (int) – default value is 8
  • Continuity (GeomAbs_Shape) – default value is GeomAbs_C2
  • Tol2D (float) – default value is 1.0e-6
Return type:

None

  • Approximate a BSpline Curve passing through an array of Point. Of coordinates : //! X = X0 + DX * (i-YValues.Lower()) Y = YValues(i) //! With i in the range YValues.Lower(), YValues.Upper() //! The BSpline will be parametrized from t = X0 to X0 + DX * (YValues.Upper() - YValues.Lower()) //! And will satisfy X(t) = t //! The resulting BSpline will have the following properties: 1- his degree will be in the range [Degmin,Degmax] 2- his continuity will be at least <Continuity> 3- the distance from the point <Points> to the BSpline will be lower to Tol2D
Parameters:
  • YValues (TColStd_Array1OfReal &) –
  • X0 (float) –
  • DX (float) –
  • DegMin (int) – default value is 3
  • DegMax (int) – default value is 8
  • Continuity (GeomAbs_Shape) – default value is GeomAbs_C2
  • Tol2D (float) – default value is 1.0e-6
Return type:

None

  • Approximate a BSpline Curve passing through an array of Point. The resulting BSpline will have the following properties: 1- his degree will be in the range [Degmin,Degmax] 2- his continuity will be at least <Continuity> 3- the distance from the point <Points> to the BSpline will be lower to Tol2D
Parameters:
  • Points (TColgp_Array1OfPnt2d) –
  • ParType (Approx_ParametrizationType) –
  • DegMin (int) – default value is 3
  • DegMax (int) – default value is 8
  • Continuity (GeomAbs_Shape) – default value is GeomAbs_C2
  • Tol2D (float) – default value is 1.0e-3
Return type:

None

  • Approximate a BSpline Curve passing through an array of Point, which parameters are given by the array <Parameters>. The resulting BSpline will have the following properties: 1- his degree will be in the range [Degmin,Degmax] 2- his continuity will be at least <Continuity> 3- the distance from the point <Points> to the BSpline will be lower to Tol2D
Parameters:
  • Points (TColgp_Array1OfPnt2d) –
  • Parameters (TColStd_Array1OfReal &) –
  • DegMin (int) – default value is 3
  • DegMax (int) – default value is 8
  • Continuity (GeomAbs_Shape) – default value is GeomAbs_C2
  • Tol2D (float) – default value is 1.0e-3
Return type:

None

  • Approximate a BSpline Curve passing through an array of Point using variational smoothing algorithm, which tries to minimize additional criterium: Weight1*CurveLength + Weight2*Curvature + Weight3*Torsion
Parameters:
  • Points (TColgp_Array1OfPnt2d) –
  • Weight1 (float) –
  • Weight2 (float) –
  • Weight3 (float) –
  • DegMax (int) – default value is 8
  • Continuity (GeomAbs_Shape) – default value is GeomAbs_C2
  • Tol3D (float) – default value is 1.0e-3
Return type:

None

Curve()
  • Returns the approximate BSpline Curve
Return type:Handle_Geom2d_BSplineCurve
Init()
  • Approximate a BSpline Curve passing through an array of Point. The resulting BSpline will have the following properties: 1- his degree will be in the range [Degmin,Degmax] 2- his continuity will be at least <Continuity> 3- the distance from the point <Points> to the BSpline will be lower to Tol2D
Parameters:
  • Points (TColgp_Array1OfPnt2d) –
  • DegMin (int) – default value is 3
  • DegMax (int) – default value is 8
  • Continuity (GeomAbs_Shape) – default value is GeomAbs_C2
  • Tol2D (float) – default value is 1.0e-6
Return type:

None

  • Approximate a BSpline Curve passing through an array of Point. Of coordinates : //! X = X0 + DX * (i-YValues.Lower()) Y = YValues(i) //! With i in the range YValues.Lower(), YValues.Upper() //! The BSpline will be parametrized from t = X0 to X0 + DX * (YValues.Upper() - YValues.Lower()) //! And will satisfy X(t) = t //! The resulting BSpline will have the following properties: 1- his degree will be in the range [Degmin,Degmax] 2- his continuity will be at least <Continuity> 3- the distance from the point <Points> to the BSpline will be lower to Tol2D
Parameters:
  • YValues (TColStd_Array1OfReal &) –
  • X0 (float) –
  • DX (float) –
  • DegMin (int) – default value is 3
  • DegMax (int) – default value is 8
  • Continuity (GeomAbs_Shape) – default value is GeomAbs_C2
  • Tol2D (float) – default value is 1.0e-6
Return type:

None

  • Approximate a BSpline Curve passing through an array of Point. The resulting BSpline will have the following properties: 1- his degree will be in the range [Degmin,Degmax] 2- his continuity will be at least <Continuity> 3- the distance from the point <Points> to the BSpline will be lower to Tol2D
Parameters:
  • Points (TColgp_Array1OfPnt2d) –
  • ParType (Approx_ParametrizationType) –
  • DegMin (int) – default value is 3
  • DegMax (int) – default value is 8
  • Continuity (GeomAbs_Shape) – default value is GeomAbs_C2
  • Tol2D (float) – default value is 1.0e-3
Return type:

None

  • Approximate a BSpline Curve passing through an array of Point, which parameters are given by the array <Parameters>. The resulting BSpline will have the following properties: 1- his degree will be in the range [Degmin,Degmax] 2- his continuity will be at least <Continuity> 3- the distance from the point <Points> to the BSpline will be lower to Tol2D
Parameters:
  • Points (TColgp_Array1OfPnt2d) –
  • Parameters (TColStd_Array1OfReal &) –
  • DegMin (int) – default value is 3
  • DegMax (int) – default value is 8
  • Continuity (GeomAbs_Shape) – default value is GeomAbs_C2
  • Tol2D (float) – default value is 1.0e-3
Return type:

None

  • Approximate a BSpline Curve passing through an array of Point using variational smoothing algorithm, which tries to minimize additional criterium: Weight1*CurveLength + Weight2*Curvature + Weight3*Torsion
Parameters:
  • Points (TColgp_Array1OfPnt2d) –
  • Weight1 (float) –
  • Weight2 (float) –
  • Weight3 (float) –
  • DegMax (int) – default value is 8
  • Continuity (GeomAbs_Shape) – default value is GeomAbs_C2
  • Tol2D (float) – default value is 1.0e-3
Return type:

None

IsDone()
Return type:bool
thisown

The membership flag

class Geom2dAPI_ProjectPointOnCurve(*args)

Bases: object

  • Constructs an empty projector algorithm. Use an Init function to define the point and the curve on which it is going to work.
Return type:None
  • Create the projection of a point <P> on a curve <Curve>
Parameters:
  • P (gp_Pnt2d) –
  • Curve (Handle_Geom2d_Curve &) –
Return type:

None

  • Create the projection of a point <P> on a curve <Curve> limited by the two points of parameter Umin and Usup. Warning Use the function NbPoints to obtain the number of solutions. If projection fails, NbPoints returns 0.
Parameters:
  • P (gp_Pnt2d) –
  • Curve (Handle_Geom2d_Curve &) –
  • Umin (Quantity_Parameter) –
  • Usup (Quantity_Parameter) –
Return type:

None

Distance()
  • Computes the distance between the point and its computed orthogonal projection on the curve. Index is a number of computed projected point. Exceptions Standard_OutOfRange if Index is not in the range [ 1,NbPoints ], where NbPoints is the number of solution points.
Parameters:Index (int) –
Return type:Quantity_Length
Extrema()
  • return the algorithmic object from Extrema
Return type:Extrema_ExtPC2d
Init()
  • Initializes this algorithm with the given arguments, and computes the orthogonal projections of a point <P> on a curve <Curve>
Parameters:
  • P (gp_Pnt2d) –
  • Curve (Handle_Geom2d_Curve &) –
Return type:

None

  • Initializes this algorithm with the given arguments, and computes the orthogonal projections of the point P onto the portion of the curve Curve limited by the two points of parameter Umin and Usup.
Parameters:
  • P (gp_Pnt2d) –
  • Curve (Handle_Geom2d_Curve &) –
  • Umin (Quantity_Parameter) –
  • Usup (Quantity_Parameter) –
Return type:

None

LowerDistance()
  • Computes the distance between the point and its nearest orthogonal projection on the curve. Exceptions StdFail_NotDone if this algorithm fails.
Return type:Quantity_Length
LowerDistanceParameter()
  • Returns the parameter on the curve of the nearest orthogonal projection of the point. Exceptions StdFail_NotDone if this algorithm fails.
Return type:Quantity_Parameter
NbPoints()
  • return the number of of computed orthogonal projectionn points.
Return type:int
NearestPoint()
  • Returns the nearest orthogonal projection of the point on the curve. Exceptions StdFail_NotDone if this algorithm fails.
Return type:gp_Pnt2d
Parameter()
  • Returns the parameter on the curve of a point which is the orthogonal projection. Index is a number of a computed projected point. Exceptions Standard_OutOfRange if Index is not in the range [ 1,NbPoints ], where NbPoints is the number of solution points.
Parameters:Index (int) –
Return type:Quantity_Parameter
  • Returns the parameter on the curve of a point which is the orthogonal projection. Index is a number of a computed projected point. Exceptions Standard_OutOfRange if Index is not in the range [ 1,NbPoints ], where NbPoints is the number of solution points
Parameters:
  • Index (int) –
  • U (Quantity_Parameter &) –
Return type:

None

Point()
  • Returns the orthogonal projection on the curve. Index is a number of a computed point. Exceptions Standard_OutOfRange if Index is not in the range [ 1,NbPoints ], where NbPoints is the number of solution points.
Parameters:Index (int) –
Return type:gp_Pnt2d
thisown

The membership flag

class SwigPyIterator(*args, **kwargs)

Bases: object

advance()
copy()
decr()
distance()
equal()
incr()
next()
previous()
thisown

The membership flag

value()
new_instancemethod(func, inst, cls)
register_handle(handle, base_object)

Inserts the handle into the base object to prevent memory corruption in certain cases