Hide menu
Loading...
Searching...
No Matches
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...

#include <cadex/ModelPrs_Measurement.hxx>

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

Public Types

typedef cadex::internal::ModelPrs_MeasurementImpl ImplType
 

Public Member Functions

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

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();
Creates measurement objects that store the sources and result of a measurement.
Definition: ModelPrs_MeasurementFactory.hxx:39
ModelPrs_Measurement CreateMajorRadius(const ModelData_Shape &theShape)
Creates a radius measurement of an edge or a face that might have such.
Definition: ModelPrs_MeasurementFactory.cxx:167
Creates a scene nodes and its children from input data model objects.
Definition: ModelPrs_SceneNodeFactory.hxx:53

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
ModelPrs_Measurement CreateDistance(const ModelData_Shape &theFirstShape, const ModelData_Shape &theSecondShape)
Creates minimum distance measurement between any two shapes.
Definition: ModelPrs_MeasurementFactory.cxx:132
double Value() const
Returns a measurement result in current units.
Definition: ModelPrs_Measurement.cxx:153