Cyclone 3DR Script
from Technodigit, part of Hexagon. Copyright 1997-2021.
SPoint Class Reference

3D point manipulation class. The SPoint creation can be done by calling the static functions:
More...

Inheritance diagram for SPoint:
SComp SObject

Public Slots

SPoint Add (SPoint iPtToAdd)
 To calculate the sum of two points (to be able to do some averages) More...
 
static Array All (Number VisCrit)
 To get all the SComp in the document. More...
 
Number Distance (SPoint iPtToCompare)
 Calculates the true distance between 'this' and PtToCompare. More...
 
SPoint Div (Number Scalar)
 To calculate the division of a point by a scalar (to be able to do averages). More...
 
Boolean Equals (SPoint iPtToCompare)
 To test if two 3D points are equal or not. More...
 
static Array FromClick ()
 Displays a dialog box to select an SComp in the scene. More...
 
static Array FromFile (String FileName)
 Imports points from a file. Authorized file extensions : .asc, .txt. 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...
 
Number GetPointSize ()
 Return the current point size. More...
 
Number GetX ()
 
Number GetY ()
 
Number GetZ ()
 
SPoint Mult (Number Scalar)
 To calculate the multiplication of a point by a scalar. More...
 
static SPoint New ()
 Default constructor to create an empty new SPoint.
X = Y = Z// TESTED. More...
 
static SPoint New (Number X, Number Y, Number Z)
 Constructs a new SPoint by defining its data. More...
 
static SPoint New (SPoint Other)
 Constructs an SPoint by copying the SPoint Other. More...
 
static Array Save (String FilePath, Array< SPoint > PointsToSave, SMatrix CoordinateSystemMatrix={})
 Saves points into a file. Supported extensions : .asc, .txt. More...
 
 SetPointSize (Number pointSize)
 New point size. More...
 
 SetX (Number X)
 Sets the X coordinate. More...
 
 SetY (Number Y)
 Sets the Y coordinate. More...
 
 SetZ (Number Z)
 Sets the Z coordinate. More...
 
 ShowName (Boolean iShowName)
 Control whether the name of the point is shown or not in the scene. More...
 
SPoint Sub (SPoint iPtToSub)
 To calculate the subtraction of two points. More...
 
String toString ()
 Get the type of the variable. More...
 
static String toString ()
 Get the type of the variable. More...
 
String ValuesToString ()
 Get a string representation of the point. 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 ()
 Displays a dialog box to select an 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 ()
 
String GetName ()
 
 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...
 

Additional Inherited Members

- 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...
 

Detailed Description

3D point manipulation class. The SPoint creation can be done by calling the static functions:

Member Function Documentation

◆ Add

SPoint SPoint::Add ( SPoint  iPtToAdd)
slot

To calculate the sum of two points (to be able to do some averages)

var myPoint = SPoint.New(1, 1, 1);
myPoint = myPoint.Add(SPoint.New(2, 2, 2)); // myPoint == (3, 3, 3) now

◆ All

static Array SPoint::All ( Number  VisCrit)
inlinestaticslot

To get all the SComp in the document.

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

◆ Distance

Number SPoint::Distance ( SPoint  iPtToCompare)
slot

Calculates the true distance between 'this' and PtToCompare.

Returns
The distance between the two points.

◆ Div

SPoint SPoint::Div ( Number  Scalar)
slot

To calculate the division of a point by a scalar (to be able to do averages).

var myPoint = SPoint.New(4, 4, 4);
myPoint = myPoint.Div(2); // myPoint == (2, 2, 2) now

◆ Equals

Boolean SPoint::Equals ( SPoint  iPtToCompare)
slot

To test if two 3D points are equal or not.

Note
This comparison is testing the "relative" equality based on a certain number of digits (by default 12 digits).
Return values
trueThe points are equal.
falseThe points are different.

◆ FromClick

static Array SPoint::FromClick ( )
inlinestaticslot

Displays a dialog box to select an 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.Pointthe SPoint selected
Note
if a point is clicked in the scene, a reference to this point is returned: modifying its coordinate will affect the point in the scene but if a point on a cloud or in the 3D scene is clicked, a new point is created

◆ FromFile

static Array SPoint::FromFile ( String  FileName)
staticslot

Imports points from a file. Authorized file extensions : .asc, .txt.

Warning
In Javascript, when you write strings the '\' character is an escape character, you need to use '\\' or '/' instead. Pay especially attention to this when writing file paths in your scripts. For example :
var res = SPoint.FromFile( 'C:/Points.txt' ); // Valid syntax\n
var res2 = SPoint.FromFile( 'C:\\Points.txt' ); // Valid syntax\n
var res3 = SPoint.FromFile( 'C:\Points.txt' ); // Invalid syntax
3D point manipulation class. The SPoint creation can be done by calling the static functions:
Definition: SPoint.h:23
static Array FromFile(String FileName)
Imports points from a file. Authorized file extensions : .asc, .txt.
Return values
Array.ErrorCodeThe error code:
  • 0: No error.
  • 1: An error occurred.
Array.PointTblThe loaded array of SPoint
Parameters
[in]FileNameThe file name path

◆ FromName

static Array SPoint::FromName ( String  Name)
inlinestaticslot

Search all the component with the given name.

Return values
Arrayall the SPoint with the given name

◆ FromSel

static Array SPoint::FromSel ( )
staticslot

To get all the selected SComp.

Return values
Arrayall the SPoint selected

◆ GetPointSize

Number SPoint::GetPointSize ( )
slot

Return the current point size.

◆ GetX

Number SPoint::GetX ( )
slot
Returns
The X coordinate.

◆ GetY

Number SPoint::GetY ( )
slot
Returns
The Y coordinate.

◆ GetZ

Number SPoint::GetZ ( )
slot
Returns
The Z coordinate.

◆ Mult

SPoint SPoint::Mult ( Number  Scalar)
slot

To calculate the multiplication of a point by a scalar.

var myPoint = SPoint.New(1, 1, 1);
myPoint = myPoint.Mult(7); // myPoint == (7, 7, 7) now

◆ New [1/3]

static SPoint SPoint::New ( )
staticslot

Default constructor to create an empty new SPoint.
X = Y = Z// TESTED.

◆ New [2/3]

static SPoint SPoint::New ( Number  X,
Number  Y,
Number  Z 
)
staticslot

Constructs a new SPoint by defining its data.

Parameters
[in]XThe X coordinate
[in]YThe Y coordinate
[in]ZThe Z coordinate

◆ New [3/3]

static SPoint SPoint::New ( SPoint  Other)
staticslot

Constructs an SPoint by copying the SPoint Other.

◆ Save

static Array SPoint::Save ( String  FilePath,
Array< SPoint PointsToSave,
SMatrix  CoordinateSystemMatrix = {} 
)
staticslot

Saves points into a file. Supported extensions : .asc, .txt.

Warning
In Javascript, when you write strings the '\' character is an escape character, you need to use '\\' or '/' instead. Pay especially attention to this when writing file paths in your scripts. For example :
var res = thePoint.Save( 'C:/Point.asc' ); // Valid syntax\n
var res2 = thePoint.Save( 'C:\\\\Point.asc' ); // Valid syntax\n
var res3 = thePoint.Save( 'C:\\Point.asc' ); // Invalid syntax
Return values
Array.ErrorCodeThe error code.
  • 0 : No error.
  • 1 : Failed to save the points
Parameters
FilePathThe complete file path to save into
PointsToSavethe points to save
CoordinateSystemMatrixthe matrix to define a UCS used for the export (or identity to use the WCS)

◆ SetPointSize

SPoint::SetPointSize ( Number  pointSize)
slot

New point size.

Parameters
[in]pointSizeThe new point size

◆ SetX

SPoint::SetX ( Number  X)
slot

Sets the X coordinate.

◆ SetY

SPoint::SetY ( Number  Y)
slot

Sets the Y coordinate.

◆ SetZ

SPoint::SetZ ( Number  Z)
slot

Sets the Z coordinate.

◆ ShowName

SPoint::ShowName ( Boolean  iShowName)
slot

Control whether the name of the point is shown or not in the scene.

Parameters
[in]iShowNamethe new visibility state of the point

◆ Sub

SPoint SPoint::Sub ( SPoint  iPtToSub)
slot

To calculate the subtraction of two points.

var myPoint = SPoint.New(7, 7, 7);
myPoint = myPoint.Sub(SPoint.New(3, 3, 3)); // myPoint == (4, 4, 4) now

◆ toString [1/2]

String SPoint::toString ( )
slot

Get the type of the variable.

◆ toString [2/2]

static String SPoint::toString ( )
staticslot

Get the type of the variable.

◆ ValuesToString

String SPoint::ValuesToString ( )
slot

Get a string representation of the point.