Hide menu
cadex::ModelPrs_Measurement Class Reference

Stores the source data and result of the measurement. Objects of this class can be created using ModelPrs_MeasurementFactory. More...

Inheritance diagram for cadex::ModelPrs_Measurement:
cadex::Base_PublicObject

Public Types

typedef cadex::internal::ModelPrs_MeasurementImpl ImplType
 

Public Member Functions

 ModelPrs_Measurement ()
 Constuctor. More...
 
ModelPrs_MeasurementType Type () const
 Returns a type of measurement.
 
double Value () const
 Returns a measurement result in current units. More...
 
Base_LengthUnit LengthUnit () const
 Returns length unit of measurement. The default value is Base_LU_Millimeters.
 
void SetLengthUnit (Base_LengthUnit theLengthUnit)
 Sets length unit. More...
 
Base_AngleUnit AngleUnit () const
 Returns angle unit of measurement. The default value is Base_AU_Radian.
 
void SetAngleUnit (Base_AngleUnit theAngleUnit)
 Sets angle unit. More...
 
double Size () const
 Returns size of measurement in millimeters. The default value is 1.
 
void SetSize (double theSize)
 Sets size of measurement in millimeters. More...
 
double SizeOfFlyOut () const
 Returns value in millimeters describing how far the measurement annotation is shifted away from its sources. The default value is 0. More...
 
void SetSizeOfFlyOut (double theSizeOfFlyOut)
 Sets size of fly out in millimeters.
 
- Public Member Functions inherited from cadex::Base_PublicObject
 Base_PublicObject ()
 Constructor. More...
 
void Nullify ()
 Resets reference to implementation object.
 
bool IsNull () const
 Returns true if the object is nullified. More...
 
 operator bool () const
 Casts the object to the bool type. More...
 
internal::Base_HandledObject * Impl () const
 Return a handle to backend (reserved for internal use).
 
const internal::Base_Handle & HImpl () const
 
template<typename T >
T * Impl () const
 Reserved for internal use.
 
bool operator== (const Base_PublicObject &theObject) const
 
bool operator!= (const Base_PublicObject &theObject) const
 

Additional Inherited Members

- Protected Member Functions inherited from cadex::Base_PublicObject
 Base_PublicObject (const internal::Base_HandledObject *theObject)
 Constructor (reserved for internal use).
 
template<typename T >
T * GetOrCreateImpl ()
 Reserved for internal use.
 

Detailed Description

Stores the source data and result of the measurement. Objects of this class can be created using ModelPrs_MeasurementFactory.

Warning
This class is a part of Visualization Toolkit add-on, which is licensed separately from the base CAD Exchanger SDK.

To display the measurement you need to create scene node from it using ModelPrs_SceneNodeFactory and add that to the scene. There are a few settings to change the look of a measurement. When these settings are changed after the measurement has already been displayed, it's necessary to either call ModelPrs_SceneNode::Invalidate or re-create a scene node for that measurement.

For instance, the following example demonstrates how to create measurement, display it, change its size and update the display:

ModelPrs_MeasurementFactory aMeasurementFactory;
auto aRadiusMeasurement = aMeasurementFactory.CreateMajorRadius (...);
ModelPrs_SceneNodeFactory aSceneNodeFactory;
auto aSceneNode = aSceneNodeFactory.Create (aRadiusMeasurement);
aScene.AddRoot (aSceneNode);
aScene.Update();
aScene.Wait();
// Change settings and update displayed object.
aRadiusMeasurement.SetSize (10);
aSceneNode.Invalidate();
aScene.Update();
aScene.Wait();
// Change settings and update displayed object. Alternative way.
aRadiusMeasurement.SetSize (20);
aScene.RemoveRoot (aSceneNode);
aSceneNode = aSceneNodeFactory.Create (aRadiusMeasurement);
aScene.AddRoot (aSceneNode);
aScene.Update();
aScene.Wait();

Constructor & Destructor Documentation

◆ ModelPrs_Measurement()

cadex::ModelPrs_Measurement::ModelPrs_Measurement ( )

Constuctor.

Creates null object.

See also
IsNull()

Member Function Documentation

◆ SetAngleUnit()

void cadex::ModelPrs_Measurement::SetAngleUnit ( Base_AngleUnit  theAngleUnit)

Sets angle unit.

Has meaning for the following types of measurement:

  • ModelPrs_MT_AngleBetweenPlanes
  • ModelPrs_MT_AngleBetweenVertexes

◆ SetLengthUnit()

void cadex::ModelPrs_Measurement::SetLengthUnit ( Base_LengthUnit  theLengthUnit)

Sets length unit.

Has meaning for the following types of measurement:

  • ModelPrs_MT_Distance
  • ModelPrs_MT_Radius
  • ModelPrs_MT_Diameter

◆ SetSize()

void cadex::ModelPrs_Measurement::SetSize ( double  theSize)

Sets size of measurement in millimeters.

Changes size of the following elements:

  • text with extension,
  • arrow with tail.

◆ SizeOfFlyOut()

double cadex::ModelPrs_Measurement::SizeOfFlyOut ( ) const

Returns value in millimeters describing how far the measurement annotation is shifted away from its sources. The default value is 0.

The following examples demonstrate a difference between 0 and 20 values of fly out:

Size of fly out is 0
Size of fly out is 20

◆ Value()

double cadex::ModelPrs_Measurement::Value ( ) const

Returns a measurement result in current units.

Only one kind of units has an effect on returned value. ModelPrs_Measurement::AngleUnit for angle measurements and ModelPrs_Measurement::LengthUnit for the rest. For instance, the following example demonstrates how to create measurement and change the unit:

ModelPrs_MeasurementFactory aMeasurementFactory;
auto aMeasurement = aMeasurementFactory.CreateDistance (..., ...);
auto aValueMM = aMeasurement.Value(); // 50.0
aMeasurement.SetLengthUnit (Base_LU_Centimeters);
auto aValueCM = aMeasurement.Value(); // 5.0
aMeasurement.SetAngleUnit (Base_AU_Degree); // has no effect