Welcome to MMD API’s documentation!

Introduce

This documentation discuss the MMD API, the following topic are included:

Contents

MMD API Concept

Introduce

MMD API, or MMD commands, are sets of JSON format message to manipulate MMD scenes, objects and buffers. The typical usage of MMD API would be display alarms, create animations or display customized information panel upon various of MMD objects.

Methods to invoke MMD API

There are 4 ways to invoke MMD API:

  • Javascript method call in browser
  • P2 server
  • Message Queue
  • ...

API Reference

ObjectCommand

Base Class, commands which inherits from ObjectCommand will have following methods build-in.

Parameters
Name Required Description
id No Get object by ID
uid No Get object by UID, e.g. user define ID
ids No Get objects by ID array
uids No Get objects by UID array
fromBuffer No Get content from buffer, would be one or more objects, or command results
toBuffer No Buffer to save command results

Buffer

CopyBuffer

Copy content of source buffer to target buffer, content in target buffer will be overwrote.

Note

This command only apply to object buffers

Parameters
Name Required Description
fromBuffer Yes source buffer path
toBuffer Yes target buffer path

Example

  • copy buffer by full path
1
2
3
4
5
{
    "cmd": "CopyBuffer",
    "fromBuffer":{"ObjectManager":"RunBuffer/buffer1"},
    "toBuffer":{"ObjectManager":"RunBuffer/buffer2"}
}
  • copy buffer by relative path
1
2
3
4
5
{
    "cmd": "CopyBuffer",
    "fromBuffer":"buffer1",
    "toBuffer":"buffer2"
}

NOTE

  • buffer1 same as {"ObjectManager":"RunBuffer/buffer1"}
  • buffer2 same as {"ObjectManager":"RunBuffer/buffer2"}

MergeBuffer

Copy content of source buffer to target buffer, content in target buffer will be reserved.

Note

This command only apply to object buffers

Parameters
Name Required Description
fromBuffer Yes source buffer path
toBuffer Yes target buffer path

Example

1
2
3
4
5
{
    "cmd": "MergeBuffer",
    "fromBuffer":{"ObjectManager":"RunBuffer/buffer1"},
    "toBuffer":{"ObjectManager":"RunBuffer/buffer2"}
}

SubtractBuffer

Delete objects in target buffer which are identical to objects in source buffer.

Note

This command only apply to object buffers

Parameters
Name Required Description
fromBuffer Yes source buffer path
toBuffer Yes target buffer path

Example

1
2
3
4
5
{
    "cmd": "SubtractBuffer",
    "fromBuffer":{"ObjectManager":"RunBuffer/buffer1"},
    "toBuffer":{"ObjectManager":"RunBuffer/buffer2"}
}

SetObjectsToBuffer

Assign object to buffer.

Parameters
Name Required Description
Object Reference Yes Object Reference
toBuffer Yes target buffer path

Example

  • refer object by uid
1
2
3
4
5
{
    "cmd": "SetObjectsToBuffer",
    "uid":"obj01",
    "toBuffer":{"ObjectManager":"RunBuffer/objsBuffer"}
}
  • object uid list
1
2
3
4
5
{
    "cmd": "SetObjectsToBuffer",
    "uids":["obj01", "obj02"],
    "toBuffer":{"ObjectManager":"RunBuffer/objsBuffer"}
}
  • refer object by id
1
2
3
4
5
{
    "cmd": "SetObjectsToBuffer",
    "id":"dg23dvw41hrdve",
    "toBuffer":{"ObjectManager":"RunBuffer/objsBuffer"}
}

SetBufferValue

Assign value to buffer.

Parameters
Name Required Description
toBuffer Yes target buffer path
value Yes value to be set

Example

  • empty buffer
1
2
3
4
5
{
    "cmd": "SetBufferValue",
    "toBuffer":{"ObjectManager":"RunBuffer/buffer1"},
    "value":""
}

Control


CreatePlacement

Create object.

Parameters
Name Required Default Description
uid Yes   UserID
bundleId Yes   Model ID
parentId No Current floor or park

Parent Object ID.

Note

Only supports floor or park as parent.

parentUid No Current floor or park

Parent Object UID.

Note

Only supports floor or park as parent

transformProxyId No   Reference Object ID, if specified, pos, rot and scl are relative to reference object
transformProxyUid No   Reference Object UID, if specified, pos, rot and scl are relative to reference object
transformProxyFromBuffer No   Reference Object from Buffer, if specified, pos, rot and scl are relative to reference object
pos No [0,0,0]

Object Position

Note

if transformProxy is specified, pos is relative to transformProxy object, otherwise is relative to parent object.

       
rot No [0,0,0]

Object rotation in 3-element tuple as Euler angles, use alternatively with quat, unit: degree.

Note

if transformProxy is specified, rot will based on transformProxy object coordinate, otherwise based on parent object.

see Euler Angles

quat No [0,0,0,1]

Object rotation specified by a 4-element tuple, use alternatively with ror.Any rotation can be determinate by a single axis with rotation angle. Give a axis (x, y, z) and a angle θ, rotation can be calculated as:

quat = [ x*sin(θ/2), y*sin(θ/2),z*sin(θ/2), cos(θ/2)]

Note

if transformProxy is specified, rot will based on transformProxy object coordinate, otherwise based on parent object.

scl No [1,1,1]

Scale Factor

Note

if transformProxy is specified, scale factor is relative to transformProxy object, otherwise is relative to parent object.

Example

1
2
3
4
5
6
7
8
9
{
    "cmd": "CreatePlacement",
    "uid" : "object01",
    "bundleId":"F933B1A524B94050BC7A82B15D2057F5",
    "transformProxyUid":"carbin01",
    "pos":[0,2,0],
    "rot":[0,90,0],
    "scl":[0.1,0.2,0,2]
}

Euler Angles

Euler Angles

Fig 1. Euler angles is essentially rotation against axis x,y and z while y is the vertical axis.


CreatePlacementFromChildren

Create object from model.

Note

name conversion for object created by this method is {object uid}_{model name}

Parameters
Name Required Description
Object Reference Yes Object Reference
childNameList Yes Array of object names to be created from model
toBuffer No uffer name which objects is saved to

Example

1
2
3
4
5
6
{
    "cmd": "CreatePlacementFromChildren",
    "uid": "silo",
    "childNameList": ["Window_01", "Window_02"],
    "toBuffer": "window"
}

GetObjectsByCondition

Get objects by search criteria.

Parameters
Name Required Description
condition Yes Search criteria
fromBuffer No Specify buffer as search scope
underLevelUid No Specify parent object by uid, which will includes all children objects. Parent object must be floor or park.
underLevelBuffer No Specify parent object by buffer, which will includes all children objects. Parent object must be floor or park.
toBuffer No Save search results to buffer

Example

 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
{
    "cmd": "GetObjectsByCondition",

    //"_default_" condition always equals to true
    //"condition": "_default_",

    //search object by id or uid
    //"condition": {"OBJECT":"4"},

    //search object by classId
    //"condition": {"CLASSID":3},

    //search object by object property
    //"condition": {"ATTRIBUTE":{"PropertyDict/Sex":"Male"}},

    //AND operator
    //"condition": {"AND":[{"PropertyDict/sex":"Male"}, {"MoniterData/RealTimeData/Status":"Normal"}]},

    //OR operator
    //"condition": {"OR":[{"PropertyDict/sex":"Male"}, {"MoniterData/RealTimeData/Status":"Normal"}]},

    //NOT operator, can be used in conjunction with AND or OR
    //"condition": {"NOT":{"AND":[{"PropertyDict/Sex":"Male"}, {"MoniterData/RealTimeData/Status":"Normal"}]}},

    //////////////////////////
    //write search condition in brief mode
    //number, which is equivalent to  {"CLASSID":3}
    //"condition": 3,

    //string, which is equivalent to {"OBJECT":"4"}
    //"condition": "4",

    //key/value pair, which is equivalent to object property, e.g. {"ATTRIBUTE":{"PropertyDict/Sex":"Male"}}
    "condition": {"PropertyDict/Sex":"Male"},

    "toBuffer": "Man"
}

Show

Set object visibility.

Parameters
Name Required Description
Object Reference Yes Object Reference
enable Yes True or False

Example

1
2
3
4
5
{
    "cmd": "Show",
    "uid": "silo",
    "enable": false
}

SetPickEnable

Set whether object can be ‘picked‘.
Parameters
Name Required Description
Object Reference Yes Object Reference
enable Yes True or False
1
2
3
4
5
{
    "cmd": "SetPickEnable",
    "uid": "silo",
    "enable": false
}

SetPosition

Set object position.

Parameters
Name Required Description
Object Reference Yes Object Reference
pos Yes

Coordinate, for instance,[0,0,0]

Note

Coordinate is relative to current floor or park

Example

1
2
3
4
5
{
    "cmd": "SetPosition",
    "uid": "silo",
    "pos": [0,0,0]
}

SetScale

Set object scale.

Parameters
Name Required Description
Object Reference Yes Object Reference
scale Yes scale value, for instance, [2,2,2]

Example

1
2
3
4
5
{
    "cmd": "SetScale",
    "uid": "silo",
    "scale": [1,2,1]
}

Sitdown

Place object on the floor.

Parameters
Name Required Description
Object Reference Yes Object Reference

Example

1
2
3
4
{
    "cmd": "Sitdown",
    "uid": "chair_01"
}

MoveTo

Move object to given position with given speed.

Parameters
Name Required Default Description
Object Reference Yes   Object Reference
fromPos No current position Start position, relative to current floor or park
pos Yes End position, relative to current floor or park  
targetUid No   End position by object ID
time No 2 Duration in seconds, use with ‘speed’ alternatively
speed No 1 Moving speed in meter per second, use with ‘time’ alternatively
delay No   delay in seconds
easeType No linear Start and/or ending mode, click here for list of ease modes
loopType No none

Repeat mode can be one of:

  • none: do not repeat
  • loop: repeat
  • pingPong: move from start to end , then move from end to start, repeat the process
orientToPath No   Align with moving direction
autoCreate No   Create new object and move it
autoCreate/enable No   Sub parameter of autoCreate, valid if autoCreate is enabled
autoCreate/bundleId No   Sub parameter of autoCreate,specify model ID while create new moving object, Valid if autoCreate is enabled
autoCreate/pos No   Sub parameter of autoCreate: object position, relative to current floor or park. Valid if autoCreate is enabled
autoCreate/targetUid No   Sub parameter of autoCreate,set coordinate of new object by existing object uid. Valid if autoCreate is enabled
autoCreate/props No   Sub parameter of autoCreate,set properties of new object. Valid if autoCreate is enabled.

Example

1
2
3
4
5
{
    "cmd": "MoveTo",
    "uid": "object01",
    "pos": [1,0,1]
}
1
2
3
4
5
6
7
8
{
    "cmd": "MoveTo",
    "uid": "object01",
    "pos": [1,0,1],
    "time": 2.0,
    "delay": 2.0,
    "easeType": "easeInOutQuad"
}
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
{
    "cmd": "MoveTo",
    "uid": "object01",
    "pos": [1,0,1],
    "speed": 2.0,
    "delay": 2.0,
    "orientToPath": true,
    "loopType": "loop",
    "easeType": "linear",
    "autoCreate": {
        "enable": true,
        "bundleId":"0AF78802F2F64DB2AEF805CB78D57E07",
        "targetUid":"posObj01",
        "props":{
            "Plate":"A001"
        }
    }
}

MovePath

Set Move Path.

Parameters
Name Required Default Description
Object Reference Yes   Object Reference
pointPath Yes A set of positions as moving path, relative to floor or park.  
objectPath No A set of object uid as moving path  
time No 2 Duration in seconds, use with ‘speed’ alternatively
speed No 1 Moving speed in meter per second, use with ‘time’ alternatively
delay No   delay in seconds
easeType No linear Start and/or ending mode, click here for list of ease modes
loopType No none

Repeat mode can be one of:

  • none: do not repeat
  • loop: repeat
  • pingPong: move from start to end , then move from end to start, repeat the process
orientToPath No   Align with moving direction
autoCreate No   Create new object and move it
autoCreate/enable No   Sub parameter of autoCreate, valid if autoCreate is enabled
autoCreate/bundleId No   Sub parameter of autoCreate,specify model ID while create new moving object, Valid if autoCreate is enabled
autoCreate/pos No   Sub parameter of autoCreate: object position, relative to current floor or park. Valid if autoCreate is enabled
autoCreate/targetUid No   Sub parameter of autoCreate,set coordinate of new object by existing object uid. Valid if autoCreate is enabled
autoCreate/props No   Sub parameter of autoCreate,set properties of new object. Valid if autoCreate is enabled.

Example

1
2
3
4
5
{
    "cmd": "MovePath",
    "uid": "object01",
    "pointPath": [[1,0,1], [1,0,0], [12,0,0]]
}
1
2
3
4
5
6
7
8
{
    "cmd": "MovePath",
    "uid": "object01",
    "objectPath": ["obj01", "obj02", "obj03"],
    "time": 2.0,
    "delay": 2.0,
    "easeType": "easeInOutQuad"
}
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
{
    "cmd": "MovePath",
    "uid": "object01",
    "objectPath": ["obj01", "obj02", "obj03"],
    "speed": 2.0,
    "delay": 2.0,
    "orientToPath": true,
    "loopType": "loop",
    "easeType": "linear",
    "autoCreate": {
        "enable": true,
        "bundleId":"0AF78802F2F64DB2AEF805CB78D57E07",
        "targetUid":"posObj01",
        "props":{
            "Plate":"A001"
        }
    }
}

Attach

Attach to object.

Parameters
Name Required Description
Object Reference Yes Object Reference
targetId No Set target object by ID
targetUid No Set target object by UID
targetFromBuffer No Set target object from buffer
pos No Offset to target object
rot No Rotation relative to target object

Example

1
2
3
4
5
6
7
{
    "cmd": "Attach",
    "uid": "eyes",
    "targetUid": "head",
    "pos": [0,0.1,0],
    "rot": [0,90,0]
}

Detach

Detach from object.

Parameters
Name Required Description
Object Reference Yes Object Reference

Example

1
2
3
4
{
    "cmd": "Detach",
    "uid": "eyes"
}

AutoRotate

Rotate object

Parameters
Name Required Default Description
Object Reference Yes   Object Reference
speed No 180 Rotate speed by degree per second
enable No true Stop auto rotating if set to false

Example

  • Start auto rotating
1
2
3
4
{
    "cmd": "AutoRotate",
    "fromBuffer": "fan"
}
  • Stop auto rotating
1
2
3
4
5
{
    "cmd": "AutoRotate",
    "fromBuffer": "fan",
    "enable":false
}

Rotate

Rotate object by a given angle.

Parameters
Name Required Default Description
Object Reference Yes   Object Reference
rot No  
A 3-element array as rotation angle. unit = degree
space No self

rotate against world or itself. Can be one of :

  • world: rotate against world.
  • self: rotate as itself.

Example

1
2
3
4
5
6
{
    "cmd": "Rotate",
    "fromBuffer": "fan",
    "rot":[0,90,0],
    "space":"self"
}

Destroy

Destroy object.

Parameters
Name Required Description
Object Reference Yes Object Reference

Example

1
2
3
4
{
    "cmd": "Destroy",
    "fromBuffer": "Trash"
}

CreateTimerObject

Create timer object, can be used as data source, invisible in UI.
Parameters
Name Required Description
toBuffer Yes Buffer to store time object

Example

1
2
3
4
{
    "cmd": "CreateTimerObject",
    "toBuffer": "timer01"
}

Properties of timer object

Properties of current time
Name Description
YearMonthDay return string as yyyy.MM.dd
HourMinuteSecond return string as HH:mm:ss
HourMinuteSecondMillisecond return string as HH:mm:ss:ffff
YearMonthDayHourMinuteSecond return string as yyyy.MM.dd HH:mm:ss
Year Year of YearMonthDayHourMinuteSecond
Month Month of YearMonthDayHourMinuteSecond
Day Day of YearMonthDayHourMinuteSecond
Hour Hour of YearMonthDayHourMinuteSecond
Minute Minute of YearMonthDayHourMinuteSecond
Second Second of YearMonthDayHourMinuteSecond
Millisecond Millisecond of HourMinuteSecondMillisecond
DayOfYear Day of year
DayOfWeek Day of week,[0-6] while 0 is Sunday
Properties of total running time
Name Description
TimerYear Year of total running time
TimerAllYear Same as TimerYear
TimerMonth Month mod year
TimerAllMonth Total month
TimerDay Day mod month
TimerAllDay Total day

Selection


AddToCandidate

Add objects to ‘candidate set’.

Note

Candidate set will be reset after scene switch

Parameters
Name Required Description
Object Reference Yes Object Reference

Example

1
2
3
4
{
    "cmd": "AddToCandidate",
    "uids": ["obj01", "obj02"]
}

ClearCandidate

Empty candidate set.

Note

Candidate set will be reset after scene switch.

Parameters

No parameters.

Example

1
2
3
{
    "cmd": "ClearCandidate"
}

RemoveFromCandidate

Remove objects from candidate set.

Note

Candidate set will be reset after scene switch

Parameters
Name Required Description
Object Reference Yes Object Reference

Example

1
2
3
4
{
    "cmd": "RemoveFromCandidate",
    "uids":["obj01", "obj02"]
}

AddToSelection

Add objects to ‘selection set’ and marked as ‘selected’.

Parameters
Name Required Description
Object Reference Yes Object Reference

Example

1
2
3
4
{
    "cmd": "AddToSelection",
    "uids":["obj01", "obj02"]
}

ClearSelection

Empty selection set and mark all objects as ‘unselected’.

Parameters

No parameters.

Example

1
2
3
{
    "cmd": "ClearSelection"
}

RemoveFromSelection

Remove objects from selection set and mark as ‘unselected’.

Parameters
Name Required Description
Object Reference Yes Object Reference

Example

1
2
3
4
{
    "cmd": "AddToSelection",
    "uids":["obj01", "obj02"]
}

GetSelection

Save objects in selection set to buffer

Parameters
Name Required Description
toBuffer Yes Buffer to save object

Example

1
2
3
4
{
    "cmd": "GetSelection",
    "toBuffer":{"ObjectManager":"RunBuffer/selection"}
}

LockSelection

Lock selection set, cannot remove or add new object if locked.

Parameters

No parameters.

Example

1
2
3
{
    "cmd": "LockSelection"
}

UnlockSelection

UnlockSelection selection set.

Parameters

No parameters.

Example

1
2
3
{
    "cmd": "UnlockSelection"
}

EnableRectangleSelect

Enable bulk selector in UI.

Parameters
Name Required Description
enable Yes True or False

Example

1
2
3
4
{
    "cmd": "EnableRectangleSelect",
    "enable":true
}

EnalbeCheckRectangleUpdate

Update bulk selection in real-time, recommended value: false

Parameters
Name Required Description
enable Yes True or False

Example

1
2
3
4
{
    "cmd": "EnalbeCheckRectangleUpdate",
    "enable":true
}

LimitRectangleSelectNum

Limit number of selected objects by bulk selector.

Parameters
Name Required Description
num Yes maxim number of selected objects by bulk selector

Example

1
2
3
4
{
    "cmd": "LimitRectangleSelectNum",
    "num": 4
}

Resource


DownloadBundle

Download model.

Parameters
Name Required Description
bundleId Yes Model Id
cmds No Callback command after download

Example

  • Change object model after download
1
2
3
4
5
6
7
8
9
{
    "cmd": "DownloadBundle",
    "bundleId":"F933B1A524B94050BC7A82B15D2057F5",
    "cmds":[{
        "cmd":"ChangePlacementBundle",
        "uid":"object01",
        "bundleId":"F933B1A524B94050BC7A82B15D2057F5"
    }]
}

ChangePlacementBundle

Change object model.

Note

Model must be downloaded or used in scene.

Parameters
Name Required Description
Object Reference Yes Object Reference
bundleId Yes Model ID

Example

  • Change object model
1
2
3
4
5
{
    "cmd":"ChangePlacementBundle",
    "uid":"object01",
    "bundleId":"F933B1A524B94050BC7A82B15D2057F5"
}

DownloadTexture

Download texture.

Parameters
Name Required Description
url Yes URL to download texture, can be relative path based on mmd server URL
cmds Yes Callback command after download

Example

  • Change object texture after download
1
2
3
4
5
6
7
8
9
{
    "cmd": "DownloadTexture",
    "url":"images/selection.png", //URL or relative path based on mmd server URL
    "cmds":[{
        "cmd":"ChangePlacementTexture",
        "uid":"object01",
        "url":"images/selection.png"
    }]
}

ChangePlacementTexture

Change texture of object.

Note

texture must be downloaded or used in scene.

Parameters
Name Required Description
Object Reference Yes Object Reference
url Yes Texture URL, or relative path based on mmd server URL

Example

  • Change texture of object
1
2
3
4
5
{
    "cmd":"ChangePlacementTexture",
    "uid":"object01",
    "url":"images/selection.png"
}

Effect


SetTransparency

Set transparency of given object.

Parameters
Name Required Description
Object Reference Yes Object Reference
trans Yes

Value range [0-1]

  • 1: 100% transparent
  • 0: No transparency

Example

  • Set Object Transparency
1
2
3
4
5
{
    "cmd": "SetTransparency",
    "uid":"object01",
    "trans":0.25
}

SetColor

Set object color.

Parameters
Name Required Description
Object Reference Yes Object Reference
color Yes Color in RGB,for instance, red is [255, 0, 0]
ratio No Effect ratio, range from 0 to 1

Example

  • Set Object Color
1
2
3
4
5
6
{
    "cmd": "SetColor",
     "uid":"object01",
     "color":[1,0,0],
     "ratio":0.75
}

Fade

Fade effect.

Parameters
Name Required Default Description
Object Reference Yes   Object Reference
start Yes   Start transparent value, range [0-1]
end Yes   End transparent value, range [0-1]
time No 1 Effect duration in seconds
endAutoRelease No true if resume object status after effect end
enable No true Enable fading effect

Example

  • Fading Effect
1
2
3
4
5
6
7
8
{
    "cmd": "Fade",
    "uid":"object01",
    "start":1.0,
    "end":0.0,
    "time":1.0,
    "endAutoRelease":true
}
  • Disable Effect
1
2
3
4
5
{
    "cmd": "Fade",
     "uid":"object01",
     "enable":false
 }

FadeIn

Fade In Effect.

Parameters
Name Required Default Description
Object Reference Yes   Object Reference
time Yes 1 Effect duration in seconds.

Example

1
2
3
4
5
{
    "cmd": "FadeIn",
    "uid":"object01",
    "time":1.0
}

FadeOut

Fade Out Effect.

Parameters
Name Required Default Description
Object Reference Yes   Object Reference
time Yes 1 Effect duration in seconds.

Example

1
2
3
4
5
{
    "cmd": "FadeOut",
    "uid":"object01",
    "time":1.0
}

Flash

Flash effect.

Parameters
Name Required Default Description
Object Reference Yes   Object Reference
start Yes   Start transparent value
end Yes   End transparent value
time No 1 Effect duration in seconds
endAutoRelease No true if resume object status after effect end
enable No true Enable fading effect

Example

  • Flash Effect
1
2
3
4
5
6
7
8
{
    "cmd": "Flash",
    "uid":"object01",
    "start":1.0,
    "end":0.0,
    "time":1.0,
    "endAutoRelease":true
}
  • Disable Flash
1
2
3
4
5
{
    "cmd": "Flash",
    "uid":"object01",
    "enable":false
 }

ColorFade

ColorFade effect.

Parameters
Name Required Default Description
Object Reference Yes   Object Reference
color Yes   Color used in effect
start Yes   Color density at the start, value range [0-1]
end Yes   Color density at the end, value range [0-1]
time No 1 Effect duration in seconds
endAutoRelease No true if resume object status after effect end
enable No true Enable fading effect

Example

  • Change object to red in one second
1
2
3
4
5
6
7
8
9
{
    "cmd": "ColorFade",
    "uid":"object01",
    "color":[1,0,0],
    "start":0.0,
    "end":1.0,
    "time":1.0,
    "endAutoRelease":false
}
  • Disable Effect
1
2
3
4
5
{
    "cmd": "ColorFade",
    "uid":"object01",
    "enable":false
 }

UI


ShowPanel

Show or hide setting panel.

Parameters
Name Required Description
panel Yes

Name of the panel, can be one of:

  • viewPointPanel: Viewpoint Panel
  • fuctionListPanel: Function List Panel
  • switch3dPanel: 2D-3D Switch Panel
  • effectPanel: Effect Panel
  • screenShotPanel: ScreenShot Panel
  • levelPanel: Floor Panel
enable Yes Show or hide panel

Example

1
2
3
4
5
{
    "cmd": "ShowPanel",
    "panel":"viewPointPanel",
    "enable":false
}

CreatePlacemarkTemplate

Create new UI panel.

Parameters
Name Required Description
template Yes Panel settings, see below sample code for details

Example

  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
{
    "cmd": "CreatePlacemarkTemplate",
    "template":{
        "name": "Template Example",

        //panel size
        "bgWidth": 243,
        "bgHeight": 149,

        //position of panel axis
        "horizontalAlignment":"LEFT",    // horizontal position, can be one of LEFT CENTER RIGHT
        "verticalAlignment":"TOP",    // vertical position, can be one of TOP CENTER BOTTOM

        //controls included in panel
        "showMapping": {
            "Background": {
                //parameters
                "type": "image",
                "sortOrder": 0,
                "drawPos": [0, 0],
                "drawSize": [ 243, 149 ],

                //control axis position
                "horizontalAlignment":"LEFT",    //horizontal position, can be one of LEFT CENTER RIGHT
                "horizontalAlignmentOffset":0,    //horizontal offset
                "verticalAlignment":"TOP",    //vertical position, can be one of TOP CENTER BOTTOM
                "verticalAlignmentOffset":0,    //vertical offset

                //private parameters
                "image":"userimage/4815/CustomTexture/20151023824126.png",
                "color":[0,0,1],    //color settings may mix with image

                //data source settings
                "getMethod": "objectPropertyMapping",
                "propertyPath":"MonitorDatas/RealTimeData/status",
                "objectPropertyMapping":{
                    "_default_":"userimage/4815/CustomTexture/1.png",    //image location
                    "alarms":{"color":[1,0.2,0.2]},    //change color
                    "error":{    //change color and texture at the same time
                        "image":"userimage/4815/CustomTexture/3.png",
                        "color":[1,0,0]
                    }
                }
        },
        "name": {
                //parameters
                "type": "text",
                "sortOrder": 1,
                "drawPos": [0, 0],
                "drawSize": [243, 39],

                //axis position
                "horizontalAlignment":"LEFT",    //horizontal position, can be one of LEFT CENTER RIGHT
                "horizontalAlignmentOffset":0,    //horizontal offset
                "verticalAlignment":"TOP",    //vertical position, can be one of TOP CENTER BOTTOM
                "verticalAlignmentOffset":0,    //vertical offset

                //private  parameters
                "fontFamily": "Arial",    //font family
                "fontSize": 14,
                "fontColor": [1,1,1,1],
                "fontStyle": "Bold",
                "fontShadow": false,
                "fontShadowThickness": 2,
                "fontShadowColour": [0,0,0],
                "fontShadowOffset": [2, 2],
                "fontOutline": true,
                "fontOutlineThickness": 2,
                "horizontalOverflow": false,
                "verticalOverflow": true,
                "fontOutlineColour": [0,0,0],

                "horizontalTextAlignment": "CENTER",
                "verticalTextAlignment": "CENTER",
                "horizontalWriterAlignment": "TOP",
                "verticalWriterAlignment": "LEFT",

                //data source
                "getMethod": "objectProperty",
                "propertyPath": "UserID"
            },
            "status": {
                //control parameters
                "type": "text",
                "sortOrder": 1,
                "drawPos": [26,80],
                "drawSize": [50,30],

                //control private paramters, list only common ones
                "fontSize": 14,
                "fontColor": [1,1,1,1],

                //data source
                "getMethod": "objectPropertyMapping",
                "propertyPath": "MonitorDatas/RealTimeData/status",
                "objectPropertyMapping":{
                    "_default_":{"text":"Normal", "fontColor":[0,1,0]},
                    "false":{"text": "Error", "fontColor":[1,0,0]}
                }
            },
             "progressBar": {
                //parameters
                "type": "progressBar",
                "sortOrder": 1,
                "drawPos": [74, 40],
                "drawSize": [128, 20],

                //axis position
                "horizontalAlignment":"LEFT",    //horizontal position, can be one of LEFT CENTER RIGHT
                "horizontalAlignmentOffset":0,    //horizontal offset
                "verticalAlignment":"TOP",    //vertical position, can be one of TOP CENTER BOTTOM
                "verticalAlignmentOffset":0,    //vertical offset

                //private parameters
                "fillDir": "right",    //"up" "down" "left" "right"
                "barImage":"uGUI/ProgressBar/img_0",
                "min": 20,
                "max": 30,
                "color": [0.513,0.874,0.552,1],
                "styleConfig": {
                    "0.25": [0.36,0.58,0.16],
                    "0.50": [1,0.83,0.4],
                    "0.75": [1,0.4,0],
                    "0.90": [1,0.15,0.15]
                },

                //data source
                "getMethod": "objectProperty",
                "propertyPath": "MonitorDatas/RealTimeData/humidity"
            },
            "pieChart": {
                //parameters
                "type": "progressPie",
                "sortOrder": 1,
                "drawPos": [99,90],
                "drawSize": [50,50],

                //axis position
                "horizontalAlignment":"LEFT",    //horizontal position, can be one of LEFT CENTER RIGHT
                "horizontalAlignmentOffset":0,    //horizontal offset
                "verticalAlignment":"TOP",    //vertical position, can be one of TOP CENTER BOTTOM
                "verticalAlignmentOffset":0,    //vertical offset

                //private parameters
                "openAngle":"360",
                "fillDirClockwise":true,    //clockwise
                "ringImage":"uGUI/ProgressBar/img_3",    //image path
                "rotation":0,
                "min": 20,
                "max": 30,
                "color": [0.513,0.874,0.552,1],
                "styleConfig": {
                    "0.25": [0.36,0.58,0.16],
                    "0.50": [1,0.83,0.4],
                    "0.75": [1,0.4,0],
                    "0.90": [1,0.15,0.15]
                },

                //data source
                "getMethod": "objectProperty",
                "propertyPath": "MonitorDatas/RealTimeData/humidity"

            },
            "ringChart": {
                //parameters
                "type": "progressRing",
                "sortOrder": 1,
                "drawPos": [149,90],
                "drawSize": [50,50],

                //axis
                "verticalAlignment":"CENTER",
                "verticalAlignmentOffset":0,
                "horizontalAlignment":"CENTER",
                "horizontalAlignmentOffset":0,

                //private control
                "openAngle":"360",
                "fillDirClockwise":false,    // counter clockwise
                "ringImage":"uGUI/ProgressBar/img_2",    //image path
                "rotation":0,
                "min": 20,
                "max": 30,
                "color": [0.513,0.874,0.552,1],
                "styleConfig": {
                    "0.25": [0.36,0.58,0.16],
                    "0.50": [1,0.83,0.4],
                    "0.75": [1,0.4,0],
                    "0.90": [1,0.15,0.15]
                },

                //data source
                "getMethod": "objectProperty",
                "propertyPath": "MonitorDatas/RealTimeData/humidity",
            },
            "DisplyValue": {
                //parameters
                "type": "text",
                "sortOrder": 2,
                "drawPos": [74,65],
                "drawSize": [128,20],

               //data source
                "getMethod": "objectProperty",
                "propertyPath": "MonitorDatas/RealTimeData/humidity"
            },
            "Button": {
                //parameters
                "type": "button",
                "sortOrder": 1,
                "drawPos": [194,98],
                "drawSize": [35,22],

                //private parameters
                "fontSize": 12,
                "fontColor": [0.235,0.792,0.501,1],
                "title":"Details",
                "normalColor": [0.3,0.5,0.3,0],
                "highlightedColor": [1,1,1],
                "pressedColor": [0.6,0.5,0.2,0],

                "cmds":[
                    {"cmd":"OpenUrl", "uid":{"objectManager":"Runbuffer/Button1"} }
                ],
                "cmdsImmediate":false
            },
            "SwitchButton": {
                //parameters
                "type": "toggle",
                 "sortOrder": 1,
                "drawPos": [194,98],
                "drawSize": [35,22],

                //private parameters
                "images":["http://www.3momoda.com/images/add_01.png","images/add_02.png","images/add_02.png"],    //images use for normal, mouse over and mouse leave events. image url can be absolute,or relative to mmd server url
                "fontSize": 12,
                "fontColor": [0.235,0.792,0.501,1],
                "title":"Open",
                "checked":true,
                "setCheckedExe":false,    //if run command while checked

                "checkCmds":[
                    { "cmd":"SetPlacemarkProperty","uid":"obj01" ,"templateName":"Template" ,"widgetName":"SwitchButton" ,"property":"title" ,"value":"Close" }
                ],
                "unCheckCmds":[
                    { "cmd":"SetPlacemarkProperty","uid":"obj01" ,"templateName":"Template" ,"widgetName":"SwitchButton" ,"property":"title" ,"value":"开" }
                ],
                "cmdsImmediate":false
            }
        }
    }
}

CopyPlacemarkTemplate

Create new control by clone existing one.

Parameters
Name Required Description
originName Yes The control panel to be cloned
newName Yes Name of new control panel

Example

1
2
3
4
5
{
    "cmd": "CopyPlacemarkTemplate",
    "originName":"Temperatureplacemark",
    "newName":"Powerplacemark"
}

DestroyPlacemarkTemplate

Delete Control.

Parameters
Name Required Description
name Yes Name of Control to be deleted.

Example

1
2
3
4
{
    "cmd": "DestroyPlacemarkTemplate",
    "name":"Temperatureplacemark"
}

SetPlacemarkTemplateConfig

Modify Control configuration.

Note

this command will not modify look and feel of the control, to change control look and feel, please use command ‘SetPlacemarkProperty’.

Parameters
Name Required Description
name Yes Name of Control to be deleted.
path Yes List of properties to be modified, seperated by ‘/’
config Yes Target value

Example

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
{
    "cmd": "SetPlacemarkTemplateConfig",
    "name":"MonitoringPanel",
    "path":"ProgressBar2/styleConfig",
    "config":{
        "0.25":[0.36,0.58,0.16],
        "0.50":[1,0.83,0.4],
        "0.75":[1,0.4,0],
        "0.90":[1,0.15,0.15]
    }
}

CreatePlacemark

Placemark Creator.

Parameters
Name Required Default Description
Object Reference Yes   Object Reference
templateName Yes   Name of the placemark template
placemarkId No  

Name of the placemark

Note

if placemark is created on the surface of object, placemarkId can be ignored. system will generate placemakrkId automatically using name conversion: {Object uid}_{Template Name}

type No Screen
coordinate type of UI, can of one of:
  • Screen:Placemark is created under screen coordinate, so it will not change during camera zoom in/zoom out
  • Plane:Placemark is created under 3D coordinate, so it could changes sizes with movement of camera
scale No [0.2,0.2,0.2] placemark scale, used to control sizes of placemark
presetPos No  

placemark position. if placemark type is ‘Plane’, use (x,y,z) as coordinate, if placemark type is ‘screen’, use (x,y) as coordinate.

Note

if ‘presetPos’ is not specified, and placemark is created against object, the placemark is located on the top of the object by default.

posFromBuffer No   Same as presetPos,set placemark position by buffer
layoutOffset No   offset from target object, if placemark type is ‘Plane’, use (x,y,z) as coordinate, if placemark type is ‘screen’, use (x,y) as coordinate.
turnWhenNegative No  

Apply to (x,y) coordinate

  • if turnWhenNegative=true,coordinate is calculated as opposite, for instance, [-0.1, -100] point to position with right 10%, 100 pixels below
  • if turnWhenNegative=false,coordinate is located outside the screen. for instance, [-0.1, -100]point to position left -10%, up -100 pixels
countPerFrame No   Number of placemark object can be shown simultaneously
additiveDataObjects No   While placemark is created against object, target object be used as data source. If placemark need multiple data source , or not created against object, this parameter can be used to specifiy data source can be key-value, id, uid or buffer
updateTime No 1 Data refresh interval in seconds, if placemark is linked to external data source

Example

  • Create a monitoring panel to an object without placemarkId
1
2
3
4
5
6
7
8
{
    "cmd": "CreatePlacemark",
    "uid":"senser01",
    "type":"Plane",
    "templateName":"T&H Template",
    "layoutOffset":[0,1,0],
    "scale":[0.1,0.1,0.1]
}
  • Create monitoring panel to multiple objects
1
2
3
4
5
6
7
8
{
    "cmd": "CreatePlacemark",
    "fromBuffer":"allSenser",
    "type":"Screen",
    "templateName":"T&H Panel",
    "layoutOffset":[0,50],
    "countPerFrame":5
}
  • Create 2D placemark with multiple data source
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
{
    "cmd": "CreatePlacemark",
    "placemarkId":"Monitor01",
    "type":"Screen",
    "templateName":"MonitorPanel",
    "presetPos":[0.5,50],
    "additiveDataObjects":{
        "ds1": "obj01" , //object id or uid
        "ds2": {"ObjectManager": "RunBuffer/obj02"} //use buffer as data source
    }
}

DestroyPlacemark

Destroy Placemark.

Parameters
Name Required Description
Object Reference Yes Object Reference
placemarkId No placemarkId
templateName No If no placemarkId is specified while placemark is created, use {object uid}_{template name} as placemarkId,so templateName is need to delete placemark

Example

  • use object id and template name to destroy placemark
1
2
3
4
5
{
    "cmd": "DestroyPlacemark",
    "uid":"obj01",
    "templateName":"T&H Panel"
}
  • use templateName to bulk delete placemark
1
2
3
4
5
{
    "cmd": "DestroyPlacemark",
    "fromBuffer":"allSenser",
    "templateName":"T&H Panel Template"
}
  • use placemarkId to delete placemark
1
2
3
4
{
    "cmd": "DestroyPlacemark",
    "placemarkId":"TH01"
}

GetLastClickedButtonPlacemarkHost

Simular to GetLastEventObj and GetLastMonitorRespondObj,click on placemark will return object reference.

Parameters
Name Required Description
toBuffer Yes buffer which store the object

Example

1
2
3
4
{
    "cmd": "GetLastClickedButtonPlacemarkHost",
    "toBuffer":"lastPlacemarkHost"
}

SetPlacemarkProperty

Modify property of existing placemark.

Parameters
Name Required Description
Object Reference Yes Object Reference
placemarkId No Must specify placemarkId if placemark is created with placemarkId
templateName No TemplateName, note that if placemark is created without placemarkId, system will use {object_uid}_{template name} as placemarkId
widgetName Yes Control name
property Yes Control property name
value Yes

“Value to be modified.

Note

system use strong type internally. String, number or boolean can be used as normal, for other data type, the name of data type need to be specified. for instance, vector3,color should be wrote as:

  • {Vector3:[1,0,0]}
  • {Vector2:[1,0]}
  • {Color:[1,0,0,1]}

Example

  • String, number or boolean used as normal
1
2
3
4
5
6
7
8
{
    "cmd": "SetPlacemarkProperty",
    "uid":"obj01",
    "templateName":"T&H Panel",
    "widgetName":"Status",
    "property":"text",
    "value":"Normal"
}
  • Specify data type if data type is vector3,color, etc.
1
2
3
4
5
6
7
8
{
    "cmd": "SetPlacemarkProperty",
    "uid":"obj01",
    "templateName":"T&H Panel",
    "widgetName":"Progressbar2",
    "property":"Color",
    "value":{"Color":[1,0,0]}
}

CreateLayerPanel

A build-in, easy to use, multi-function Panel provided by system.

Parameters
Name Required Description
config Yes config
presetPos No

Position, use (x,y) as coordinate

Note

default position is on top of object.

posFromBuffer No Same as presetPos,set position from buffer
turnWhenNegative No

Apply to (x,y) coordinate

  • if turnWhenNegative=true,coordinate is calculated as opposite, for instance, [-0.1, -100] point to position with right 10%, 100 pixels below
  • if turnWhenNegative=false,coordinate is located outside the screen. for instance, [-0.1, -100]point to position left -10%, up -100 pixels

Example

 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
{
    "cmd": "CreateLayerPanel",
    "presetPos":[-100, 0.5],
    "turnWhenNegative":true,
    "config":{
        //set panel size
        "bgWidth": 150,
        "bgHeight": 330,

        //function groups
        "groups":[
            {
                "name":"basic function",
                "icon":"userimage/3534/CustomTexture/20150708325991.png", //icon path
                "textConfig":{    //set text
                    "fontFamily": "Arial",
                    "fontSize": 18,
                    "drawSize": [100,38],
                    "verticalTextAlignment": "CENTER",
                    "fontColor": [1,1,1,1]
                },

                //multiable functions inside one function group
                "items":[
                    {
                         "name":"warehouse_index",
                         "textConfig":{
                             "fontFamily": "Arial",
                             "fontSize": 14,
                             "fontColor": [0,0,0,1]
                         },
                         "initCmds":[ //run command after creation
                            { "cmd":"ChangeLayerPanelItems","items":["warehouse_index"],"state":true } //set status as checked
                         ],
                         "checkCmds":[ //run command if checked
                            { "cmd":"ChangeLayerPanelItems","items":["TemperatureControl","humidityControl"],"state":false }, //uncheck other items
                            { "cmd":"CreatePlacemark", "fromBuffer":{"ObjectManager": "RunBuffer/warehouse"}, "templateName" : "warehouse_index", "type":"screen", "countPerFrame":100000}
                         ],
                         "unCheckCmds":[ //run command if unchecked
                            { "cmd":"DestroyPlacemark", "fromBuffer":{"ObjectManager": "RunBuffer/warehouse"}, "templateName" : "warehouse_index"}
                         ]
                     },
                    {
                         "name":"temperature monitoring",
                        //......
                    },
                    //......
                ]
            },
            {
                "name":"advance settings",
                //......
            },
            //......
        ]
    }
}

DestroyLayerPanel

Destroy Layer Panel.

Parameters

No parameters.

Example

1
2
3
{
    "cmd": "DestroyLayerPanel"
}

ChangeLayerPanelItems

Check or uncheck panel item.

Parameters
Name Required Description
items Yes Set check status by array
state Yes true means check, false means uncheck

Example

1
2
3
4
5
{
    "cmd": "ChangeLayerPanelItems",
    "items":["Temperature Monitoring","Power Monitoring"],
    "state":true
}

ShowLayerPanel

Show or hide Panel.

Parameters
Name Required Description
enable Yes Panel name

Example

1
2
3
4
5
{
    "cmd": "ChangeLayerPanelItems",
    "items":["temperature monitoring","power monitoring"],
    "enable":true
}

ShowHideLayerPanel

Show or hide panel.

Parameters

No parameters.

Example

1
2
3
{
    "cmd": "ShowHideLayerPanel"
}

ShowPropListPanel

A build-in, easy to use ‘object property panel’, can be also used to config function buttons.

Parameters
Name Required Description
Object Reference Yes Object Reference
config Yes

Panel position, use (x,y) as coordinate.

Note

Default position is on top of object.

posFromBuffer No Same as presetPos,set position from buffer
turnWhenNegative No

Apply to (x,y) coordinate

  • if turnWhenNegative=true,coordinate is calculated as opposite, for instance, [-0.1, -100] point to position with right 10%, 100 pixels below
  • if turnWhenNegative=false,coordinate is located outside the screen. for instance, [-0.1, -100]point to position left -10%, up -100 pixels

Example

 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
{
    "cmd": "ShowPropListPanel",
    "fromBuffer":{"ObjectManager": "RunBuffer/lastEventObj"},
    "presetPos":[100, 0.5],
    "turnWhenNegative":true,
    "config":{
        "initCmds":[ //run command after creation
            { "cmd":"CopyBuffer",  "fromBuffer":{"ObjectManager":"RunBuffer/lastEventObj"}, "toBuffer":{"ObjectManager":"RunBuffer/curShowPanelObj"}} ,
            { "cmd":"ChangePropListPanelItems", "items":["basicInfo"], "state":true, "exeCommands":true } //set which button is clicked after creation
        ],
        "items":[
            {
                "name":"basicInfo",
                "normalColor":[0.415,0.839,0.462,1],//color on normal status
                "highlightedColor":[0.337,0.666,0.372,1], //color on mouse over
                "pressedColor":[0.415,0.839,0.462,1], //color on mouse click
                "clickCmds":[
                    { "cmd": "ChangePropListPanelItems", "items":["warehouseInfo","alarmInfo"], "state":false, "exeCommands":false},//uncheck other function button.
                    { "cmd": "GetValue", "fromBuffer":{"ObjectManager":"RunBuffer/curShowPanelObj"}, "path":"MonitorDatas/RealTimeData", "toBuffer":{"ObjectManager":"RunBuffer/panelData"}},
                    { "cmd": "SetPropListPanelKeyValue", "valueBuffer":{"ObjectManager":"RunBuffer/panelData"} ,"names":["warehouse_index","Catelog","Qualtity","Manager","UpdateTime","Power Consumption","CheckNumber"]}
                ]
            },
            {
                "name":"Warehouse Info",
                "clickCmds":[
                    { "cmd": "ChangePropListPanelItems", "items":["basicInfo","alarmInfo"], "state":false, "exeCommands":false},
                    { "cmd": "GetValue", "fromBuffer":{"ObjectManager":"RunBuffer/curShowPanelObj"}, "path":"MonitorDatas/RealTimeData", "toBuffer":{"ObjectManager":"RunBuffer/panelData"}},
                    { "cmd": "SetPropListPanelKeyValue", "valueBuffer":{"ObjectManager":"RunBuffer/panelData"} ,"names":["Temperature","WarehouseTemperature","          Up","          MiddleUp","          MiddleDown","          Down","AvgTemperature","Humidity","InsectControl"]}
                ]
            },
            {
                "name":"alarmInfo",
                "clickCmds":[
                    { "cmd": "ChangePropListPanelItems", "items":["basicInfo","warehouseInfo"], "state":"unclicked", "exeCommands":false},
                    { "cmd": "GetValue", "fromBuffer":{"ObjectManager":"RunBuffer/curShowPanelObj"}, "path":"MonitorDatas/RealTimeData", "toBuffer":{"ObjectManager":"RunBuffer/panelData"}},
                    { "cmd": "SetPropListPanelKeyValue", "valueBuffer":{"ObjectManager":"RunBuffer/panelData"} ,"names":["Temperature","Fire","InsectControl"]}
                ]
            },
            {
                "name":"Barcode",
                "clickCmds":[
                    { "cmd": "GetValue", "fromBuffer":{"ObjectManager":"RunBuffer/curShowPanelObj"}, "path":"MonitorDatas/RealTimeData/barcode_url", "toBuffer":{"ObjectManager":"RunBuffer/barcode_url"}},
                    { "cmd": "UrlWindow" ,"urlBuffer":{"ObjectManager":"RunBuffer/barcode_url"} ,"title":"Barcode", "width":"250" , "height":"250"}
                ]
            }
        ]
    }
}

HidePropListPanel

Hide property list panel.

Parameters

No parameters.

Example

1
2
3
{
    "cmd": "HidePropListPanel"
}

ChangePropListPanelItems

Change panel button status.

Parameters
Name Required Description
items Yes Array to set button status in bulk
state Yes ture means clicked, false means unclicked
exeCommands No Run command while state changed to clicked

Example

1
2
3
4
5
6
{
    "cmd": "ChangePropListPanelItems",
    "items":["warehouseInfo","alarmInfo"],
    "state":false,
    "exeCommands":false
}

SetPropListPanelKeyValue

Show object property on panel.

Parameters
Name Required Description
valueBuffer Yes Buffer name
names No Get data from buffer by order of name array

Example

1
2
3
4
5
{
    "cmd": "SetPropListPanelKeyValue",
    "valueBuffer":{"ObjectManager":"RunBuffer/panelData"},
    "names":["Temperature","Fire","InsectControl"]
}

Camera


SwitchCameraTo3D

Viewpoint switch between 3D and 2D.

Note

Same as 3D/2D switch button in control panel

Parameters
Name Required Default Description
enable No true If true, switch to 3D, if false, switch to 2D

CameraFitToSelection

Fit to selected object, if no object is selected, fit to current layer.

Parameters

No parameters.

Example

1
2
3
{
    "cmd": "CameraFitToSelection"
}

SetOrbitCameraParam

Camera parameters setting.

Parameters
Name Required Default Description
heightLimit No [0,1500] Height limit setting, take two array as input, first array as minimum height, second array as maxium height.
zoomLimit No [0.1,1000] Limits on back and froths moving through mouse wheel. take one array as input, first element in array sets closest distance to viewpoint, second viewpoint sets farthest distance from viewpoint.
farClipDistance No change with height attribute Far clip distance setting, for animation effects only
nearClipDistance No change with height attribute Near clip distance setting, for animation effects only
smooth No true Flying camera in smooth mode, if set to false, camera will fly straight.

Example

1
2
3
4
5
6
7
8
{
    "cmd": "SetOrbitCameraParam",
    "heightLimit":[0, 5500],
    "zoomLimit":[0, 15500],
    "farClipDistance":5000,
    "nearClipDistance":0.2,
    "smooth":true
}

CameraFlyToBest

Fly to optimized viewpoint of given object.

Note

Only accept one object as input

Parameters
Name Required Default Description
Object Reference Yes Object Reference  
time No 2 Fly time, in seconds
offset No [0,0,0]

Optimized viewpoint plus offset as camera location.

Note

Offset is calculated in world coordinate.

Example

1
2
3
4
5
6
{
    "cmd": "CameraFlyToBest",
    "uid":"object01",
    "time":3,
    "offset":[0.0, 1.0, 0.0] //move up another 1 meter.
}

CameraFitToBest

Move camera to optimized viewpoint of given object, no flying process.

Note

Only accept one object as input

Parameters
Name Required Default Description
Object Reference Yes Object Reference  
time No 2 Fly time, in seconds
offset No [0,0,0]

Optimized viewpoint plus offset as camera location.

Note

Offset is calculated in world coordinate.

Example

1
2
3
4
5
6
{
    "cmd": "CameraFitToBest",
    "uid":"object01",
    "time":3,
    "offset":[0.0, 1.0, 0.0] //move up another 1 meter.
}

Common Object Interface


GetValue

Get object properties and save to buffer, Object properties can be access:
  • ID:uique ID generated by system
  • UserID:user input ID
  • Name:object name set by user
  • BundleId:model ID
  • PropertyDict:user-defined properties, can be access by path such as “PropertyDict/ObjectType”, will access all user-defined properties if no path is given
  • MoniterData/RealTimeData: monitoring data, save as PropertyDict, can be access by path, will access all monitoring properties if no path is given
Parameters
Name Required Description
Object Reference Yes Object Reference
path Yes property path, for instance, PropertyDict/ObjectType,can also be used to access user-define property
toBuffer Yes Buffer to save result

Example

  • Get user-define value of a object
1
2
3
4
5
6
{
    "cmd": "GetValue",
    "uid":"obj01"
    "path":"PropertyDict/ObjectType",
    "toBuffer":"resultBuffer"
}
  • Get one monitoring data
1
2
3
4
5
6
{
    "cmd": "GetValue",
    "uid":"obj01"
    "path":"MoniterData/RealTimeData/Temperature",
    "toBuffer":"resultBuffer"
}
  • Get all monitoring data
1
2
3
4
5
6
{
    "cmd": "GetValue",
    "uid":"obj01"
    "path":"MoniterData/RealTimeData",
    "toBuffer":"resultBuffer"
}

SetValue

Set object property.

Parameters
Name Required Description
Object Reference Yes Object Reference
path Yes Property path, for instance, PropertyDict/ObjectType,can also be used to access user-define property
value Yes

Value to be assign to property

Note

System use strong type internally. String, number or boolean can be used as normal, for other data type, the name of data type need to be specified. For instance, vector3,color should be wrote as

  • {'Vector3':[1,0,0]}
  • {'Vector2':[1,0]}
  • {'Color':[1,0,0,1]}

Example

  • Set Object Name
1
2
3
4
5
6
{
    "cmd": "SetValue",
    "uid":"obj01",
    "path":"Name",
    "value":"Camera01"
}

CallMethod

Call Object Method. Object Method List:

  • Object in Scene:
    • show:if visible
    • GetCenter:get object center
  • Timer Object
    • reset:reset timer
    • setStartTime:set timer start time [2015, 8,12,16,15,22,0]
    • setPeriod:set timer run duration [0,0,0,30,0]
    • start:start timer
    • pause:pause timer
    • setSpeed:set timer run speed
Parameters
Name Required Description
Object Reference Yes Object Reference
path Yes property path, for instance, PropertyDict/ObjectType,can also be used to access user-define property
toBuffer Yes Buffer to save result

Example

  • Show method, same as CmdShow command
1
2
3
4
5
6
{
    "cmd": "CallMethod",
    "uid":"obj01",
    "path":"show",
    "params":false
}
  • Get object center and save to buffer
1
2
3
4
5
6
{
    "cmd": "CallMethod",
    "uid":"obj01",
    "path":"GetCenter",
    "toBuffer":{"ObjectManager":"RunBuffer/curObjectCenter"}
}
  • Set timer start time
1
2
3
4
5
6
{
    "cmd": "CallMethod",
    "uid":"timer01",
    "path":"setStartTtime",
    "params":[2015,8,11,13,55,23,0]
}

Deploy Object


Deploy

Specify model set available in current environment.

Parameters
Name Required Description  
enable No true If true, enable, if false, disable
item No   Array of model IDs

Example

  • Deploy Model
1
2
3
4
5
6
7
{
    "cmd": "Deploy",
    "items":[
        "614AC0466F4E48B792CC83A5B99AF4FC",
        "F933B1A524B94050BC7A82B15D2057F5",
    ]
}
  • Disable
1
2
3
4
{
    "cmd": "Deploy",
    "enable":false
}

SetDragPlacementParamInDeploy

Effect setting during drag and drop.

Parameters
Name Required Description
absorbPlacement No If object being drag can be attached by target object automatically.
absorbNormal No If object being drag align to normal line of target object automatically.
absorbPivot No If object being drag align to axis line of target object automatically.

Example

1
2
3
4
5
6
{
    "cmd":"SetDragPlacementParamInDeploy",
    "absorbPlacement":true,
    "absorbNormal":false,
    "absorbPivot":true
}

GetDeployObjects

Get deploy objects and save to buffer.

Parameters
Name Required Description
toBuffer Yes Buffer to store objects

Example

1
2
3
4
{
    "cmd":"GetDeployObjects",
    "toBuffer":{"ObjectManager":"RunBuffer/deployObjects"}
}

GetDeployToJson

Get deploy objects and save to buffer in JSON format.

Parameters
Name Required Description
toBuffer Yes Buffer to store objects

Example

1
2
3
4
{
    "cmd":"GetDeployToJson",
    "toBuffer":{"ObjectManager":"RunBuffer/deployObjects"}
}

SetDeployFromJson

Deploy objects from JSON

Parameters
Name Required Description
json Yes JSON data

Example

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
{
    "cmd":"SetDeployFromJson",
    "json":{
            "2345223":{
                "bundle":"3268DD250B694147B0BDB37FA390BF96",
                "floor":"floor01",
                "pos":"0.22 0.33 1.34", //position
                "rot":"0 0 0",//rotation
                "scl":"1 1 1",//scale
                "properties":{
                    "UserID":"Camera01",
                    "PropertyDict":{
                        "Operator":"wxz"
                    }
                }
            }
        }
}

ClearDeployObjects

Get deploy objects and save to buffer in JSON format.

Parameters
Name Required Default Description
destroyObjects Yes true Clear objects in scene, if true, will clear objects both in Deploy module and scene, if false, only clear objects in Deploy module, and keep objects in scene.

Example

1
2
3
{
    "cmd":"ClearDeployObjects"
}

Event


RegEvent

Event Register.

Note

Use id or uid for object reference

Parameters
Name Required Default Description
id No   Object id
uid No   Object uid(UserID)
condition No   Trigger condition
event Yes   Trigger event, to avoid conflict, use / to separate callbacks, for instance, AddToSelection/callBack1 see Event List
priority No 50 Event with higher priority will be trigger first
cmds Yes   Callback commands

Example

 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
{
    "cmd": "RegEvent",

    //"_default_" means always trigger
    //"condition": "_default_",

    //register by object id or uid
    //"condition": {"OBJECT":"4"},

    //register by classId
    //"condition": {"CLASSID":3},

    //register by object properties
    //"condition": {"ATTRIBUTE":{"PropertyDict/sex":"male"}},

    //AND operator
    //"condition": {"AND":[{"PropertyDict/sex":"male"}, {"MoniterData/RealTimeData/status":"normal"}]},

    //OR operator
    //"condition": {"OR":[{"PropertyDict/sex":"male"}, {"MoniterData/RealTimeData/status":"normal"}]},

    //NOT operator
    //"condition": {"NOT":{"AND":[{"PropertyDict/sex":"male"}, {"MoniterData/RealTimeData/status":"normal"}]}},

    //////////////////////////
    //condition shortcuts
    //a number,same as {"CLASSID":3}
    //"condition": 3,

    //a string, means id or uid,same as {"OBJECT":"4"}
    //"condition": "4",

    //a key/value pair,means object properties, same as {"ATTRIBUTE":{"PropertyDict/sex":"male"}}
    "condition": {"PropertyDict/sex":"male"},


    "event":"AddToSelection/callBack1",
    "priority":50,
    "cmds":[
        {    "cmd":"GetLastEventObj",  "toBuffer":{"ObjectManager":"RunBuffer/lastEventObj"} } ,
        {    "cmd":"ChangePlacementBundle",  "fromBuffer":{"ObjectManager":"RunBuffer/lastEventObj"} , "bundleId":"F933B1A524B94050BC7A82B15D2057F5"}
    ]
}

UnregEvent

Unregister Event.

Parameters
Name Required Description
id No Object id
uid No Object uid(UserID)
condition No Trigger condition
event Yes

Same as event parameter in RegEvent

Note

if no callback is specified, all callbacks under this event will be unregistered.

Example

1
2
3
4
5
6
7
{
    "cmd": "UnregEvent",
    "condition":{
        "PropertyDict/sex":"male"
    },
    "event":"AddToSelection/callBack1"
}

GetLastEventObj

Get object associated with event and save to buffer.

Parameters
Name Required Description
toBuffer Yes

Target buffer

Note

object is save to {'ObjectManager':'RunBuffer/lastEventObj'} by system automatically

Example

1
2
3
4
5
6
{
    "cmd":"GetLastEventObj",
    "toBuffer":{
        "ObjectManager":"RunBuffer/lastEventObj"
    }
}

RegIgnoreEvent

Suppress events.

Parameters
Name Required Description
condition Yes Same as condition parameter in RegEvent
event Yes

Same as event parameter in RegEvent

Note

if no callback is specified, all callbacks under this event will be suppressed.

Example

1
2
3
4
5
{
    "cmd": "RegIgnoreEvent",
    "condition":"_default_", //suppress all AddToSelection events
    "event":"AddToSelection"
}

UnregIgnoreEvent

Resume suppress events.

Parameters
Name Required Description
condition Yes Same as condition parameter in RegEvent
event Yes

Same as event parameter in RegEvent

Note

if no callback is specified, all callbacks under this event will be suppressed.

Example

1
2
3
4
5
{
    "cmd": "UnregIgnoreEvent",
    "condition":"_default_",
    "event":"AddToSelection"
}

Monitor


SetMonitorRespond

Set response to MonitorDatas/RealTimeData.

Parameters
Name Required Description
Object Reference Yes Object Reference
config Yes

Response is based on properties of MonitorDatas/RealTimeData.

Note

  1. Support configure response on multiable properties
  2. Supports multiable response to single property.
  3. Value of property can be string or number. if property value are all numbers, system will sort those numbers and trigger command with equal or less than numbers.
  4. If property value are all strings, use ‘_default_’ to run command if data is NOT in value set.
  5. Use GetLastMonitorRespondObj to get current object in callback, or use buffer: {'ObjectManager':'RunBuffer/lastMonitorRespondObj'} to get current object

Example

 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
{
    "cmd": "SetMonitorRespond",
    "fromBuffer":{"ObjectManager": "RunBuffer/Grain"},
    "config":{
        "GrainCatelog":{ //get value from "MonitorDatas/RealTimeData/GrainCatelog"
            "Corn":[ //run command if value is "Corn"
                {"cmd": "GetLastMonitorRespondObj", "toBuffer":"monitorRespondObj"}, //run command
                {"cmd": "ChangePlacementTexture", "fromBuffer":"monitorRespondObj", "url": "images/corn.jpg"}
            ],
            "Wheat":[ //run command if value is "Wheat"
                {"cmd": "GetLastMonitorRespondObj", "toBuffer":"monitorRespondObj"}, //run command
                {"cmd": "ChangePlacementTexture", "fromBuffer":"monitorRespondObj", "url": "images/wheat.jpg"}
             ]
        },
        "GrainStorage":{ //get value from "MonitorDatas/RealTimeData/GrainStorage"
            "10":[{"cmd":"SetScale", "fromBuffer":"lastMonitorRespondObj", "scale":[1,0.1,1] } ], // run command if value equal or less than 10, note that current object is fetch by system buffer lastMonitorRespondObj
            "30":[{"cmd":"SetScale", "fromBuffer":"lastMonitorRespondObj", "scale":[1,0.3,1]  } ], //run command if value equal or less than 30
            "50":[{"cmd":"SetScale", "fromBuffer":"lastMonitorRespondObj", "scale":[1,0.5,1]  } ], //run command if value equal or less than 50
            "80":[{"cmd":"SetScale", "fromBuffer":"lastMonitorRespondObj", "scale":[1,0.8,1]  } ], //run command if value equal or less than 50
            "100":[{"cmd":"SetScale", "fromBuffer":"lastMonitorRespondObj", "scale":[1,1,1]  } ] //run command if value equal or less than 100
        },
        "GrainStatus":{ //get value from "MonitorDatas/RealTimeData/GrainStatus"
            "InsectHazzard":[{"cmd":"ColorFlash",   "fromBuffer":"lastMonitorRespondObj",   "color":[1,0,0] , "start":0.6, "end":0.2, "time":1.0 } ], //run command if value equals to InsectHazzard
            "Decay":[{"cmd":"ColorFlash",   "fromBuffer":"lastMonitorRespondObj",   "color":[0,0,1] , "start":0.6, "end":0.2, "time":1.0 } ], //run command if value equals to Decay
            "_default_":[{"cmd":"ColorFlash",   "fromBuffer":"lastMonitorRespondObj",   "enable":false } ] //run command if no match
        }
    }
}

GetLastMonitorRespondObj

Get current object.

Parameters
Name Required Description
toBuffer Yes Buffer name

Example

1
2
3
4
{
    "cmd": "GetLastMonitorRespondObj",
    "toBuffer":"monitorRespondObj"
}

Snapshot


Snapshot

Get and save snapshot.

Parameters
Name Required Description
name Yes Name of snapshot
isSaveToServer No If save snapshot to server
isShowIn3D No If show snapshot in menu
jsonToBuffer No Save snapshot to buffer in json format

Example

  • Set a snapshot
1
2
3
4
5
6
{
    "cmd": "Snapshot",
    "name":"my workspace",
    "isSaveToServer": true,
    "isShowIn3D": false
}
  • Get snapshot data and save to buffer
1
2
3
4
5
{
    "cmd": "Snapshot",
    "name":"name",
    "jsonToBuffer": "SnapshotBuffer"
}

SnapshotRecoverByName

Recover snapshot by name.

Parameters
Name Required Description
name Yes Snapshot name

Example

1
2
3
4
{
    "cmd": "SnapshotRecoverByName",
    "name":"my workspace"
}

SnapshotRecoverByJson

Recover snapshot by name.

Parameters
Name Required Description
json Yes json data

Example

1
2
3
4
{
    "cmd": "SnapshotRecoverByJson",
    "name":"my workspace"
}

PlaySnapshotAnimByName

Recover snapshot by name.

Parameters
Name Required Description
name Yes Name of animation

Example

1
2
3
4
{
    "cmd": "PlaySnapshotAnimByName",
    "name":"check01"
}

PlaySnapshotAnimByName

Stop snapshot animation.

Parameters

No Parameters.

Example

1
2
3
{
    "cmd": "StopSnapshotAnim"
}

Web

OpenUrl

Open webpage, same as run javascript function window.open, only valid in browser.

Parameters
Name Required Description
url No URL to be open
urlBuffer No Get URL from urlBuffer
param No Same as parameters used in javascript function window.open for instance: height=100, width=400, toolbar =no, menubar=no, scrollbars=no, resizable=no, location=no, status=no

Example

1
2
3
4
5
{
    "cmd": "OpenUrl",
    "url":"http://www.3dmomoda.com",
    "param": "height=100, width=400, toolbar =no, menubar=no, scrollbars=no, resizable=no, location=no, status=no"
}
1
2
3
4
5
{
    "cmd": "OpenUrl",
    "urlBuffer":"url",
    "param": "height=100, width=400, toolbar =no, menubar=no, scrollbars=no, resizable=no, location=no, status=no"
}

UrlWindow

Open browser window with given URL, only valid in browser.

Parameters
Name Required Description
url No URL to be open
urlBuffer No Get URL from urlBuffer
title No Window title
titleBuffer No Get window title from buffer
width No Window width
height No Window height

Example

1
2
3
4
5
6
7
{
    "cmd": "UrlWindow",
    "urlBuffer":"url",
    "title": "message",
    "width": 512,
    "height": 512
}

HtmlWindow

Open browser windows and display given html, only valid in browser.

Parameters
Name Required Description
html No Data in html format
htmlBuffer No Get html data from urlBuffer
title No Window title
titleBuffer No Get window title from buffer
width No Window width
height No Window height

Example

  • Display HTML
1
2
3
4
5
6
7
{
    "cmd": "HtmlWindow",
    "html": "<ol><li>dog</li><li>cat</li><li>bird</li></ol>",
    "title": "Catalog",
    "width": 512,
    "height": 512
}
  • Display HTML from buffer
1
2
3
4
5
6
7
{
    "cmd": "HtmlWindow",
    "htmlBuffer":{"ObjectManager":"RunBuffer/htmlContent"},
    "title": "Catalog",
    "width": 512,
    "height": 512
}

HideWindow

Close window opened by UrlWindow or HtmlWindow, only valid in browser.

Parameters

No Parameters.

Example

1
2
3
{
    "cmd": "HideWindow"
}

ExecuteHtmlInterface

Open browser windows and display given html, only valid in browser.

Parameters
Name Required Description
interfaceName No javascript method name
fromBuffer No

Set buffer content(object only) to javascript method

Note

  1. Data structure pass to javascript method

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    {
        'ID':'J17gKNmUeUeSXpDzPH_pZA', //ObjecID'
        'UserID':'100007001', //Object UID'
        'Name':'Box002', //Object name'
        'ParentObjectUserID':'floor001', //Parent Object UID'
        'ParentObjectID':'144', //Parent Object ID'
        'Position':'-21.263 2.357 -5.653', //Coordinate in world'
        'LocalPosition':'-22.944 2.357 -10.038', //Coordinate in Parent'
        'BoundBoxMax':'-21.163 2.657 -5.630', //Object bound point (max)'
        'BoundBoxMin':'-21.363 2.357 -5.675', //Object bound point (min)'
        'BundleId':'B723E9E1B279467EBC9433D30D35F683', //Model ID'
        'BundleSize':'1.000 1.000 1.000', //Model size'
        'BundleVersion':'1.000 1.000 1.000', //Model version'
        'BundleTitleEn':'Universal side box', //Model name in english'
        'BundleTitle':'Universal side box', //Model name'
        'PropertyDict':{'ObjectType':'box'}, //User-define properties'
        'MonitorDatas/RealTimeData':{'Temperature':67} //Monitoring data'
    }
    
  2. Use exArguments to pass additional values

exArguments No Additional arguments in array

Example

 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
//////////////////////////////////////////////////////////
//Pass object from buffer to javascript method
//////////////////////////////////////////////////////////

//define method in javascript
var keeper = {};
keeper.getSelectedObjs = function(objs){
    objs = mmd.jsonTools.parseJSON(objs);
    for(var i = 0 ; i < objs.length; i++){
        ......
    }
}

//call method
{
    "cmd": "ExecuteHtmlInterface",
    "interfaceName": "keeper.getSelectedObjs",
    "fromBuffer":{"ObjectManager":"RunBuffer/selection"}
}

//////////////////////////////////////////////////////////
//Pass object from buffer to javascript method with additional arguments
//////////////////////////////////////////////////////////

//define javascript method
var keeper = {};
keeper.setColorByType = function( objs, objType, color ){
    objs = mmd.jsonTools.parseJSON(objs);
    var uids = [];
    for(var i = 0 ; i < objs.length; i++){
        var obj = objs[i];
        if(obj["PropertyDict"]["ObjectType"] == objType){
            uids.push(obj["UserID"]);
        }
    };
    var cmds = [
        { "cmd":"SetColor", "uids":uids, "color":color}
    ];
    var cmdsStr = mmd.jsonTools.toJSON(cmds);
    mmd.RunCommand( cmdsStr, true);
}

//call method
{
    "cmd": "ExecuteHtmlInterface",
    "interfaceName": "keeper.setColorByType",
    "fromBuffer":{"ObjectManager":"RunBuffer/objs"},
    "exArguments":[ "100box", [1,0,0]]
}

//////////////////////////////////////////////////////////
//Pass arguments without object data
//////////////////////////////////////////////////////////

//define javascript method
var saveLog = function( text, sync ){
    ......
}

//call method
{
    "cmd": "ExecuteHtmlInterface",
    "interfaceName": "saveLog",
    "exArguments":[ "scene is open", false]
}

Logic

RegTimer

Timer register.

Parameters
Name Required Description
name Yes Name of timer
time No Timeout in seconds
loop No If loop
cmds No Command to be executed at timeout

Example

  • Set a snapshot
1
2
3
4
5
6
7
8
{
    "cmd": "RegTimer",
    "name":"ExplodeWhenTimeout",
    "loop":false,
    "cmds":[
        { "cmd": "CreatePlacement", "uid" : "Explode", "bundleId":"C2F0A5FB249A4F4C9D7A46E4876E2F4C", "pos":[0,0,0]}
    ]
}

UnregTimer

Unregister timer.

Parameters

No Parameters.

Example

1
2
3
4
{
    "cmd": "UnregTimer",
    "name":"ExplodeWhenTimeout"
}

CheckBoolean

Pass boolean value from buffer, then run command depends on boolean value.

Parameters
Name Required Description
fromBuffer Yes Buffer to get boolean value
trueCmds No Command to run if true
falseCmds No Command to run if false

Example

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
{
    "cmd": "CheckBoolean",
    "fromBuffer":"resultBuffer",
    "trueCmds":[
        {"cmd":"SetColor",   "uid":"obj01",   "color":[1,0,0] }
    ],
    "falseCmds":[
        {"cmd":"SetColor",   "uid":"obj01",   "color":[0,1,0] }
    ]
}

Command Panel


ClearCmdPanel

Clear command panel.

Parameters

No Parameters.

Example

1
2
3
{
    "cmd": "ClearCmdPanel"
}

AddToCmdPanel

Add command to command panel.

Parameters
Name Required Description
cmds Yes Command or command array to be added to panel
execute No If run command after add

Example

1
2
3
4
5
6
7
{
    "cmd": "AddToCmdPanel",
    "cmds":[
        {"cmd":"clearSelection" }
    ],
    "execute":false
}

RemoveFromCmdPanel

Remove command from command panel.

Note

Command name must be identical.

Parameters
Name Required Description
cmds Yes Command or command array to be removed from panel

Example

1
2
3
4
5
6
{
    "cmd": "RemoveFromCmdPanel",
    "cmds":[
        {"cmd":"clearSelection" }
    ]
}

Calculation


CalculateObjectsCenter

Calculate objects center.

Parameters
Name Required Default Description
Object Reference Yes   Object Reference
offset No [0,0,0] Offset to calculated result
toBuffer Yes   Buffer to save result

Example

1
2
3
4
5
{
    "cmd": "CalculateObjectsCenter",
    "fromBuffer": "selected objects",
    "toBuffer": "center_location"
}

CalculateWorldToViewport

Given world coordinate, calculate 3D viewpoint coordinate. Note, 3D viewpoint coordinate is different from screen coordinate.

Parameters
Name Required Description
Object Reference Yes Object Reference
pos No Position in world coordinate.
fromBuffer No Buffer of world coordinate
toBuffer Yes Save calculate result to buffer

Example

1
2
3
4
5
{
    "cmd": "CalculateWorldToViewport",
    "pos": [89,3,45],
    "toBuffer": "2DCord"
}

Scene Level

ChangeObjectLevel

Change scene level to given object.

Note

only supports one object as input.

Parameters
Name Required Description
Object Reference Yes Object Reference

Example

1
2
3
4
{
    "cmd": "ChangeObjectLevel",
    "uid":"first floor"
}

GetCurrentObjectLevel

Get current level of given object.

Note

only supports one object as input.

Parameters
Name Required Description
toBuffer Yes Buffer to store command result.

Example

1
2
3
4
{
    "cmd": "GetCurrentObjectLevel",
    "toBuffer":"currentLevel"
}

GetCurrentObjectLevelClass

Get class name of current level.

Note

only supports one object as input.

Parameters
Name Required Description
toBuffer Yes Buffer to store command result.

Example

1
2
3
4
{
    "cmd": "GetCurrentObjectLevelClass",
    "toBuffer":"currentLevelClass"
}

GetCurrentObjectLevelClassId

Get ClassId of current level, note: classId is a number.

Parameters
Name Required Description
toBuffer Yes Buffer to store command result.

Example

1
2
3
4
{
    "cmd": "GetCurrentObjectLevelClassId",
    "toBuffer":"currentLevelClassId"
}

SetExpandFloorPlanHeight

Set floor distance while expanded.

Parameters
Name Required Description
height Yes Floor distance in meters.

Example

1
2
3
4
{
    "cmd": "SetExpandFloorPlanHeight",
    "height":3
}

Misc. Reference

Ease Mode List

  • easeInQuad
  • easeOutQuad
  • easeInOutQuad
  • easeInCubic
  • easeOutCubic
  • easeInOutCubic
  • easeInQuart
  • easeOutQuart
  • easeInOutQuart
  • easeInQuint
  • easeOutQuint
  • easeInOutQuint
  • easeInSine
  • easeOutSine
  • easeInOutSine
  • easeInExpo
  • easeOutExpo
  • easeInOutExpo
  • easeInCirc
  • easeOutCirc
  • easeInOutCirc
  • linear
  • spring
  • easeInBounce
  • easeOutBounce
  • easeInOutBounce
  • easeInBack
  • easeOutBack
  • easeInOutBack
  • easeInElastic
  • easeOutElastic
  • easeInOutElastic
  • punch

Event List

MouseEvents

  • ClickObject
  • DbClickObject
  • RightClickObject
  • RightDbClickObject
  • LeftClickObject
  • LeftDbClickObject
  • RightClick
  • LeftClick
  • RightDbClick
  • LeftDbClick
  • OnMouseEnterObject
  • OnMouseLeaveObject
  • OnMouseEnterPlacemark
  • OnMouseLeavePlacemark

SelectionEvents

  • ChangedSelection
  • AddToSelection
  • RemoveFromSelection
  • RemoveLastFromSelection

ObjectLifeCycleEvents

  • CreateObject
  • CreateObjectMoveTo
  • DestroyObject
  • CreateDeployObject
  • DeployObjects

LayerChangeEvents