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:
  • Curve (Handle_Geom2d_Curve &) –
  • Tol2d (float) –
  • Order (GeomAbs_Shape) –
  • MaxSegments (int) –
  • MaxDegree (int) –
Return type:

None

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:

None

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 [Uk-1, 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:
  • BasisCurve (Handle_Geom2d_BSplineCurve &) –
  • U1 (float) –
  • U2 (float) –
  • ParametricTolerance (float) –
Return type:

None

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 B-spline 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:

None

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:
  • NewCurve (Handle_Geom2d_BoundedCurve &) –
  • Tolerance (float) –
  • After (bool) – default value is Standard_False
Return type:

bool

BSplineCurve()
Return type:Handle_Geom2d_BSplineCurve
Clear()
  • Clear result curve
Return type:None
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:
  • BS (Handle_Geom2d_BSplineCurve &) –
  • tabBS (Handle_TColGeom2d_HArray1OfBSplineCurve &) –
  • AngularTolerance (float) –
  • Tolerance (float) –
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..N-1] ArrayOfToler contains the biggest tolerance of the two points shared by two consecutives curves. Its dimension: [0..N-2] 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:
  • ArrayOfCurves (TColGeom2d_Array1OfBSplineCurve &) –
  • ArrayOfToler (TColStd_Array1OfReal &) –
  • ArrayOfIndices (Handle_TColStd_HArray1OfInteger &) –
  • ArrayOfConcatenated (Handle_TColGeom2d_HArray1OfBSplineCurve &) –
  • ClosedFlag (bool) –
  • ClosedTolerance (float) –
Return type:

void

  • This Method concatenates C1 the ArrayOfCurves as far as it is possible. ArrayOfCurves[0..N-1] ArrayOfToler contains the biggest tolerance of the two points shared by two consecutives curves. Its dimension: [0..N-2] 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:
  • ArrayOfCurves (TColGeom2d_Array1OfBSplineCurve &) –
  • ArrayOfToler (TColStd_Array1OfReal &) –
  • ArrayOfIndices (Handle_TColStd_HArray1OfInteger &) –
  • ArrayOfConcatenated (Handle_TColGeom2d_HArray1OfBSplineCurve &) –
  • ClosedFlag (bool) –
  • ClosedTolerance (float) –
  • AngularTolerance (float) –
Return type:

void

static ConcatG1(*args)
  • This Method concatenates G1 the ArrayOfCurves as far as it is possible. ArrayOfCurves[0..N-1] ArrayOfToler contains the biggest tolerance of the two points shared by two consecutives curves. Its dimension: [0..N-2] 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:
  • ArrayOfCurves (TColGeom2d_Array1OfBSplineCurve &) –
  • ArrayOfToler (TColStd_Array1OfReal &) –
  • ArrayOfConcatenated (Handle_TColGeom2d_HArray1OfBSplineCurve &) –
  • ClosedFlag (bool) –
  • ClosedTolerance (float) –
Return type:

void

static CurveToBSplineCurve(*args)
  • This function converts a non infinite curve from Geom into a B-spline 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 B-spline 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 half-circle or a half-ellipse, 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 quasi-complete circle or ellipse).
Parameters:
  • C (Handle_Geom2d_Curve &) –
  • Parameterisation (Convert_ParameterisationType) – default value is Convert_TgtThetaOver2
Return type:

Handle_Geom2d_BSplineCurve

static SplitBSplineCurve(*args)
  • – Convert a curve to BSpline by Approximation //! This method computes the arc of B-spline 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 B-spline 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:
  • C (Handle_Geom2d_BSplineCurve &) –
  • FromK1 (int) –
  • ToK2 (int) –
  • SameOrientation (bool) – default value is Standard_True
Return type:

Handle_Geom2d_BSplineCurve

  • This function computes the segment of B-spline 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:
  • C (Handle_Geom2d_BSplineCurve &) –
  • FromU1 (float) –
  • ToU2 (float) –
  • ParametricTolerance (float) –
  • SameOrientation (bool) – default value is Standard_True
Return type:

Handle_Geom2d_BSplineCurve

thisown

The membership flag

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:
  • BS (Handle_Geom2d_BSplineCurve &) –
  • tabBS (Handle_TColGeom2d_HArray1OfBSplineCurve &) –
  • AngularTolerance (float) –
  • Tolerance (float) –
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..N-1] ArrayOfToler contains the biggest tolerance of the two points shared by two consecutives curves. Its dimension: [0..N-2] 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:
  • ArrayOfCurves (TColGeom2d_Array1OfBSplineCurve &) –
  • ArrayOfToler (TColStd_Array1OfReal &) –
  • ArrayOfIndices (Handle_TColStd_HArray1OfInteger &) –
  • ArrayOfConcatenated (Handle_TColGeom2d_HArray1OfBSplineCurve &) –
  • ClosedFlag (bool) –
  • ClosedTolerance (float) –
Return type:

void

  • This Method concatenates C1 the ArrayOfCurves as far as it is possible. ArrayOfCurves[0..N-1] ArrayOfToler contains the biggest tolerance of the two points shared by two consecutives curves. Its dimension: [0..N-2] 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:
  • ArrayOfCurves (TColGeom2d_Array1OfBSplineCurve &) –
  • ArrayOfToler (TColStd_Array1OfReal &) –
  • ArrayOfIndices (Handle_TColStd_HArray1OfInteger &) –
  • ArrayOfConcatenated (Handle_TColGeom2d_HArray1OfBSplineCurve &) –
  • ClosedFlag (bool) –
  • ClosedTolerance (float) –
  • AngularTolerance (float) –
Return type:

void

geom2dconvert_ConcatG1(*args)
  • This Method concatenates G1 the ArrayOfCurves as far as it is possible. ArrayOfCurves[0..N-1] ArrayOfToler contains the biggest tolerance of the two points shared by two consecutives curves. Its dimension: [0..N-2] 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:
  • ArrayOfCurves (TColGeom2d_Array1OfBSplineCurve &) –
  • ArrayOfToler (TColStd_Array1OfReal &) –
  • ArrayOfConcatenated (Handle_TColGeom2d_HArray1OfBSplineCurve &) –
  • ClosedFlag (bool) –
  • ClosedTolerance (float) –
Return type:

void

geom2dconvert_CurveToBSplineCurve(*args)
  • This function converts a non infinite curve from Geom into a B-spline 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 B-spline 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 half-circle or a half-ellipse, 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 quasi-complete circle or ellipse).
Parameters:
  • C (Handle_Geom2d_Curve &) –
  • Parameterisation (Convert_ParameterisationType) – default value is Convert_TgtThetaOver2
Return type:

Handle_Geom2d_BSplineCurve

geom2dconvert_SplitBSplineCurve(*args)
  • – Convert a curve to BSpline by Approximation //! This method computes the arc of B-spline 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 B-spline 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:
  • C (Handle_Geom2d_BSplineCurve &) –
  • FromK1 (int) –
  • ToK2 (int) –
  • SameOrientation (bool) – default value is Standard_True
Return type:

Handle_Geom2d_BSplineCurve

  • This function computes the segment of B-spline 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:
  • C (Handle_Geom2d_BSplineCurve &) –
  • FromU1 (float) –
  • ToU2 (float) –
  • ParametricTolerance (float) –
  • SameOrientation (bool) – default value is Standard_True
Return type:

Handle_Geom2d_BSplineCurve

register_handle(handle, base_object)

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