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

Provide plane edition and creation methods. More...

Inheritance diagram for SPlane:
SFeature SComp

Public Member Functions

Object BestSymmetryPlane (SComp selComp, number option=0)
 Compute the best symmetry plane of a cloud or mesh. More...
 
Object Discretize (number deflection=0, number meanPointDistance=0)
 Discretize the plane into a discretized SPoly. Only one parameter must be specified at a time. To use the deflection, set a positive value and set 0 to meanPointDistance.To use the mean distance between points, set a positive value and set 0 to deflection. More...
 
number Distance (SPoint point)
 Return the distance between a point and the plane. More...
 
Object FitPlaneToBoundingBox3D (SPoint lowerPoint, SPoint upperPoint, boolean moveCenter, number scale)
 Update the width and length of the plane in order to cover the given bounding box in the normal direction of the plane. More...
 
number GetLength ()
 Return the length of the plane. More...
 
number GetSurface ()
 Return the surface of the plane. More...
 
number GetWidth ()
 Return the width of the plane. More...
 
SVector GetXDir ()
 Return the X direction of the plane. More...
 
SVector GetYDir ()
 Return the Y direction of the plane. More...
 
Object IntersectionBetween2Planes (SPlane secondPlane)
 Calculate intersection with another plane. More...
 
Object Proj3D (SMultiline multilineToProject)
 Project a polyline onto the plane (3D projection) More...
 
Object Proj3D (SPoint pointToProject)
 Project a point onto the plane (shortest point) More...
 
Object ProjDir (SMultiline multilineToProject, SVector direction)
 Project a polyline onto the plane along a given direction. More...
 
Object ProjDir (SPoint pointToProject, SVector projectionVector)
 Project a point onto the plane along a given direction. More...
 
 SetLength (number length)
 Set the length. More...
 
 SetWidth (number width)
 Set the width. More...
 
 SPlane ()
 Default constructor to create an empty new SPlane. More...
 
 SPlane (SPlane other)
 Construct a SPlane by copying another SPlane. More...
 
 SPlane (SPoint center, SVector normal)
 Construct a new SPlane from a given center and normal direction. More...
 
 SPlane (SPoint center, SVector normal, SVector xDir, number length, number width)
 Construct a new SPlane from a given center, normal direction, x direction, length and width. More...
 
 SPlane (SPoint firstPt, SPoint secondPt, SPoint thirdPt)
 Construct a new SPlane by 3 points. More...
 
string toString ()
 Get the type of the variable. More...
 
string ValuesToString ()
 Get a debug string representation of the plane. More...
 
- Public Member Functions inherited from SFeature
Object Compare (SCloud measCloud, number distMax, number mappingObject=1, number maxCosAngle=-2)
 Calculate the distances between 2 components for further inspection purpose (color mapping) More...
 
SPoint GetCenter ()
 Return the center of the feature. More...
 
SVector GetNormal ()
 Return the normal of the feature. More...
 
 SetCenter (SPoint center)
 Set the center. More...
 
 SetNormal (SVector normal)
 Set the normal. More...
 
string toString ()
 Get the type of the variable. 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 (SMatrix ucs=null)
 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< SPlaneAll (VisibilityEnum visCrit=SComp.ANY_VISIBILITY)
 Get all the SPlane in the document. More...
 
static Object FromClick ()
 Launch an interaction to select a SPlane in the scene. More...
 
static Array< SPlaneFromName (string name)
 Search all the SPlane with the given name. More...
 
static Array< SPlaneFromSel ()
 Get all the selected SPlane. More...
 
static SPlane New ()
 Default constructor to create an empty new SPlane. More...
 
static SPlane New (SPlane other)
 Construct a SPlane by copying another SPlane. More...
 
static SPlane New (SPoint center, SVector normal)
 Construct a new SPlane from a given center and normal direction. More...
 
static SPlane New (SPoint center, SVector normal, SVector xDir, number length, number width)
 Construct a new SPlane from a given center, normal direction, x direction, length and width. More...
 
static SPlane New (SPoint firstPt, SPoint secondPt, SPoint thirdPt)
 Construct a new SPlane by 3 points. More...
 
- Static Public Member Functions inherited from SFeature
static Array< SFeatureAll (VisibilityEnum visCrit=SComp.ANY_VISIBILITY)
 Get all the SFeature in the document. More...
 
static Object FromBfcFile (string filePath)
 Load a .bfc file. More...
 
static Object FromClick ()
 Launch an interaction to select a SFeature in the scene. More...
 
static Array< SFeatureFromName (string name)
 Search all the SFeature with the given name. More...
 
static Array< SFeatureFromSel ()
 Get all the selected SFeature. 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 plane edition and creation methods.

Constructor & Destructor Documentation

◆ SPlane() [1/5]

SPlane::SPlane ( )

Default constructor to create an empty new SPlane.

◆ SPlane() [2/5]

SPlane::SPlane ( SPlane  other)

Construct a SPlane by copying another SPlane.

Parameters
other(SPlane) The SPlane to copy

◆ SPlane() [3/5]

SPlane::SPlane ( SPoint  center,
SVector  normal 
)

Construct a new SPlane from a given center and normal direction.

Parameters
center(SPoint) Plane center
normal(SVector) Plane normal

◆ SPlane() [4/5]

SPlane::SPlane ( SPoint  center,
SVector  normal,
SVector  xDir,
number  length,
number  width 
)

Construct a new SPlane from a given center, normal direction, x direction, length and width.

Parameters
center(SPoint) Plane center
normal(SVector) Plane normal
xDir(SVector) Plane X axis
length(number) Plane length
width(number) Plane width

◆ SPlane() [5/5]

SPlane::SPlane ( SPoint  firstPt,
SPoint  secondPt,
SPoint  thirdPt 
)

Construct a new SPlane by 3 points.

Note
The 3 points must be not identical.If you want to construct a plane with more than 3 points, use SCloud.BestPlane().
Parameters
firstPt(SPoint) First point on the plane
secondPt(SPoint) Second point on the plane
thirdPt(SPoint) Third point on the plane

Member Function Documentation

◆ All()

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

Get all the SPlane in the document.

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

◆ BestSymmetryPlane()

Object SPlane::BestSymmetryPlane ( SComp  selComp,
number  option = 0 
)

Compute the best symmetry plane of a cloud or mesh.

Note
The selection must contain an initial plane, necessary to find the best one
Parameters
selComp(SComp) Cloud or mesh on which the best symmetry plane is computed
option(number) Option for best fit computation
  • 0: No constraints
  • 1: Only parallel plane -> only allowing translation along Z
  • 2: Center does not move -> only allowing rotations
  • 3: Keep XDir -> allowing rotation along X and all translations
  • 4: Keep YDir -> allowing rotation along Y and all translations
  • 5: Keep XDir and center -> only allowing rotation along X
  • 6: Keep YDir and center -> only allowing rotation along Y
Return values
ret.ErrorCode(number) The error code
  • 0: OK, No error
  • 1: An exception occurred
  • 2: Invalid list of component or bad or incomplete initialization or impossible to initialize
  • 3: Objects are too far from each other: impossible to make bestfit
ret.Plane(SPlane) The computed plane

◆ Discretize()

Object SPlane::Discretize ( number  deflection = 0,
number  meanPointDistance = 0 
)

Discretize the plane into a discretized SPoly. Only one parameter must be specified at a time. To use the deflection, set a positive value and set 0 to meanPointDistance.To use the mean distance between points, set a positive value and set 0 to deflection.

Parameters
deflection(number) Max deviation between the ideal shape and the discretized element
meanPointDistance(number) Mean distance between points/vertices
Return values
ret.ErrorCode(number) The error code
  • 0: No error
  • 1: An error occurred
ret.Poly(SPoly) The discretized SPoly

◆ Distance()

number SPlane::Distance ( SPoint  point)

Return the distance between a point and the plane.

Parameters
point(SPoint) The point from which the distance to the feature has to be calculated
Return values
<0Below/inside the feature
>0Above/outside the feature

◆ FitPlaneToBoundingBox3D()

Object SPlane::FitPlaneToBoundingBox3D ( SPoint  lowerPoint,
SPoint  upperPoint,
boolean  moveCenter,
number  scale 
)

Update the width and length of the plane in order to cover the given bounding box in the normal direction of the plane.

Parameters
lowerPoint(SPoint) Lower point of the bounding box
upperPoint(SPoint) Upper point of the bounding box
moveCenter(boolean) Should we move the center of the plane?
  • true: The resulting plane will be as small as possible
  • false: The resulting plane will be larger because of symmetry around its center
scale(number) Resize the resulting plane (its new borders will be offset).
Offset = 0.5 * MAX(width, height) * (scale - 1)
If scale = 1, no offset applied.
If scale = 2, offset = 0.5 * longest dimension.
If scale = 3, offset = 1 * longest dimension.
If scale = 4, offset = 1.5 * longest dimension.
Return values
ret.ErrorCode(number) The error code
  • 0: No error
  • 1: An error occurred

◆ FromClick()

static Object SPlane::FromClick ( )
static

Launch an interaction to select a SPlane 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 SPlane is selected.
  • 1: Nothing is selected.
  • 2: The ESCape key has been pressed
ret.Plane(SPlane) The selected SPlane

◆ FromName()

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

Search all the SPlane with the given name.

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

◆ FromSel()

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

Get all the selected SPlane.

Returns
(Array<SPlane>) All the selected SPlane

◆ GetLength()

number SPlane::GetLength ( )

Return the length of the plane.

Returns
(number) The length of the plane

◆ GetSurface()

number SPlane::GetSurface ( )

Return the surface of the plane.

Returns
(number) The surface of the plane

◆ GetWidth()

number SPlane::GetWidth ( )

Return the width of the plane.

Returns
(number) The width of the plane

◆ GetXDir()

SVector SPlane::GetXDir ( )

Return the X direction of the plane.

Warning
This vector can be null. Check it with SVector.IsNull()
Returns
(SVector) The X direction of the plane

◆ GetYDir()

SVector SPlane::GetYDir ( )

Return the Y direction of the plane.

Warning
This vector can be null. Check it with SVector.IsNull()
Returns
(SVector) The Y direction of the plane

◆ IntersectionBetween2Planes()

Object SPlane::IntersectionBetween2Planes ( SPlane  secondPlane)

Calculate intersection with another plane.

Parameters
secondPlane(SPlane) The second plane to calculate intersection with
Return values
ret.ErrorCode(number) The error code
  • 0: No error
  • 1: An error occurred
ret.Line(SLine) The intersection line

◆ New() [1/5]

static SPlane SPlane::New ( )
static

Default constructor to create an empty new SPlane.

Returns
(SPlane) The new SPlane.

◆ New() [2/5]

static SPlane SPlane::New ( SPlane  other)
static

Construct a SPlane by copying another SPlane.

Parameters
other(SPlane) The SPlane to copy
Returns
(SPlane) The new SPlane.

◆ New() [3/5]

static SPlane SPlane::New ( SPoint  center,
SVector  normal 
)
static

Construct a new SPlane from a given center and normal direction.

Parameters
center(SPoint) Plane center
normal(SVector) Plane normal
Returns
(SPlane) The new SPlane.

◆ New() [4/5]

static SPlane SPlane::New ( SPoint  center,
SVector  normal,
SVector  xDir,
number  length,
number  width 
)
static

Construct a new SPlane from a given center, normal direction, x direction, length and width.

Parameters
center(SPoint) Plane center
normal(SVector) Plane normal
xDir(SVector) Plane X axis
length(number) Plane length
width(number) Plane width
Returns
(SPlane) The new SPlane.

◆ New() [5/5]

static SPlane SPlane::New ( SPoint  firstPt,
SPoint  secondPt,
SPoint  thirdPt 
)
static

Construct a new SPlane by 3 points.

Note
The 3 points must be not identical.If you want to construct a plane with more than 3 points, use SCloud.BestPlane().
Parameters
firstPt(SPoint) First point on the plane
secondPt(SPoint) Second point on the plane
thirdPt(SPoint) Third point on the plane
Returns
(SPlane) The new SPlane.

◆ Proj3D() [1/2]

Object SPlane::Proj3D ( SMultiline  multilineToProject)

Project a polyline onto the plane (3D projection)

See also
SPlane.ProjDir()
Parameters
multilineToProject(SMultiline) The multiline to project onto the plane
Return values
ret.ErrorCode(number) The error code
  • 0: No error
  • 1: An error occurred
ret.Multi(SMultiline) The projected polyline

◆ Proj3D() [2/2]

Object SPlane::Proj3D ( SPoint  pointToProject)

Project a point onto the plane (shortest point)

See also
SPlane.ProjDir()
Parameters
pointToProject(SPoint) The point to project onto the plane
Return values
ret.ErrorCode(number) The error code
  • 0: No error
  • 1: An error occurred
ret.Point(SPoint) The projected point

◆ ProjDir() [1/2]

Object SPlane::ProjDir ( SMultiline  multilineToProject,
SVector  direction 
)

Project a polyline onto the plane along a given direction.

See also
SPlane.Proj3D()
Parameters
multilineToProject(SMultiline) The multiline to project onto the plane
direction(SVector) The projection direction
Return values
ret.ErrorCode(number) The error code
  • 0: OK, No error
  • 1: No projection found; maybe direction is parallel to the plane
  • 2: An error occurred
ret.Multi(SMultiline) The projected polyline

◆ ProjDir() [2/2]

Object SPlane::ProjDir ( SPoint  pointToProject,
SVector  projectionVector 
)

Project a point onto the plane along a given direction.

See also
SPlane.Proj3D(), SCloud.ProjDir(), SPoly.ProjDir(), SMultiline.ProjDir()
Parameters
pointToProject(SPoint) The point to project onto the plane
projectionVector(SVector) The projection direction
Return values
ret.ErrorCode(number) The error code
  • 0: No error
  • 1: An error occurred
ret.Point(SPoint) The projected point

◆ SetLength()

SPlane::SetLength ( number  length)

Set the length.

Parameters
length(number) The length of the plane

◆ SetWidth()

SPlane::SetWidth ( number  width)

Set the width.

Parameters
width(number) The width of the plane

◆ toString()

string SPlane::toString ( )

Get the type of the variable.

Returns
(string) The type name

◆ ValuesToString()

string SPlane::ValuesToString ( )

Get a debug string representation of the plane.

Returns
(string) A debug string representing the plane