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

Provide point edition and creation methods. More...

Inheritance diagram for SPoint:
SComp

Public Member Functions

SPoint Add (SPoint addValue)
 Calculate the sum of two points (to be able to do some averages) More...
 
number Distance (SPoint ptToCompare)
 Calculate the true distance between 'this' and ptToCompare. More...
 
SPoint Div (number divValue)
 Calculate the division of a point by a scalar (to be able to do averages). More...
 
boolean Equals (SPoint ptToCompare)
 Test if two 3D points are equal or not. More...
 
number GetPointSize ()
 Return the current point size. More...
 
number GetX ()
 Get the X coordinate value. More...
 
number GetY ()
 Get the Y coordinate value. More...
 
number GetZ ()
 Get the Z coordinate value. More...
 
SPoint Mult (number multValue)
 Calculate the multiplication of a point by a scalar. More...
 
 SetPointSize (number pointSize)
 New point size. More...
 
 SetX (number x)
 Set the X coordinate. More...
 
 SetY (number y)
 Set the Y coordinate. More...
 
 SetZ (number z)
 Set the Z coordinate. More...
 
 ShowName (boolean showName)
 Control whether the name of the point is shown or not in the scene. More...
 
 SPoint ()
 Default constructor to create an empty new SPoint. X = Y = Z = 0. More...
 
 SPoint (number iX, number iY, number iZ)
 Constructor from X, Y, Z coordinates. More...
 
 SPoint (SPoint iPoint)
 Constructor by copy from other point. More...
 
SPoint Sub (SPoint subValue)
 Calculate the subtraction of two points. More...
 
string toString ()
 Get the type of the variable. More...
 
string ValuesToString ()
 Get a string representation of the point. More...
 
- Public Member Functions inherited from SComp
 AddToDoc ()
 Add the object to the document. More...
 
 ApplyTransformation (SMatrix matrix)
 Apply a geometric transformation to the current object by making a product with the given matrix. More...
 
Object GetBoundingBox ()
 Calculate the bounding box of the object. More...
 
Object GetColors ()
 Get the colors of the object. More...
 
string GetFolderName ()
 Get the name of the folder containing the object. More...
 
string GetName ()
 Return the object's name. More...
 
string GetPath ()
 Return the full path of a SComp in the tree. More...
 
 Invert ()
 Invert the normal of the object. More...
 
boolean IsInDoc ()
 Return if the object is in the document or not. More...
 
boolean IsVisible ()
 Get the visibility of the object. More...
 
 MoveToGroup (string groupPath, boolean moveInsideTopParent=true)
 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 ()
 Remove the object from the document. More...
 
 SetClippable (boolean clipping)
 Set clippable or not. More...
 
 SetColors (number red, number green, number blue)
 Set the colors of the object. More...
 
 SetName (string objectName)
 Set the object's name. More...
 
 SetTransparency (number alpha)
 Set the transparency of the object. More...
 
 SetVisibility (boolean visible)
 Set the object to be visible, or not visible. More...
 
string toString ()
 Get the type of the variable. More...
 
 Translate (SVector vector)
 Make a translation of the current object with an SVector. More...
 

Static Public Member Functions

static Array< SPointAll (VisibilityEnum visCrit=SComp.ANY_VISIBILITY)
 Get all the SPoint in the document. More...
 
static Object FromClick ()
 Launch an interaction to select a SPoint in the scene. More...
 
static Object FromFile (string fileName)
 Import points from a file. Authorized file extensions : .asc, .txt. More...
 
static Array< SPointFromName (string name)
 Search all the SPoint with the given name. More...
 
static Array< SPointFromSel ()
 Get all the selected SPoint. More...
 
static SPoint New ()
 Default constructor to create an empty new SPoint. X = Y = Z = 0. More...
 
static SPoint New (number iX, number iY, number iZ)
 Constructor from X, Y, Z coordinates. More...
 
static SPoint New (SPoint iPoint)
 Constructor by copy from other point. More...
 
static Object Save (string filePath, Array< SPoint > pointsToSave, SMatrix coordinateSystemMatrix=SMatrix())
 Save points into a file. Supported extensions : .asc, .txt. More...
 
- Static Public Member Functions inherited from SComp
static Array< SCompAll (VisibilityEnum visCrit=SComp.ANY_VISIBILITY)
 Get all the SComp in the document. More...
 
static Object FromClick ()
 Launch an interaction to select a SComp in the scene. More...
 
static Array< SCompFromName (string name)
 Search all the SComp with the given name. More...
 
static Array< SCompFromSel ()
 Get all the selected SComp. More...
 

Additional Inherited Members

- Public Types inherited from SComp
enum  VisibilityEnum { HIDDEN_ONLY = 0 , VISIBLE_ONLY = 1 , ANY_VISIBILITY = 2 }
 Visible criteria. More...
 

Detailed Description

Provide point edition and creation methods.

Constructor & Destructor Documentation

◆ SPoint() [1/3]

SPoint::SPoint ( )

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

◆ SPoint() [2/3]

SPoint::SPoint ( SPoint  iPoint)

Constructor by copy from other point.

Parameters
iPoint(SPoint) Point to copy

◆ SPoint() [3/3]

SPoint::SPoint ( number  iX,
number  iY,
number  iZ 
)

Constructor from X, Y, Z coordinates.

Parameters
iX(number) X coordinate
iY(number) Y coordinate
iZ(number) Z coordinate

Member Function Documentation

◆ Add()

SPoint SPoint::Add ( SPoint  addValue)

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
Provide point edition and creation methods.
Definition: Reshaper.h:6179
static SPoint New()
Default constructor to create an empty new SPoint. X = Y = Z = 0.
SPoint Add(SPoint addValue)
Calculate the sum of two points (to be able to do some averages)
Parameters
addValue(SPoint) The SPoint used for the addition
Returns
(SPoint) New point which is the sum of current point and 'addValue'

◆ All()

static Array< SPoint > SPoint::All ( VisibilityEnum  visCrit = SComp.ANY_VISIBILITY)
static

Get all the SPoint in the document.

Parameters
visCrit(VisibilityEnum) Visible selection criteria
Returns
(Array<SPoint>) Array of all the SPoint contained in the document, that fulfill the visibility criteria

◆ Distance()

number SPoint::Distance ( SPoint  ptToCompare)

Calculate the true distance between 'this' and ptToCompare.

Parameters
ptToCompare(SPoint) The point to calculate the distance with.
Returns
(number) The distance between the two points.

◆ Div()

SPoint SPoint::Div ( number  divValue)

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
SPoint Div(number divValue)
Calculate the division of a point by a scalar (to be able to do averages).
Parameters
divValue(number) The value used for the division
Returns
(SPoint) New point which is the division of current point with 'divValue'

◆ Equals()

boolean SPoint::Equals ( SPoint  ptToCompare)

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).
Parameters
ptToCompare(SPoint) The point to compare with.
Returns
(boolean) True if the points are equal.

◆ FromClick()

static Object SPoint::FromClick ( )
static

Launch an interaction to select a SPoint in the scene.

Warning
This function will pause the script, and wait for user interaction
Return values
ret.ErrorCode(number) The error code
  • 0: No error, the SPoint is selected.
  • 1: Nothing is selected.
  • 2: The ESCape key has been pressed
ret.Point(SPoint) The selected SPoint

◆ FromFile()

static Object SPoint::FromFile ( string  fileName)
static

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

Warning
When you write a '\' in string you need to double it '\\' or use '/' instead. Pay especially attention to this when writing file paths in your scripts.
var path = 'C:/Point.asc'; // valid syntax
var path = 'C:\\Point.asc'; // valid syntax
var path = 'C:\Point.asc'; // invalid syntax
Note
Example of txt file:
Name1 1 0 0
Name2 1 2 3.5
Parameters
fileName(string) The file name path
Return values
ret.ErrorCode(number) The error code
  • 0: No error
  • 1: An error occurred
ret.PointTbl(Array<SPoint>) The loaded array of SPoint

◆ FromName()

static Array< SPoint > SPoint::FromName ( string  name)
static

Search all the SPoint with the given name.

Parameters
name(string) The name to find
Returns
(Array<SPoint>) All the SPoint with the given name

◆ FromSel()

static Array< SPoint > SPoint::FromSel ( )
static

Get all the selected SPoint.

Returns
(Array<SPoint>) All the selected SPoint

◆ GetPointSize()

number SPoint::GetPointSize ( )

Return the current point size.

Returns
(number) The point size.

◆ GetX()

number SPoint::GetX ( )

Get the X coordinate value.

Returns
(number) The X coordinate.

◆ GetY()

number SPoint::GetY ( )

Get the Y coordinate value.

Returns
(number) The Y coordinate.

◆ GetZ()

number SPoint::GetZ ( )

Get the Z coordinate value.

Returns
(number) The Z coordinate.

◆ Mult()

SPoint SPoint::Mult ( number  multValue)

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
SPoint Mult(number multValue)
Calculate the multiplication of a point by a scalar.
Parameters
multValue(number) The value used for the multiplication
Returns
(SPoint) New point which is the current point multiplied by 'multValue'

◆ New() [1/3]

static SPoint SPoint::New ( )
static

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

Returns
(SPoint) The new SPoint.

◆ New() [2/3]

static SPoint SPoint::New ( number  iX,
number  iY,
number  iZ 
)
static

Constructor from X, Y, Z coordinates.

Parameters
iX(number) X coordinate
iY(number) Y coordinate
iZ(number) Z coordinate
Returns
(SPoint) The new SPoint.

◆ New() [3/3]

static SPoint SPoint::New ( SPoint  iPoint)
static

Constructor by copy from other point.

Parameters
iPoint(SPoint) Point to copy
Returns
(SPoint) The new SPoint.

◆ Save()

static Object SPoint::Save ( string  filePath,
Array< SPoint pointsToSave,
SMatrix  coordinateSystemMatrix = SMatrix() 
)
static

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

Warning
When you write a '\' in string you need to double it '\\' or use '/' instead. Pay especially attention to this when writing file paths in your scripts.
var path = 'C:/Point.asc'; // valid syntax
var path = 'C:\\Point.asc'; // valid syntax
var path = 'C:\Point.asc'; // invalid syntax
Parameters
filePath(string) The complete file path to save into
pointsToSave(Array<SPoint>) the points to save
coordinateSystemMatrix(SMatrix) The matrix to define a UCS used for the export (or identity to use the WCS)
Return values
ret.ErrorCode(number) The error code.
  • 0: No error.
  • 1: Failed to save the points

◆ SetPointSize()

SPoint::SetPointSize ( number  pointSize)

New point size.

Parameters
pointSize(number) The new point size.

◆ SetX()

SPoint::SetX ( number  x)

Set the X coordinate.

Parameters
x(number) Value to set.

◆ SetY()

SPoint::SetY ( number  y)

Set the Y coordinate.

Parameters
y(number) Value to set.

◆ SetZ()

SPoint::SetZ ( number  z)

Set the Z coordinate.

Parameters
z(number) Value to set.

◆ ShowName()

SPoint::ShowName ( boolean  showName)

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

Parameters
showName(boolean) The new visibility state of the point name

◆ Sub()

SPoint SPoint::Sub ( SPoint  subValue)

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
SPoint Sub(SPoint subValue)
Calculate the subtraction of two points.
Parameters
subValue(SPoint) The SPoint used for the subtraction
Returns
(SPoint) New point which is the current point subtracted by 'subValue'

◆ toString()

string SPoint::toString ( )

Get the type of the variable.

Returns
(string) The type name

◆ ValuesToString()

string SPoint::ValuesToString ( )

Get a string representation of the point.

Returns
(string) A string representing the point coordinates