Cyclone 3DR Script
from Technodigit, part of Hexagon. Copyright 1997-2022.
 
Loading...
Searching...
No Matches
SLabel Class Reference

The SLabel class provides a labelling feature, to easily track your components on the scene. The SLabel creation can be done by calling the static functions:
. More...

#include <SLabel.h>

Inheritance diagram for SLabel:
SComp SObject

Public Types

enum  SLabelBackgroundType {
  NO_BACKGROUND , SCENE_BACKGROUND_COLOR , SPECIAL_COLOR , TOLERANCE_COLOR ,
  LastBackgroundType
}
 
enum  SLabelCol {
  Reference , Measure , Deviation , TolMin ,
  TolMax , Note , Flushing , EmptyCol ,
  Nominal , BBoxMin , BBoxMax , Size ,
  Centroid , LowestPoint , UppestPoint , Count ,
  UndefinedCol , LastColType
}
 
enum  SLabelLine {
  XX , YY , ZZ , NormalX ,
  NormalY , NormalZ , Radius , Diameter ,
  Angle , Circularity , Cylindricity , Planeity ,
  Distance , AngleX , AngleY , AngleZ ,
  AngleCompX , AngleCompY , AngleCompZ , AngleSuppX ,
  AngleSuppY , AngleSuppZ , AngleC , AngleS ,
  Dev3D , Curv , EmptyLine , Length ,
  Width , Linearity , Sphericity , DistanceXY ,
  DistanceYZ , DistanceXZ , DistanceX , DistanceY ,
  DistanceZ , Volume , Intensity , VolumeOver ,
  VolumeUnder , Perpendicularity , Parallelism , Level ,
  Surface , NbPoints , NbTriangles , NbPieces ,
  NbFreeCont , UndefinedLine , Flatness , LastLineType
}
 
enum  SLabelType {
  LONG , MEDIUM , SMALL , MINIMUM ,
  LastLabelType
}
 
- Public Types inherited from SComp
enum  RepresentationTypeEnum {
  SMOOTH , FLAT , WIRE , SMOOTH_WIRE ,
  FLAT_WIRE , SMOOTH_ROTWIRE , FLAT_ROTWIRE , TEXTURE ,
  INSPECTION
}
 The different representation types for inherited classes.
Use (inherited class).SMOOTH. Example: for a cloud, use SCloud.SMOOTH. More...
 

Public Slots

 AddSComp (Array< SComp > tblSComp)
 To add some SComp to the label.
The label and the SComp will be one entity. More...
 
static Array All (Number VisCrit)
 To get all the SComp in the document. More...
 
 AttachToPoint (SPoint iAttachedPoint)
 To attach the label to a 3D point in the scene. More...
 
static Array FromClick ()
 Launches a click interaction to select a SComp in the scene. More...
 
static Array FromName (String Name)
 Search all the component with the given name. More...
 
static Array FromSel ()
 To get all the selected SComp. More...
 
Array GetCell (Number IdxLin, Number IdxCol)
 To get the content of a cell. More...
 
Array GetCol (Number IdxCol)
 To get the content of all the column IdxCol. More...
 
Array GetColByType (SLabelCol ColType)
 To get the content of all the column by his type. More...
 
String GetComment ()
 
Array GetLine (Number IdxLin)
 To get the content of all the line IdxLin. More...
 
Array GetLineByType (SLabelLine LineType)
 To get the content of all the Line by his type. More...
 
static SLabel New (Number NbLin, Number NbCol)
 Default constructor to create an empty new SLabel. More...
 
static SLabel New (SLabel iOther)
 Constructs an SLabel by copying the SLabel _iOther. More...
 
static SetBackgroundColor (Number Red, Number Green, Number Blue, Number Transparency)
 To define backGround color. More...
 
static SetBackgroundType (SLabelBackgroundType BackgroundType)
 To define background type
. More...
 
Array SetCell (Number IdxLin, Number IdxCol, Number Value)
 To set the content of a cell. More...
 
Array SetCol (Number IdxCol, Array< Number > ValueTbl)
 To set the content of all the column IdxCol. More...
 
Array SetColType (Array< SLabelCol > ColType)
 To set the type for all columns. More...
 
 SetComment (String Comment)
 To set a comment to the label. More...
 
static SetDecimalNumber (Number NbDecimal)
 To define number of decimal to display. More...
 
Array SetLine (Number IdxLin, Array< Number > ValueTbl)
 To set the content of all the line IdxLin. More...
 
static SetLineColor (Number Red, Number Green, Number Blue)
 To define color of line contour and text. More...
 
Array SetLineType (Array< SLabelLine > LineType)
 To set the type for all lines. More...
 
static SetSizeType (SLabelType LabelType)
 To define how the label is visible. More...
 
 SetTolerance (Number LowTol, Number UpperTol)
 To set the default tolerance. More...
 
Array SetVisibleColumn (Number ColumnRowIndex, Boolean IsVisible)
 To hide/show one column with a given index. More...
 
Array SetVisibleRow (Number RowIndex, Boolean IsVisible)
 To hide/show one row with a given index. More...
 
 ShowComment (Boolean iShowComment)
 To show or hide the comment. More...
 
String toString ()
 Get the type of the variable. More...
 
static String toString ()
 Get the type of the variable. More...
 
static UseEngineeringNotation (Boolean Use)
 To define if labels use engineering notation ( Xe+y ) More...
 
- Public Slots inherited from SComp
 AddToDoc ()
 To add the object to the document. More...
 
static Array All (Number VisCrit)
 To get all the SComp in the document. More...
 
 ApplyTransformation (SMatrix iMatrix)
 To apply a geometric transformation to the current object by making a product with the given matrix. More...
 
 Clear ()
 To deallocate object memory. More...
 
static Array FromClick ()
 Launches a click interaction to select a SComp in the scene. More...
 
static Array FromName (String Name)
 Search all the component with the given name. More...
 
static Array FromSel ()
 To get all the selected SComp. More...
 
Array GetBoundingBox ()
 Calculates the bounding box of the component. More...
 
Array GetColors ()
 To get the colors of the component. More...
 
String GetFolderName ()
 The component containing folder's name. More...
 
String GetName ()
 The component's name. More...
 
String GetPath ()
 To get the full path of a comp in the tree. More...
 
 Invert ()
 Normal of the component is inverted. More...
 
Boolean IsInDoc ()
 Return if the component is in the document or not. More...
 
Boolean IsVisible ()
 
 MoveToGroup (String GroupPath, Boolean MoveInsideTopParent)
 Move the object to the document group represent by the given path. If some groups, in the path, don't exist, they will be created. More...
 
 RemoveFromDoc ()
 To remove the object from the document. More...
 
 SetClippable (Boolean clipping)
 Set clippable or not. More...
 
 SetColors (Number Red, Number Green, Number Blue)
 Sets the colors of the component. More...
 
 SetName (String ComponentName)
 To set the component's name. More...
 
 SetRepresentationType (RepresentationTypeEnum Representation)
 The shading type of the component is modified. More...
 
 SetTransparency (Number Alpha)
 Sets the transparency of the component. More...
 
 SetVisibility (Boolean Visible)
 Sets the component to be visible, or not visible. More...
 
String toString ()
 Get the type of the variable. More...
 
String toString ()
 Get the type of the variable. More...
 
 Translate (SVector Vector)
 To make a translation of the current object with an SVector. More...
 
- Public Slots inherited from SObject
 Clear ()
 To deallocate memory of the object. More...
 
String toString ()
 Get the type of the variable. More...
 

Detailed Description

The SLabel class provides a labelling feature, to easily track your components on the scene. The SLabel creation can be done by calling the static functions:
.

  • New() to copy an existing SLabel.
  • New() to create your own empty SLabel with custom numbers of lines and columns.
    var theLabel = SLabel.New(3, 2); // Custom SLabel creation
    theLabel.AttachToPoint(SPoint.New()); // Attach to origin
    theLabel.SetLineType(
    [SLabel.XX, SLabel.YY, SLabel.ZZ] // [in] The line types
    );
    theLabel.SetColType(
    [SLabel.Reference, SLabel.Measure] // [in] The column types
    );
    theLabel.SetCol(0, [1, 2, 3]); // Fill first column
    theLabel.SetCol(1, [10, 20, 30]); // Fill second column
    theLabel.SetComment("Sample");
    theLabel.AddToDoc();

Member Enumeration Documentation

◆ SLabelBackgroundType

Enumerator
NO_BACKGROUND 

No label background

SCENE_BACKGROUND_COLOR 

Same color as scene background

SPECIAL_COLOR 

Use defined color

TOLERANCE_COLOR 

Use tolerance related color

LastBackgroundType 

Not used but MUST be the last one

◆ SLabelCol

Enumerator
Reference 
Measure 
Deviation 
TolMin 
TolMax 
Note 
Flushing 
EmptyCol 
Nominal 
BBoxMin 
BBoxMax 
Size 
Centroid 
LowestPoint 
UppestPoint 
Count 
UndefinedCol 
LastColType 

Not used but MUST be the last one

◆ SLabelLine

Enumerator
XX 
YY 
ZZ 
NormalX 
NormalY 
NormalZ 
Radius 
Diameter 
Angle 
Circularity 
Cylindricity 
Planeity 
Distance 
AngleX 
AngleY 
AngleZ 
AngleCompX 
AngleCompY 
AngleCompZ 
AngleSuppX 
AngleSuppY 
AngleSuppZ 
AngleC 
AngleS 
Dev3D 
Curv 
EmptyLine 
Length 
Width 
Linearity 
Sphericity 
DistanceXY 
DistanceYZ 
DistanceXZ 
DistanceX 
DistanceY 
DistanceZ 
Volume 
Intensity 
VolumeOver 
VolumeUnder 
Perpendicularity 
Parallelism 
Level 
Surface 
NbPoints 
NbTriangles 
NbPieces 
NbFreeCont 
UndefinedLine 
Flatness 

Flatness for DlgSurfaceAnalysis

LastLineType 

Not used but MUST be the last one

◆ SLabelType

Enumerator
LONG 

Display all data defined as visible

MEDIUM 

Display only necessary data

SMALL 
MINIMUM 

[in] Display only label number

LastLabelType 

Not used but MUST be the last one

Member Function Documentation

◆ AddSComp

SLabel::AddSComp ( Array< SComp tblSComp)
slot

To add some SComp to the label.
The label and the SComp will be one entity.

Warning
If one SComp is in the document, you cannot add it.
If one SComp is associated with a label, you must not add it to the current document.
To add the associated SComp, you must add the SLabel to the document
See also
RemoveFromDoc()
Parameters
tblSCompList of SComp to draw with the label

◆ All

static Array SLabel::All ( Number  VisCrit)
inlinestaticslot

To get all the SComp in the document.

Return values
Arrayall the SLabel contained in the document
Parameters
[in]VisCritVisible selection criteria
  • 0 Keep if not visible
  • 1 Keep if visible
  • 2 (Default) Indifferent

◆ AttachToPoint

SLabel::AttachToPoint ( SPoint  iAttachedPoint)
slot

To attach the label to a 3D point in the scene.

◆ FromClick

static Array SLabel::FromClick ( )
inlinestaticslot

Launches a click interaction to select a SComp in the scene.

Warning
This function will break the script, and wait for user interaction.
Return values
Array.ErrorCodeThe error code
  • 0: Success, the SComp is selected.
  • 1: Nothing is selected.
  • 2: The ESCape key has been pressed
Array.Labelthe SLabel selected

◆ FromName

static Array SLabel::FromName ( String  Name)
inlinestaticslot

Search all the component with the given name.

Return values
Arrayall the SLabel with the given name

◆ FromSel

static Array SLabel::FromSel ( )
staticslot

To get all the selected SComp.

Return values
Arrayall the SLabel selected

◆ GetCell

Array SLabel::GetCell ( Number  IdxLin,
Number  IdxCol 
)
slot

To get the content of a cell.

Return values
Array.ErrorCodeThe error code
  • 0: SUCCESS.
  • 1: Impossible to get the info.
Array.ValueThe number associated to the cell
Parameters
[in]IdxLinThe line index between 0 <= IdxLin < Nb Line
[in]IdxColThe column index between 0 <= IdxCol < Nb Column

◆ GetCol

Array SLabel::GetCol ( Number  IdxCol)
slot

To get the content of all the column IdxCol.

Return values
Array.ErrorCodeThe error code
  • 0: SUCCESS.
  • 1: Impossible to get the info.
Array.ValueTblA table of value associated to the column
Array.HeaderThe type of the column (see SLabelCol)
Parameters
[in]IdxColThe column index between 0 <= IdxCol < Nb Column

◆ GetColByType

Array SLabel::GetColByType ( SLabelCol  ColType)
slot

To get the content of all the column by his type.

Return values
Array.IndexTblAll the column index with this type
Parameters
[in]ColTypeThe column type

◆ GetComment

String SLabel::GetComment ( )
slot
Return values
StringAssociated comment.
See also
SetComment()

◆ GetLine

Array SLabel::GetLine ( Number  IdxLin)
slot

To get the content of all the line IdxLin.

Return values
Array.ErrorCodeThe error code
  • 0: SUCCESS.
  • 1: Impossible to get the info.
Array.ValueTblA table of value associated to the line
Array.HeaderThe type of the line (see SLabelLine)
Parameters
[in]IdxLinthe line index between 0 <= IdxLin < Nb Line

◆ GetLineByType

Array SLabel::GetLineByType ( SLabelLine  LineType)
slot

To get the content of all the Line by his type.

Return values
Array.IndexTblAll the Line index with this type
Parameters
[in]LineTypeThe line type

◆ New [1/2]

static SLabel SLabel::New ( Number  NbLin,
Number  NbCol 
)
staticslot

Default constructor to create an empty new SLabel.

Parameters
[in]NbLinThe number of lines
[in]NbColThe number of columns

◆ New [2/2]

static SLabel SLabel::New ( SLabel  iOther)
staticslot

Constructs an SLabel by copying the SLabel _iOther.

◆ SetBackgroundColor

static SLabel::SetBackgroundColor ( Number  Red,
Number  Green,
Number  Blue,
Number  Transparency 
)
staticslot

To define backGround color.

Parameters
[in]Redred 0 to 1
[in]Greengreen 0 to 1
[in]Blueblue 0 to 1
[in]Transparencytransparency 0 to 1

◆ SetBackgroundType

static SLabel::SetBackgroundType ( SLabelBackgroundType  BackgroundType)
staticslot

To define background type
.

See also
SetBackgroundColor()
Parameters
[in]BackgroundTypeType of background SLabel.SCENE_BACKGROUND_COLOR, // Same color as scene background SLabel.TOLERANCE_COLOR, // Use tolerance related color (take a look to SetBackgroundColor())

◆ SetCell

Array SLabel::SetCell ( Number  IdxLin,
Number  IdxCol,
Number  Value 
)
slot

To set the content of a cell.

Return values
Array.ErrorCodeThe error code
  • 0: SUCCESS.
  • 1: Impossible to add the info.
Parameters
[in]IdxLinThe line index between 0 <= IdxLin < Nb Line
[in]IdxColThe column index between 0 <= IdxCol < Nb Column
[in]ValueThe data to store in the cell

◆ SetCol

Array SLabel::SetCol ( Number  IdxCol,
Array< Number >  ValueTbl 
)
slot

To set the content of all the column IdxCol.

Return values
Array.ErrorCodeThe error code
  • 0: SUCCESS.
  • 1: Impossible to add the info.
Parameters
[in]IdxColThe column index between 0 <= IdxCol < Nb Column
[in]ValueTblA table of values

◆ SetColType

Array SLabel::SetColType ( Array< SLabelCol ColType)
slot

To set the type for all columns.

Return values
Array.ErrorCodeThe error code
  • 0: SUCCESS.
  • 1: Parameters are incorrect.
Parameters
[in]ColTypeThe column types

◆ SetComment

SLabel::SetComment ( String  Comment)
slot

To set a comment to the label.

See also
GetComment()

◆ SetDecimalNumber

static SLabel::SetDecimalNumber ( Number  NbDecimal)
staticslot

To define number of decimal to display.

Note
value must be between 0 and 5 decimals
Parameters
[in]NbDecimalnumber of decimal 0 <= NbDecimal <= 5

◆ SetLine

Array SLabel::SetLine ( Number  IdxLin,
Array< Number >  ValueTbl 
)
slot

To set the content of all the line IdxLin.

Return values
Array.ErrorCodeThe error code
  • 0: SUCCESS.
  • 1: Impossible to add the info.
Parameters
[in]IdxLinthe line index between 0 <= IdxLin < Nb Line
[in]ValueTblA table of value

◆ SetLineColor

static SLabel::SetLineColor ( Number  Red,
Number  Green,
Number  Blue 
)
staticslot

To define color of line contour and text.

Parameters
[in]Redred 0 to 1
[in]Greengreen 0 to 1
[in]Blueblue 0 to 1

◆ SetLineType

Array SLabel::SetLineType ( Array< SLabelLine LineType)
slot

To set the type for all lines.

Return values
Array.ErrorCodeThe error code
  • 0: SUCCESS.
  • 1: Parameters are incorrect.
Parameters
[in]LineTypeThe line types

◆ SetSizeType

static SLabel::SetSizeType ( SLabelType  LabelType)
staticslot

To define how the label is visible.

◆ SetTolerance

SLabel::SetTolerance ( Number  LowTol,
Number  UpperTol 
)
slot

To set the default tolerance.

Parameters
LowTolLower tolerance
UpperTolUpper tolerance

◆ SetVisibleColumn

Array SLabel::SetVisibleColumn ( Number  ColumnRowIndex,
Boolean  IsVisible 
)
slot

To hide/show one column with a given index.

Return values
Array.ErrorCodeThe error code
  • 0: the column is hide/show.
  • 1: impossible to modify the column index is incorrect.
Parameters
[in]ColumnRowIndexThe column index to hide.
[in]IsVisibleTrue if the row must be visible, else false

◆ SetVisibleRow

Array SLabel::SetVisibleRow ( Number  RowIndex,
Boolean  IsVisible 
)
slot

To hide/show one row with a given index.

Return values
Array.ErrorCodeThe error code
  • 0: the row is hide/show
  • 1: impossible to modify the row index is incorrect
Parameters
[in]RowIndexThe row index to hide.
[in]IsVisibleTrue if the row must be visible, else false

◆ ShowComment

SLabel::ShowComment ( Boolean  iShowComment)
slot

To show or hide the comment.

◆ toString [1/2]

String SLabel::toString ( )
slot

Get the type of the variable.

◆ toString [2/2]

static String SLabel::toString ( )
staticslot

Get the type of the variable.

◆ UseEngineeringNotation

static SLabel::UseEngineeringNotation ( Boolean  Use)
staticslot

To define if labels use engineering notation ( Xe+y )

Parameters
[in]Useif true use engineering notation, else false