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

The SComp class is an abstract class.
Use derived classes SCircle, SCylinder, SCloud, SLabel, SMultiline, SPlane, SPoint, SPoly, SClippingPlane.

. More...

Inheritance diagram for SComp:
SObject SClipping SCloud SCwCloud SFeature SImage SLabel SMultiline SPoint SPoly SReport SReportData SSetMultiline SShape SViewSet

Public Types

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

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

Detailed Description

The SComp class is an abstract class.
Use derived classes SCircle, SCylinder, SCloud, SLabel, SMultiline, SPlane, SPoint, SPoly, SClippingPlane.

.

  • This class allows to display 3D objects in the current document.
    All derived classes can be added to the scene or removed from the scene
    var myCircle = SCircle.New();
    myCircle.AddToDoc(); // Display the circle in the current document
    myCircle.RemoveFromDoc(); // The circle disappears from the document
  • SComp provide functionality to manipulate the 3D Object: translation, rotation, scale.
    var myCircle = SCircle.New(center, normal, radius);
    var mat = SMatrix.New();
    mat.InitScale(SPoint.New(), 5, 5, 5);
    myCircle.ApplyTransformation(mat); // Apply a scale on the circle 'myCircle'
  • And to manage aspect: SetVisibility(), SetColors(), SetTransparency().
    Note
    A useful function is GetBoundingBox() which returns the upper point and lower point of the bounding box.

Member Enumeration Documentation

◆ RepresentationTypeEnum

The different representation types for inherited classes.
Use (inherited class).SMOOTH. Example: for a cloud, use SCloud.SMOOTH.

Enumerator
SMOOTH 
FLAT 
WIRE 
SMOOTH_WIRE 
FLAT_WIRE 
SMOOTH_ROTWIRE 
FLAT_ROTWIRE 
TEXTURE 
INSPECTION 

Member Function Documentation

◆ AddToDoc

SComp::AddToDoc ( )
slot

To add the object to the document.

See also
SLabel::AddSComp() the label obtains SComp ownership

◆ All

static Array SComp::All ( Number  VisCrit)
inlinestaticslot

To get all the SComp in the document.

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

◆ ApplyTransformation

SComp::ApplyTransformation ( SMatrix  Matrix)
slot

To apply a geometric transformation to the current object by making a product with the given matrix.

See also
Translate
Parameters
[in]MatrixThe transformation matrix

◆ Clear

SComp::Clear ( )
inlineslot

To deallocate object memory.

◆ FromClick

static Array SComp::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.Compthe SComp selected

◆ FromName

static Array SComp::FromName ( String  Name)
inlinestaticslot

Search all the component with the given name.

Return values
Arrayall the SComp with the given name

◆ FromSel

static Array SComp::FromSel ( )
staticslot

To get all the selected SComp.

Return values
Arrayall the SComp selected

◆ GetBoundingBox

Array SComp::GetBoundingBox ( )
slot

Calculates the bounding box of the component.

Return values
Array.ErrorCodeThe error code:
  • 0 OK, the bounding box could be calculated
  • 1 if the bounding box could NOT be calculated
Array.LowPointThe lower SPoint
Array.UpPointThe upper SPoint

◆ GetColors

Array SComp::GetColors ( )
slot

To get the colors of the component.

Return values
Array.Redthe red color (0 to 1)
Array.Greenthe green color (0 to 1)
Array.Bluethe blue color (0 to 1)

◆ GetFolderName

String SComp::GetFolderName ( )
slot
Returns
The component containing folder's name

◆ GetName

String SComp::GetName ( )
slot
Returns
The component's name

◆ Invert

SComp::Invert ( )
slot

Normal of the component is inverted.

◆ IsInDoc

Boolean SComp::IsInDoc ( )
slot

Return if the component is in the document or not.

Returns
Return true if the component is in the document.

◆ IsVisible

Boolean SComp::IsVisible ( )
slot
Return values
trueThe component is visible
falseThe component is not visible
See also
SetVisibility()

◆ MoveToGroup

SComp::MoveToGroup ( String  GroupPath,
Boolean  MoveInsideTopParent 
)
slot

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.

Warning
The object must be inside the document. Else this function won't do anything.
// After the execution of the code below, the plane will be in the group "Geometric Group" (the top parent),
// inside the sub group "Building" and sub sub group "Wall".
myPlane.MoveToGroup("Building/Wall");
// After the execution of the code below, this other plane will be in the top group "Building Group" and
// inside the sub group "Wall".
myOtherPlane.MoveToGroup("/Building Group/Wall", false);
See also
AddToDoc
Parameters
[in]GroupPathThe path where the object will be moved. Each group must be separated by character '/'.
[in]MoveInsideTopParentIf true (default value), the object will be moved inside the top
  • parent group there it is ("Geometric Group", "Cloud Group", "Mesh Group", etc.). Else, if false, the first group in the path will be the new top parent.

◆ RemoveFromDoc

SComp::RemoveFromDoc ( )
slot

To remove the object from the document.

◆ SetClippable

SComp::SetClippable ( Boolean  clipping)
slot

Set clippable or not.

◆ SetColors

SComp::SetColors ( Number  Red,
Number  Green,
Number  Blue 
)
slot

Sets the colors of the component.

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

◆ SetName

SComp::SetName ( String  ComponentName)
slot

To set the component's name.

Parameters
[in]ComponentNameThe new component name

◆ SetRepresentationType

SComp::SetRepresentationType ( RepresentationTypeEnum  Representation)
slot

The shading type of the component is modified.

Parameters
[in]RepresentationThe representation type

◆ SetTransparency

SComp::SetTransparency ( Number  Alpha)
slot

Sets the transparency of the component.

Parameters
[in]AlphaTransparency 0 to 255

◆ SetVisibility

SComp::SetVisibility ( Boolean  Visible)
slot

Sets the component to be visible, or not visible.

See also
IsVisible()
Parameters
[in]VisibleTrue to set the component visible, else false

◆ toString [1/2]

String SComp::toString ( )
slot

Get the type of the variable.

◆ toString [2/2]

String SComp::toString ( )
slot

Get the type of the variable.

◆ Translate

SComp::Translate ( SVector  Vector)
slot

To make a translation of the current object with an SVector.

See also
ApplyTransformation
Parameters
[in]VectorThe translation vector