Cyclone 3DR Script
from Technodigit, part of Hexagon. Copyright 1997-2022.
 
Loading...
Searching...
No Matches
SComp.h
1
2
3
5
6#pragma once
7
8#include "RshPluginScript/RshPluginScriptDefines.h"
9#include "RshDisplay/SComp/DGroup.h"
10#include "RshDisplay/Display/DCompSelectionModel.h"
11#include "RshPluginScript/SClass/SObject.h"
12#include "RshPluginScript/SClass/SVector3.h"
13#include "RshPluginScript/Script/SEngineManager.h"
14#include "RshPluginScriptInterface/Script/ScriptConvert.h"
15
16#ifndef FCT_DOC
17namespace rsh::ScriptBinding
18{
19#endif // !FCT_DOC
31class RshPluginScriptAPI SComp : public SObject
32{
33 //======================================================================================================================
34 // INTERNAL FUNCTION
35 //======================================================================================================================
36
37 //======================================================================================================================
38 // DOCUMENTED FUNCTION
39 //======================================================================================================================
40
41public:
48 {
49 SMOOTH, // smooth shading + rotation idem
50 FLAT, // flat shading and compatible with real time edition + rotation idem
51 WIRE, // wireframe + rotation idem
52 SMOOTH_WIRE, // smooth shading et wireframe together + rotation idem
53 FLAT_WIRE, // flat shading and wireframe together + rotation idem
54 SMOOTH_ROTWIRE, // smooth shading and wireframe together + rotation wireframe
55 FLAT_ROTWIRE, // flat shading and wireframe together + rotation wireframe
56 TEXTURE, // Colored points / Vertex
57 INSPECTION, // Calculate a color based on a value on each vertex.
58 };
59
60public slots: // these functions (slots) will be available in QtScript
65 // TESTED
68 );
69
74 // TESTED
77 );
78
83 // @note (not in the documentation)
84 // If no error occurred the ownership is taken by the DComptree
85 // TESTED
87
90 // @note (not in the documentation)
91 // If no error occurred the ownership is taken by the qtScript
92 // TESTED
94
110 // TESTED
112 String GroupPath,
114 Boolean MoveInsideTopParent
118 );
119
124 // TESTED
125 Boolean IsInDoc() ;
126
129 // TESTED
131 Number Red,
133 Number Green,
135 Number Blue
137 );
138
144 Array GetColors();
145
148 // TESTED
149 SetTransparency(Number Alpha
151 );
152
155 // TESTED
156 SetName(String ComponentName
158 );
159
162 // TESTED
163 String GetName() ;
164
167 // TESTED
168 String GetFolderName() ;
169
172 String GetPath() ;
173
176 Clear() {}
177
187 // TESTED
189
194 SetVisibility(Boolean Visible
196 ) ;
197
203 Boolean IsVisible() ;
204
208
215 );
216
219 SetClippable(Boolean clipping);
220
223 String toString() ;
224
225private:
228 static Number SelectDComp(
229 std::type_index iDCompType, SComp opSelectedComp, rsh::Display::DCompTree ipCompTree);
230};
231
232// @brief
233// This class allows to wrap static functions to SComp easily.
234// This allow to wrap constructor more easily : the constructor will be declared with the function New(...)
235class RshPluginScriptAPI SComp
236#ifndef FCT_DOC
237 : public SObjectStatic
238#endif // FCT_DOC
239{
240 //======================================================================================================================
241 // INTERNAL FUNCTION
242 //======================================================================================================================
243
244 //======================================================================================================================
245 // DOCUMENTED FUNCTION
246 //======================================================================================================================
247public slots:
248
258 static Array FromClick() { return SComp::GetFromClick<SComp>(SV_COMP); }
259
263 // TESTED
264 static Array FromName( String Name) { return SComp::GetFromName<SComp>(Name); }
265
269 // TESTED
270 static Array FromSel();
271
275 // TESTED
276 static Array All(
277 Number VisCrit
282 )
283 {
284 return SComp::GetAll<SComp>(VisCrit);
285 }
286
289 String toString() ;
290};
291RSH_SCOMP_STATIC_Q_DECLARE_METATYPE(SComp, _SCompDummy);
292
293
294#ifndef FCT_DOC
295
296} // namespace rsh::ScriptBinding
297#endif // !FCT_DOC
298
299#ifndef FCT_DOC
300namespace rsh::Script::ScriptConvert
301{
302//-------------------------------------------------------------------------------------------------------------------
305template<typename DCompClass>
306 DCompFromScriptValue( Array _iScriptValue, DCompClass _oDComp)
307{
308 using namespace rsh::Display;
309 using namespace rsh::ScriptBinding;
310
311 _oDComp = nullptr;
312 QObject myObj = _iScriptValue.prototype().toQObject();
313 SComp currentScomp = dynamic_cast<SComp>(myObj);
314 if(currentScomp)
315 {
316 SComp myDcomp = currentScomp->thisDComp(_iScriptValue);
317 _oDComp = dynamic_cast<DCompClass>(myDcomp);
318 }
319}
320
321} // namespace rsh::Script::ScriptConvert
322#endif // !FCT_DOC
323
324RSH_Q_DECLARE_METATYPE_FORWARD(rsh::ScriptBinding::SCircle);
325RSH_Q_DECLARE_METATYPE_FORWARD(rsh::ScriptBinding::SPlane);
326RSH_Q_DECLARE_METATYPE_FORWARD(rsh::ScriptBinding::SCylinder);
327RSH_Q_DECLARE_METATYPE_FORWARD(rsh::ScriptBinding::SMultiline);
328RSH_Q_DECLARE_METATYPE_FORWARD(rsh::ScriptBinding::SPoint);
329RSH_Q_DECLARE_METATYPE_FORWARD(rsh::ScriptBinding::SPoly);
330RSH_Q_DECLARE_METATYPE_FORWARD(rsh::ScriptBinding::SCloud);
331RSH_Q_DECLARE_METATYPE_FORWARD(rsh::ScriptBinding::SLabel);
332RSH_Q_DECLARE_METATYPE_FORWARD(rsh::ScriptBinding::SSetMultiline);
333RSH_Q_DECLARE_METATYPE_FORWARD(rsh::ScriptBinding::SLine);
334RSH_Q_DECLARE_METATYPE_FORWARD(rsh::ScriptBinding::SCone);
335RSH_Q_DECLARE_METATYPE_FORWARD(rsh::ScriptBinding::SSphere);
336RSH_Q_DECLARE_METATYPE_FORWARD(rsh::ScriptBinding::SRoundSlot);
337RSH_Q_DECLARE_METATYPE_FORWARD(rsh::ScriptBinding::SSquareSlot);
338RSH_Q_DECLARE_METATYPE_FORWARD(rsh::ScriptBinding::SViewSet);
339RSH_Q_DECLARE_METATYPE_FORWARD(rsh::ScriptBinding::SCADSurface);
340RSH_Q_DECLARE_METATYPE_FORWARD(rsh::ScriptBinding::SFeature);
341RSH_Q_DECLARE_METATYPE_FORWARD(rsh::ScriptBinding::SClipping);
342RSH_Q_DECLARE_METATYPE_FORWARD(rsh::ScriptBinding::SClippingPlane);
343RSH_Q_DECLARE_METATYPE_FORWARD(rsh::ScriptBinding::SClippingBox);
344RSH_Q_DECLARE_METATYPE_FORWARD(rsh::ScriptBinding::SReportData);
345RSH_Q_DECLARE_METATYPE_FORWARD(rsh::ScriptBinding::SReport);
The SComp class is an abstract class. Use derived classes SCircle, SCylinder, SCloud,...
Definition: SComp.h:32
SetTransparency(Number Alpha)
Sets the transparency of the component.
Clear()
To deallocate object memory.
Definition: SComp.h:176
SetColors(Number Red, Number Green, Number Blue)
Sets the colors of the component.
static Array All(Number VisCrit)
To get all the SComp in the document.
Definition: SComp.h:276
String GetName()
The component's name.
Array GetBoundingBox()
Calculates the bounding box of the component.
static Array FromName(String Name)
Search all the component with the given name.
Definition: SComp.h:264
Invert()
Normal of the component is inverted.
String GetPath()
To get the full path of a comp in the tree.
Boolean IsInDoc()
Return if the component is in the document or not.
SetName(String ComponentName)
To set the component's name.
Array GetColors()
To get the colors of the component.
RepresentationTypeEnum
The different representation types for inherited classes. Use (inherited class).SMOOTH....
Definition: SComp.h:48
@ INSPECTION
Definition: SComp.h:57
@ FLAT_ROTWIRE
Definition: SComp.h:55
@ SMOOTH
Definition: SComp.h:49
@ TEXTURE
Definition: SComp.h:56
@ FLAT_WIRE
Definition: SComp.h:53
@ FLAT
Definition: SComp.h:50
@ SMOOTH_ROTWIRE
Definition: SComp.h:54
@ WIRE
Definition: SComp.h:51
@ SMOOTH_WIRE
Definition: SComp.h:52
Translate(SVector Vector)
To make a translation of the current object with an SVector.
SetClippable(Boolean clipping)
Set clippable or not.
SetVisibility(Boolean Visible)
Sets the component to be visible, or not visible.
AddToDoc()
To add the object to the document.
SetRepresentationType(RepresentationTypeEnum Representation)
The shading type of the component is modified.
static Array FromSel()
To get all the selected SComp.
Boolean IsVisible()
String GetFolderName()
The component containing folder's name.
RemoveFromDoc()
To remove the object from the document.
static Array FromClick()
Launches a click interaction to select a SComp in the scene.
Definition: SComp.h:258
ApplyTransformation(SMatrix iMatrix)
To apply a geometric transformation to the current object by making a product with the given matrix.
MoveToGroup(String GroupPath, Boolean MoveInsideTopParent)
Move the object to the document group represent by the given path. If some groups,...
String toString()
Get the type of the variable.
Matrix with 3 lines and 4 columns to make any transformation. This class should be used in order to a...
Definition: SMatrix.h:21
The mathematical object vector.
Definition: SVector3.h:26