C3D Toolkit  Kernel - 117982, Vision - 2.9.2.2

Thread. More...

#include <mb_thread.h>

+ Inheritance diagram for MbThread:
+ Collaboration diagram for MbThread:

Public Member Functions

 MbThread (const MbPlacement3D &place, double rObj, double rThr, double len, double ang)
 Constructor. More...
 
 MbThread (const MbPlacement3D &place, double rObj, double rThr, double begPos, double endPos, double ang)
 Constructor. More...
 
virtual ~MbThread ()
 Destructor.
 
Common functions of a geometric object.
MbeSpaceType IsA () const override
 Get the type of the object.
 
MbeSpaceType Type () const override
 Get the group object type.
 
MbSpaceItemDuplicate (MbRegDuplicate *=nullptr) const override
 Create a copy of the object. More...
 
bool IsSame (const MbSpaceItem &, double accuracy=LENGTH_EPSILON) const override
 Determine whether an object is equal. More...
 
bool IsSimilar (const MbSpaceItem &) const override
 Determine whether an object is similar. More...
 
bool SetEqual (const MbSpaceItem &) override
 Make objects equal if they are similar. More...
 
void Transform (const MbMatrix3D &, MbRegTransform *=nullptr) override
 Convert the object according to the matrix. More...
 
void Move (const MbVector3D &, MbRegTransform *=nullptr) override
 Move an object along a vector. More...
 
void Rotate (const MbAxis3D &, double, MbRegTransform *=nullptr) override
 Rotate an object around an axis at a given angle. More...
 
double DistanceToPoint (const MbCartPoint3D &) const override
 Determine the distance to the point. More...
 
void AddYourGabaritTo (MbCube &) const override
 Expand sent bounding box (a.k.a. gabarit), so that it included the object. More...
 
void Refresh () override
 Translate all the time (mutable) data objects in an inconsistent (initial) state.
 
void CalculateMesh (const MbStepData &stepData, const MbFormNote &note, MbMesh &mesh) const override
 Build polygonal copy mesh. More...
 
MbPropertyCreateProperty (MbePrompt) const override
 Create your own property with the name.
 
void GetProperties (MbProperties &) override
 Outstanding properties of the object. More...
 
void SetProperties (const MbProperties &) override
 Change the properties of an object. More...
 
void GetBasisPoints (MbControlData3D &) const override
 Get control points of object.
 
void SetBasisPoints (const MbControlData3D &) override
 Change the object by control points.
 
Initialization functions.
bool SetThreadParams (const MbPlacement3D &place, double radObj, double radThr, double len, double ang)
 Initialization. More...
 
bool SetThreadParams (const MbPlacement3D &place, double diamObj, double depth, bool bOutThr, double len, double ang)
 Initialization. More...
 
Functions for working with names.
void SetName (const MbName &n)
 Set name. More...
 
MbNameGetName () const
 Get name. More...
 
bool IsName () const
 Is there a name. More...
 
Functions for operating with threaded solids.
template<class ConstLumps >
void AddBodies (const ConstLumps &initBodies)
 Add solids. More...
 
bool IsBody (const MbLump *) const
 Find solid. More...
 
size_t GetBodiesCount () const
 Count of solids.
 
template<class ConstLumps >
void GetBodies (ConstLumps &lumps) const
 Get solids. More...
 
void DetachWrongBodies ()
 Detach solids unsuitable for this thread. More...
 
void DetachBodies ()
 Detach threaded solids.
 
Functions for access to data. Information about thread.
bool IsValid () const
 Check if parameters are correct. More...
 
bool IsConical () const
 Check if thread is conic. More...
 
bool IsOutside () const
 Check if thread is external. More...
 
bool IsLeft () const
 Check if thread is left. More...
 
const MbPlacement3DGetPlacement () const
 Get thread coordinate system in world coordinate system.
 
double GetObjBegRadius () const
 Get initial thread radius on surface.
 
double GetObjEndRadius () const
 Get final thread radius on surface.
 
double GetThrBegRadius () const
 Get initial thread radius in solid.
 
double GetThrEndRadius () const
 Get final thread radius in solid.
 
double GetLength () const
 Get thread length.
 
double GetAngle () const
 Get conicity angle of thread surface.
 
MbeThrState GetState () const
 Get thread state.
 
double GetDepth () const
 Depth of threading.
 
void GetBegAxisPoint (MbCartPoint3D &) const
 Get start point of thread on axis.
 
void GetEndAxisPoint (MbCartPoint3D &) const
 Get start point of thread on axis.
 
bool IsMatedTo (const MbThread &otherThread) const
 Check if threads are mating. More...
 
bool IsMatedTo (const MbThread &otherThread, const MbThreadedJointCheckParameters &checkParams, ThreadedJointErrors *thrJointErrors=nullptr) const
 Check if threads are mating. More...
 
bool IsFaceThread (const MbFace *, const MbMatrix3D &) const
 Check if thread belongs to face.
 
bool IsBodyThread (const MbSolid &solid, const MbMatrix3D &matrix, c3d::IndicesVector *simObjNumbers=nullptr, c3d::IndicesVector *intObjNumbers=nullptr) const
 Check if thread belongs to solid.
More...
 
bool IsBodyThread (const MbLump &lump) const
 Check if thread belongs to solid.
More...
 
bool AdaptToBody (const MbSolid &solid, const MbMatrix3D &matrix, MbeThrAdapt thrAdapt, const ThreadLimiters *limiters=nullptr)
 Fit start and end of thread to solid.
More...
 
bool GetLimitPositions (const MbThread &thread, double &begPos, double &endPos) const
 Get limit positions of the modified thread in regard to an initial thread.
More...
 
template<class SolidsVector , class MatricesVector , class IndicesVector >
bool FindThreadBodies (const SolidsVector &solids, const MatricesVector &matrices, IndicesVector &solidsNumbers) const
 Find solids thread belongs to.
More...
 
const MbCubeCalculateGabarit () const
 Calculate bounding box of thread.
 
void CalculateLocalGabarit (const MbMatrix3D &mIntoLocal, MbCube &cubeLocal) const override
 Calculate bounding box of thread. More...
 
void Init (const MbThread &)
 
- Public Member Functions inherited from MbLegend
virtual ~MbLegend ()
 Destructor.
 
MbeSpaceType Family () const override
 Get family of objects.
 
- Public Member Functions inherited from MbSpaceItem
virtual ~MbSpaceItem ()
 Destructor.
 
void PrepareWrite () const
 Register object. More...
 
MbeRefType RefType () const override
 Get a registration type (for copying, duplication).
 
bool IsFamilyRegistrable () const override
 Whether the object belongs to a registrable family.
 
void CalculateWire (const MbStepData &stepData, MbMesh &mesh) const
 
void CalculateWire (double sag, MbMesh &mesh) const
 
virtual void GetBasisItems (RPArray< MbSpaceItem > &)
 Outstanding reference objects in a container sent.
 
- Public Member Functions inherited from TapeBase
 TapeBase (RegistrableRec regs=noRegistrable)
 Constructor.
 
 TapeBase (const TapeBase &)
 Copy-constructor.
 
virtual ~TapeBase ()
 Destructor.
 
RegistrableRec GetRegistrable () const
 Whether the stream class is registrable.
 
void SetRegistrable (RegistrableRec regs=registrable) const
 Set the state of registration of the stream class.
 
virtual const char * GetPureName (const VersionContainer &) const
 Get the class name.
 
- Public Member Functions inherited from MbRefItem
refcount_t GetUseCount () const
 Get count of references (get count of owners of an object).
 
refcount_t AddRef () const
 Increase count of references by one.
 
refcount_t DecRef () const
 Decrease count of references by one.
 
refcount_t Release () const
 Decrease count of references by one and if count of references became zero, then remove itself.
 

Protected Attributes

MbPlacement3D place
 A thread coordinate system (in the world coordinate system).
 
double radObj
 Initial thread radius on surface.
 
double radThr
 Initial thread radius in solid.
 
double length
 Thread length.
 
double angle
 Conicity angle of thread surface.
 

Additional Inherited Members

- Protected Member Functions inherited from MbLegend
 MbLegend ()
 Constructor.
 
- Protected Member Functions inherited from MbSpaceItem
 MbSpaceItem ()
 Default constructor.
 
- Protected Member Functions inherited from MbRefItem
 MbRefItem ()
 Constructor without parameters.
 

Detailed Description

Thread.

Thread of holes and shafts.

Constructor & Destructor Documentation

◆ MbThread() [1/2]

MbThread::MbThread ( const MbPlacement3D place,
double  rObj,
double  rThr,
double  len,
double  ang 
)

Constructor.

Constructor.

Parameters
[in]place- Coordinate system.
[in]rObj- Initial thread radius on surface.
[in]rThr- Initial thread radius in solid.
[in]len- Thread length.
[in]ang- Conicity angle of thread surface.

◆ MbThread() [2/2]

MbThread::MbThread ( const MbPlacement3D place,
double  rObj,
double  rThr,
double  begPos,
double  endPos,
double  ang 
)

Constructor.

Constructor.

Parameters
[in]place- Coordinate system.
[in]rObj- Initial thread radius on surface.
[in]rThr- Initial thread radius in solid.
[in]begPos- Thread start position along the Z axis of the coordinate system.
[in]begPos- Thread end position along the Z axis of the coordinate system.
[in]ang- Conicity angle of thread surface.

Member Function Documentation

◆ Duplicate()

MbSpaceItem& MbThread::Duplicate ( MbRegDuplicate iReg = nullptr) const
overridevirtual

Create a copy of the object.

Create a copy of an object using the registrator. Registrator is used to prevent multiple copy of the object. If the object contains references to the other objects, then nested objects are copied as well. It is allowed not to pass registrator into the function. Then new copy of object will be created. While copying of single object or set of not connected objects, it is allowed not to use registrator. Registrator should be used if it is required to copy several connected objects. It is possible, that objects connection is based on the references to common objects. Then, while copying without using of registrator, it is possible to obtain set of copies, that contain references to the different copies of the same nested object, that leads to loss of connection between copies.

Parameters
[in]iReg- Registrator.
Returns
A copy of the object.

Implements MbSpaceItem.

◆ IsSame()

bool MbThread::IsSame ( const MbSpaceItem other,
double  accuracy = LENGTH_EPSILON 
) const
overridevirtual

Determine whether an object is equal.

Still considered objects of the same type, all data is the same (equal).

Parameters
[in]item- The object to compare.
[in]accuracy- The accuracy to compare.
Returns
Whether the objects are equal.

Implements MbSpaceItem.

◆ IsSimilar()

bool MbThread::IsSimilar ( const MbSpaceItem item) const
overridevirtual

Determine whether an object is similar.

Such are considered the same objects whose data are similar.

Parameters
[in]item- The object to compare.
Returns
Whether the objects are similar.

Reimplemented from MbSpaceItem.

◆ SetEqual()

bool MbThread::SetEqual ( const MbSpaceItem item)
overridevirtual

Make objects equal if they are similar.

You can still make only a similar objects.

Parameters
[in]item- The object to initialize.
Returns
Object is changed.

Implements MbSpaceItem.

◆ Transform()

void MbThread::Transform ( const MbMatrix3D matr,
MbRegTransform iReg = nullptr 
)
overridevirtual

Convert the object according to the matrix.

Convert the original object according to the matrix using the registrator. If object contains references to the other geometric objects, then nested objects are transformed according to the matrix. Registrator is needed to prevent multiple object copying. It is allowed to use function without registrator, if it is needed to transform single object. If it is needed to transform a set of connected objects, then one should use registrator to prevent repeating transformation of nested objects, because of the possible situation when several objects contain references to the same common objects, that require to be transformed.

Parameters
[in]matr- Transformation matrix.
[in]iReg- Registrator.

Implements MbSpaceItem.

◆ Move()

void MbThread::Move ( const MbVector3D to,
MbRegTransform iReg = nullptr 
)
overridevirtual

Move an object along a vector.

Move an object along a geometric vector using the registrator. If object contains references to the other geometric objects then the move operation is applied to the nested objects. Registrator is needed to prevent multiple copying of the object. It is allowed to use function without registrator, if it is needed to transform a single object. If it is needed to transform a set of connected objects, then one should use registrator to prevent repeating transformation of nested objects, because of the possible situation when several objects contain references to the same common objects, that require to be moved.

Parameters
[in]to- Shift vector.
[in]iReg- Registrator.

Implements MbSpaceItem.

◆ Rotate()

void MbThread::Rotate ( const MbAxis3D axis,
double  angle,
MbRegTransform iReg = nullptr 
)
overridevirtual

Rotate an object around an axis at a given angle.

Rotate an object around an axis at a given angle with the registrator. If object contains references to the other geometric objects then the rotation operation is applied to the nested objects. Registrator is needed to prevent multiple copying of the object. It is allowed to use function without registrator, if it is needed to transform a single object. If it is needed to transform a set of connected objects, then one should use registrator to prevent repeating transformation of nested objects, because of the possible situation when several objects contain references to the same common objects, that require to be rotated.

Parameters
[in]axis- The axis of rotation.
[in]angle- Rotation.
[in]iReg- Registrator.

Implements MbSpaceItem.

◆ DistanceToPoint()

double MbThread::DistanceToPoint ( const MbCartPoint3D point) const
overridevirtual

Determine the distance to the point.

Determine the distance to the point.

Parameters
[in]point- Point.
Returns
Distance to point

Implements MbSpaceItem.

◆ AddYourGabaritTo()

void MbThread::AddYourGabaritTo ( MbCube cube) const
overridevirtual

Expand sent bounding box (a.k.a. gabarit), so that it included the object.

Expand sent bounding box, so that it included the object.

Parameters
[in,out]cube- The bounding box to expand.

Implements MbSpaceItem.

◆ CalculateMesh()

void MbThread::CalculateMesh ( const MbStepData stepData,
const MbFormNote note,
MbMesh mesh 
) const
overridevirtual

Build polygonal copy mesh.

Build a polygonal copy of the object that is represented by polygons or/and fasets.

Parameters
[in]stepData- Data for еру step calculation for polygonal object.
[in]note- Way for polygonal object constructing.
[in,out]mesh- The builded polygonal object.

Implements MbSpaceItem.

◆ GetProperties()

void MbThread::GetProperties ( MbProperties properties)
overridevirtual

Outstanding properties of the object.

Issue internal data (properties) of the object for viewing and modification.

Parameters
[in]properties- Container for the internal data of the object.

Implements MbSpaceItem.

◆ SetProperties()

void MbThread::SetProperties ( const MbProperties properties)
overridevirtual

Change the properties of an object.

Changing the internal data (properties) of the object you are copying the corresponding values from the sent object.

Parameters
[in]properties- Container for the internal data of the object.

Implements MbSpaceItem.

◆ SetThreadParams() [1/2]

bool MbThread::SetThreadParams ( const MbPlacement3D place,
double  radObj,
double  radThr,
double  len,
double  ang 
)

Initialization.

Initialization.

Parameters
[in]place- Coordinate system.
[in]radObj- Initial thread radius (on surface).
[in]radThr- Final thread radius.
[in]len- Thread length.
[in]ang- Angle.

◆ SetThreadParams() [2/2]

bool MbThread::SetThreadParams ( const MbPlacement3D place,
double  diamObj,
double  depth,
bool  bOutThr,
double  len,
double  ang 
)

Initialization.

Initialization.

Parameters
[in]place- Coordinate system.
[in]diamObj- Initial diameter.
[in]depth- Depth of threading
[in]bOutThr- External thread attribute.
if true then thread is external,
If false then thread is internal.
[in]len- Thread length.
[in]ang- Angle.

◆ SetName()

void MbThread::SetName ( const MbName n)
inline

Set name.

Set thread name.

Parameters
[in]n- New name.

◆ GetName()

MbName* MbThread::GetName ( ) const
inline

Get name.

Get thread name.

Returns
Pointer to name.

◆ IsName()

bool MbThread::IsName ( ) const
inline

Is there a name.

Is there a name of a thread.

Returns
True if there is name and it is not empty.

◆ AddBodies()

template<class ConstLumps >
void MbThread::AddBodies ( const ConstLumps &  initBodies)
inline

Add solids.

Add threaded solids.
Null pointers from specified array are not added, duplicate objects also not added.

Parameters
[in]lumps- Set of solids.

◆ IsBody()

bool MbThread::IsBody ( const MbLump ) const

Find solid.

Find solid in array.

Returns
Solid index.
SYS_MAX_T, if solid isn't found.

◆ GetBodies()

template<class ConstLumps >
void MbThread::GetBodies ( ConstLumps &  lumps) const
inline

Get solids.

Get array of solids.

Parameters
[out]lumps- Set of solids as result.

◆ DetachWrongBodies()

void MbThread::DetachWrongBodies ( )

Detach solids unsuitable for this thread.

Detach solids unsuitable for this thread.

◆ IsValid()

bool MbThread::IsValid ( ) const

Check if parameters are correct.

Check if thread parameters are correct:

  • thread should not be degenerate,
  • thread coordinate system should be orthonormalized,
  • values of radius and length should be not less than minimal radius of object MIN_RADIUS, not greater than maximal radius of object MAX_RADIUS,
  • radii should be different,
  • angle should not be greater than full turn,
  • thread should not have self-intersections.
    Returns

◆ IsConical()

bool MbThread::IsConical ( ) const

Check if thread is conic.

Check if thread is conic.

Returns
True if value of angle is non-zero.

◆ IsOutside()

bool MbThread::IsOutside ( ) const

Check if thread is external.

Check if thread is external.

Thread is external if initial radius of thread is greater than final one.

Returns
External thread attribute.

◆ IsLeft()

bool MbThread::IsLeft ( ) const
inline

Check if thread is left.

Check if thread is left.

Returns
True if thread coordinate system is left.

◆ IsMatedTo() [1/2]

bool MbThread::IsMatedTo ( const MbThread otherThread) const

Check if threads are mating.

Check if threads are mated (internal with external).
1) Threads must have same angle.
2) One of threads must be internal, other - external.
3) Each object must have correct parameters.
4) Axes of threads must be parallel.

Parameters
[in]otherThread- Second thread.
Returns
True if threads are mating.

◆ IsMatedTo() [2/2]

bool MbThread::IsMatedTo ( const MbThread otherThread,
const MbThreadedJointCheckParameters checkParams,
ThreadedJointErrors *  thrJointErrors = nullptr 
) const

Check if threads are mating.

Check if threads are mated (internal with external).
1) Threads must have same angle.
2) One of threads must be internal, other - external.
3) Each object must have correct parameters.
4) Axes of threads must be parallel.

Parameters
[in]otherThread- Second thread.
[in]checkParams- Threaded joint check parameters.
Returns
True if threads are mating.

◆ IsBodyThread() [1/2]

bool MbThread::IsBodyThread ( const MbSolid solid,
const MbMatrix3D matrix,
c3d::IndicesVector simObjNumbers = nullptr,
c3d::IndicesVector intObjNumbers = nullptr 
) const

Check if thread belongs to solid.

Check if thread belongs to solid.

Parameters
[in]solid- A solid.
[in]matrix- A matrix of transformation to the world coordinate system.
[out]simObjNumbers- Indices of faces thread belongs to.
[out]intObjNumbers- Indices of faces intersecting with thread.
Returns
True if thread belongs to one of solid faces.

◆ IsBodyThread() [2/2]

bool MbThread::IsBodyThread ( const MbLump lump) const

Check if thread belongs to solid.

Check if thread belongs to solid.

Parameters
[in]solid- A solid with a matrix of transformation to the world coordinate system.
Returns
True if thread belongs to one of solid faces.

◆ AdaptToBody()

bool MbThread::AdaptToBody ( const MbSolid solid,
const MbMatrix3D matrix,
MbeThrAdapt  thrAdapt,
const ThreadLimiters *  limiters = nullptr 
)

Fit start and end of thread to solid.

Fit start and end of thread to solid if thread can belong to solid.

Parameters
[in]solid- A solid.
[in]matrix- A matrix of transformation to the world coordinate system.
[in]thrAdapt- Method of thread fitting.
[in]limiters- Beginning and ending thread limiters.
Returns
True if the operation is successful.

◆ GetLimitPositions()

bool MbThread::GetLimitPositions ( const MbThread thread,
double &  begPos,
double &  endPos 
) const

Get limit positions of the modified thread in regard to an initial thread.

Get limit positions of the modified thread in regard to an initial thread. Positions are defined along the Z axis of the initial coordinate system.

Parameters
[in]thread- Initial thread.
[out]begPos- Thread start position.
[out]endPos- Thread end position.
Returns
True if these threads are similar to each other.

◆ FindThreadBodies()

template<class SolidsVector , class MatricesVector , class IndicesVector >
bool MbThread::FindThreadBodies ( const SolidsVector &  solids,
const MatricesVector &  matrices,
IndicesVector &  solidsNumbers 
) const

Find solids thread belongs to.

Find solids thread belongs to.

Parameters
[in]solids- Set of solids.
[in]matrices- Set of matrices of solid transformation to the world coordinate system. Count must be equal to count of solids.
[out]solidsNumbers- Indices of solids thread belongs to.
Returns
True if thread belongs at least to one of solids.

◆ CalculateLocalGabarit()

void MbThread::CalculateLocalGabarit ( const MbMatrix3D mIntoLocal,
MbCube cubeLocal 
) const
overridevirtual

Calculate bounding box of thread.

Calculate bounding box of thread in local coordinate system.

Parameters
[in]mIntoLocal- A local coordinate system.
[out]cubeLocal- Calculated bounding box as result.

Reimplemented from MbLegend.


The documentation for this class was generated from the following file: