OCC.FairCurve module¶
this package is used to make ‘FairCurve’ byno linear optimization.- Batten- [Curve with] MinimalVariation [of curvature] or ‘MVC’.
-
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.
Parameters: Return type: -
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.
Parameters: Return type:
-
Curve
()¶ - Returns the computed curve a 2d BSpline.
Return type: Handle_Geom2d_BSplineCurve
-
Delete
()¶ Return type: void
-
DumpToString
()¶ FairCurve_Batten_DumpToString(FairCurve_Batten self) -> std::string
-
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.
Return type: bool
-
SetAngle1
()¶ - Allows you to change the angle Angle1 at the first point, P1. The default setting is 0.
Parameters: Angle1 (float) – Return type: None
-
SetAngle2
()¶ - Allows you to change the angle Angle2 at the second point, P2. The default setting is 0.
Parameters: Angle2 (float) – Return type: 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.
Parameters: ConstraintOrder (int) – Return type: 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.
Parameters: ConstraintOrder (int) – Return type: 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.
Parameters: FreeSliding (bool) – Return type: None
-
SetHeight
()¶ - Allows you to change the height of the deformation. Raises NegativeValue; – if Height <= 0 if Height <= 0
Parameters: Height (float) – Return type: 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.
Parameters: P1 (gp_Pnt2d) – Return type: 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.
Parameters: P2 (gp_Pnt2d) – Return type: 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.
Parameters: SlidingFactor (float) – Return type: 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.
Return type: float
-
thisown
¶ The membership flag
-
class
FairCurve_BattenLaw
(*args)¶ Bases:
OCC.math.math_Function
- Constructor of linear batten with Heigth : the Heigth at the middle point Slope : the geometric slope of the batten Sliding : Active Length of the batten without extension
Parameters: Return type: -
SetHeigth
()¶ - Change the value of Heigth at the middle point.
Parameters: Heigth (float) – Return type: None
-
thisown
¶ The membership flag
-
class
FairCurve_DistributionOfEnergy
(*args, **kwargs)¶ Bases:
OCC.math.math_FunctionSet
-
thisown
¶ The membership flag
-
-
class
FairCurve_DistributionOfJerk
(*args)¶ Bases:
OCC.FairCurve.FairCurve_DistributionOfEnergy
Parameters: - BSplOrder (int) –
- FlatKnots (Handle_TColStd_HArray1OfReal &) –
- Poles (Handle_TColgp_HArray1OfPnt2d) –
- DerivativeOrder (int) –
- Law (FairCurve_BattenLaw &) –
- NbValAux (int) – default value is 0
Return type: -
thisown
¶ The membership flag
-
class
FairCurve_DistributionOfSagging
(*args)¶ Bases:
OCC.FairCurve.FairCurve_DistributionOfEnergy
Parameters: - BSplOrder (int) –
- FlatKnots (Handle_TColStd_HArray1OfReal &) –
- Poles (Handle_TColgp_HArray1OfPnt2d) –
- DerivativeOrder (int) –
- Law (FairCurve_BattenLaw &) –
- NbValAux (int) – default value is 0
Return type: -
thisown
¶ The membership flag
-
class
FairCurve_DistributionOfTension
(*args)¶ Bases:
OCC.FairCurve.FairCurve_DistributionOfEnergy
Parameters: Return type: -
thisown
¶ The membership flag
-
-
class
FairCurve_Energy
(*args, **kwargs)¶ Bases:
OCC.math.math_MultipleVarFunctionWithHessian
-
Poles
()¶ - return the poles
Return type: 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.
Parameters: - X (math_Vector &) –
- E (float &) –
- G (math_Vector &) –
Return type: - 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.
Parameters: - X (math_Vector &) –
- E (float &) –
- G (math_Vector &) –
- H (math_Matrix &) –
Return type:
-
Variable
()¶ - compute the variables <X> wich correspond with the field <MyPoles>
Parameters: X (math_Vector &) – Return type: bool
-
thisown
¶ The membership flag
-
-
class
FairCurve_EnergyOfBatten
(*args)¶ Bases:
OCC.FairCurve.FairCurve_Energy
- Angles corresspond to the Ox axis
Parameters: - BSplOrder (int) –
- FlatKnots (Handle_TColStd_HArray1OfReal &) –
- Poles (Handle_TColgp_HArray1OfPnt2d) –
- ContrOrder1 (int) –
- ContrOrder2 (int) –
- Law (FairCurve_BattenLaw &) –
- LengthSliding (float) –
- FreeSliding (bool) – default value is Standard_True
- Angle1 (float) – default value is 0
- Angle2 (float) – default value is 0
Return type: -
Status
()¶ - return the status
Return type: FairCurve_AnalysisCode
-
thisown
¶ The membership flag
-
class
FairCurve_EnergyOfMVC
(*args)¶ Bases:
OCC.FairCurve.FairCurve_Energy
- Angles corresspond to the Ox axis
Parameters: - BSplOrder (int) –
- FlatKnots (Handle_TColStd_HArray1OfReal &) –
- Poles (Handle_TColgp_HArray1OfPnt2d) –
- ContrOrder1 (int) –
- ContrOrder2 (int) –
- Law (FairCurve_BattenLaw &) –
- PhysicalRatio (float) –
- LengthSliding (float) –
- FreeSliding (bool) – default value is Standard_True
- Angle1 (float) – default value is 0
- Angle2 (float) – default value is 0
- Curvature1 (float) – default value is 0
- Curvature2 (float) – default value is 0
Return type: -
Status
()¶ - return the status
Return type: FairCurve_AnalysisCode
-
thisown
¶ The membership flag
-
class
FairCurve_MinimalVariation
(*args)¶ Bases:
OCC.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
Parameters: Return type: -
DumpToString
()¶ FairCurve_MinimalVariation_DumpToString(FairCurve_MinimalVariation self) -> std::string
-
SetCurvature1
()¶ - Allows you to set a new constraint on curvature at the first point.
Parameters: Curvature (float) – Return type: None
-
SetCurvature2
()¶ - Allows you to set a new constraint on curvature at the second point.
Parameters: Curvature (float) – Return type: 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
Parameters: Ratio (float) – Return type: None
-
thisown
¶ The membership flag
-
class
FairCurve_Newton
(*args)¶ Bases:
OCC.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
Parameters: - theFunction (math_MultipleVarFunctionWithHessian &) –
- theSpatialTolerance (float) – default value is 1.0e-7
- theCriteriumTolerance (float) – default value is 1.0e-7
- theNbIterations (int) – default value is 40
- theConvexity (float) – default value is 1.0e-6
- theWithSingularity (bool) – default value is Standard_True
Return type: -
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.
Return type: bool
-
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