-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathregularApi.xml
12603 lines (12528 loc) · 787 KB
/
regularApi.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?xml version='1.0' encoding='utf-8'?>
<functions>
<function>
<api-function-name>loadPlugin</api-function-name>
<api-description>Lua only. Loads a CoppeliaSim <a href="../plugins.htm">plugin</a>
</api-description>
<api-see-also>unloadPlugin</api-see-also>
<api-synopsis-lua>map namespace = loadPlugin(string pluginName)</api-synopsis-lua>
<api-input-python-lua>
<ul>
<li><strong>pluginName</strong>: the name of the plugin, including version number, e.g. simIK, simIK-2-0, etc.</li>
</ul>
</api-input-python-lua>
<api-output-python-lua>
<ul>
<li><strong>namespace</strong>: a map containing the variables and functions offered by the plugin</li>
</ul>
</api-output-python-lua>
</function>
<function>
<api-function-name>unloadPlugin</api-function-name>
<api-description>Lua only. Unloads a CoppeliaSim plugin</api-description>
<api-see-also>loadPlugin</api-see-also>
<api-synopsis-lua>unloadPlugin(map namespace, map options = {})</api-synopsis-lua>
<api-input-python-lua>
<ul>
<li><strong>namespace</strong>: the map returned by <a href="loadPlugin.htm">loadPlugin</a></li>
<li><strong>options</strong>: an optional map. If options.force is set, then the plugin will be forceably unloaded, even if other scripts still depend on it</li>
</ul>
</api-input-python-lua>
</function>
<function>
<api-function-name>sim.acquireLock</api-function-name>
<api-description>Allows to have CoppeliaSim wait for a threaded code section to be executed without
interruption. Locking is cumulative</api-description>
<api-see-also>sim.releaseLock</api-see-also>
<api-synopsis-python>sim.acquireLock()</api-synopsis-python>
<api-synopsis-lua>sim.acquireLock()</api-synopsis-lua>
<api-calltip>sim.acquireLock()</api-calltip>
</function>
<function>
<api-function-name>sim.addDrawingObject</api-function-name>
<api-description>Adds a drawing object that will be displayed in the scene. Drawing objects are containers
that hold several items of a given type. This can be used for several different applications
(simulation of paint, simulation of welding seam, display of 3D objects, etc.). Drawing objects
created in a <a href="../simulationScripts.htm">simulation script</a> will be automatically
removed at simulation end</api-description>
<api-see-also>sim.addDrawingObjectItem
sim.removeDrawingObject</api-see-also>
<api-synopsis-cpp>int simAddDrawingObject(int objectType, double size, double duplicateTolerance,
int parentObjectHandle, int maxItemCount, const float* color,
const float* setToNULL, const float* setToNULL, const float* setToNULL)</api-synopsis-cpp>
<api-input-cpp>
<ul>
<li><strong>objectType</strong>: a <a href="../apiConstants.htm#customDrawingObjects">drawing object type combined with attributes</a></li>
<li><strong>size</strong>: size of the item (width of lines or size of points are in pixels, other sizes are in meters</li>
<li><strong>duplicateTolerance</strong>: if different from 0.0, then a call to <a href="simAddDrawingObjectItem.htm">simAddDrawingObjectItem</a> will only add the item if there is no other item within duplicateTolerance distance. Useful to avoid adding a too high density of points, is however not appropriate when using a large number of points (slower operation). Applicable only for single vertex items.</li>
<li><strong>parentObjectHandle</strong>: handle of the scene object where the drawing items should keep attached to (if the scene object moves, the drawing items will also move), or -1 if the drawing items are relative to the world (fixed)</li>
<li><strong>maxItemCount</strong>: maximum number of items this object can hold. 0 uses a default size of 1000.</li>
<li><strong>color</strong>: default color (pointer to 3 rgb values). Can be nullptr</li>
</ul>
</api-input-cpp>
<api-output-cpp>
<ul>
<li>handle of the drawing object if successful, -1 otherwise</li>
</ul>
</api-output-cpp>
<api-synopsis-python>int drawingObjectHandle = sim.addDrawingObject(int objectType, float size, float duplicateTolerance,
int parentObjectHandle, int maxItemCount,
list color = None)</api-synopsis-python>
<api-synopsis-lua>int drawingObjectHandle = sim.addDrawingObject(int objectType, float size, float duplicateTolerance,
int parentObjectHandle, int maxItemCount,
float[3] color = nil)</api-synopsis-lua>
<api-input-python-lua>
<ul>
<li><strong>objectType</strong>: a <a href="../apiConstants.htm#customDrawingObjects">drawing object type combined with attributes</a></li>
<li><strong>size</strong>: size of the item (width of lines or size of points are in pixels, other sizes are in meters</li>
<li><strong>duplicateTolerance</strong>: if different from 0.0, then a call to <a href="simAddDrawingObjectItem.htm">simAddDrawingObjectItem</a> will only add the item if there is no other item within duplicateTolerance distance. Useful to avoid adding a too high density of points, is however not appropriate when using a large number of points (slower operation). Applicable only for single vertex items.</li>
<li><strong>parentObjectHandle</strong>: handle of the scene object where the drawing items should keep attached to (if the scene object moves, the drawing items will also move), or -1 if the drawing items are relative to the world (fixed)</li>
<li><strong>maxItemCount</strong>: maximum number of items this object can hold. 0 uses a default size of 1000.</li>
<li><strong>color</strong>: default color (3 rgb values). Can be None/nil</li>
</ul>
</api-input-python-lua>
<api-output-python-lua>
<ul>
<li>handle of the drawing object</li>
</ul>
</api-output-python-lua>
<api-calltip>int drawingObjectHandle = sim.addDrawingObject(int objectType, float size, float duplicateTolerance, int parentObjectHandle, int maxItemCount, float[3] color=nil)</api-calltip>
</function>
<function>
<api-function-name>sim.addDrawingObjectItem</api-function-name>
<api-description>Adds an item (or clears all items) to a previously inserted drawing object</api-description>
<api-see-also>sim.addDrawingObject
sim.removeDrawingObject</api-see-also>
<api-synopsis-cpp>int simAddDrawingObjectItem(int objectHandle, const double* itemData)</api-synopsis-cpp>
<api-input-cpp>
<ul>
<li><strong>objectHandle</strong>: handle of a previously added drawing object</li>
<li><strong>itemData</strong>: data relative to an item. If the item is a point item, 3 values are required (x;y;z). If the item is a line item, 6 values are required, etc. Specifying nullptr will empty the drawing object</li>
</ul>
</api-input-cpp>
<api-output-cpp>
<ul>
<li>-1 if operation was not successful. If the point was added, then the return value is >0, if it was not added (e.g. drawing object is saturated or the item was merged with an existing item), then the return value will be 0.</li>
</ul>
</api-output-cpp>
<api-synopsis-python>int result = sim.addDrawingObjectItem(int drawingObjectHandle, list itemData)</api-synopsis-python>
<api-synopsis-lua>int result = sim.addDrawingObjectItem(int drawingObjectHandle, float[] itemData)</api-synopsis-lua>
<api-input-python-lua>
<ul>
<li><strong>objectHandle</strong>: handle of a previously added drawing object. Can be combined with sim.handleflag_addmultiple to add several drawing items at once, or with sim.handleflag_codedstring, when one wishes to provide data as a float buffer</li>
<li><strong>itemData</strong>: data relative to an item. If the item is a point item, 3 values are required [x y z]. If the item is a line item, 6 values are required, etc. None/nil to empty the drawing object</li>
</ul>
</api-input-python-lua>
<api-output-python-lua>
<ul>
<li><strong>result</strong>: If the point was added, the return value is >0, if it was not added the return value is 0</li>
</ul>
</api-output-python-lua>
<api-calltip>int result = sim.addDrawingObjectItem(int drawingObjectHandle, float[] itemData)</api-calltip>
</function>
<function>
<api-function-name>sim.addForce</api-function-name>
<api-description>Adds a non-central force to a shape object that is dynamically enabled. Added forces are cumulative,
applied relative to the center of mass, and are reset to zero after <a href="simHandleDynamics.htm">sim.handleDynamics</a>
was called (or by using the following flag: sim.handleflag_resetforcetorque)</api-description>
<api-see-also>sim.addForceAndTorque</api-see-also>
<api-synopsis-cpp>int simAddForce (int shapeHandle, const double* position, const double* force)</api-synopsis-cpp>
<api-input-cpp>
<ul>
<li><strong>shapeHandle</strong>: handle of a dynamically enabled shape. Can be combined with sim.handleflag_resetforcetorque in order to clear the accumulated force and torque.</li>
<li><strong>position</strong>: pointer to 3 values that represent the relative position where the force should be applied.</li>
<li><strong>force</strong>: pointer to 3 values that represent the force (in relative coordinates) to add.</li>
</ul>
</api-input-cpp>
<api-output-cpp>
<ul>
<li>-1 if operation was not successful</li>
</ul>
</api-output-cpp>
<api-synopsis-python>sim.addForce(int shapeHandle, list position, list force)</api-synopsis-python>
<api-synopsis-lua>sim.addForce(int shapeHandle, float[3] position, float[3] force)</api-synopsis-lua>
<api-input-python-lua>
<ul>
<li><strong>shapeHandle</strong>: handle of a dynamically enabled shape. Can be combined with sim.handleflag_resetforcetorque in order to clear the accumulated force and torque.</li>
<li><strong>position</strong>: array of 3 values that represent the relative position where the force should be applied.</li>
<li><strong>force</strong>: array of 3 values that represent the force (in relative coordinates) to add.</li>
</ul>
</api-input-python-lua>
<api-calltip>sim.addForce(int shapeHandle, float[3] position, float[3] force)</api-calltip>
</function>
<function>
<api-function-name>sim.addForceAndTorque</api-function-name>
<api-description>Adds a force and/or torque to a shape object that is dynamically enabled.
Forces are applied at the center of mass. Added forces and torques are cumulative, and are reset to zero
after <a href="simHandleDynamics.htm">sim.handleDynamics</a> was called (or by using the following
flags: sim.handleflag_resetforce and/or sim.handleflag_resettorque)</api-description>
<api-see-also>sim.addForce</api-see-also>
<api-synopsis-cpp>int simAddForceAndTorque(int shapeHandle, const double* force, const double* torque)</api-synopsis-cpp>
<api-input-cpp>
<ul>
<li><strong>shapeHandle</strong>: handle of a dynamically enabled shape. Can be combined with sim.handleflag_resetforce and/or sim.handleflag_resettorque in order to clear the accumulated force or torque.</li>
<li><strong>force</strong>: pointer to 3 values that represent the force (in absolute coordinates) to add. Can be nullptr.</li>
<li><strong>torque</strong>: pointer to 3 values that represent the torque (in absolute coordinates) to add. Can be nullptr</li>
</ul>
</api-input-cpp>
<api-output-cpp>
<ul>
<li>-1 if operation was not successful</li>
</ul>
</api-output-cpp>
<api-synopsis-python>sim.addForceAndTorque(int shapeHandle, list force, list torque)</api-synopsis-python>
<api-synopsis-lua>sim.addForceAndTorque(int shapeHandle, float[3] force, float[3] torque)</api-synopsis-lua>
<api-input-python-lua>
<ul>
<li><strong>shapeHandle</strong>: handle of a dynamically enabled shape. Can be combined with sim.handleflag_resetforce and/or sim.handleflag_resettorque in order to clear the accumulated force or torque.</li>
<li><strong>force</strong>: array of 3 values that represent the force (in absolute coordinates) to add. Can be None/nil</li>
<li><strong>torque</strong>: array of 3 values that represent the torque (in absolute coordinates) to add. Can be None/nil</li>
</ul>
</api-input-python-lua>
<api-calltip>sim.addForceAndTorque(int shapeHandle, float[3] force=nil, float[3] torque=nil)</api-calltip>
</function>
<function>
<api-function-name>sim.addGraphCurve</api-function-name>
<api-description>Adds or updates a graph curve. A graph curve is persistent, but can be removed with
<a href="simDestroyGraphCurve.htm">sim.destroyGraphCurve</a>
</api-description>
<api-see-also>
<a href="../apiFunctions.htm#graphs">functions related to graphs</a>
</api-see-also>
<api-synopsis-cpp>int simAddGraphCurve(int graphHandle, const char* curveName, int dim, const int* streamIds,
const double* defaultValues, const char* unitStr, int int options,
const float* color, int curveWidth)</api-synopsis-cpp>
<api-input-cpp>
<ul>
<li><strong>graphHandle</strong>: handle of the graph</li>
<li><strong>curveName</strong>: name of the curve</li>
<li><strong>dim</strong>: dimension of the curve. Valid values are 2 or 3</li>
<li><strong>streamIds</strong>: a pointer to 2 or 3 graph streams (x/y curves require 2 stream IDs, xyz curves require 3 stream IDs). Indicate -1 for a missing stream, in which case a default value will be used instead</li>
<li><strong>defaultValues</strong>: a pointer to 2 or 3 default values</li>
<li><strong>unitStr</strong>: string describing the unit of the curve. Can be nullptr</li>
<li><strong>options</strong>: bit-coded: bit0 is not used. If bit1 is set (2), the label is not visible. If bit2 is set (4), the points are not linked.</li>
<li><strong>color</strong>: rgb-triplet, with values in [0.0-1.0], indicating the color of the stream. Can be nullptr</li>
<li><strong>curveWidth</strong>: the width of an xyz curve</li>
</ul>
</api-input-cpp>
<api-output-cpp>
<ul>
<li>-1 if operation was not successful, otherwise the id of the created/updated curve</li>
</ul>
</api-output-cpp>
<api-synopsis-python>int curveId = sim.addGraphCurve(int graphHandle, string curveName, int dim, list streamIds,
list defaultValues, string unitStr, int options = 0,
list color = [0 1, 0], int curveWidth = 2)</api-synopsis-python>
<api-synopsis-lua>int curveId = sim.addGraphCurve(int graphHandle, string curveName, int dim, int[] streamIds,
float[] defaultValues, string unitStr, int options = 0,
float[3] color = {0, 1, 0}, int curveWidth = 2)</api-synopsis-lua>
<api-input-python-lua>
<ul>
<li><strong>graphHandle</strong>: handle of the graph</li>
<li><strong>curveName</strong>: name of the curve</li>
<li><strong>dim</strong>: dimension of the curve. Valid values are 2 or 3</li>
<li><strong>streamIds</strong>: array of 2 or 3 graph streams (x/y curves require 2 stream IDs, xyz curves require 3 stream IDs). Indicate -1 for a missing stream, in which case a default value will be used instead</li>
<li><strong>defaultValues</strong>: array of 2 or 3 default values</li>
<li><strong>unitStr</strong>: string describing the unit of the curve. Can be None/nil</li>
<li><strong>options</strong>: bit-coded:
<ul>
<li>bit0 is not used.</li>
<li>If bit1 is set (2), the label is not visible</li>
<li>If bit2 is set (4), the points are not linked</li>
</ul>
</li>
<li><strong>color</strong>: rgb-triplet, with values between 0.0 and 1.0, indicating the color of the stream. Can be None/nil</li>
<li><strong>curveWidth</strong>: the width of an xyz curve</li>
</ul>
</api-input-python-lua>
<api-output-python-lua>
<ul>
<li><strong>curveId</strong>: id of the created/updated curve</li>
</ul>
</api-output-python-lua>
<api-calltip>int curveId = sim.addGraphCurve(int graphHandle, string curveName, int dim, int[2..3] streamIds, float[2..3] defaultValues, string unitStr, int options=0, float[3] color={1, 1, 0}, int curveWidth=2)</api-calltip>
</function>
<function>
<api-function-name>sim.addGraphStream</api-function-name>
<api-description>Adds or updates a graph stream. A graph stream is persistent, but can be removed
with <a href="simDestroyGraphCurve.htm">sim.destroyGraphCurve</a>
</api-description>
<api-see-also>
<a href="../apiFunctions.htm#graphs">functions related to graphs</a>
</api-see-also>
<api-synopsis-cpp>int simAddGraphStream(int graphHandle, const char* streamName, const char* unitStr, int options,
const float* color, double cyclicRange)</api-synopsis-cpp>
<api-input-cpp>
<ul>
<li><strong>graphHandle</strong>: handle of the graph</li>
<li><strong>streamName</strong>: name of the stream</li>
<li><strong>unitStr</strong>: string describing the unit of the stream. Can be nullptr</li>
<li><strong>options</strong>: bit-coded: if bit0 is set (1), the stream is not visible. If bit1 is set (2), the label is not visible. If bit2 is set (4), the points are not linked.</li>
<li><strong>color</strong>: rgb-triplet, with values in [0.0-1.0], indicating the color of the stream. Can be nullptr</li>
<li><strong>cyclicRange</strong>: can be used with cyclic values (e.g. angles) for correct data interpretation during <a href="simSetGraphStreamTransformation.htm">stream data transformation</a>. Set to 0 if not used</li>
</ul>
</api-input-cpp>
<api-output-cpp>
<ul>
<li>-1 if operation was not successful, otherwise the id of the created/updated stream</li>
</ul>
</api-output-cpp>
<api-synopsis-python>int streamId = sim.addGraphStream(int graphHandle, string streamName, string unitStr = '',
int options = 0, list color = [1, 0, 0], cyclicRange = 0)</api-synopsis-python>
<api-synopsis-lua>int streamId = sim.addGraphStream(int graphHandle, string streamName, string unitStr = '',
int options = 0, float[3] color = {1, 0, 0}, cyclicRange = 0)</api-synopsis-lua>
<api-input-python-lua>
<ul>
<li><strong>graphHandle</strong>: handle of the graph</li>
<li><strong>streamName</strong>: name of the stream</li>
<li><strong>unitStr</strong>: string describing the unit of the stream. Can be None/nil</li>
<li><strong>options</strong>: bit-coded:
<ul>
<li>if bit0 is set (1), the stream is not visible</li>
<li>if bit1 is set (2), the label is not visible</li>
<li>if bit2 is set (4), the points are not linked</li>
</ul>
</li>
<li><strong>color</strong>: rgb-triplet, with values between 0.0 and 1.0, indicating the color of the stream. Can be None/nil</li>
<li><strong>cyclicRange</strong>: can be used with cyclic values (e.g. angles) for correct data interpretation during <a href="simSetGraphStreamTransformation.htm">stream data transformation</a>. Set to 0 if not used</li>
</ul>
</api-input-python-lua>
<api-output-python-lua>
<ul>
<li><strong>streamId</strong>: id of the created/updated stream</li>
</ul>
</api-output-python-lua>
<api-calltip>int streamId = sim.addGraphStream(int graphHandle, string streamName, string unit, int options=0, float[3] color={1, 0, 0}, float cyclicRange=pi)</api-calltip>
</function>
<function>
<api-function-name>sim.addItemToCollection</api-function-name>
<api-description>Adds an item to a <a href="../collections.htm">collection</a>
</api-description>
<api-see-also>
<a href="../apiFunctions.htm#collections">functions related to collections</a>
</api-see-also>
<api-synopsis-cpp>int simAddItemToCollection(int collectionHandle, int what, int objectHandle, int options)</api-synopsis-cpp>
<api-input-cpp>
<ul>
<li><strong>collectionHandle</strong>: the handle of a collection.</li>
<li><strong>what</strong>: the type of object (or group of objects) to add. Following are allowed values: <em>sim.handle_single</em> (for a single object), <em>sim.handle_all</em> (for all objects in the scene), <em>sim.handle_tree</em> (for a tree of objects), or <em>sim.handle_chain</em> (for a chain of objects (i.e. an inverted tree)).</li>
<li><strong>objectHandle</strong>: the handle of an object.</li>
<li><strong>options</strong>: bit-coded options:
<ul>
<li>bit 0 set (1): the specified object (or group of objects) is removed from the collection. Otherwise it is added.</li>
<li>bit 1 set (2): the specified object is not included in the group of objects, if sim.handle_tree or sim.handle_chain is specified (i.e. the tree base or tip is excluded).</li>
</ul>
</li>
</ul>
</api-input-cpp>
<api-output-cpp>
<ul>
<li>-1 if operation was not successful.</li>
</ul>
</api-output-cpp>
<api-synopsis-python>sim.addItemToCollection(int collectionHandle, int what, int objectHandle, int options)</api-synopsis-python>
<api-synopsis-lua>sim.addItemToCollection(int collectionHandle, int what, int objectHandle, int options)</api-synopsis-lua>
<api-input-python-lua>
<ul>
<li><strong>collectionHandle</strong>: handle of a collection.</li>
<li><strong>what</strong>: type of object (or group of objects) to add. Following are allowed values:
<ul>
<li><em>sim.handle_single</em> (for a single object)</li>
<li><em>sim.handle_all</em> (for all objects in the scene)</li>
<li><em>sim.handle_tree</em> (for a tree of objects)</li>
<li><em>sim.handle_chain</em> (for a chain of objects (i.e. an inverted tree)).</li>
</ul>
</li>
<li><strong>objectHandle</strong>: handle of an object</li>
<li><strong>options</strong>: bit-coded options:
<ul>
<li>bit 0 set (1): the specified object (or group of objects) is removed from the collection. Otherwise it is added.</li>
<li>bit 1 set (2): the specified object is not included in the group of objects, if sim.handle_tree or sim.handle_chain is specified (i.e. the tree base or tip is excluded).</li>
</ul>
</li>
</ul>
</api-input-python-lua>
<api-calltip>sim.addItemToCollection(int collectionHandle, int what, int objectHandle, int options)</api-calltip>
</function>
<function>
<api-function-name>sim.addLog</api-function-name>
<api-description>Adds a log message that will be output in the console or status bar</api-description>
<api-synopsis-cpp>int simAddLog(const char* pluginName, int verbosity, const char* message)</api-synopsis-cpp>
<api-input-cpp>
<ul>
<li><strong>pluginName</strong>: the name of the plugin that outputs the message. e.g. <em>simIK</em></li>
<li><strong>verbosity</strong>: the <a href="../apiConstants.htm#verbosity">verbosity level</a>. Most appropriate values are sim.verbosity_errors (for errors), sim.verbosity_warnings (for warning) and sim.verbosity_infos.</li>
<li><strong>message</strong>: the message. Set to nullptr to clear the status bar</li>
</ul>
</api-input-cpp>
<api-output-cpp>
<ul>
<li>-1 if operation was not successful.</li>
</ul>
</api-output-cpp>
<api-synopsis-python>sim.addLog(int verbosity, string message)</api-synopsis-python>
<api-synopsis-lua>sim.addLog(int verbosity, string message)</api-synopsis-lua>
<api-input-python-lua>
<ul>
<li><strong>verbosity</strong>: the <a href="../apiConstants.htm#verbosity">verbosity level</a>. Most appropriate values are sim.verbosity_scripterrors (for errors), sim.verbosity_scriptwarnings (for warning) and sim.verbosity_scriptinfos. Combine with sim.verbosity_undecorated if you wish to output the naked message. sim.verbosity_scripterrors will additionaly raise an error.</li>
<li><strong>message</strong>: the message. None/nil clears the status bar</li>
</ul>
</api-input-python-lua>
<api-calltip>sim.addLog(int verbosityLevel, string logMessage)</api-calltip>
</function>
<function>
<api-function-name>sim.addParticleObject</api-function-name>
<api-description>Adds a particle object that will be simulated and displayed in the scene. Particle objects
are containers that hold several items (particles) of a given type. This can be used for
several different applications (e.g. simulation of air/water jets)</api-description>
<api-see-also>sim.addParticleObjectItem
sim.removeParticleObject</api-see-also>
<api-synopsis-python>int particleObjectHandle = sim.addParticleObject(int objectType, float size, float density,
list parameters, float lifeTime, int maxItemCount,
list color = None)</api-synopsis-python>
<api-synopsis-lua>int particleObjectHandle = sim.addParticleObject(int objectType, float size, float density,
float[] parameters, float lifeTime,
int maxItemCount, float[3] color = nil)</api-synopsis-lua>
<api-input-python-lua>
<ul>
<li><strong>objectType</strong>: a <a href="../apiConstants.htm#particleObjects">particle object type combined with attributes</a></li>
<li><strong>size</strong>: diameter of the particles (spheres)</li>
<li><strong>density</strong>: density of the particles</li>
<li><strong>parameters</strong>: an array of values, allowing to specify additional parameters. Can be None/nil. Values come in pair (an integer indicating what parameter, and a float indicating the parameter value. Following indicates the parameters:
<ul>
<li>0: Bullet friction coefficient (default: 0.0)</li>
<li>1: Bullet restitution coefficient (default: 0.0)</li>
<li>2: ODE friction coefficient (default: 0.0)</li>
<li>3: ODE soft ERP value (default: 0.2)</li>
<li>4: ODE soft CFM values (default: 0.0)</li>
<li>5: Bullet, ODE, Newton and Vortex linear drag parameter (default: 0.0). Adds a force opposite to the particle velocity (f=v*parameter)</li>
<li>6: Bullet, ODE, Newton and Vortex quadratic drag parameter (default: 0.0). Adds a force opposite to the particle velocity (f=v*v*parameter)</li>
<li>7: Bullet, ODE, Newton and Vortex linear drag parameter in air (z>0) if sim.particle_water was specified (default: 0.0). Adds a force opposite to the particle velocity (f=v*parameter)</li>
<li>8: Bullet, ODE, Newton and Vortex quadratic drag parameter in air (z>0) if sim.particle_water was specified (default: 0.0). Adds a force opposite to the particle velocity (f=v*v*parameter)</li>
<li>9: Vortex friction (default: 0.0)</li>
<li>10: Vortex restitution (default: 0.0)</li>
<li>11: Vortex restitution threshold (default: 0.001)</li>
<li>12: Vortex compliance (default: 0.0)</li>
<li>13: Vortex damping (default: 0.0)</li>
<li>14: Vortex adhesive force (default: 0.0)</li>
<li>15: Newton static friction (default: 0.0)</li>
<li>16: Newton kinetic friction (default: 0.0)</li>
<li>17: Newton restitution (default: 0.0)</li>
<li>If a parameter is not set, then its default value is used</li>
</ul>
</li>
<li><strong>lifeTime</strong>: simulation time after which the particles are destroyed. Set to 0.0 for an unlimited lifetime.</li>
<li><strong>maxItemCount</strong>: the maximum number of particles that this object can hold</li>
<li><strong>color</strong>: default ambient/diffuse color (pointer to 3 rgb values). Can be None/nil</li>
</ul>
</api-input-python-lua>
<api-output-python-lua>
<ul>
<li>handle of the particle object</li>
</ul>
</api-output-python-lua>
<api-calltip>int particleObjectHandle = sim.addParticleObject(int objectType, float size, float density, float[] params, float lifeTime, int maxItemCount, float[3] color=nil)</api-calltip>
</function>
<function>
<api-function-name>sim.addParticleObjectItem</api-function-name>
<api-description>Adds an item (or clears all items) to a previously inserted particle object</api-description>
<api-see-also>sim.addParticleObject
sim.removeParticleObject</api-see-also>
<api-synopsis-python>sim.addParticleObjectItem(int particleObjectHandle, list itemData)</api-synopsis-python>
<api-synopsis-lua>sim.addParticleObjectItem(int particleObjectHandle, float[] itemData)</api-synopsis-lua>
<api-input-python-lua>
<ul>
<li><strong>objectHandle</strong>: handle of a previously added particle object</li>
<li><strong>itemData</strong>: data relative to an item. All items (particles) require at least 6 values: p1x, p1y, p1z, p2x, p2y, p2z with p1 is the particle start position, p2-p1 is the particle initial velocity vector. Auxiliary values might be required depending on the particle object attributes. See the <a href="../apiConstants.htm#particleObjects">particle object type combined with attributes</a> for more information. If None/nil, the particle object is emptied of all its items</li>
</ul>
</api-input-python-lua>
<api-calltip>sim.addParticleObjectItem(int objectHandle, float[] itemData)</api-calltip>
</function>
<function>
<api-function-name>sim.adjustView</api-function-name>
<api-description>Adjusts parameters of a view</api-description>
<api-see-also>sim.floatingViewAdd
sim.cameraFitToView</api-see-also>
<api-synopsis-cpp>int simAdjustView(int viewHandleOrIndex, int associatedViewableObjectHandle, int options,
const char* viewLabel)</api-synopsis-cpp>
<api-input-cpp>
<ul>
<li><strong>viewHandleOrIndex</strong>: the handle of the view (can also be a floating view), or the index of the view.</li>
<li><strong>associatedViewableObjectHandle</strong>: handle of the object that you wish to associate with the view. Must be a viewable object. Can also be -1, in which case the view is emptied</li>
<li><strong>options</strong>: bit-coded:
<ul>
<li><strong>bit0-bit5</strong>= 0</li>
<li><strong>bit6 (64)</strong> set=floating view is removed at simulation end</li>
<li><strong>bit7 (128)</strong> set=floating view is ignored during a scene save operation</li>
<li><strong>bit8 (256)</strong> set=the view is not modified. The return value of the function indicates if the view still exists (2), or does not exist anymore (1). No error is generated.</li>
<li><strong>bit9 (512)</strong> set=the view is not modified. The return value of the function represents the object associated with the view.</li>
</ul>
</li>
<li><strong>viewLabel</strong>: a label that will be displayed at the top of a floating view. If nullptr is specified, then the name of the associated viewable object is taken as label.</li>
</ul>
</api-input-cpp>
<api-output-cpp>
<ul>
<li>a value >0 in case of success</li>
</ul>
</api-output-cpp>
<api-synopsis-python>int res = sim.adjustView(int viewHandleOrIndex, int objectHandle, int options,
string viewLabel = None)</api-synopsis-python>
<api-synopsis-lua>int res = sim.adjustView(int viewHandleOrIndex, int objectHandle, int options,
string viewLabel = nil)</api-synopsis-lua>
<api-input-python-lua>
<ul>
<li><strong>viewHandleOrIndex</strong>: handle of the view (can also be a floating view), or the index of the view.</li>
<li><strong>objectHandle</strong>: handle of the object that you wish to associate with the view. Must be a viewable object. Can also be -1, in which case the view is emptied</li>
<li><strong>options</strong>: bit-coded:
<ul>
<li><strong>bit0-bit5</strong>= 0</li>
<li><strong>bit6 (64)</strong> set=floating view is removed at simulation end</li>
<li><strong>bit7 (128)</strong> set=floating view is ignored during a scene save operation</li>
<li><strong>bit8 (256)</strong> set=the view is not modified. The return value of the function indicates if the view still exists (2), or does not exist anymore (1). No error is generated.</li>
<li><strong>bit9 (512)</strong> set=the view is not modified. The return value of the function represents the object associated with the view.</li>
</ul>
</li>
<li><strong>viewLabel</strong>: a label that will be displayed at the top of a floating view. If None/nil is specified, then the name of the associated viewable object is taken as label.</li>
</ul>
</api-input-python-lua>
<api-output-python-lua>
<ul>
<li><strong>res</strong>: a value >0 in case of success</li>
</ul>
</api-output-python-lua>
<api-calltip>sim.adjustView(int viewHandleOrIndex, int associatedViewableObjectHandle, int options, string viewLabel=nil)</api-calltip>
</function>
<function>
<api-function-name>sim.alignShapeBB</api-function-name>
<api-description>Reorients the bounding box of a shape, while keeping the shape frame in place.
The shape's inertia properties are unaffected</api-description>
<api-see-also>sim.relocateShapeFrame</api-see-also>
<api-synopsis-cpp>int simAlignShapeBB(int shapeHandle, const double* pose)</api-synopsis-cpp>
<api-input-cpp>
<ul>
<li><strong>shapeHandle</strong>: handle of the shape</li>
<li><strong>pose</strong>: pose describing the new orientation of the shape's bounding box. The pose is expressed as [x y z qx qy qz qw], where the positional part is ignored. A nullptr pose, or a pose containing only zeros will align the bounding box with the mesh's natural bounding box</li>
</ul>
</api-input-cpp>
<api-output-cpp>
<ul>
<li>-1 if operation was not successful. 0 if the bounding box could not be reoriented (the bounding box of primitive shapes cannot be reoriented), otherwise 1.</li>
</ul>
</api-output-cpp>
<api-synopsis-python>bool result = sim.alignShapeBB(int shapeHandle, list pose)</api-synopsis-python>
<api-synopsis-lua>bool result = sim.alignShapeBB(int shapeHandle, float[7] pose)</api-synopsis-lua>
<api-input-python-lua>
<ul>
<li><strong>shapeHandle</strong>: handle of the shape</li>
<li><strong>pose</strong>: pose describing the new orientation of the shape's bounding box. The pose is expressed as [x y z qx qy qz qw], where the positional part is ignored. A pose containing only zeros aligns the bounding box with the mesh's natural bounding box</li>
</ul>
</api-input-python-lua>
<api-output-python-lua>
<ul>
<li><strong>result</strong>: 0 if the bounding box could not be reoriented (the bounding box of primitive shapes cannot be reoriented), otherwise 1.</li>
</ul>
</api-output-python-lua>
<api-calltip>int result = sim.alignShapeBB(int shapeHandle, float[7] pose)</api-calltip>
</function>
<function>
<api-function-name>sim.alphaBetaGammaToYawPitchRoll</api-function-name>
<api-description>Converts CoppeliaSim's alpha-beta-gamma angles to Yaw-Pitch-Roll angles</api-description>
<api-see-also>sim.yawPitchRollToAlphaBetaGamma
<a href="../positionOrientationTransformation.htm">positions and orientations</a>
</api-see-also>
<api-synopsis-python>float yaw, float pitch, float roll = sim.alphaBetaGammaToYawPitchRoll(float alpha,
float beta, float gamma)</api-synopsis-python>
<api-synopsis-lua>float yaw, float pitch, float roll = sim.alphaBetaGammaToYawPitchRoll(float alpha,
float beta, float gamma)</api-synopsis-lua>
<api-input-python-lua>
<ul>
<li><strong>alpha</strong>: the alpha angle</li>
<li><strong>beta</strong>: the beta angle</li>
<li><strong>gamma</strong>: the gamma angle</li>
</ul>
</api-input-python-lua>
<api-output-python-lua>
<ul>
<li><strong>yaw</strong>: the yaw angle</li>
<li><strong>pitch</strong>: the pitch angle</li>
<li><strong>roll</strong>: the roll angle</li>
</ul>
</api-output-python-lua>
<api-calltip>float yawAngle, float pitchAngle, float rollAngle = sim.alphaBetaGammaToYawPitchRoll(float alphaAngle, float betaAngle, float gammaAngle)</api-calltip>
</function>
<function>
<api-function-name>sim.announceSceneContentChange</api-function-name>
<api-description>Announces a change in the scene. This is required for the undo/redo function to operate properly
when performing changes via the API. Only call this function directly after a change was made through
a dialog element (e.g. a checkbox was checked/unchecked) and that change was reported to the scene.
What this call will do is following: the whole scene will be serialized (saved) to memory as a
"scene image" and compared to a previously memorized "scene image". If both images
are same, then the last image is discarded, otherwise only the changes between the two images are memorized.
A call to this function has no effect (and doesn't generate any error) when called during simulation or when in edit mode.</api-description>
<api-synopsis-cpp>int simAnnounceSceneContentChange()</api-synopsis-cpp>
<api-output-cpp>
<ul>
<li>-1 if operation was not successful, 0 if nothing was memorized, or 1 if changes were memorized.</li>
</ul>
</api-output-cpp>
<api-synopsis-python>int result = sim.announceSceneContentChange()</api-synopsis-python>
<api-synopsis-lua>int result = sim.announceSceneContentChange()</api-synopsis-lua>
<api-output-python-lua>
<ul>
<li><strong>result</strong>: 0 if nothing was memorized, or 1 if changes were memorized.</li>
</ul>
</api-output-python-lua>
<api-calltip>int result = sim.announceSceneContentChange()</api-calltip>
</function>
<function>
<api-function-name>simApplyTexture</api-function-name>
<api-description>Applies a texture via texture coordinates to a shape</api-description>
<api-see-also>sim.setShapeTexture</api-see-also>
<api-synopsis-cpp>int simApplyTexture(int shapeHandle, const double* textureCoordinates, int textCoordSize,
const unsigned char* texture, const int* textureResolution, int options)</api-synopsis-cpp>
<api-input-cpp>
<ul>
<li><strong>shapeHandle</strong>: handle of the shape</li>
<li><strong>textureCoordinates</strong>: UV texture coordinates. For each of the shape's triangle, there should be exactly 3 UV texture coordinate pairs</li>
<li><strong>textCoordSize</strong>: size of the textureCoordinate array</li>
<li><strong>texture</strong>: RGB or RGBA texture</li>
<li><strong>textureResolution</strong>: X/Y resolution of the texture</li>
<li><strong>options</strong>: bit-coded:
<ul>
<li>bit0: if set (1), then adjacent texture pixels are not interpolated</li>
<li>bit1: if set (2), then the texture is applied as a decal (its appearance won't be influenced by light conditions)</li>
<li>bit2: unused, keep unset</li>
<li>bit3: unused, keep unset</li>
<li>bit4: if set (16), then the texture is RGBA, otherwise it is RGB</li>
<li>bit5: if set (32), then the texture is horizontally flipped</li>
<li>bit6: if set (64), then the texture is vertically flipped</li>
</ul>
</li>
</ul>
</api-input-cpp>
<api-output-cpp>
<ul>
<li>The ID of the texture, or -1 in case of an error</li>
</ul>
</api-output-cpp>
</function>
<function>
<api-function-name>sim.auxiliaryConsoleClose</api-function-name>
<api-description>Closes an auxiliary console window</api-description>
<api-see-also>sim.auxiliaryConsoleOpen</api-see-also>
<api-synopsis-cpp>int simAuxiliaryConsoleClose(int consoleHandle)</api-synopsis-cpp>
<api-input-cpp>
<ul>
<li><strong>consoleHandle</strong>: handle of the console window, previously returned by simAuxiliaryConsoleOpen</li>
</ul>
</api-input-cpp>
<api-output-cpp>
<ul>
<li>-1 if operation was not successful. 0 if the console doesn't exist (anymore), in which case no error is generated. 1 if the console window was closed.</li>
</ul>
</api-output-cpp>
<api-synopsis-python>int result = sim.auxiliaryConsoleClose(int consoleHandle)</api-synopsis-python>
<api-synopsis-lua>int result = sim.auxiliaryConsoleClose(int consoleHandle)</api-synopsis-lua>
<api-input-python-lua>
<ul>
<li><strong>consoleHandle</strong>: handle of the console window, previously returned by sim.auxiliaryConsoleOpen</li>
</ul>
</api-input-python-lua>
<api-output-python-lua>
<ul>
<li><strong>result</strong>: 0 if the console doesn't exist (anymore), in which case no error is generated. 1 if the console window was closed</li>
</ul>
</api-output-python-lua>
<api-calltip>int result = sim.auxiliaryConsoleClose(int consoleHandle)</api-calltip>
</function>
<function>
<api-function-name>sim.auxiliaryConsoleOpen</api-function-name>
<api-description>Opens an auxiliary console window for text display. This console window is different from
the application main console window. Console window handles are shared across all simulator scenes</api-description>
<api-see-also>sim.auxiliaryConsolePrint
sim.auxiliaryConsoleClose
sim.addLog</api-see-also>
<api-synopsis-cpp>int simAuxiliaryConsoleOpen(const char* title, int maxLines, int mode, const int* position,
const int* size, const float* textColor, const float* backgroundColor)</api-synopsis-cpp>
<api-input-cpp>
<ul>
<li><strong>title</strong>: title of the console window</li>
<li><strong>maxLines</strong>: number of text lines that can be displayed and buffered</li>
<li><strong>mode</strong>: bit-coded value:
<ul>
<li>bit0 (1) set indicates that the console window automatically closes at simulation end</li>
<li>bit1 (2) set indicates that lines will be wrapped</li>
<li>bit2 (4) set indicates that the user can close the console window</li>
<li>bit3 (8) is not used</li>
<li>bit4 (16) set indicates that the console will not automatically hide when the user switches to another scene</li>
</ul>
</li>
<li><strong>position</strong>: initial position of the console window (x and y value). Can be nullptr</li>
<li><strong>size</strong>: initial size of the console window (x and y value). Can be nullptr</li>
<li><strong>textColor</strong>: color of the text (rgb values, 0.0 - 1.0). Can be nullptr</li>
<li><strong>backgroundColor</strong>: background color of the console window (rgb values, 0.0 - 1.0). Can be nullptr</li>
</ul>
</api-input-cpp>
<api-output-cpp>
<ul>
<li>-1 if operation was not successful. Otherwise a console window handle</li>
</ul>
</api-output-cpp>
<api-synopsis-python>int consoleHandle = sim.auxiliaryConsoleOpen(string title, int maxLines, int mode,
list position = None, list size = None,
list textColor = None, list backgroundColor = None)</api-synopsis-python>
<api-synopsis-lua>int consoleHandle = sim.auxiliaryConsoleOpen(string title, int maxLines, int mode,
int[2] position = nil, int[2] size = nil,
float[3] textColor = nil,
float[3] backgroundColor = nil)</api-synopsis-lua>
<api-input-python-lua>
<ul>
<li><strong>title</strong>: title of the console window</li>
<li><strong>maxLines</strong>: number of text lines that can be displayed and buffered</li>
<li><strong>mode</strong>: bit-coded value:
<ul>
<li>bit0 (1) set indicates that the console window automatically closes at simulation end</li>
<li>bit1 (2) set indicates that lines will be wrapped</li>
<li>bit2 (4) set indicates that the user can close the console window</li>
<li>bit3 (8) is not used</li>
<li>bit4 (16) set indicates that the console will not automatically hide when the user switches to another scene</li>
</ul>
</li>
<li><strong>position</strong>: initial position of the console window (x and y value). Can be None/nil</li>
<li><strong>size</strong>: initial size of the console window (x and y value). Can be None/nil</li>
<li><strong>textColor</strong>: color of the text (rgb values, 0.0 - 1.0). Can be None/nil</li>
<li><strong>backgroundColor</strong>: background color of the console window (rgb values, 0.0 - 1.0 ). Can be None/nil</li>
</ul>
</api-input-python-lua>
<api-output-python-lua>
<ul>
<li><strong>consoleHandle</strong>: console window handle</li>
</ul>
</api-output-python-lua>
<api-calltip>int consoleHandle = sim.auxiliaryConsoleOpen(string title, int maxLines, int mode, int[2] position=nil, int[2] size=nil, float[3] textColor=nil, float[3] backgroundColor=nil)</api-calltip>
</function>
<function>
<api-function-name>sim.auxiliaryConsolePrint</api-function-name>
<api-description>Prints to an auxiliary console window</api-description>
<api-see-also>sim.auxiliaryConsoleOpen</api-see-also>
<api-synopsis-cpp>int simAuxiliaryConsolePrint(int consoleHandle, const char* text)</api-synopsis-cpp>
<api-input-cpp>
<ul>
<li><strong>consoleHandle</strong>: handle of the console window, previously returned by the <a href="simAuxiliaryConsoleOpen.htm">simAuxiliaryConsoleOpen</a></li>
<li><strong>text</strong>: text to append, or nullptr to clear the console window</li>
</ul>
</api-input-cpp>
<api-output-cpp>
<ul>
<li>-1 if operation was not successful. 0 if the console doesn't exist (anymore), in which case no error is generated. 1 if the operation was successful.</li>
</ul>
</api-output-cpp>
<api-synopsis-python>int result = sim.auxiliaryConsolePrint(int consoleHandle, string text)</api-synopsis-python>
<api-synopsis-lua>int result = sim.auxiliaryConsolePrint(int consoleHandle, string text)</api-synopsis-lua>
<api-input-python-lua>
<ul>
<li><strong>consoleHandle</strong>: handle of the console window, previously returned by the <a href="simAuxiliaryConsoleOpen.htm">sim.auxiliaryConsoleOpen</a></li>
<li><strong>text</strong>: text to append, or None/nil to clear the console window</li>
</ul>
</api-input-python-lua>
<api-output-python-lua>
<ul>
<li><strong>result</strong>: 0 if the console doesn't exist (anymore), in which case no error is generated. 1 if the operation was successful</li>
</ul>
</api-output-python-lua>
<api-calltip>int result = sim.auxiliaryConsolePrint(int consoleHandle, string text)</api-calltip>
</function>
<function>
<api-function-name>sim.auxiliaryConsoleShow</api-function-name>
<api-description>Shows or hides an auxiliary console window</api-description>
<api-see-also>sim.auxiliaryConsoleOpen
sim.auxiliaryConsoleClose</api-see-also>
<api-synopsis-cpp>int simAuxiliaryConsoleShow(int consoleHandle, bool showState)</api-synopsis-cpp>
<api-input-cpp>
<ul>
<li><strong>consoleHandle</strong>: handle of the console window, previously returned by <a href="simAuxiliaryConsoleOpen.htm">simAuxiliaryConsoleOpen</a>. When combined with <em>sim.handleflag_extended</em>, then the function will simply query the visibility state of the console.</li>
<li><strong>showState</strong>: indicates whether the console should be hidden (0) or shown (!=0)</li>
</ul>
</api-input-cpp>
<api-output-cpp>
<ul>
<li>-1 if operation was not successful. 0 if the console doesn't exist (anymore), in which case no error is generated. 1 if the console window's show state was changed.</li>
</ul>
</api-output-cpp>
<api-synopsis-python>int result = sim.auxiliaryConsoleShow(int consoleHandle, bool showState)</api-synopsis-python>
<api-synopsis-lua>int result = sim.auxiliaryConsoleShow(int consoleHandle, bool showState)</api-synopsis-lua>
<api-input-python-lua>
<ul>
<li><strong>consoleHandle</strong>: handle of the console window, previously returned by <a href="simAuxiliaryConsoleOpen.htm">sim.auxiliaryConsoleOpen</a>. When combined with <em>sim.handleflag_extended</em>, then the function will simply query the visibility state of the console.</li>
<li><strong>showState</strong>: indicates whether the console should be hidden (0) or shown (!=0)</li>
</ul>
</api-input-python-lua>
<api-output-python-lua>
<ul>
<li><strong>result</strong>: 0 if the console doesn't exist (anymore), in which case no error is generated. 1 if the console window's show state was changed.</li>
</ul>
</api-output-python-lua>
<api-calltip>int result = sim.auxiliaryConsoleShow(int consoleHandle, bool showState)</api-calltip>
</function>
<function>
<api-function-name>sim.broadcastMsg</api-function-name>
<api-description>Broadcasts a message to all scripts, except for the emitting script. Messages are received
synchronously via the sysCall_msg <a href="../callbackFunctions.htm">callback function</a>
</api-description>
<api-synopsis-python>sim.broadcastMsg(dict message, int options = 0)</api-synopsis-python>
<api-synopsis-lua>sim.broadcastMsg(map message, int options = 0)</api-synopsis-lua>
<api-input-python-lua>
<ul>
<li><strong>message</strong>: message to broadcast. Best is to use following skeleton message: message = {'id': 'msgIdentifyingString', 'data': [...]}</li>
<li><strong>options</strong>: not used, keep at 0</li>
</ul>
</api-input-python-lua>
<api-calltip>sim.broadcastMsg(map message, int options=0)</api-calltip>
</function>
<function>
<api-function-name>sim.buildIdentityMatrix</api-function-name>
<api-description>Builds an identity transformation matrix</api-description>
<api-see-also>
<a href="../apiFunctions.htm#coordinatesAndTransformations">matrix/transformation functions</a>
</api-see-also>
<api-synopsis-cpp>int simBuildIdentityMatrix(double* matrix)</api-synopsis-cpp>
<api-input-cpp>
<ul>
<li><strong>matrix</strong>: matrix (array of 12 values [Vx0 Vy0 Vz0 P0 Vx1 Vy1 Vz1 P1 Vx2 Vy2 Vz2 P2])</li>
</ul>
</api-input-cpp>
<api-output-cpp>
<ul>
<li>-1 if operation was not successful</li>
</ul>
</api-output-cpp>
<api-synopsis-python>list matrix = sim.buildIdentityMatrix()</api-synopsis-python>
<api-synopsis-lua>float[12] matrix = sim.buildIdentityMatrix()</api-synopsis-lua>
<api-output-python-lua>
<ul>
<li><strong>matrix</strong>: array of 12 values [Vx0 Vy0 Vz0 P0 Vx1 Vy1 Vz1 P1 Vx2 Vy2 Vz2 P2]</li>
</ul>
</api-output-python-lua>
<api-calltip>float[12] matrix = sim.buildIdentityMatrix()</api-calltip>
</function>
<function>
<api-function-name>sim.buildMatrix</api-function-name>
<api-description>Builds a transformation matrix based on a position vector and
<a href="../positionOrientationTransformation.htm#euler">Euler angles</a>
</api-description>
<api-see-also>
<a href="../positionOrientationTransformation.htm">positions and orientations</a>
</api-see-also>
<api-synopsis-cpp>int simBuildMatrix(const double* position, const double* eulerAngles, double* matrix)</api-synopsis-cpp>
<api-input-cpp>
<ul>
<li><strong>position</strong>: pointer to 3 values</li>
<li><strong>eulerAngles</strong>: pointer to 3 values</li>
<li><strong>matrix</strong>: matrix (array of 12 values [Vx0 Vy0 Vz0 P0 Vx1 Vy1 Vz1 P1 Vx2 Vy2 Vz2 P2])</li>
</ul>
</api-input-cpp>
<api-output-cpp>
<ul>
<li>-1 if operation was not successful</li>
</ul>
</api-output-cpp>
<api-synopsis-python>list matrix = sim.buildMatrix(list position, list eulerAngles)</api-synopsis-python>
<api-synopsis-lua>float[12] matrix = sim.buildMatrix(float[3] position, float[3] eulerAngles)</api-synopsis-lua>
<api-input-python-lua>
<ul>
<li><strong>position</strong>: array of 3 values</li>
<li><strong>eulerAngles</strong>: array of 3 values</li>
</ul>
</api-input-python-lua>
<api-output-python-lua>
<ul>
<li><strong>matrix</strong>: array of 12 values [Vx0 Vy0 Vz0 P0 Vx1 Vy1 Vz1 P1 Vx2 Vy2 Vz2 P2]</li>
</ul>
</api-output-python-lua>
<api-calltip>float[12] matrix = sim.buildMatrix(float[3] position, float[3] eulerAngles)</api-calltip>
</function>
<function>
<api-function-name>sim.buildPose</api-function-name>
<api-description>Builds a pose based on a position vector and <a href="../positionOrientationTransformation.htm#euler">Euler angles</a> or
axes</api-description>
<api-see-also>
<a href="../positionOrientationTransformation.htm">positions and orientations</a>
</api-see-also>
<api-synopsis-cpp>int simBuildPose(const double* position, const double* eulerAngles, double* pose)</api-synopsis-cpp>
<api-input-cpp>
<ul>
<li><strong>position</strong>: pointer to 3 values</li>
<li><strong>eulerAngles</strong>: pointer to 3 values</li>
<li><strong>pose</strong>: pose (array of 7 values [x y z qx qy qz qw])</li>
</ul>
</api-input-cpp>
<api-output-cpp>
<ul>
<li>-1 if operation was not successful</li>
</ul>
</api-output-cpp>
<api-synopsis-python>list pose = sim.buildPose(list position, list eulerAnglesOrAxis, int mode = 0, list axis2 = None)</api-synopsis-python>
<api-synopsis-lua>float[7] pose = sim.buildPose(float[3] position, float[3] eulerAnglesOrAxis1, int mode = 0,
float[3] axis2 = nil)</api-synopsis-lua>
<api-input-python-lua>
<ul>
<li><strong>position</strong>: pointer to 3 values representing the position component</li>
<li><strong>eulerAnglesOrAxis1</strong>: pointer to 3 values representing Euler angles or a reference frame axis (see mode below)</li>
<li><strong>mode</strong>: describes how the orientation is specified:
<ul>
<li>0: eulerAnglesOrAxis1 represents Euler angles and axis2 is ignored</li>
<li>1: eulerAnglesOrAxis1 represents the x-axis of the new pose's reference frame, axis2 is ignored</li>
<li>2: eulerAnglesOrAxis1 represents the y-axis of the new pose's reference frame, axis2 is ignored</li>
<li>3: eulerAnglesOrAxis1 represents the z-axis of the new pose's reference frame, axis2 is ignored</li>
<li>4: eulerAnglesOrAxis1 represents the x-axis and axis2 represents the y-axis of the new pose's reference frame</li>
<li>5: eulerAnglesOrAxis1 represents the y-axis and axis2 represents the z-axis of the new pose's reference frame</li>
<li>6: eulerAnglesOrAxis1 represents the z-axis and axis2 represents the x-axis of the new pose's reference frame</li>
<li>7: eulerAnglesOrAxis1 represents the x-axis and axis2 represents the z-axis of the new pose's reference frame</li>
<li>8: eulerAnglesOrAxis1 represents the y-axis and axis2 represents the x-axis of the new pose's reference frame</li>
<li>9: eulerAnglesOrAxis1 represents the z-axis and axis2 represents the y-axis of the new pose's reference frame</li>
</ul>
</li>
<li><strong>axis2</strong>: pointer to 3 values representing a reference frame axis (see mode above)</li>
</ul>
</api-input-python-lua>
<api-output-python-lua>
<ul>
<li><strong>pose</strong>: the pose (array of 7 values [x y z qx qy qz qw])</li>
</ul>
</api-output-python-lua>
<api-calltip>float[7] pose = sim.buildPose(float[3] position, float[3] eulerAnglesOrAxis, int mode=0, float[3] axis2=nil)</api-calltip>
</function>
<function>
<api-function-name>sim.callScriptFunction</api-function-name>
<api-description>Calls a script function (from a <a href="../plugins.htm">plugin</a>, <a href="../mainClientApplication.htm">the main client application</a>,
or from another script). This represents a <a href="../callbackFunctions.htm">user callback</a> inside of a script. The
target script must be initialized for this call to succeed, e.g. when calling <a href="../simulationScripts.htm">simulation scripts</a>,
then simulation must be running</api-description>
<api-see-also>sim.getScriptFunctions
sim.executeScriptString</api-see-also>
<api-synopsis-python>... = sim.callScriptFunction(string functionName, int scriptHandle, ...)</api-synopsis-python>
<api-synopsis-lua>... = sim.callScriptFunction(string functionName, int scriptHandle, ...)</api-synopsis-lua>
<api-input-python-lua>
<ul>
<li><strong>functionName</strong>: the function to call.</li>
<li><strong>scriptHandle</strong>: the handle of the script, or sim.handle_self to target the current script. See <a href="simGetScript.htm">sim.getScript</a></li>
<li><strong>...</strong>: any number of arguments that will be handed over to the called function.</li>
</ul>
</api-input-python-lua>
<api-output-python-lua>
<ul>
<li><strong>...</strong>: any number of return values from the called function.</li>
</ul>
</api-output-python-lua>
<api-calltip>any outArg = sim.callScriptFunction(string functionName, int scriptHandle, any inArg=nil)</api-calltip>
</function>
<function>
<api-function-name>simCallScriptFunctionEx</api-function-name>
<api-description>Calls a script function (from a <a href="../plugins.htm">plugin</a>,
<a href="../mainClientApplication.htm">the main client application</a>, or from another script). This
represents a <a href="../callbackFunctions.htm">user callback</a> inside of a script. The target script
must be initialized for this call to succeed, e.g. when calling <a href="../simulationScripts.htm">simulation scripts</a>,
then simulation must be running
<br />
<br />
Data exchange between a plugin and a script happens via a <a href="../apiFunctions.htm#stacks">stack</a>. Reading and writing arguments from/to the stack gives you a maximum of flexibility, and you wil be able to exchange also complex data structures. But it can also be tedious and error prone. Use instead the helper classes located in <em>programming/include/simStack</em>: they will greatly simplify the task. Have a look at the example plugins <a href="https://github.com/CoppeliaRobotics/simSkeleton" target="_blank">simSkeleton</a> and <a href="https://github.com/CoppeliaRobotics/simSkel" target="_blank">simSkel</a>
</api-description>
<api-see-also>sim.executeScriptString
simGetScriptHandleEx</api-see-also>
<api-synopsis-cpp>int simCallScriptFunctionEx(int scriptHandle, const char* functionName,
int stackId)</api-synopsis-cpp>
<api-input-cpp>
<ul>
<li><strong>scriptHandle</strong>: the handle of the script, or -1 for the sandbox script, or -2 for the main script</li>
<li><strong>functionName</strong>: the function to call.</li>
<li><strong>stackId</strong>: a <a href="simCreateStack_cpp.htm">stack handle</a>. The stack represents the function's in/out values. See also the <a href="../apiFunctions.htm#stacks">available stack functions</a>.</li>
</ul>
</api-input-cpp>
<api-output-cpp>
<ul>
<li>-1 in case of an error</li>
</ul>
</api-output-cpp>
</function>
<function>
<api-function-name>sim.cameraFitToView</api-function-name>
<api-description>Shifts and adjusts a camera associated with a view to fill the view entirely with
the specified objects or models</api-description>
<api-see-also>sim.adjustView
sim.floatingViewAdd</api-see-also>
<api-synopsis-cpp>int simCameraFitToView(int viewHandleOrIndex, int objectCount, const int* objectHandles, int options,
double scaling)</api-synopsis-cpp>
<api-input-cpp>
<ul>
<li><strong>viewHandleOrIndex</strong>: the handle of the view (can also be a floating view), or the index of the view. If the camera is not associated with any view, then you can specify the handle of the camera, together with the <em>sim.handleflag_camera</em> flag.</li>
<li><strong>objectCount</strong>: number of intems in the objectHandles pointer. Can be 0, in which case the whole visible scene will be filling the view.</li>
<li><strong>objectHandles</strong>: pointer to objectHandles. Only visible objects will be taken into account. Can be nullptr, in which case the whole visible scene will be filling the view.</li>
<li><strong>options</strong>: bit-coded:
<ul>
<li>bit0 (1): if set, then individual objects will be filling the view. If not set, then models associated with model base objects will also be included</li>
<li>bit1 (2): if set, then the view proportions will be 1 by 1, independently on what the view size is</li>
</ul>
</li>
<li><strong>scaling</strong>: scaling factor. Use 1.0 for normal behaviour.</li>
</ul>
</api-input-cpp>
<api-output-cpp>
<ul>
<li>-1 if operation was not successful. 0 for a silent error (e.g. when the indicated view doesn't exist anymore), 1 for success</li>
</ul>
</api-output-cpp>
<api-synopsis-python>int result = sim.cameraFitToView(int viewHandleOrIndex, list objectHandles = None, int options = 0,
float scaling = 1)</api-synopsis-python>
<api-synopsis-lua>int result = sim.cameraFitToView(int viewHandleOrIndex, int[] objectHandles = nil, int options = 0,
float scaling = 1)</api-synopsis-lua>
<api-input-python-lua>
<ul>
<li><strong>viewHandleOrIndex</strong>: handle of the view (can also be a floating view), or the index of the view. If the camera is not associated with any view, then you can specify the handle of the camera, together with the <em>sim.handleflag_camera</em> flag.</li>
<li><strong>objectHandles</strong>: object handles. Only visible objects will be taken into account. Can be None/nil, in which case the whole visible scene will be filling the view.</li>
<li><strong>options</strong>: bit-coded:
<ul>
<li>bit0 (1): if set, then individual objects will be filling the view. If not set, then models associated with model base objects will also be included</li>
<li>bit1 (2): if set, then the view proportions will be 1 by 1, independently on what the view size is</li>
</ul>
</li>
<li><strong>scaling</strong>: scaling factor. Use 1.0 for normal behaviour.</li>
</ul>
</api-input-python-lua>
<api-output-python-lua>
<ul>
<li><strong>result</strong>: 0 for a silent error (e.g. when the indicated view doesn't exist anymore), 1 for success</li>
</ul>
</api-output-python-lua>
<api-calltip>int result = sim.cameraFitToView(int viewHandleOrIndex, int[] objectHandles=nil, int options=0, float scaling=1.0)</api-calltip>
</function>
<function>
<api-function-name>sim.changeEntityColor</api-function-name>