BOPAlgo_MakePeriodic is the tool for making an arbitrary shape periodic in 3D space in specified directions. More...
#include <BOPAlgo_MakePeriodic.hxx>
Data Structures | |
struct | PeriodicityParams |
Public Member Functions | ||||||||||
Constructor | ||||||||||
Empty constructor | ||||||||||
BOPAlgo_MakePeriodic () | ||||||||||
Setting the shape to make it periodic | ||||||||||
Sets the shape to make it periodic.
| ||||||||||
void | SetShape (const TopoDS_Shape &theShape) | |||||||||
Setters/Getters for periodicity parameters structure | ||||||||||
Sets the periodicity parameters.
| ||||||||||
void | SetPeriodicityParameters (const PeriodicityParams &theParams) | |||||||||
const PeriodicityParams & | PeriodicityParameters () const | |||||||||
Methods for setting/getting periodicity info using ID as a direction | ||||||||||
Sets the flag to make the shape periodic in specified direction:
| ||||||||||
void | MakePeriodic (const Standard_Integer theDirectionID, const Standard_Boolean theIsPeriodic, const Standard_Real thePeriod=0.0) | |||||||||
Returns the info about Periodicity of the shape in specified direction. | ||||||||||
Standard_Boolean | IsPeriodic (const Standard_Integer theDirectionID) const | |||||||||
Returns the info about Periodicity of the shape in specified direction. | ||||||||||
Standard_Real | Period (const Standard_Integer theDirectionID) const | |||||||||
Returns the Period of the shape in specified direction. | ||||||||||
Named methods for setting/getting info about shape's periodicity | ||||||||||
Sets the flag to make the shape periodic in X direction.
| ||||||||||
void | MakeXPeriodic (const Standard_Boolean theIsPeriodic, const Standard_Real thePeriod=0.0) | |||||||||
Returns the info about periodicity of the shape in X direction. | ||||||||||
Standard_Boolean | IsXPeriodic () const | |||||||||
Returns the info about periodicity of the shape in X direction. | ||||||||||
Standard_Real | XPeriod () const | |||||||||
Returns the XPeriod of the shape. | ||||||||||
void | MakeYPeriodic (const Standard_Boolean theIsPeriodic, const Standard_Real thePeriod=0.0) | |||||||||
Sets the flag to make the shape periodic in Y direction. | ||||||||||
Standard_Boolean | IsYPeriodic () const | |||||||||
Returns the info about periodicity of the shape in Y direction. | ||||||||||
Standard_Real | YPeriod () const | |||||||||
Returns the YPeriod of the shape. | ||||||||||
void | MakeZPeriodic (const Standard_Boolean theIsPeriodic, const Standard_Real thePeriod=0.0) | |||||||||
Sets the flag to make the shape periodic in Z direction. | ||||||||||
Standard_Boolean | IsZPeriodic () const | |||||||||
Returns the info about periodicity of the shape in Z direction. | ||||||||||
Standard_Real | ZPeriod () const | |||||||||
Returns the ZPeriod of the shape. | ||||||||||
Methods for setting/getting trimming info taking Direction ID as a parameter | ||||||||||
Defines whether the input shape is already trimmed in specified direction to fit the period in this direction. Direction is defined by an ID:
If the shape is not trimmed it is required to set the first parameter of the period in that direction. The algorithm will make the shape fit into the period. Before calling this method, the shape has to be set to be periodic in this direction.
| ||||||||||
void | SetTrimmed (const Standard_Integer theDirectionID, const Standard_Boolean theIsTrimmed, const Standard_Real theFirst=0.0) | |||||||||
Returns whether the input shape was trimmed in the specified direction. | ||||||||||
Standard_Boolean | IsInputTrimmed (const Standard_Integer theDirectionID) const | |||||||||
Returns whether the input shape was trimmed in the specified direction. | ||||||||||
Standard_Real | PeriodFirst (const Standard_Integer theDirectionID) const | |||||||||
Returns the first periodic parameter in the specified direction. | ||||||||||
Named methods for setting/getting trimming info | ||||||||||
Defines whether the input shape is already trimmed in X direction to fit the X period. If the shape is not trimmed it is required to set the first parameter for the X period. The algorithm will make the shape fit into the period. Before calling this method, the shape has to be set to be periodic in this direction.
| ||||||||||
void | SetXTrimmed (const Standard_Boolean theIsTrimmed, const Standard_Boolean theFirst=0.0) | |||||||||
Returns whether the input shape was already trimmed for X period. | ||||||||||
Standard_Boolean | IsInputXTrimmed () const | |||||||||
Returns whether the input shape was already trimmed for X period. | ||||||||||
Standard_Real | XPeriodFirst () const | |||||||||
Returns the first parameter for the X period. | ||||||||||
void | SetYTrimmed (const Standard_Boolean theIsTrimmed, const Standard_Boolean theFirst=0.0) | |||||||||
Defines whether the input shape is already trimmed in Y direction to fit the Y period. If the shape is not trimmed it is required to set the first parameter for the Y period. The algorithm will make the shape fit into the period. | ||||||||||
Standard_Boolean | IsInputYTrimmed () const | |||||||||
Returns whether the input shape was already trimmed for Y period. | ||||||||||
Standard_Real | YPeriodFirst () const | |||||||||
Returns the first parameter for the Y period. | ||||||||||
void | SetZTrimmed (const Standard_Boolean theIsTrimmed, const Standard_Boolean theFirst=0.0) | |||||||||
Defines whether the input shape is already trimmed in Z direction to fit the Z period. If the shape is not trimmed it is required to set the first parameter for the Z period. The algorithm will make the shape fit into the period. | ||||||||||
Standard_Boolean | IsInputZTrimmed () const | |||||||||
Returns whether the input shape was already trimmed for Z period. | ||||||||||
Standard_Real | ZPeriodFirst () const | |||||||||
Returns the first parameter for the Z period. | ||||||||||
Performing the operation | ||||||||||
Makes the shape periodic in necessary directions | ||||||||||
void | Perform () | |||||||||
Using the algorithm to repeat the shape | ||||||||||
Performs repetition of the shape in specified direction required number of times. Negative value of times means that the repetition should be perform in negative direction. Makes the repeated shape a base for following repetitions.
| ||||||||||
const TopoDS_Shape & | RepeatShape (const Standard_Integer theDirectionID, const Standard_Integer theTimes) | |||||||||
Repeats the shape in X direction specified number of times. Negative value of times means that the repetition should be perform in negative X direction. Makes the repeated shape a base for following repetitions. | ||||||||||
const TopoDS_Shape & | XRepeat (const Standard_Integer theTimes) | |||||||||
Repeats the shape in X direction specified number of times. Negative value of times means that the repetition should be perform in negative X direction. Makes the repeated shape a base for following repetitions. | ||||||||||
const TopoDS_Shape & | YRepeat (const Standard_Integer theTimes) | |||||||||
Repeats the shape in Y direction specified number of times. Negative value of times means that the repetition should be perform in negative Y direction. Makes the repeated shape a base for following repetitions. | ||||||||||
const TopoDS_Shape & | ZRepeat (const Standard_Integer theTimes) | |||||||||
Repeats the shape in Z direction specified number of times. Negative value of times means that the repetition should be perform in negative Z direction. Makes the repeated shape a base for following repetitions. | ||||||||||
Starting the repetitions over | ||||||||||
Returns the repeated shape | ||||||||||
const TopoDS_Shape & | RepeatedShape () const | |||||||||
Clears all performed repetitions. The next repetition will be performed on the base shape. | ||||||||||
void | ClearRepetitions () | |||||||||
Clears all performed repetitions. The next repetition will be performed on the base shape. | ||||||||||
Obtaining the result shape | ||||||||||
Returns the resulting periodic shape | ||||||||||
const TopoDS_Shape & | Shape () const | |||||||||
Getting the identical shapes | ||||||||||
Returns the identical shapes for the given shape located on the opposite periodic side. Returns empty list in case the shape has no twin.
| ||||||||||
const TopTools_ListOfShape & | GetTwins (const TopoDS_Shape &theS) const | |||||||||
Getting the History of the algorithm | ||||||||||
Returns the History of the algorithm | ||||||||||
const Handle< BRepTools_History > & | History () const | |||||||||
Clearing the algorithm from previous runs | ||||||||||
Clears the algorithm from previous runs | ||||||||||
void | Clear () | |||||||||
Clears all warnings and errors, and any data cached by the algorithm. User defined options are not cleared. | ||||||||||
![]() | ||||||||||
BOPAlgo_Options () | ||||||||||
Empty constructor. | ||||||||||
BOPAlgo_Options (const Handle< NCollection_BaseAllocator > &theAllocator) | ||||||||||
Constructor with allocator. | ||||||||||
virtual | ~BOPAlgo_Options () | |||||||||
Destructor. | ||||||||||
const Handle< NCollection_BaseAllocator > & | Allocator () const | |||||||||
Returns allocator. | ||||||||||
void | AddError (const Handle< Message_Alert > &theAlert) | |||||||||
Adds the alert as error (fail) | ||||||||||
void | AddWarning (const Handle< Message_Alert > &theAlert) | |||||||||
Adds the alert as warning. | ||||||||||
Standard_Boolean | HasErrors () const | |||||||||
Returns true if algorithm has failed. | ||||||||||
Standard_Boolean | HasError (const Handle< Standard_Type > &theType) const | |||||||||
Returns true if algorithm has generated error of specified type. | ||||||||||
Standard_Boolean | HasWarnings () const | |||||||||
Returns true if algorithm has generated some warning alerts. | ||||||||||
Standard_Boolean | HasWarning (const Handle< Standard_Type > &theType) const | |||||||||
Returns true if algorithm has generated warning of specified type. | ||||||||||
const Handle< Message_Report > & | GetReport () const | |||||||||
Returns report collecting all errors and warnings. | ||||||||||
void | DumpErrors (Standard_OStream &theOS) const | |||||||||
Dumps the error status into the given stream. | ||||||||||
void | DumpWarnings (Standard_OStream &theOS) const | |||||||||
Dumps the warning statuses into the given stream. | ||||||||||
void | ClearWarnings () | |||||||||
Clears the warnings of the algorithm. | ||||||||||
void | SetFuzzyValue (const Standard_Real theFuzz) | |||||||||
Sets the additional tolerance. | ||||||||||
Standard_Real | FuzzyValue () const | |||||||||
Returns the additional tolerance. | ||||||||||
void | SetUseOBB (const Standard_Boolean theUseOBB) | |||||||||
Enables/Disables the usage of OBB. | ||||||||||
Standard_Boolean | UseOBB () const | |||||||||
Returns the flag defining usage of OBB. | ||||||||||
void | SetRunParallel (const Standard_Boolean theFlag) | |||||||||
Set the flag of parallel processing if <theFlag> is true the parallel processing is switched on if <theFlag> is false the parallel processing is switched off. | ||||||||||
Standard_Boolean | RunParallel () const | |||||||||
Returns the flag of parallel processing. | ||||||||||
Static Public Member Functions | |
Conversion of the integer to ID of periodic direction | |
Converts the integer to ID of periodic direction | |
static Standard_Integer | ToDirectionID (const Standard_Integer theDirectionID) |
static Standard_Boolean | GetParallelMode () |
Gets the global parallel mode. | |
static void | SetParallelMode (const Standard_Boolean theNewMode) |
Sets the global parallel mode. | |
Protected Member Functions | |
Protected methods performing the operation | |
Checks the validity of input data | |
void | CheckData () |
Trims the shape to fit to the periodic bounds. | |
void | Trim () |
Trims the shape to fit to the periodic bounds. | |
void | MakeIdentical () |
Makes the shape identical on opposite sides. | |
void | SplitNegative () |
Splits the negative side of the shape with the geometry located on the positive side copying the geometry from positive side to the negative. | |
void | SplitPositive () |
Splits the positive side of the shape with the geometry located on the negative side of the shape. Ensures that the geometries on the opposite sides will be identical. Associates the identical opposite sub-shapes. | |
void | SplitShape (const TopTools_ListOfShape &theTools, Handle< BRepTools_History > theSplitShapeHistory=NULL, Handle< BRepTools_History > theSplitToolsHistory=NULL) |
Splits the shape by the given tools, copying the geometry of coinciding parts from the given tools to the split shape. | |
void | UpdateTwins (const BRepTools_History &theTranslationHistory, const BRepTools_History &theGluingHistory) |
Updates the map of twins after periodic shape repetition. | |
Standard_Boolean | UserBreak (const Message_ProgressScope &thePS) |
Adds error to the report if the break signal was caught. Returns true in this case, false otherwise. | |
Protected Attributes | |
Fields | |
TopoDS_Shape | myInputShape |
Input shape to make periodic. | |
PeriodicityParams | myPeriodicityParams |
Periodicity parameters. | |
TopoDS_Shape | myShape |
Resulting periodic shape (base for repetitions) | |
TopoDS_Shape | myRepeatedShape |
Resulting shape after making repetitions of the base. | |
Standard_Real | myRepeatPeriod [3] |
XYZ repeat period. | |
TopTools_DataMapOfShapeListOfShape | myRepeatedTwins |
Map of associations of the identical sub-shapes after repetition of the periodic shape. | |
TopTools_DataMapOfShapeListOfShape | myTwins |
Map of associations of the identical sub-shapes located on the opposite sides of the shape. | |
Handle< BRepTools_History > | mySplitHistory |
Split history - history of shapes modification after the split for making the shape periodic. | |
Handle< BRepTools_History > | myHistory |
Final history of shapes modifications (to include the history of shape repetition) | |
Handle< NCollection_BaseAllocator > | myAllocator |
Enables/Disables the usage of OBB. | |
Handle< Message_Report > | myReport |
Enables/Disables the usage of OBB. | |
Standard_Boolean | myRunParallel |
Enables/Disables the usage of OBB. | |
Standard_Real | myFuzzyValue |
Enables/Disables the usage of OBB. | |
Standard_Boolean | myUseOBB |
Enables/Disables the usage of OBB. | |
BOPAlgo_MakePeriodic is the tool for making an arbitrary shape periodic in 3D space in specified directions.
Periodicity of the shape means that the shape can be repeated in any periodic direction any number of times without creation of the new geometry or splits.
The idea is to make the shape look identical on the opposite sides of the periodic directions, so when translating the copy of a shape on the period there will be no coinciding parts of different dimensions.
If necessary the algorithm will trim the shape to fit it into the requested period by splitting it by the planes limiting the shape's requested period.
For making the shape periodic in certain direction the algorithm performs the following steps:
The algorithm also associates the identical (or twin) shapes located on the opposite sides of the result shape. Using the GetTwins() method it is possible to get the twin shapes from the opposite sides.
Algorithm also provides the methods to repeat the periodic shape in periodic directions. The subsequent repetitions are performed on the repeated shape, thus repeating the shape two times in X direction will create result in three shapes (original plus two copies). Single subsequent repetition will result already in 6 shapes. The repetitions can be cleared and started over.
The algorithm supports History of shapes modifications, thus it is possible to track how the shape has been changed to make it periodic and what new shapes have been created during repetitions.
The algorithm supports the parallel processing mode, which allows faster completion of the operations.
The algorithm supports the Error/Warning system and returns the following alerts:
Example of usage of the algorithm:
|
inline |
|
protected |
Trims the shape to fit to the periodic bounds.
|
inlinevirtual |
Clears all warnings and errors, and any data cached by the algorithm. User defined options are not cleared.
Reimplemented from BOPAlgo_Options.
|
inline |
Clears all performed repetitions. The next repetition will be performed on the base shape.
|
inline |
|
inline |
|
inline |
Returns whether the input shape was trimmed in the specified direction.
[in] | theDirectionID | The direction's ID. |
|
inline |
Returns whether the input shape was already trimmed for X period.
|
inline |
Returns whether the input shape was already trimmed for Y period.
|
inline |
Returns whether the input shape was already trimmed for Z period.
|
inline |
Returns the info about Periodicity of the shape in specified direction.
[in] | theDirectionID | The direction's ID. |
|
inline |
Returns the info about periodicity of the shape in X direction.
|
inline |
Returns the info about periodicity of the shape in Y direction.
|
inline |
Returns the info about periodicity of the shape in Z direction.
|
protected |
Makes the shape identical on opposite sides.
|
inline |
Returns the info about Periodicity of the shape in specified direction.
[in] | theDirectionID | The direction's ID. |
|
inline |
Returns the info about periodicity of the shape in X direction.
|
inline |
Sets the flag to make the shape periodic in Y direction.
[in] | theIsPeriodic | Flag defining periodicity in Y direction; |
[in] | thePeriod | Required period in Y direction. |
|
inline |
Sets the flag to make the shape periodic in Z direction.
[in] | theIsPeriodic | Flag defining periodicity in Z direction; |
[in] | thePeriod | Required period in Z direction. |
void BOPAlgo_MakePeriodic::Perform | ( | ) |
|
inline |
Returns the Period of the shape in specified direction.
[in] | theDirectionID | The direction's ID. |
|
inline |
Returns the first periodic parameter in the specified direction.
[in] | theDirectionID | The direction's ID. |
|
inline |
|
inline |
Clears all performed repetitions. The next repetition will be performed on the base shape.
const TopoDS_Shape & BOPAlgo_MakePeriodic::RepeatShape | ( | const Standard_Integer | theDirectionID, |
const Standard_Integer | theTimes ) |
Repeats the shape in X direction specified number of times. Negative value of times means that the repetition should be perform in negative X direction. Makes the repeated shape a base for following repetitions.
[in] | theTimes | Requested number of repetitions. |
|
inline |
|
inline |
|
inline |
Returns whether the input shape was trimmed in the specified direction.
[in] | theDirectionID | The direction's ID. |
|
inline |
Returns whether the input shape was already trimmed for X period.
|
inline |
Defines whether the input shape is already trimmed in Y direction to fit the Y period. If the shape is not trimmed it is required to set the first parameter for the Y period. The algorithm will make the shape fit into the period.
Before calling this method, the shape has to be set to be periodic in this direction.
[in] | theIsTrimmed | Flag defining whether the shape is already trimmed in Y direction to fit the Y period; |
[in] | theFirst | The first Y periodic parameter. |
|
inline |
Defines whether the input shape is already trimmed in Z direction to fit the Z period. If the shape is not trimmed it is required to set the first parameter for the Z period. The algorithm will make the shape fit into the period.
Before calling this method, the shape has to be set to be periodic in this direction.
[in] | theIsTrimmed | Flag defining whether the shape is already trimmed in Z direction to fit the Z period; |
[in] | theFirst | The first Z periodic parameter. |
|
inline |
|
protected |
Splits the negative side of the shape with the geometry located on the positive side copying the geometry from positive side to the negative.
|
protected |
Splits the positive side of the shape with the geometry located on the negative side of the shape. Ensures that the geometries on the opposite sides will be identical. Associates the identical opposite sub-shapes.
|
protected |
Splits the shape by the given tools, copying the geometry of coinciding parts from the given tools to the split shape.
[in] | theTools | The tools to split the shape and take the geometry for coinciding parts. |
[out] | theSplitShapeHistory | The history of shape split |
[out] | theSplitToolsHistory | The history of tools modifications during the split |
|
inlinestatic |
|
protected |
Trims the shape to fit to the periodic bounds.
|
protected |
Updates the map of twins after periodic shape repetition.
[in] | theTranslationHistory | The history of translation of the periodic shape. |
[in] | theGluingHistory | The history of gluing of the repeated shapes. |
|
inline |
Returns the XPeriod of the shape.
|
inline |
Returns the first parameter for the X period.
|
inline |
Repeats the shape in X direction specified number of times. Negative value of times means that the repetition should be perform in negative X direction. Makes the repeated shape a base for following repetitions.
[in] | theTimes | Requested number of repetitions. |
|
inline |
Returns the YPeriod of the shape.
|
inline |
Returns the first parameter for the Y period.
|
inline |
Repeats the shape in Y direction specified number of times. Negative value of times means that the repetition should be perform in negative Y direction. Makes the repeated shape a base for following repetitions.
[in] | theTimes | Requested number of repetitions. |
|
inline |
Returns the ZPeriod of the shape.
|
inline |
Returns the first parameter for the Z period.
|
inline |
Repeats the shape in Z direction specified number of times. Negative value of times means that the repetition should be perform in negative Z direction. Makes the repeated shape a base for following repetitions.
[in] | theTimes | Requested number of repetitions. |
|
protected |
Final history of shapes modifications (to include the history of shape repetition)
|
protected |
Input shape to make periodic.
|
protected |
Periodicity parameters.
|
protected |
Resulting shape after making repetitions of the base.
|
protected |
Map of associations of the identical sub-shapes after repetition of the periodic shape.
|
protected |
XYZ repeat period.
|
protected |
Resulting periodic shape (base for repetitions)
|
protected |
Split history - history of shapes modification after the split for making the shape periodic.
|
protected |
Map of associations of the identical sub-shapes located on the opposite sides of the shape.