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

ScriptUtil is a various toolbox with features to get paths, work on the tree view, adjust zoom and views, etc.
. More...

Enumerations

enum  SketchFabCategories {
  Animals_Creatures , Architecture , Cars_Vehicles , Characters ,
  Cultural_Heritage , Gaming , Places_Scenes , Product_Technology ,
  Weapons
}
 
enum  ViewDirEnum {
  AXIS_X , AXIS_Y , AXIS_Z , AXIS_REVERSE_X ,
  AXIS_REVERSE_Y , AXIS_REVERSE_Z
}
 Set of the view direction. More...
 
enum  ViewModeEnum { PERSPECTIVE , ORTHOGRAPHIC }
 Set of the view direction. More...
 

Functions

String ApplicationPath ()
 This function will return the application path. More...
 
 ClearDoc ()
 To clear all the document and the trash.
Can be useful to begin with a blank document. More...
 
Array ConvertNumberToString (Number iNumberToConvert, String iLocale="")
 Convert the number to a string using the given locale settings. More...
 
 copydircontent (String DirOrg, String DirDest)
 Copy the content of one folder to another all files and subfolders, recursively. More...
 
Array CreatePicture (String FileName, Number Height, Number Width, Number Background, Number TextHeightCoef)
 To create a picture of the current scene.
. More...
 
String CurrentScriptPath ()
 This function will return the current script path of the first script evaluated (not the include files) More...
 
Number Execute (String Program, Array< String > Arguments)
 Starts the program program with the arguments arguments in a new process, waits for it to finish, and then returns the exit code of the process. Any data the new process writes to the console is forwarded to the calling process. If the process cannot be started, -2 is returned. If the process crashes, -1 is returned. Otherwise, the process' exit code is returned. More...
 
Array Export3DPDF (String FileName, Array exportSettings=Array())
 To export the content of the 3D scene in a 3D PDF.
. More...
 
 FlushDisplay ()
 Blocking function waiting for all visible objects to be ready to be displayed. This function is useful for objects like clouds which used an optimized structure computed asynchronously (in another thread). More...
 
Array GetCameraDirection (SPoint iTargetPt)
 To get the camera direction from the camera position to the target pointed by the camera (the point the camera is looking at). This vector is not normalized. More...
 
Array GetCameraMode ()
 To check whether the camera mode is in perspective or orthographic view . More...
 
Array GetCameraPosition ()
 To get the camera position. More...
 
Array GetCoordSysTransf ()
 Get the transformation matrix of the current local coordinate system if exists. More...
 
Array GetListSeparator (String iLocale="")
 Function to get the separator list in the given locale settings. More...
 
String GetOpenFileName (String Caption, String Filter, String DefaultPath="")
 This is a convenience function that returns an existing file selected by the user. If the user presses Cancel, it returns a null string. More...
 
QStringList GetOpenFileNames (String Caption, String Filter, String DefaultPath="")
 This is a convenience function that returns a table of existing files selected by the user. If the user presses Cancel, it returns an empty table. More...
 
String GetOpenFolder (String Caption, String DefaultPath="")
 This is a convenience function that returns an existing folder selected by the user. If the user presses Cancel, it returns a null string. More...
 
String GetSaveFileName (String Caption, String Filter, String DefaultPath="")
 This is a convenience function that will return a file name selected by the user. The file does not have to exist. If the user presses Cancel, it returns a null string. More...
 
Number GetScaleFactor ()
 Get the scale factor permitting to convert the current document unit to mm. More...
 
Array GetThousandSeparator (String iLocale="")
 Function to get the separator used for the thousands in the given locale settings. More...
 
 Include (String FileName)
 To include other javascript files. More...
 
Array IsCameraLocked ()
 To check whether the camera is locked (no rotation possible) . More...
 
 KeepOnlyCurrentView ()
 Keep only current view. More...
 
 LockCamera (Boolean lock)
 Lock the camera (no rotation possible) More...
 
Boolean mkdir (String DirName)
 Creates a sub-directory called DirName. Returns true on success; otherwise returns false. If the directory already exists when this function is called, it will return false. More...
 
Array OpenDoc (String FileName, Boolean ClearDoc, Boolean ApplyUnit)
 To load an .3dr file, all the content of the file will be load in the current document.
If you want to access to an element in the script, you can use FromClick(), or FromName() function. More...
 
Array OpenRsh (String FileName, Boolean ClearDoc, Boolean ApplyUnit)
 To load an .3dr file, all the content of the file will be load in the current document.
If you want to access to an element in the script, you can use FromClick(), or FromName() function. More...
 
Boolean OpenUrl (String Url)
 Opens the given url in the appropriate Web browser for the user's desktop environment, and returns true if successful; otherwise returns false. More...
 
 RemoveSplit ()
 Remove split on current view. More...
 
 Repaint ()
 To force Repaint scene of the current document. More...
 
Array SaveDoc (String FileName, Boolean IsOverWrite)
 To save an .3dr file, all the content of the current document will be save.
If an object was created in the script and wasn't add to the document by calling the function AddToDoc(), this object will not be saved. More...
 
Array SaveRsh (String FileName, Boolean IsOverWrite)
 To save an .3dr file, all the content of the current document will be save.
If an object was created in the script and wasn't add to the document by calling the function AddToDoc(), this object will not be saved. More...
 
String ScriptPath ()
 This function will return the sample script path. More...
 
Array SendToSketchFab (Array< SComp > CompToExport, String Token, String Name, String Description, String Tags, SketchFabCategories Category)
 Send a cloud or mesh in SketchFab platform. . More...
 
 SetActiveView (uint viewNumber,)
 Change the active view. i.e set the focus to the view viewNumber. zero-based index. More...
 
 SetCameraMode (ViewModeEnum Mode)
 To set the camera in perspective or orthographic view. More...
 
 SetTextSize (Number Size)
 To define character height inside the graphic scene. More...
 
 SetViewDir (SVector Dir, SVector Up)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Update the direction of the view. More...
 
 SetViewDir (ViewDirEnum Dir)
 Update the direction of the view. More...
 
 ShowOnly (Array< SComp > compsToShowOnly)
 Show only input objects. More...
 
 ShowOnlyInActiveView (Array< SComp > compsToShowOnly)
 Show only input objects in the specified view. More...
 
 Sleep (Number Milliseconds)
 To sleep the current script, this sleep function will not block interface. More...
 
 SplitHor ()
 Split current view horizontally. More...
 
 SplitVert ()
 Split current view vertically. More...
 
String TempPath ()
 Returns the absolute path of the system's temporary directory. More...
 
Number ToLocaleNumber (String StringToConvert)
 to convert the string to number using the system's locale settings More...
 
String ToLocaleString (Number NumberToConvert)
 to convert a number in a string using the system's locale settings More...
 
 trayCreate ()
 Create tray icon
Hide current windows
Show tray icon. More...
 
 trayRemove ()
 Display application windows
Hide tray icon. More...
 
 ZoomAll ()
 To make a zoom on all the visible SComp. More...
 
 ZoomFactor (Number factor)
 Zoom the scene. More...
 
 ZoomOn (Array< SComp > TableOfObjects, Number milliseconds)
 To make a zoom on some SComp. More...
 

Detailed Description

ScriptUtil is a various toolbox with features to get paths, work on the tree view, adjust zoom and views, etc.
.

Warning
How to use function from namespace ScriptUtil ?
Directly use the function name, without any namespace.
CreateGroup('MyGroup','Mesh Group');
ZoomAll()
To make a zoom on all the visible SComp.

Enumeration Type Documentation

◆ SketchFabCategories

Enumerator
Animals_Creatures 
Architecture 
Cars_Vehicles 
Characters 
Cultural_Heritage 
Gaming 
Places_Scenes 
Product_Technology 
Weapons 

◆ ViewDirEnum

Set of the view direction.

Enumerator
AXIS_X 
AXIS_Y 
AXIS_Z 
AXIS_REVERSE_X 
AXIS_REVERSE_Y 
AXIS_REVERSE_Z 

◆ ViewModeEnum

Set of the view direction.

Enumerator
PERSPECTIVE 
ORTHOGRAPHIC 

Function Documentation

◆ ApplicationPath()

String ScriptUtil::ApplicationPath ( )

This function will return the application path.

◆ ClearDoc()

ScriptUtil::ClearDoc ( )

To clear all the document and the trash.
Can be useful to begin with a blank document.

◆ ConvertNumberToString()

Array ScriptUtil::ConvertNumberToString ( Number  iNumberToConvert,
String  iLocale = "" 
)

Convert the number to a string using the given locale settings.

Return values
Thenumber converted into local string.
Parameters
[in]iNumberToConvertThe number to convert to string
[in]iLocaleName of the locale language and country settings, in the form language-COUNTRY using the corresponding ISO codes
for example: "en-US" for United-States English, "en-GB" for Great-Britain English, "fr-FR" for French
If empty, the locale settings of the computer are used

◆ copydircontent()

ScriptUtil::copydircontent ( String  DirOrg,
String  DirDest 
)

Copy the content of one folder to another all files and subfolders, recursively.

◆ CreatePicture()

Array ScriptUtil::CreatePicture ( String  FileName,
Number  Height,
Number  Width,
Number  Background,
Number  TextHeightCoef 
)

To create a picture of the current scene.
.

Return values
Array.ErrorCodeThe error code:
  • 0 OK
  • 1 An exception occurred !
  • 2 Partial save or no save ; demo version !
Parameters
[in]FileNameimage file name
[in]Heightnumber of pixels height. If <0, this number is adjusted to insure the picture is no too large for photo editor
[in]Widthnumber of pixels width. If <0, this number is adjusted to insure the picture is no too large for photo editor
[in]BackgroundBackground type
  • 0 Same background as on screen
  • 1 Always white.
[in]TextHeightCoefText height coef multiplication factor
  • 0 Same as on screen
  • <1 Smaller.
  • >1 Greater

◆ CurrentScriptPath()

String ScriptUtil::CurrentScriptPath ( )

This function will return the current script path of the first script evaluated (not the include files)

◆ Execute()

Number ScriptUtil::Execute ( String  Program,
Array< String >  Arguments 
)

Starts the program program with the arguments arguments in a new process, waits for it to finish, and then returns the exit code of the process. Any data the new process writes to the console is forwarded to the calling process. If the process cannot be started, -2 is returned. If the process crashes, -1 is returned. Otherwise, the process' exit code is returned.

print(Execute("C:\\LaunchPythonScript.bat", ["test_1337", "3.1415"]));
Number Execute(String Program, Array< String > Arguments)
Starts the program program with the arguments arguments in a new process, waits for it to finish,...

◆ Export3DPDF()

Array ScriptUtil::Export3DPDF ( String  FileName,
Array  exportSettings = Array() 
)

To export the content of the 3D scene in a 3D PDF.
.

Note
This function will add the suffix "pdf" at the end of the filename, if the user haven't done it
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 = Export3DPDF( 'C:/MyPdfFile.pdf'); // Valid syntax\n
var res2 = Export3DPDF( 'C:\\MyPdfFile.pdf'); // Valid syntax\n
var res3 = Export3DPDF( 'C:\MyPdfFile.pdf'); // Invalid syntax
var labelDir = SVector.New(0,0,1)
var exportOption = {
basePdfFilePath : 'C:/MyBasicPdfFile.pdf',
pageIndex : -2, //insert at last page
labelDirection : labelDir,
labelColorRed : 1,
labelColorGreen : 0,
labelColorBlue : 0,
contourLineTextDistance : 15,
contourLineColorRed : 0,
contourLineColorGreen : 1,
contourLineColorBlue : 0,
}
var res4 = Export3DPDF( 'C:/MyPdfFile.pdf', exportOption ); // insert the scene at the last page of C:/MyBasicPdfFile.pdf and save the final file as C:/MyPdfFile.pdf
The mathematical object vector.
Definition: SVector3.h:26
static SVector New()
Default constructor to initialize all values with zero.
Array Export3DPDF(String FileName, Array exportSettings=Array())
To export the content of the 3D scene in a 3D PDF. .
Return values
Array.ErrorCodeThe error code:
  • 0 OK
  • 1 An exception occurred !
  • 2 The file basePdfFilePath does not exist !
  • 3 A color value is not in the right range
Parameters
[in]FileNameThe file path to write in
[in]exportSettingsdata structure containing export options for 3DPDF
  • basePdfFilePath (string value): path of the existing pdf to append (can be equal to FileName)
  • pageIndex (integer numerical value): index of the page before the inserted page. -1: insert at first page (default), -2: insert at last page, 0..N: insert after page n
  • labelDirection (SVector value): direction of the line of label
  • labelColorRed (Number number value): Red color of label, between [0-1]
  • labelColorGreen (Number number value): Green color of label, between [0-1]
  • labelColorBlue (Number number value): Blue color of label, between [0-1]
  • contourLineTextDistance (Number number value): distance between text of contourLine
  • contourLineColorRed (Number number value): Red color of contourLine, between [0-1]
  • contourLineColorGreen (Number number value): Green color of contourLine, between [0-1]
  • contourLineColorBlue (Number number value): Blue color of contourLine, between [0-1]

◆ FlushDisplay()

ScriptUtil::FlushDisplay ( )

Blocking function waiting for all visible objects to be ready to be displayed. This function is useful for objects like clouds which used an optimized structure computed asynchronously (in another thread).

◆ GetCameraDirection()

Array ScriptUtil::GetCameraDirection ( SPoint  iTargetPt)

To get the camera direction from the camera position to the target pointed by the camera (the point the camera is looking at). This vector is not normalized.

Return values
Array.ErrorCodeThe error code:
  • 0 OK
  • 1 An error occurred
Array.VectorThe camera direction
Parameters
[in]iTargetPtOptional point target in the camera plane. If the point is null the returned direction is the normal to camera plane.

◆ GetCameraMode()

Array ScriptUtil::GetCameraMode ( )

To check whether the camera mode is in perspective or orthographic view .

Return values
Array.ErrorCodeThe error code:
  • 0 OK
  • 1 An error occurred
Array.ValueThe camera mode (ViewModeEnum)

◆ GetCameraPosition()

Array ScriptUtil::GetCameraPosition ( )

To get the camera position.

Return values
Array.ErrorCodeThe error code:
  • 0 OK
  • 1 An error occurred
Array.PointThe camera position

◆ GetCoordSysTransf()

Array ScriptUtil::GetCoordSysTransf ( )

Get the transformation matrix of the current local coordinate system if exists.

var point = SPoint.New(1, 2, 3);
var res = GetCoordSysTransf();
if(res.ErrorCode == 0) // Check if there is a local coordinate system
point.ApplyTransformation(res.MatW2L);
3D point manipulation class. The SPoint creation can be done by calling the static functions:
Definition: SPoint.h:23
static SPoint New()
Default constructor to create an empty new SPoint. X = Y = Z// TESTED.
Array GetCoordSysTransf()
Get the transformation matrix of the current local coordinate system if exists.
Return values
Array.ErrorCodeThe error code:
  • 0: OK, no error
  • 1: No local coordinate system is activated.
Array.MatW2LThe transformation matrix from World to Local coordinate system.
Array.MatL2WThe transformation matrix from Local to World coordinate system.

◆ GetListSeparator()

Array ScriptUtil::GetListSeparator ( String  iLocale = "")

Function to get the separator list in the given locale settings.

Return values
Theseparator list. If the decimal separator of the locale settings is '.' the list separator is ',' else it is ';'.
Parameters
[in]iLocaleName of the locale language and country settings, in the form language-COUNTRY using the corresponding ISO codes
for example: "en-US" for United-States English, "en-GB" for Great-Britain English, "fr-FR" for French
If empty, the locale settings of the computer are used

◆ GetOpenFileName()

String ScriptUtil::GetOpenFileName ( String  Caption,
String  Filter,
String  DefaultPath = "" 
)

This is a convenience function that returns an existing file selected by the user. If the user presses Cancel, it returns a null string.

Parameters
[in]Captionname of the dialog box shown to the user. Example: "Select file to open"
[in]Filtername of the filter to show only relevant files to user. Example: "*.stl" or "*.stl; *.ply" or "Mesh files (*.stl; *.ply)" or "*.stl;;*.ply"
[in]DefaultPathpath to a default folder. Example: "C:\\Data\\"

◆ GetOpenFileNames()

QStringList ScriptUtil::GetOpenFileNames ( String  Caption,
String  Filter,
String  DefaultPath = "" 
)

This is a convenience function that returns a table of existing files selected by the user. If the user presses Cancel, it returns an empty table.

Parameters
[in]Captionname of the dialog box shown to the user. Example: "Select file to open"
[in]Filtername of the filter to show only relevant files to user. Example: "*.stl" or "*.stl; *.ply" or "Mesh files (*.stl; *.ply)" or "*.stl;;*.ply"
[in]DefaultPathpath to a default folder. Example: "C:\\Data\\"

◆ GetOpenFolder()

String ScriptUtil::GetOpenFolder ( String  Caption,
String  DefaultPath = "" 
)

This is a convenience function that returns an existing folder selected by the user. If the user presses Cancel, it returns a null string.

Parameters
[in]Captionname of the dialog box shown to the user. Example: "Select folder to open"
[in]DefaultPathpath to a default folder. Example: "C:\\Data\\"

◆ GetSaveFileName()

String ScriptUtil::GetSaveFileName ( String  Caption,
String  Filter,
String  DefaultPath = "" 
)

This is a convenience function that will return a file name selected by the user. The file does not have to exist. If the user presses Cancel, it returns a null string.

Parameters
[in]Captionname of the dialog box shown to the user. Example: "Select file to save"
[in]Filtername of the filter to show only relevant files to user. Example: "PTS files (*.pts)"
[in]DefaultPathpath to a default folder. Example: "C:\\Data\\"

◆ GetScaleFactor()

Number ScriptUtil::GetScaleFactor ( )

Get the scale factor permitting to convert the current document unit to mm.

◆ GetThousandSeparator()

Array ScriptUtil::GetThousandSeparator ( String  iLocale = "")

Function to get the separator used for the thousands in the given locale settings.

Return values
Theseparator.
Parameters
[in]iLocaleName of the locale language and country settings, in the form language-COUNTRY using the corresponding ISO codes
for example: "en-US" for United-States English, "en-GB" for Great-Britain English, "fr-FR" for French
If empty, the locale settings of the computer are used

◆ Include()

ScriptUtil::Include ( String  FileName)

To include other javascript files.

Parameters
FileNameThe file name path

◆ IsCameraLocked()

Array ScriptUtil::IsCameraLocked ( )

To check whether the camera is locked (no rotation possible) .

Return values
Array.ErrorCodeThe error code:
  • 0 OK
  • 1 An error occurred
Array.ValueIs the camera locked ? (Boolean)

◆ KeepOnlyCurrentView()

ScriptUtil::KeepOnlyCurrentView ( )

Keep only current view.

Return values
0OK, no error
1other error

◆ LockCamera()

ScriptUtil::LockCamera ( Boolean  lock)

Lock the camera (no rotation possible)

Parameters
[in]locklocking or unlocking the camera

◆ mkdir()

Boolean ScriptUtil::mkdir ( String  DirName)

Creates a sub-directory called DirName. Returns true on success; otherwise returns false. If the directory already exists when this function is called, it will return false.

◆ OpenDoc()

Array ScriptUtil::OpenDoc ( String  FileName,
Boolean  ClearDoc,
Boolean  ApplyUnit 
)

To load an .3dr file, all the content of the file will be load in the current document.
If you want to access to an element in the script, you can use FromClick(), or FromName() function.

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 = OpenDoc( 'C:/MyRshFile.3dr' ); // Valid syntax\n
var res2 = OpenDoc( 'C:\\MyRshFile.3dr' ); // Valid syntax\n
var res3 = OpenDoc( 'C:\MyRshFile.3dr' ); // Invalid syntax
Array OpenDoc(String FileName, Boolean ClearDoc, Boolean ApplyUnit)
To load an .3dr file, all the content of the file will be load in the current document....
Return values
Array.ErrorCodeThe error code:
  • 0: OK, no error
  • 1: An exception occurred, or irrecoverable error or file does not exist
Parameters
[in]FileNameThe file path
[in]ClearDocTrue if we must clear the current document before adding the new element in the document, else false. you can use ClearDoc() instead
[in]ApplyUnitTrue if we want to load the unit from the file to the current document.

◆ OpenRsh()

Array ScriptUtil::OpenRsh ( String  FileName,
Boolean  ClearDoc,
Boolean  ApplyUnit 
)

To load an .3dr file, all the content of the file will be load in the current document.
If you want to access to an element in the script, you can use FromClick(), or FromName() function.

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 :
This function is deprecated, please used OpenDoc().
var res = OpenRsh( 'C:/MyRshFile.3dr' ); // Valid syntax\n
var res2 = OpenRsh( 'C:\\MyRshFile.3dr' ); // Valid syntax\n
var res3 = OpenRsh( 'C:\MyRshFile.3dr' ); // Invalid syntax
Array OpenRsh(String FileName, Boolean ClearDoc, Boolean ApplyUnit)
To load an .3dr file, all the content of the file will be load in the current document....
Return values
Array.ErrorCodeThe error code:
  • 0: OK, no error
  • 1: An exception occurred, or irrecoverable error or file does not exist
  • 2: Incomplete read, because the file is probably corrupted or premature EOF.
  • 3: Incomplete read, some object could not be read because the version of the file is too recent or because some objects type are unknown. The software version should be upgraded.
  • 4: Resetting
  • 5: The CAD license is not authorized. CAD objects of the file are converted into simple reshaper Objects (polyhedrons, lines)
  • 6: A plugin is missing in order to read completely this component.
Parameters
[in]FileNameThe file path
[in]ClearDocTrue if we must clear the current document before adding the new element in the document, else false. you can use ClearDoc() instead
[in]ApplyUnitTrue if we want to load the unit from the file to the current document.

◆ OpenUrl()

Boolean ScriptUtil::OpenUrl ( String  Url)

Opens the given url in the appropriate Web browser for the user's desktop environment, and returns true if successful; otherwise returns false.

◆ RemoveSplit()

ScriptUtil::RemoveSplit ( )

Remove split on current view.

Return values
0OK, no error
1no split to remove: only 1 view in the document
2other error

◆ Repaint()

ScriptUtil::Repaint ( )

To force Repaint scene of the current document.

◆ SaveDoc()

Array ScriptUtil::SaveDoc ( String  FileName,
Boolean  IsOverWrite 
)

To save an .3dr file, all the content of the current document will be save.
If an object was created in the script and wasn't add to the document by calling the function AddToDoc(), this object will not be saved.

Note
This function will add the suffix "3dr" at the end of the filename, if the user haven't done it
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 = SaveDoc( 'C:/MyRshFile.3dr', false ); // Valid syntax\n
var res2 = SaveDoc( 'C:\\MyRshFile.3dr', false ); // Valid syntax\n
var res3 = SaveDoc( 'C:\MyRshFile.3dr', false ); // Invalid syntax
Array SaveDoc(String FileName, Boolean IsOverWrite)
To save an .3dr file, all the content of the current document will be save. If an object was created ...
Return values
Array.ErrorCodeThe error code:
  • 0 OK
  • 1 An exception occurred !
  • 2 Partial save or no save ; demo version !
Parameters
[in]FileNameThe file path to save
[in]IsOverWriteOverwrite if necessary, if the file exist already

◆ SaveRsh()

Array ScriptUtil::SaveRsh ( String  FileName,
Boolean  IsOverWrite 
)

To save an .3dr file, all the content of the current document will be save.
If an object was created in the script and wasn't add to the document by calling the function AddToDoc(), this object will not be saved.

Note
This function will add the suffix "3dr" at the end of the filename, if the user haven't done it
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 = SaveRsh( 'C:/MyRshFile.3dr', false ); // Valid syntax\n
var res2 = SaveRsh( 'C:\\MyRshFile.3dr', false ); // Valid syntax\n
var res3 = SaveRsh( 'C:\MyRshFile.3dr', false ); // Invalid syntax
Array SaveRsh(String FileName, Boolean IsOverWrite)
To save an .3dr file, all the content of the current document will be save. If an object was created ...
Return values
Array.ErrorCodeThe error code:
  • 0 OK
  • 1 An exception occurred !
  • 2 Partial save or no save ; demo version !
Parameters
[in]FileNameThe file path to save
[in]IsOverWriteOverwrite if necessary, if the file exist already

◆ ScriptPath()

String ScriptUtil::ScriptPath ( )

This function will return the sample script path.

◆ SendToSketchFab()

Array ScriptUtil::SendToSketchFab ( Array< SComp CompToExport,
String  Token,
String  Name,
String  Description,
String  Tags,
SketchFabCategories  Category 
)

Send a cloud or mesh in SketchFab platform. .

Return values
Array.StringThe link result
Array.ErrorCodeThe error code:
  • 0: No error.
  • 1: An error occurred.
Parameters
[in]CompToExporttable of object to export
[in]TokenAPI Token to your account
[in]NameName of the object
[in]DescriptionDescription of the object
[in]TagsTags to describe the object
[in]CategoryCategory to your object. Please refer to SketchFab categories to choose

◆ SetActiveView()

ScriptUtil::SetActiveView ( uint  viewNumber)

Change the active view. i.e set the focus to the view viewNumber. zero-based index.

Return values
0OK, no error
1viewNumber is not present
Parameters
[in]viewNumbernumber of view to activate

◆ SetCameraMode()

ScriptUtil::SetCameraMode ( ViewModeEnum  Mode)

To set the camera in perspective or orthographic view.

Parameters
[in]ModePerspective or orthographic

◆ SetTextSize()

ScriptUtil::SetTextSize ( Number  Size)

To define character height inside the graphic scene.

Parameters
[in]Size8 <= Size <= 22

◆ SetViewDir() [1/2]

ScriptUtil::SetViewDir ( SVector  Dir,
SVector  Up 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Update the direction of the view.

Parameters
[in]DirDirection to set
[in]UpUp direction

◆ SetViewDir() [2/2]

ScriptUtil::SetViewDir ( ViewDirEnum  Dir)

Update the direction of the view.

Parameters
[in]DirUse a predefined direction

◆ ShowOnly()

ScriptUtil::ShowOnly ( Array< SComp compsToShowOnly)

Show only input objects.

Parameters
[in]compsToShowOnlytable of object to show only

◆ ShowOnlyInActiveView()

ScriptUtil::ShowOnlyInActiveView ( Array< SComp compsToShowOnly)

Show only input objects in the specified view.

Parameters
[in]compsToShowOnlytable of object to show only

◆ Sleep()

ScriptUtil::Sleep ( Number  Milliseconds)

To sleep the current script, this sleep function will not block interface.

Parameters
MillisecondsDuration to wait (in milliseconds)

◆ SplitHor()

ScriptUtil::SplitHor ( )

Split current view horizontally.

Return values
0OK, no error
1other error

◆ SplitVert()

ScriptUtil::SplitVert ( )

Split current view vertically.

Return values
0OK, no error
1other error

◆ TempPath()

String ScriptUtil::TempPath ( )

Returns the absolute path of the system's temporary directory.

◆ ToLocaleNumber()

Number ScriptUtil::ToLocaleNumber ( String  StringToConvert)

to convert the string to number using the system's locale settings

◆ ToLocaleString()

String ScriptUtil::ToLocaleString ( Number  NumberToConvert)

to convert a number in a string using the system's locale settings

◆ trayCreate()

ScriptUtil::trayCreate ( )

Create tray icon
Hide current windows
Show tray icon.

Return values
0OK, no error
1other error

◆ trayRemove()

ScriptUtil::trayRemove ( )

Display application windows
Hide tray icon.

Return values
0OK, no error
1other error

◆ ZoomAll()

ScriptUtil::ZoomAll ( )

To make a zoom on all the visible SComp.

◆ ZoomFactor()

ScriptUtil::ZoomFactor ( Number  factor)

Zoom the scene.

Parameters
[in]factor

◆ ZoomOn()

ScriptUtil::ZoomOn ( Array< SComp TableOfObjects,
Number  milliseconds 
)

To make a zoom on some SComp.

Parameters
[in]TableOfObjectsWill make a zoom on this SComp
[in]millisecondsTime to make the zoom on it will be progressive