OCC.Core.FairCurve module¶
FairCurve module, see official documentation at https://www.opencascade.com/doc/occt-7.4.0/refman/html/package_faircurve.html
-
class
FairCurve_Batten
(*args)¶ Bases:
object
- Constructor with the two points and the geometrical characteristics of the batten (elastic beam) Height is the height of the deformation, and Slope is the slope value, initialized at 0. The user can then supply the desired slope value by the method, SetSlope. Other parameters are initialized as follow- FreeSliding = False - ConstraintOrder1 = 1 - ConstraintOrder2 = 1 - Angle1 = 0 - Angle2 = 0 - SlidingFactor = 1 Exceptions NegativeValue if Height is less than or equal to 0. NullValue if the distance between P1 and P2 is less than or equal to the tolerance value for distance in Precision::Confusion: P1.IsEqual(P2, Precision::Confusion()). The function gp_Pnt2d::IsEqual tests to see if this is the case.
- param P1
- type P1
gp_Pnt2d
- param P2
- type P2
gp_Pnt2d
- param Height
- type Height
float
- param Slope
default value is 0
- type Slope
float
- rtype
None
-
Compute
()¶ - Performs the algorithm, using the arguments Code, NbIterations and Tolerance and computes the curve with respect to the constraints. Code will have one of the following values: - OK - NotConverged - InfiniteSliding - NullHeight The parameters Tolerance and NbIterations control how precise the computation is, and how long it will take.
- param Code
- type Code
FairCurve_AnalysisCode
- param NbIterations
default value is 50
- type NbIterations
int
- param Tolerance
default value is 1.0e-3
- type Tolerance
float
- rtype
bool
-
Curve
()¶ - Returns the computed curve a 2d BSpline.
- rtype
opencascade::handle<Geom2d_BSplineCurve>
-
DumpToString
(FairCurve_Batten self) → std::string¶
-
GetAngle1
()¶ - Returns the established first angle.
- rtype
float
-
GetAngle2
()¶ - Returns the established second angle.
- rtype
float
-
GetConstraintOrder1
()¶ - Returns the established first constraint order.
- rtype
int
-
GetConstraintOrder2
()¶ - Returns the established second constraint order.
- rtype
int
-
GetFreeSliding
()¶ - Returns the initial free sliding value, false by default. Free sliding is generally more aesthetically pleasing than constrained sliding. However, the computation can fail with values such as angles greater than PI/2. This is because the resulting batten length is theoretically infinite.
- rtype
bool
-
GetHeight
()¶ - Returns the thickness of the lathe.
- rtype
float
-
GetP1
()¶ - Returns the established location of the point P1.
- rtype
gp_Pnt2d
-
GetP2
()¶ - Returns the established location of the point P2.
- rtype
gp_Pnt2d
-
GetSlidingFactor
()¶ - Returns the initial sliding factor.
- rtype
float
-
GetSlope
()¶ - Returns the established slope value.
- rtype
float
-
SetAngle1
()¶ - Allows you to change the angle Angle1 at the first point, P1. The default setting is 0.
- param Angle1
- type Angle1
float
- rtype
None
-
SetAngle2
()¶ - Allows you to change the angle Angle2 at the second point, P2. The default setting is 0.
- param Angle2
- type Angle2
float
- rtype
None
-
SetConstraintOrder1
()¶ - Allows you to change the order of the constraint on the first point. ConstraintOrder has the default setting of 1. The following settings are available: - 0-the curve must pass through a point - 1-the curve must pass through a point and have a given tangent - 2-the curve must pass through a point, have a given tangent and a given curvature. The third setting is only valid for FairCurve_MinimalVariation curves. These constraints, though geometric, represent the mechanical constraints due, for example, to the resistance of the material the actual physical batten is made of.
- param ConstraintOrder
- type ConstraintOrder
int
- rtype
None
-
SetConstraintOrder2
()¶ - Allows you to change the order of the constraint on the second point. ConstraintOrder is initialized with the default setting of 1. The following settings are available: - 0-the curve must pass through a point - 1-the curve must pass through a point and have a given tangent - 2-the curve must pass through a point, have a given tangent and a given curvature. The third setting is only valid for FairCurve_MinimalVariation curves. These constraints, though geometric, represent the mechanical constraints due, for example, to the resistance of the material the actual physical batten is made of.
- param ConstraintOrder
- type ConstraintOrder
int
- rtype
None
-
SetFreeSliding
()¶ - Freesliding is initialized with the default setting false. When Freesliding is set to true and, as a result, sliding is free, the sliding factor is automatically computed to satisfy the equilibrium of the batten.
- param FreeSliding
- type FreeSliding
bool
- rtype
None
-
SetHeight
()¶ - Allows you to change the height of the deformation. Raises NegativeValue; – if Height <= 0 if Height <= 0
- param Height
- type Height
float
- rtype
None
-
SetP1
()¶ - Allows you to change the location of the point, P1, and in doing so, modify the curve. Warning This method changes the angle as well as the point. Exceptions NullValue if the distance between P1 and P2 is less than or equal to the tolerance value for distance in Precision::Confusion: P1.IsEqual(P2, Precision::Confusion()). The function gp_Pnt2d::IsEqual tests to see if this is the case.
- param P1
- type P1
gp_Pnt2d
- rtype
None
-
SetP2
()¶ - Allows you to change the location of the point, P1, and in doing so, modify the curve. Warning This method changes the angle as well as the point. Exceptions NullValue if the distance between P1 and P2 is less than or equal to the tolerance value for distance in Precision::Confusion: P1.IsEqual(P2, Precision::Confusion()). The function gp_Pnt2d::IsEqual tests to see if this is the case.
- param P2
- type P2
gp_Pnt2d
- rtype
None
-
SetSlidingFactor
()¶ - Allows you to change the ratio SlidingFactor. This compares the length of the batten and the reference length, which is, in turn, a function of the constraints. This modification has one of the following two effects: - if you increase the value, it inflates the batten - if you decrease the value, it flattens the batten. When sliding is free, the sliding factor is automatically computed to satisfy the equilibrium of the batten. When sliding is imposed, a value is required for the sliding factor. SlidingFactor is initialized with the default setting of 1.
- param SlidingFactor
- type SlidingFactor
float
- rtype
None
-
SetSlope
()¶ - Allows you to set the slope value, Slope.
- param Slope
- type Slope
float
- rtype
None
-
SlidingOfReference
()¶ - Computes the real number value for length Sliding of Reference for new constraints. If you want to give a specific length to a batten curve, use the following syntax: b.SetSlidingFactor(L / b.SlidingOfReference()) where b is the name of the batten curve object.
- rtype
float
-
property
thisown
¶ The membership flag
-
class
FairCurve_BattenLaw
(*args)¶ Bases:
OCC.Core.math.math_Function
- Constructor of linear batten with Heigththe Heigth at the middle point Slopethe geometric slope of the batten SlidingActive Length of the batten without extension
- param Heigth
- type Heigth
float
- param Slope
- type Slope
float
- param Sliding
- type Sliding
float
- rtype
None
-
SetHeigth
()¶ - Change the value of Heigth at the middle point.
- param Heigth
- type Heigth
float
- rtype
None
-
SetSliding
()¶ - Change the value of sliding
- param Sliding
- type Sliding
float
- rtype
None
-
SetSlope
()¶ - Change the value of the geometric slope.
- param Slope
- type Slope
float
- rtype
None
-
property
thisown
¶ The membership flag
-
class
FairCurve_DistributionOfEnergy
(*args, **kwargs)¶ Bases:
OCC.Core.math.math_FunctionSet
-
SetDerivativeOrder
()¶ - Parameters
DerivativeOrder –
- type DerivativeOrder
int
- rtype
None
-
property
thisown
¶ The membership flag
-
-
class
FairCurve_DistributionOfJerk
(*args)¶ Bases:
OCC.Core.FairCurve.FairCurve_DistributionOfEnergy
- Parameters
BSplOrder –
- type BSplOrder
int
- param FlatKnots
- type FlatKnots
TColStd_HArray1OfReal
- param Poles
- type Poles
TColgp_HArray1OfPnt2d
- param DerivativeOrder
- type DerivativeOrder
int
- param Law
- type Law
FairCurve_BattenLaw
- param NbValAux
default value is 0
- type NbValAux
int
- rtype
None
-
property
thisown
¶ The membership flag
-
class
FairCurve_DistributionOfSagging
(*args)¶ Bases:
OCC.Core.FairCurve.FairCurve_DistributionOfEnergy
- Parameters
BSplOrder –
- type BSplOrder
int
- param FlatKnots
- type FlatKnots
TColStd_HArray1OfReal
- param Poles
- type Poles
TColgp_HArray1OfPnt2d
- param DerivativeOrder
- type DerivativeOrder
int
- param Law
- type Law
FairCurve_BattenLaw
- param NbValAux
default value is 0
- type NbValAux
int
- rtype
None
-
property
thisown
¶ The membership flag
-
class
FairCurve_DistributionOfTension
(*args)¶ Bases:
OCC.Core.FairCurve.FairCurve_DistributionOfEnergy
- Parameters
BSplOrder –
- type BSplOrder
int
- param FlatKnots
- type FlatKnots
TColStd_HArray1OfReal
- param Poles
- type Poles
TColgp_HArray1OfPnt2d
- param DerivativeOrder
- type DerivativeOrder
int
- param LengthSliding
- type LengthSliding
float
- param Law
- type Law
FairCurve_BattenLaw
- param NbValAux
default value is 0
- type NbValAux
int
- param Uniform
default value is Standard_False
- type Uniform
bool
- rtype
None
-
SetLengthSliding
()¶ - change the length sliding
- param LengthSliding
- type LengthSliding
float
- rtype
None
-
property
thisown
¶ The membership flag
-
class
FairCurve_Energy
(*args, **kwargs)¶ Bases:
OCC.Core.math.math_MultipleVarFunctionWithHessian
-
Poles
()¶ - return the poles
- rtype
opencascade::handle<TColgp_HArray1OfPnt2d>
-
Values
()¶ - computes the Energy <E> and the gradient <G> of the energy for the variable <X>. Returns True if the computation was done successfully, False otherwise.
- param X
- type X
math_Vector
- param E
- type E
float
- param G
- type G
math_Vector
- rtype
bool* computes the Energy <E>, the gradient <G> and the Hessian <H> of the energy for the variable <X>. Returns True if the computation was done successfully, False otherwise.
- param X
- type X
math_Vector
- param E
- type E
float
- param G
- type G
math_Vector
- param H
- type H
math_Matrix
- rtype
bool
-
Variable
()¶ - compute the variables <X> wich correspond with the field <MyPoles>
- param X
- type X
math_Vector
- rtype
bool
-
property
thisown
¶ The membership flag
-
-
class
FairCurve_EnergyOfBatten
(*args)¶ Bases:
OCC.Core.FairCurve.FairCurve_Energy
- Angles corresspond to the Ox axis
- param BSplOrder
- type BSplOrder
int
- param FlatKnots
- type FlatKnots
TColStd_HArray1OfReal
- param Poles
- type Poles
TColgp_HArray1OfPnt2d
- param ContrOrder1
- type ContrOrder1
int
- param ContrOrder2
- type ContrOrder2
int
- param Law
- type Law
FairCurve_BattenLaw
- param LengthSliding
- type LengthSliding
float
- param FreeSliding
default value is Standard_True
- type FreeSliding
bool
- param Angle1
default value is 0
- type Angle1
float
- param Angle2
default value is 0
- type Angle2
float
- rtype
None
-
LengthSliding
()¶ - return the lengthSliding = P1P2 + Sliding
- rtype
float
-
Status
()¶ - return the status
- rtype
FairCurve_AnalysisCode
-
property
thisown
¶ The membership flag
-
class
FairCurve_EnergyOfMVC
(*args)¶ Bases:
OCC.Core.FairCurve.FairCurve_Energy
- Angles corresspond to the Ox axis
- param BSplOrder
- type BSplOrder
int
- param FlatKnots
- type FlatKnots
TColStd_HArray1OfReal
- param Poles
- type Poles
TColgp_HArray1OfPnt2d
- param ContrOrder1
- type ContrOrder1
int
- param ContrOrder2
- type ContrOrder2
int
- param Law
- type Law
FairCurve_BattenLaw
- param PhysicalRatio
- type PhysicalRatio
float
- param LengthSliding
- type LengthSliding
float
- param FreeSliding
default value is Standard_True
- type FreeSliding
bool
- param Angle1
default value is 0
- type Angle1
float
- param Angle2
default value is 0
- type Angle2
float
- param Curvature1
default value is 0
- type Curvature1
float
- param Curvature2
default value is 0
- type Curvature2
float
- rtype
None
-
LengthSliding
()¶ - return the lengthSliding = P1P2 + Sliding
- rtype
float
-
Status
()¶ - return the status
- rtype
FairCurve_AnalysisCode
-
property
thisown
¶ The membership flag
-
class
FairCurve_MinimalVariation
(*args)¶ Bases:
OCC.Core.FairCurve.FairCurve_Batten
- Constructs the two contact points P1 and P2 and the geometrical characteristics of the batten (elastic beam) These include the real number values for height of deformation Height, slope value Slope, and kind of energy PhysicalRatio. The kinds of energy include: - Jerk (0) - Sagging (1). Note that the default setting for Physical Ration is in FairCurve_Batten Other parameters are initialized as follow- FreeSliding = False - ConstraintOrder1 = 1 - ConstraintOrder2 = 1 - Angle1 = 0 - Angle2 = 0 - Curvature1 = 0 - Curvature2 = 0 - SlidingFactor = 1 Warning If PhysicalRatio equals 1, you cannot impose constraints on curvature. Exceptions NegativeValue if Height is less than or equal to 0. NullValue if the distance between P1 and P2 is less than or equal to the tolerance value for distance in Precision::Confusion: P1.IsEqual(P2, Precision::Confusion()). The function gp_Pnt2d::IsEqual tests to see if this is the case. Definition of the geometricals constraints
- param P1
- type P1
gp_Pnt2d
- param P2
- type P2
gp_Pnt2d
- param Heigth
- type Heigth
float
- param Slope
default value is 0
- type Slope
float
- param PhysicalRatio
default value is 0
- type PhysicalRatio
float
- rtype
None
-
DumpToString
(FairCurve_MinimalVariation self) → std::string¶
-
GetCurvature1
()¶ - Returns the first established curvature.
- rtype
float
-
GetCurvature2
()¶ - Returns the second established curvature.
- rtype
float
-
GetPhysicalRatio
()¶ - Returns the physical ratio, or kind of energy.
- rtype
float
-
SetCurvature1
()¶ - Allows you to set a new constraint on curvature at the first point.
- param Curvature
- type Curvature
float
- rtype
None
-
SetCurvature2
()¶ - Allows you to set a new constraint on curvature at the second point.
- param Curvature
- type Curvature
float
- rtype
None
-
SetPhysicalRatio
()¶ - Allows you to set the physical ratio Ratio. The kinds of energy which you can specify include: 0 is only ‘Jerk’ Energy 1 is only ‘Sagging’ Energy like batten Warning: if Ratio is 1 it is impossible to impose curvature constraints. Raises DomainError if Ratio < 0 or Ratio > 1
- param Ratio
- type Ratio
float
- rtype
None
-
property
thisown
¶ The membership flag
-
class
FairCurve_Newton
(*args)¶ Bases:
OCC.Core.math.math_NewtonMinimum
- The tolerance required on the solution is given by Tolerance. Iteration are stopped if (!WithSingularity) and H(F(Xi)) is not definite positive (if the smaller eigenvalue of H < Convexity) or IsConverged() returns True for 2 successives Iterations. Warning: This constructor do not computation
- param theFunction
- type theFunction
math_MultipleVarFunctionWithHessian
- param theSpatialTolerance
default value is 1.0e-7
- type theSpatialTolerance
float
- param theCriteriumTolerance
default value is 1.0e-7
- type theCriteriumTolerance
float
- param theNbIterations
default value is 40
- type theNbIterations
int
- param theConvexity
default value is 1.0e-6
- type theConvexity
float
- param theWithSingularity
default value is Standard_True
- type theWithSingularity
bool
- rtype
None
-
IsConverged
()¶ - This method is called at the end of each iteration to check the convergence|| Xi+1 - Xi || < SpatialTolerance/100 Or || Xi+1 - Xi || < SpatialTolerance and |F(Xi+1) - F(Xi)| < CriteriumTolerance * |F(xi)| It can be redefined in a sub-class to implement a specific test.
- rtype
bool
-
property
thisown
¶ The membership flag