Cyclone 3DR Script
from Technodigit, part of Hexagon. Copyright 1997-2022.
 
Loading...
Searching...
No Matches
SGeneral.h
1
2
3
5
6#pragma once
7
8#include "RshPluginScript/RshPluginScriptDefines.h"
9#include <QtScript/QScriptEngine>
10
11#ifndef FCT_DOC
12namespace rsh::ScriptBinding
13{
14#endif // !FCT_DOC
15
25namespace ScriptUtil
26{
27#ifndef FCT_DOC
32class EnumsWrapper : public QObject
33{
34 Q_OBJECT;
35 Q_ENUMS(ViewDirEnum);
36 Q_ENUMS(ViewModeEnum);
37 Q_ENUMS(SketchFabCategories);
38
39public:
40#endif
41 //------------------------------------------------
42 // the enum must be defined here
43 //------------------------------------------------
44
48 {
49 AXIS_X, // view on X axis, Z is up
50 AXIS_Y, // view on Y axis, Z is up
51 AXIS_Z, // view on Z axis, Y is up
52 AXIS_REVERSE_X, // view on -X axis, Z is up
53 AXIS_REVERSE_Y, // view on -Y axis, Z is up
54 AXIS_REVERSE_Z // view on -Z axis, Y is up
55 };
56
60 {
61 PERSPECTIVE, // To use the perspective view
62 ORTHOGRAPHIC // To use the orthographic view
63 };
64
65 // Set of categories names, to send in SketchFab
67 {
86 };
87
88#ifndef FCT_DOC
89
90public:
91 EnumsWrapper(){};
92 ~EnumsWrapper(){};
93};
94#endif
95
96
97#ifdef FCT_DOC
100 Sleep(Number Milliseconds
102);
103#else
104Array Sleep(
105 QScriptContext ipContext,
107 QScriptEngine ipEngine
109);
110#endif
111
112#ifdef FCT_DOC
116 Include(String FileName
118);
119#else
120Array Include(
121 QScriptContext ipContext,
123 QScriptEngine ipEngine
125);
126#endif
127
128#ifdef FCT_DOC
144 String FileName,
146 Boolean ClearDoc,
149 Boolean ApplyUnit
151);
152#else
153// TESTED
154Array OpenDoc(
155 QScriptContext ipContext,
157 QScriptEngine ipEngine
159);
160#endif
161
162#ifdef FCT_DOC
186 String FileName,
188 Boolean ClearDoc,
191 Boolean ApplyUnit
193);
194#else
195// TESTED
196Array OpenRsh(
197 QScriptContext ipContext,
199 QScriptEngine ipEngine
201);
202#endif
203
204#ifdef FCT_DOC
224 String FileName,
226 Boolean IsOverWrite
228);
229#else
230// NOT TESTED
231Array SaveDoc(
232 QScriptContext ipContext,
234 QScriptEngine ipEngine
236);
237#endif
238
239#ifdef FCT_DOC
259 String FileName,
261 Boolean IsOverWrite
263);
264#else
265// NOT TESTED
266Array SaveRsh(
267 QScriptContext ipContext,
269 QScriptEngine ipEngine
271);
272#endif
273
274#ifdef FCT_DOC
275
289 SComp CompToExport,
290 String Token,
291 String Name,
292 String Description,
293 String Tags,
294 SketchFabCategories Category);
295#else
296Array SendToSketchFab(
297 QScriptContext ipContext,
299 QScriptEngine ipEngine
301);
302#endif
303
304#ifdef FCT_DOC
308#else
309// TESTED
311 QScriptContext ipContext,
313 QScriptEngine ipEngine
315);
316#endif
317
318#ifdef FCT_DOC
321String ScriptPath();
322#else
323// TESTED
324Array ScriptPath(
325 QScriptContext ipContext,
327 QScriptEngine ipEngine
329);
330#endif
331
332#ifdef FCT_DOC
336#else
337// TESTED
338Array ApplicationPath(
339 QScriptContext ipContext,
341 QScriptEngine ipEngine
343);
344#endif
345
346#ifdef FCT_DOC
349String ToLocaleString(Number NumberToConvert);
350#else
351// TESTED
352Array ToLocaleString(
353 QScriptContext ipContext,
355 QScriptEngine ipEngine
357);
358#endif
359
360#ifdef FCT_DOC
363Number ToLocaleNumber( String StringToConvert);
364#else
365// TESTED
366Array ToLocaleNumber(
367 QScriptContext ipContext,
369 QScriptEngine ipEngine
371);
372#endif
373
374#ifdef FCT_DOC
379 String Caption,
381 String Filter,
383 String DefaultPath = ""
385);
386#else
387// TESTED
388Array GetOpenFileName(
389 QScriptContext ipContext,
391 QScriptEngine ipEngine
393);
394#endif
395
396#ifdef FCT_DOC
401 String Caption,
403 String Filter,
405 String DefaultPath = ""
407);
408#else
409// TESTED
410Array GetOpenFileNames(
411 QScriptContext ipContext,
413 QScriptEngine ipEngine
415);
416#endif
417
418#ifdef FCT_DOC
424 String Caption,
426 String Filter,
428 String DefaultPath = ""
430);
431#else
432// TESTED
433Array GetSaveFileName(
434 QScriptContext ipContext,
436 QScriptEngine ipEngine
438);
439#endif
440
441#ifdef FCT_DOC
446 String Caption,
448 String DefaultPath = ""
450);
451#else
452// TESTED?
453Array GetOpenFolder(
454 QScriptContext ipContext,
456 QScriptEngine ipEngine
458);
459#endif
460
461#ifdef FCT_DOC
465Boolean OpenUrl( String Url);
466#else
467// TESTED
468Array OpenUrl(
469 QScriptContext ipContext,
471 QScriptEngine ipEngine
473);
474#endif
475
476#ifdef FCT_DOC
479String TempPath();
480#else
481// TESTED
482Array TempPath(
483 QScriptContext ipContext,
485 QScriptEngine ipEngine
487);
488#endif
489
490#ifdef FCT_DOC
494 copydircontent( String DirOrg, String DirDest);
495#else
496// TESTED
497Array copydircontent(
498 QScriptContext ipContext,
500 QScriptEngine ipEngine
502);
503#endif
504
505#ifdef FCT_DOC
510Boolean mkdir( String DirName);
511#else
512// TESTED
513Array mkdir(
514 QScriptContext ipContext,
516 QScriptEngine ipEngine
518);
519#endif
520
521#ifdef FCT_DOC
529Number Execute( String Program, Array<String> Arguments);
530#else
531// TESTED
532Array Execute(
533 QScriptContext ipContext,
535 QScriptEngine ipEngine
537);
538#endif
539
540#ifdef FCT_DOC
545#else
546// TESTED
547Array ClearDoc(
548 QScriptContext ipContext,
550 QScriptEngine ipEngine
552);
553#endif
554
555#ifdef FCT_DOC
560);
565 SVector Dir,
567 SVector Up
569);
570#else
571// TESTED
572Array SetViewDir(
573 QScriptContext ipContext,
575 QScriptEngine ipEngine
577);
578#endif
579
580#ifdef FCT_DOC
584#else
585// TESTED
586Array ZoomAll(
587 QScriptContext ipContext,
589 QScriptEngine ipEngine
591);
592#endif
593
594#ifdef FCT_DOC
598 Array<SComp> TableOfObjects,
600 Number milliseconds
602);
603#else
604// TESTED
605Array ZoomOn(
606 QScriptContext ipContext,
608 QScriptEngine ipEngine
610);
611#endif
612
613#ifdef FCT_DOC
618);
619#else
620Array SetCameraMode(
621 QScriptContext ipContext,
623 QScriptEngine ipEngine
625);
626#endif
627
628#ifdef FCT_DOC
637#else
638Array GetCameraMode(
639 QScriptContext ipContext,
641 QScriptEngine ipEngine
643);
644#endif
645
646#ifdef FCT_DOC
655#else
656Array IsCameraLocked(
657 QScriptContext ipContext,
659 QScriptEngine ipEngine
661);
662#endif
663
664#ifdef FCT_DOC
667 LockCamera(Boolean lock
669);
670#else
671Array LockCamera(
672 QScriptContext ipContext,
674 QScriptEngine ipEngine
676);
677#endif
678
679#ifdef FCT_DOC
687 SPoint iTargetPt
689);
690#else
692 QScriptContext ipContext,
694 QScriptEngine ipEngine
696);
697#endif
698
699#ifdef FCT_DOC
707#else
709 QScriptContext ipContext,
711 QScriptEngine ipEngine
713);
714#endif
715
716#ifdef FCT_DOC
719 ZoomFactor(Number factor
721);
722#else
723// TESTED
724Array ZoomFactor(
725 QScriptContext ipContext,
727 QScriptEngine ipEngine
729);
730#endif
731
732#ifdef FCT_DOC
740 String FileName,
742 Number Height,
744 Number Width,
746 Number Background,
750 Number PointLineMagnification
754);
755#else
756// TESTED
757Array CreatePicture(
758 QScriptContext ipContext,
760 QScriptEngine ipEngine
762);
763#endif
764
765#ifdef FCT_DOC
769#else
770// TESTED
771Array Repaint(
772 QScriptContext ipContext,
774 QScriptEngine ipEngine
776);
777#endif
778
779#ifdef FCT_DOC
784#else
785// TESTED
786Array FlushDisplay(
787 QScriptContext ipContext,
789 QScriptEngine ipEngine
791);
792#endif
793
794#ifdef FCT_DOC
797 SetTextSize(Number Size
799);
800#else
801// TESTED
802Array SetTextSize(
803 QScriptContext ipContext,
805 QScriptEngine ipEngine
807);
808#endif
809
810#ifdef FCT_DOC
825#else
826// TESTED
828 QScriptContext ipContext,
830 QScriptEngine ipEngine
832);
833#endif
834
835#ifdef FCT_DOC
843#else
844Array trayCreate(
845 QScriptContext ipContext,
847 QScriptEngine ipEngine
849);
850#endif
851
852#ifdef FCT_DOC
859#else
860Array trayRemove(
861 QScriptContext ipContext,
863 QScriptEngine ipEngine
865);
866#endif
867
868#ifdef FCT_DOC
874#else
875Array SplitVert(
876 QScriptContext ipContext,
878 QScriptEngine ipEngine
880);
881#endif
882
883#ifdef FCT_DOC
889#else
890Array SplitHor(
891 QScriptContext ipContext,
893 QScriptEngine ipEngine
895);
896#endif
897
898#ifdef FCT_DOC
904#else
906 QScriptContext ipContext,
908 QScriptEngine ipEngine
910);
911#endif
912
913#ifdef FCT_DOC
920#else
921Array RemoveSplit(
922 QScriptContext ipContext,
924 QScriptEngine ipEngine
926);
927#endif
928
929#ifdef FCT_DOC
935 uint viewNumber,
937);
938#else
939Array SetActiveView(
940 QScriptContext ipContext,
942 QScriptEngine ipEngine
944);
945#endif
946
947#ifdef FCT_DOC
950 ShowOnly(Array<SComp> compsToShowOnly
952);
953#else
954Array ShowOnly(
955 QScriptContext ipContext,
957 QScriptEngine ipEngine
959);
960#endif
961
962#ifdef FCT_DOC
965 ShowOnlyInActiveView(Array<SComp> compsToShowOnly
967);
968#else
970 QScriptContext ipContext,
972 QScriptEngine ipEngine
974);
975#endif
976
977
978#ifdef FCT_DOC
982#else
983Array GetScaleFactor(QScriptContext ipContext, QScriptEngine ipEngine);
984#endif
985
986#ifdef FCT_DOC
991 String iLocale = ""
995);
996#else
997Array GetThousandSeparator(QScriptContext ipContext, QScriptEngine ipEngine);
998#endif
999
1000#ifdef FCT_DOC
1005 Number iNumberToConvert,
1007 String iLocale = ""
1011);
1012#else
1013Array ConvertNumberToString(QScriptContext ipContext, QScriptEngine ipEngine);
1014#endif
1015
1016#ifdef FCT_DOC
1021 String iLocale = ""
1025);
1026#else
1027Array GetListSeparator(QScriptContext ipContext, QScriptEngine ipEngine);
1028#endif
1029
1030} // namespace ScriptUtil
1031
1032#ifndef FCT_DOC
1033} // namespace rsh::ScriptBinding
1034#endif // !FCT_DOC
The SComp class is an abstract class. Use derived classes SCircle, SCylinder, SCloud,...
Definition: SComp.h:32
3D point manipulation class. The SPoint creation can be done by calling the static functions:
Definition: SPoint.h:23
The mathematical object vector.
Definition: SVector3.h:26
ScriptUtil is a various toolbox with features to get paths, work on the tree view,...
Definition: ScriptUtilReport.h:17
Array GetCameraPosition()
To get the camera position.
Repaint()
To force Repaint scene of the current document.
Array GetCameraMode()
To check whether the camera mode is in perspective or orthographic view .
ViewDirEnum
Set of the view direction.
Definition: SGeneral.h:48
@ AXIS_Y
Definition: SGeneral.h:50
@ AXIS_Z
Definition: SGeneral.h:51
@ AXIS_REVERSE_X
Definition: SGeneral.h:52
@ AXIS_X
Definition: SGeneral.h:49
@ AXIS_REVERSE_Z
Definition: SGeneral.h:54
@ AXIS_REVERSE_Y
Definition: SGeneral.h:53
ClearDoc()
To clear all the document and the trash. Can be useful to begin with a blank document.
SetCameraMode(ViewModeEnum Mode)
To set the camera in perspective or orthographic view.
SetTextSize(Number Size)
To define character height inside the graphic scene.
copydircontent(String DirOrg, String DirDest)
Copy the content of one folder to another all files and subfolders, recursively.
SketchFabCategories
Definition: SGeneral.h:67
@ Music
Definition: SGeneral.h:78
@ Fashion_Style
Definition: SGeneral.h:75
@ Science_Technology
Definition: SGeneral.h:83
@ Nature_Plants
Definition: SGeneral.h:79
@ Cars_Vehicles
Definition: SGeneral.h:71
@ Characters_Creatures
Definition: SGeneral.h:72
@ Furniture_Home
Definition: SGeneral.h:77
@ Cultural_Heritage_History
Definition: SGeneral.h:73
@ Art_Abstract
Definition: SGeneral.h:70
@ Weapons_Military
Definition: SGeneral.h:85
@ News_Politics
Definition: SGeneral.h:80
@ People
Definition: SGeneral.h:81
@ Architecture
Definition: SGeneral.h:69
@ Places_Travel
Definition: SGeneral.h:82
@ Food_Drink
Definition: SGeneral.h:76
@ Sports_Fitness
Definition: SGeneral.h:84
@ Animals_Pets
Definition: SGeneral.h:68
@ Electronic_Gadgets
Definition: SGeneral.h:74
Number ToLocaleNumber(String StringToConvert)
to convert the string to number using the system's locale settings
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 h...
ZoomFactor(Number factor)
Zoom the scene.
String ToLocaleString(Number NumberToConvert)
to convert a number in a string using the system's locale settings
LockCamera(Boolean lock)
Lock the camera (no rotation possible)
ShowOnly(Array< SComp > compsToShowOnly)
Show only input objects.
String TempPath()
Returns the absolute path of the system's temporary directory.
SetViewDir(ViewDirEnum Dir)
Update the direction of the view.
ZoomAll()
To make a zoom on all the visible SComp.
Boolean OpenUrl(String Url)
Opens the given url in the appropriate Web browser for the user's desktop environment,...
RemoveSplit()
Remove split on current view.
KeepOnlyCurrentView()
Keep only current view.
Array IsCameraLocked()
To check whether the camera is locked (no rotation possible) .
SplitVert()
Split current view vertically.
String CurrentScriptPath()
This function will return the current script path of the first script evaluated (not the include file...
SplitHor()
Split current view horizontally.
Array SendToSketchFab(SComp CompToExport, String Token, String Name, String Description, String Tags, SketchFabCategories Category)
Send a cloud or mesh in SketchFab platform.
Array GetCoordSysTransf()
Get the transformation matrix of the current local coordinate system if exists.
trayRemove()
Display application windows Hide tray icon.
FlushDisplay()
Blocking function waiting for all visible objects to be ready to be displayed. This function is usefu...
trayCreate()
Create tray icon Hide current windows Show tray icon.
ViewModeEnum
Set of the view direction.
Definition: SGeneral.h:60
@ PERSPECTIVE
Definition: SGeneral.h:61
@ ORTHOGRAPHIC
Definition: SGeneral.h:62
Array ConvertNumberToString(Number iNumberToConvert, String iLocale="")
Convert the number to a string using the given locale settings.
String GetOpenFileName(String Caption, String Filter, String DefaultPath="")
This is a convenience function that returns an existing file selected by the user....
QStringList GetOpenFileNames(String Caption, String Filter, String DefaultPath="")
This is a convenience function that returns a table of existing files selected by the user....
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....
String ApplicationPath()
This function will return the application path.
Array SaveDoc(String FileName, Boolean IsOverWrite)
To save a .3dr file. All the content of the current document will be saved. If an object was created ...
Sleep(Number Milliseconds)
To sleep the current script, this sleep function will not block interface.
ShowOnlyInActiveView(Array< SComp > compsToShowOnly)
Show only input objects in the specified view.
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....
Array GetThousandSeparator(String iLocale="")
Function to get the separator used for the thousands in the given locale settings.
Array GetListSeparator(String iLocale="")
Function to get the separator list in the given locale settings.
Array GetCameraDirection(SPoint iTargetPt)
To get the camera direction from the camera position to the target pointed by the camera (the point t...
Array CreatePicture(String FileName, Number Height, Number Width, Number Background, Number PointLineMagnification)
To create a picture of the current scene. .
Number Execute(String Program, Array< String > Arguments)
Starts the program program with the arguments arguments in a new process, waits for it to finish,...
String GetOpenFolder(String Caption, String DefaultPath="")
This is a convenience function that returns an existing folder selected by the user....
String ScriptPath()
This function will return the sample script path.
Number GetScaleFactor()
Get the scale factor permitting to convert the current document unit to mm.
Boolean mkdir(String DirName)
Creates a sub-directory called DirName. Returns true on success; otherwise returns false....
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 ...
Include(String FileName)
To include other javascript files.
SetActiveView(uint viewNumber,)
Change the active view. i.e set the focus to the view viewNumber. zero-based index.
ZoomOn(Array< SComp > TableOfObjects, Number milliseconds)
To make a zoom on some SComp.