OCC.Geom2dConvert module¶

class
Geom2dConvert_ApproxCurve
(*args)¶ Bases:
object
 Constructs an approximation framework defined by  the 2D conic Curve  the tolerance value Tol2d  the degree of continuity Order  the maximum number of segments allowed MaxSegments  the highest degree MaxDegree which the polynomial defining the BSpline is allowed to have.
Parameters: Return type: 
Curve
()¶  Returns the 2D BSpline curve resulting from the approximation algorithm.
Return type: Handle_Geom2d_BSplineCurve

DumpToString
()¶ Geom2dConvert_ApproxCurve_DumpToString(Geom2dConvert_ApproxCurve self) > std::string

HasResult
()¶  returns Standard_True if the approximation did come out with a result that is not NECESSARELY within the required tolerance
Return type: bool

IsDone
()¶  returns Standard_True if the approximation has been done with within requiered tolerance
Return type: bool

MaxError
()¶  Returns the greatest distance between a point on the source conic and the BSpline curve resulting from the approximation. (>0 when an approximation has been done, 0 if no approximation)
Return type: float

thisown
¶ The membership flag

class
Geom2dConvert_BSplineCurveKnotSplitting
(*args)¶ Bases:
object
 Determines points at which the BSpline curve BasisCurve should be split in order to obtain arcs with a degree of continuity equal to ContinuityRange. These points are knot values of BasisCurve. They are identified by indices in the knots table of BasisCurve. Use the available interrogation functions to access computed values, followed by the global function SplitBSplineCurve (provided by the package Geom2dConvert) to split the curve. Exceptions Standard_RangeError if ContinuityRange is less than zero.
Parameters:  BasisCurve (Handle_Geom2d_BSplineCurve &) –
 ContinuityRange (int) –
Return type: 
NbSplits
()¶  Returns the number of points at which the analysed BSpline curve should be split, in order to obtain arcs with the continuity required by this framework. All these points correspond to knot values. Note that the first and last points of the curve, which bound the first and last arcs, are counted among these splitting points.
Return type: int

SplitValue
()¶  Returns the split knot of index Index to the split knots table computed in this framework. The returned value is an index in the knots table of the BSpline curve analysed by this algorithm. Notes:  If Index is equal to 1, the corresponding knot gives the first point of the curve.  If Index is equal to the number of split knots computed in this framework, the corresponding point is the last point of the curve. Exceptions Standard_RangeError if Index is less than 1 or greater than the number of split knots computed in this framework.
Parameters: Index (int) – Return type: int

Splitting
()¶  Loads the SplitValues table with the split knots values computed in this framework. Each value in the table is an index in the knots table of the BSpline curve analysed by this algorithm. The values in SplitValues are given in ascending order and comprise the indices of the knots which give the first and last points of the curve. Use two consecutive values from the table as arguments of the global function SplitBSplineCurve (provided by the package Geom2dConvert) to split the curve. Exceptions Standard_DimensionError if the array SplitValues was not created with the following bounds:  1, and  the number of split points computed in this framework (as given by the function NbSplits).
Parameters: SplitValues (TColStd_Array1OfInteger &) – Return type: None

thisown
¶ The membership flag

class
Geom2dConvert_BSplineCurveToBezierCurve
(*args)¶ Bases:
object
 Computes all the data needed to convert  the BSpline curve BasisCurve, into a series of adjacent Bezier arcs. The result consists of a series of BasisCurve arcs limited by points corresponding to knot values of the curve. Use the available interrogation functions to ascertain the number of computed Bezier arcs, and then to construct each individual Bezier curve (or all Bezier curves). Note: ParametricTolerance is not used.
Parameters: BasisCurve (Handle_Geom2d_BSplineCurve &) – Return type: None  Computes all the data needed to convert the portion of the BSpline curve BasisCurve limited by the two parameter values U1 and U2 for Example if there is a Knot Uk and Uk < U < Uk + ParametricTolerance/2 the last curve corresponds to the span [Uk1, Uk] and not to [Uk, Uk+1] The result consists of a series of BasisCurve arcs limited by points corresponding to knot values of the curve. Use the available interrogation functions to ascertain the number of computed Bezier arcs, and then to construct each individual Bezier curve (or all Bezier curves). Note: ParametricTolerance is not used. Raises DomainError if U1 or U2 are out of the parametric bounds of the basis curve [FirstParameter, LastParameter]. The Tolerance criterion is ParametricTolerance. Raised if Abs (U2  U1) <= ParametricTolerance.
Parameters: Return type: 
Arc
()¶  Constructs and returns the Bezier curve of index Index to the table of adjacent Bezier arcs computed by this algorithm. This Bezier curve has the same orientation as the BSpline curve analyzed in this framework. Exceptions Standard_OutOfRange if Index is less than 1 or greater than the number of adjacent Bezier arcs computed by this algorithm.
Parameters: Index (int) – Return type: Handle_Geom2d_BezierCurve

Arcs
()¶  Constructs all the Bezier curves whose data is computed by this algorithm and loads these curves into the Curves table. The Bezier curves have the same orientation as the BSpline curve analyzed in this framework. Exceptions Standard_DimensionError if the Curves array was not created with the following bounds:  1 , and  the number of adjacent Bezier arcs computed by this algorithm (as given by the function NbArcs).
Parameters: Curves (TColGeom2d_Array1OfBezierCurve &) – Return type: None

Knots
()¶  This methode returns the bspline’s knots associated to the converted arcs Raises DimensionError if the length of Curves is not equal to NbArcs + 1
Parameters: TKnots (TColStd_Array1OfReal &) – Return type: None

NbArcs
()¶  Returns the number of BezierCurve arcs. If at the creation time you have decomposed the basis curve between the parametric values UFirst, ULast the number of BezierCurve arcs depends on the number of knots included inside the interval [UFirst, ULast]. If you have decomposed the whole basis Bspline curve the number of BezierCurve arcs NbArcs is equal to the number of knots less one.
Return type: int

thisown
¶ The membership flag

class
Geom2dConvert_CompCurveToBSplineCurve
(*args)¶ Bases:
object
 Initialize the algorithme  Parameterisation is used to convert
Parameters: Parameterisation (Convert_ParameterisationType) – default value is Convert_TgtThetaOver2 Return type: None  Initialize the algorithme with one curve  Parameterisation is used to convert
Parameters:  BasisCurve (Handle_Geom2d_BoundedCurve &) –
 Parameterisation (Convert_ParameterisationType) – default value is Convert_TgtThetaOver2
Return type: 
Add
()¶  Append a curve in the BSpline Return False if the curve is not G0 with the BSplineCurve. Tolerance is used to check continuity and decrease Multiplicty at the common Knot After is usefull if BasisCurve is a closed curve .
Parameters: Return type:

BSplineCurve
()¶ Return type: Handle_Geom2d_BSplineCurve

thisown
¶ The membership flag

class
SwigPyIterator
(*args, **kwargs)¶ Bases:
object

advance
()¶

copy
()¶

decr
()¶

distance
()¶

equal
()¶

incr
()¶

next
()¶

previous
()¶

thisown
¶ The membership flag

value
()¶


class
geom2dconvert
¶ Bases:
object

static
C0BSplineToArrayOfC1BSplineCurve
(*args)¶  This Method reduces as far as it is possible the multiplicities of the knots of the BSpline BS.(keeping the geometry). It returns an array of BSpline C1. Tolerance is a geometrical tolerance
Parameters:  BS (Handle_Geom2d_BSplineCurve &) –
 tabBS (Handle_TColGeom2d_HArray1OfBSplineCurve &) –
 Tolerance (float) –
Return type: void
 This Method reduces as far as it is possible the multiplicities of the knots of the BSpline BS.(keeping the geometry). It returns an array of BSpline C1. tolerance is a geometrical tolerance
Parameters: Return type: void

static
C0BSplineToC1BSplineCurve
(*args)¶  This Method reduces as far as it is possible the multiplicities of the knots of the BSpline BS.(keeping the geometry). It returns a new BSpline which could still be C0. tolerance is a geometrical tolerance
Parameters:  BS (Handle_Geom2d_BSplineCurve &) –
 Tolerance (float) –
Return type: void

static
ConcatC1
(*args)¶  This Method concatenates C1 the ArrayOfCurves as far as it is possible. ArrayOfCurves[0..N1] ArrayOfToler contains the biggest tolerance of the two points shared by two consecutives curves. Its dimension: [0..N2] ClosedTolerance indicates if the ArrayOfCurves is closed. In this case ClosedTolerance contains the biggest tolerance of the two points which are at the closure. Otherwise its value is 0.0
Parameters: Return type: void
 This Method concatenates C1 the ArrayOfCurves as far as it is possible. ArrayOfCurves[0..N1] ArrayOfToler contains the biggest tolerance of the two points shared by two consecutives curves. Its dimension: [0..N2] ClosedTolerance indicates if the ArrayOfCurves is closed. In this case ClosedTolerance contains the biggest tolerance of the two points which are at the closure. Otherwise its value is 0.0
Parameters: Return type: void

static
ConcatG1
(*args)¶  This Method concatenates G1 the ArrayOfCurves as far as it is possible. ArrayOfCurves[0..N1] ArrayOfToler contains the biggest tolerance of the two points shared by two consecutives curves. Its dimension: [0..N2] ClosedTolerance indicates if the ArrayOfCurves is closed. In this case ClosedTolerance contains the biggest tolerance of the two points which are at the closure. Otherwise its value is 0.0
Parameters: Return type: void

static
CurveToBSplineCurve
(*args)¶  This function converts a non infinite curve from Geom into a Bspline curve. C must be an ellipse or a circle or a trimmed conic or a trimmed line or a Bezier curve or a trimmed Bezier curve or a BSpline curve or a trimmed BSpline curve or an Offset curve or a trimmed Offset curve. The returned Bspline is not periodic except if C is a Circle or an Ellipse. ParameterisationType applies only if the curve is a Circle or an ellipse : TgtThetaOver2, TgtThetaOver2_1, TgtThetaOver2_2, TgtThetaOver2_3, TgtThetaOver2_4, Purpose: this is the classical rational parameterisation 2 1  t cos(theta) = —— 2 1 + t //! 2t sin(theta) = —— 2 1 + t //! t = tan (theta/2) //! with TgtThetaOver2 the routine will compute the number of spans using the rule num_spans = [ (ULast  UFirst) / 1.2 ] + 1 with TgtThetaOver2_N, N spans will be forced: an error will be raized if (ULast  UFirst) >= PI and N = 1, ULast  UFirst >= 2 PI and N = 2 //! QuasiAngular, here t is a rational function that approximates theta —> tan(theta/2). Neverthless the composing with above function yields exact functions whose square sum up to 1 RationalC1 ; t is replaced by a polynomial function of u so as to grant C1 contiuity across knots. Exceptions Standard_DomainError if the curve C is infinite. Standard_ConstructionError:  if C is a complete circle or ellipse, and if Parameterisation is not equal to Convert_TgtThetaOver2 or to Convert_RationalC1, or  if C is a trimmed circle or ellipse and if Parameterisation is equal to Convert_TgtThetaOver2_1 and if U2  U1 > 0.9999 * Pi where U1 and U2 are respectively the first and the last parameters of the trimmed curve (this method of parameterization cannot be used to convert a halfcircle or a halfellipse, for example), or  if C is a trimmed circle or ellipse and Parameterisation is equal to Convert_TgtThetaOver2_2 and U2  U1 > 1.9999 * Pi where U1 and U2 are respectively the first and the last parameters of the trimmed curve (this method of parameterization cannot be used to convert a quasicomplete circle or ellipse).
Parameters:  C (Handle_Geom2d_Curve &) –
 Parameterisation (Convert_ParameterisationType) – default value is Convert_TgtThetaOver2
Return type:

static
SplitBSplineCurve
(*args)¶  – Convert a curve to BSpline by Approximation //! This method computes the arc of Bspline curve between the two knots FromK1 and ToK2. If C is periodic the arc has the same orientation as C if SameOrientation = Standard_True. If C is not periodic SameOrientation is not used for the computation and C is oriented from the knot fromK1 to the knot toK2. We just keep the local definition of C between the knots FromK1 and ToK2. The returned Bspline curve has its first and last knots with a multiplicity equal to degree + 1, where degree is the polynomial degree of C. The indexes of the knots FromK1 and ToK2 doesn’t include the repetition of multiple knots in their definition. //! Raised if FromK1 or ToK2 are out of the bounds [FirstUKnotIndex, LastUKnotIndex] Raised if FromK1 = ToK2
Parameters: Return type:  This function computes the segment of Bspline curve between the parametric values FromU1, ToU2. If C is periodic the arc has the same orientation as C if SameOrientation = True. If C is not periodic SameOrientation is not used for the computation and C is oriented fromU1 toU2. If U1 and U2 and two parametric values we consider that U1 = U2 if Abs (U1  U2) <= ParametricTolerance and ParametricTolerance must be greater or equal to Resolution from package gp. //! Raised if FromU1 or ToU2 are out of the parametric bounds of the curve (The tolerance criterion is ParametricTolerance). Raised if Abs (FromU1  ToU2) <= ParametricTolerance Raised if ParametricTolerance < Resolution from gp.
Parameters: Return type:

thisown
¶ The membership flag

static

geom2dconvert_C0BSplineToArrayOfC1BSplineCurve
(*args)¶  This Method reduces as far as it is possible the multiplicities of the knots of the BSpline BS.(keeping the geometry). It returns an array of BSpline C1. Tolerance is a geometrical tolerance
Parameters:  BS (Handle_Geom2d_BSplineCurve &) –
 tabBS (Handle_TColGeom2d_HArray1OfBSplineCurve &) –
 Tolerance (float) –
Return type: void
 This Method reduces as far as it is possible the multiplicities of the knots of the BSpline BS.(keeping the geometry). It returns an array of BSpline C1. tolerance is a geometrical tolerance
Parameters: Return type: void

geom2dconvert_C0BSplineToC1BSplineCurve
(*args)¶  This Method reduces as far as it is possible the multiplicities of the knots of the BSpline BS.(keeping the geometry). It returns a new BSpline which could still be C0. tolerance is a geometrical tolerance
Parameters:  BS (Handle_Geom2d_BSplineCurve &) –
 Tolerance (float) –
Return type: void

geom2dconvert_ConcatC1
(*args)¶  This Method concatenates C1 the ArrayOfCurves as far as it is possible. ArrayOfCurves[0..N1] ArrayOfToler contains the biggest tolerance of the two points shared by two consecutives curves. Its dimension: [0..N2] ClosedTolerance indicates if the ArrayOfCurves is closed. In this case ClosedTolerance contains the biggest tolerance of the two points which are at the closure. Otherwise its value is 0.0
Parameters: Return type: void
 This Method concatenates C1 the ArrayOfCurves as far as it is possible. ArrayOfCurves[0..N1] ArrayOfToler contains the biggest tolerance of the two points shared by two consecutives curves. Its dimension: [0..N2] ClosedTolerance indicates if the ArrayOfCurves is closed. In this case ClosedTolerance contains the biggest tolerance of the two points which are at the closure. Otherwise its value is 0.0
Parameters: Return type: void

geom2dconvert_ConcatG1
(*args)¶  This Method concatenates G1 the ArrayOfCurves as far as it is possible. ArrayOfCurves[0..N1] ArrayOfToler contains the biggest tolerance of the two points shared by two consecutives curves. Its dimension: [0..N2] ClosedTolerance indicates if the ArrayOfCurves is closed. In this case ClosedTolerance contains the biggest tolerance of the two points which are at the closure. Otherwise its value is 0.0
Parameters: Return type: void

geom2dconvert_CurveToBSplineCurve
(*args)¶  This function converts a non infinite curve from Geom into a Bspline curve. C must be an ellipse or a circle or a trimmed conic or a trimmed line or a Bezier curve or a trimmed Bezier curve or a BSpline curve or a trimmed BSpline curve or an Offset curve or a trimmed Offset curve. The returned Bspline is not periodic except if C is a Circle or an Ellipse. ParameterisationType applies only if the curve is a Circle or an ellipse : TgtThetaOver2, TgtThetaOver2_1, TgtThetaOver2_2, TgtThetaOver2_3, TgtThetaOver2_4, Purpose: this is the classical rational parameterisation 2 1  t cos(theta) = —— 2 1 + t //! 2t sin(theta) = —— 2 1 + t //! t = tan (theta/2) //! with TgtThetaOver2 the routine will compute the number of spans using the rule num_spans = [ (ULast  UFirst) / 1.2 ] + 1 with TgtThetaOver2_N, N spans will be forced: an error will be raized if (ULast  UFirst) >= PI and N = 1, ULast  UFirst >= 2 PI and N = 2 //! QuasiAngular, here t is a rational function that approximates theta —> tan(theta/2). Neverthless the composing with above function yields exact functions whose square sum up to 1 RationalC1 ; t is replaced by a polynomial function of u so as to grant C1 contiuity across knots. Exceptions Standard_DomainError if the curve C is infinite. Standard_ConstructionError:  if C is a complete circle or ellipse, and if Parameterisation is not equal to Convert_TgtThetaOver2 or to Convert_RationalC1, or  if C is a trimmed circle or ellipse and if Parameterisation is equal to Convert_TgtThetaOver2_1 and if U2  U1 > 0.9999 * Pi where U1 and U2 are respectively the first and the last parameters of the trimmed curve (this method of parameterization cannot be used to convert a halfcircle or a halfellipse, for example), or  if C is a trimmed circle or ellipse and Parameterisation is equal to Convert_TgtThetaOver2_2 and U2  U1 > 1.9999 * Pi where U1 and U2 are respectively the first and the last parameters of the trimmed curve (this method of parameterization cannot be used to convert a quasicomplete circle or ellipse).
Parameters:  C (Handle_Geom2d_Curve &) –
 Parameterisation (Convert_ParameterisationType) – default value is Convert_TgtThetaOver2
Return type:

geom2dconvert_SplitBSplineCurve
(*args)¶  – Convert a curve to BSpline by Approximation //! This method computes the arc of Bspline curve between the two knots FromK1 and ToK2. If C is periodic the arc has the same orientation as C if SameOrientation = Standard_True. If C is not periodic SameOrientation is not used for the computation and C is oriented from the knot fromK1 to the knot toK2. We just keep the local definition of C between the knots FromK1 and ToK2. The returned Bspline curve has its first and last knots with a multiplicity equal to degree + 1, where degree is the polynomial degree of C. The indexes of the knots FromK1 and ToK2 doesn’t include the repetition of multiple knots in their definition. //! Raised if FromK1 or ToK2 are out of the bounds [FirstUKnotIndex, LastUKnotIndex] Raised if FromK1 = ToK2
Parameters: Return type:  This function computes the segment of Bspline curve between the parametric values FromU1, ToU2. If C is periodic the arc has the same orientation as C if SameOrientation = True. If C is not periodic SameOrientation is not used for the computation and C is oriented fromU1 toU2. If U1 and U2 and two parametric values we consider that U1 = U2 if Abs (U1  U2) <= ParametricTolerance and ParametricTolerance must be greater or equal to Resolution from package gp. //! Raised if FromU1 or ToU2 are out of the parametric bounds of the curve (The tolerance criterion is ParametricTolerance). Raised if Abs (FromU1  ToU2) <= ParametricTolerance Raised if ParametricTolerance < Resolution from gp.
Parameters: Return type:

register_handle
(handle, base_object)¶ Inserts the handle into the base object to prevent memory corruption in certain cases