Remote Control
DESITE MD/CUSTOM/SHARE is addressed and remotely controlled via a TCP socket.
The communication is performed via XML messages.
Send messages to DESITE:
By default, port 45456 is used for incoming messages. The port can be changed at program start with the switch -srvPort [portnumber]. If the port is already occupied, the next higher port number is tried.
Receive messages from DESITE:
The client port is 45455 for messages from DESITE to connected programs. Return values of commands to DESITE are sent from DESITE via this port. The port can be changed at program start with the switch -cltPort [port number].
When DESITE SHARE is started, a log file is written to the user directory C:\Users\[user]\AppData\Local\ceapoint_aec_technologies\desiteSHARE2, in which the used ports are entered.
1. Kommandos
An ID can be passed to the command call. After the command has been executed, a status information and a textual status information with the ID is returned. If no ID is passed with the call, no response is returned.
- cmdID
Example:
<cmdMessage cmdID="123ABC">
<![CDATA[
<font size="+2" color="#ffffff">Hello World!</font>
]]>
</cmdMessage>
Return:
<cmd cmdID="123ABC" status="1" statusMsg="ok" />
- cmdGetInstance
Returns the instance ID of the server (DESITE MD, SHARE).
Example:
<cmdGetInstance/>
Return:
<instance ID="123ABC"/>
2. Run Script
A script can be passed to the DESITE MD program for execution. DESITE MD is programmed with JavaScript.
- cmdRunScript
Example:
<cmdRunScript cmdID="123ABC"><![CDATA[
// Example Script
desiteAPI.zoomToSelected()
]]></cmdRunScript>
Return:
message [<cmd cmdID="123ABC" status="0" statusMsg="" />]
3. Window Geometry
- cmdSetWinPosSize
Attributes: x, y, w, h
Example:
<cmdSetWinPosSize x="10" y="20" w="900" h="600" />
- cmdGetWinPosSize
Example:
<cmdGetWinPosSize/>
Return:
<winPosSize x="-4" y="-4" w="1280" h="998"/>
4. Message
- cmdMessage
The message can be formatted with HTML elements. The message to be displayed in DESITE is defined in a CDATA section.
Example:
<cmdMessage>
<![CDATA[
<font size="+2" color="#ffffff">Hello World!</font>
]]>
</cmdMessage>
5. Selection
- cmdGetSelected
Example:
<cmdGetSelected/>
- cmdSelectAll
Selects/deselects all elements. cmdSelectAll v="false" --> deselect all
Example:
<cmdSelectAll v="true"/>
<cmdSelectAll v="false"/>
- cmdSelect
Selects/deselects the elements contained in the ID list. The IDs are separated by ";". If v="false" the elements are deselected.
Example:
<cmdSelect v="true">
Projektname::249d1d41-732b-42b7-b63c-664713800f26-0003b686;
Projektname::249d1d41-732b-42b7-b63c-664713800f26-0003b65a
</cmdSelect>
6. Signal
- selectionChanged
If the <selectionChanged/> signal is enabled, desite sends this signal every time the selection is changed. The signal is enabled/disabled with the cmdEnableSelectionChanged command. By default the signal is disabled.
Example:
<cmdEnableSignalSelectionChanged v="1" />
7. Visibility
- cmdGetVisible
Example:
<cmdGetVisble cmdID="abc"/>
- cmdShowAll
Example:
<!--Show all--> <cmdShowAll v="true"/>
<!--Hide all--> <cmdShowAll v="false"/>
- cmdShowSelectedOnly
- cmdHideSelected
8. Property Value
- cmdGetPropertyValuesOfVisible
- cmdGetPropertyValuesOfSelected
Example:
<cmdGetPropertyValuesOfSelected pName="cpiComponentType" pType="xs:string" />
- cmdGetPropertyValue
Example:
<cmGetPropertyValue ID="ab45sx45a" pName="cpiComponentType" pType="xs:string" />
9. Viewpoints/Camera
- cmdZoomToSelected
- cmdZoomToVisible
- cmdHasElement
Checks if an object or container with this ID already exists.
Example:
<cmdHasElement ID="abcXYZ123"/>
10. Create/remove Object
- cmdCreateObject
Create new object from XML description. If the ID already exists, a new ID will be created. The function returns the ID of the new object. "parentID" is the ID of the container to which the new object should be added. The material "matID" must exist in the same model as the new object.
<cmdCreateObject parentID="{85c92280-3637-493f-99be-509de6876e6c}-1ad" >
<object3D ID="ABCxyz123" name="object-2" matID="mat-abcxyz" >
<p x="21.0" y="1.0" z="41" />
<p x="25.0" y="2.0" z="41" />
<p x="24.0" y="3.0" z="41" />
<p x="22.0" y="2.5" z="41" />
<t p1="0" p2="1" p3="2" />
<t p1="2" p2="3" p3="0" />
</object3D>
</cmdCreateObject>
In case of an error, the error code is returned.
- cmdDeleteObjects
Delete one or more objects. The IDs of the objects are separated by a ";".
<cmdDeleteObjects>
{85c92280-3637-493f-99be-509de6876e6c}-1ad;Projektname::249d1d41-732b-42b7-b63c-664713800f26-0003b65a
</cmdDeleteObjects>
11. Transform Object
- cmdTransformObject
Move, scale and rotate objects.
Example:
<cmdTransformObject ID="abcXYZ">
<t>
<scale sx="1.0" sy="1.0" sz="1.0" />
<translate dx="10.0" dy="20.0" dz="30.0" />
<rotate x="2.0" y="1.0" z="2.0" m="0.5 0.5 0.0 0.5 0.0 0.5 0.0 0.0 1.0" />
</t>
</cmdTransformObject>
12. Create/set Material
- cmdCreateMaterial
Create a new material. Returns the ID of the new material. The material is created in the 'modelID' model. If the model does not exist, the default model in the project will be used.
Example:
<cmdCreateMaterial modelID="abcXYZZ6r">
<material ID="default-mat-11" name="default-mat-11">
<diff r="140" b="40" g="150" a="1"/>
<amb r="140" b="40" g="150" a="1"/>
<spec r="255" b="255" g="255" a="1"/>
<trans v="0"/>
<shin v="0.5"/>
</material>
</cmdCreateMaterial>
- cmdSetMaterial
Setting an existing material for a list of objects. The 3D view is not automatically updated after setting the material.
<cmdSetMaterial cmdID="2" matID="2345xsea">
Projektname:249d1d41-732b-42b7-b63c-664713800f26-0003b686;
Projektname:249d1d41-732b-42b7-b63c-664713800f26-0003b65a
</cmdSetMaterial>
Return in status:
-1 : material was not found
>= 0 : number of objects for which the material was changed.
<cmd cmdID="2" status="2" statusMsg="2 objects affected" />
- cmdHasMaterial
Checks if a material with a given name already exists. Returns the ID of the material if it exists.
<cmdHasMaterial name="abc" />
Return:
<hasMaterial ="1" ID="abcxyz12321" />
If it doesn't exist:
<hasMaterial ="0" />
13. Project
- cmdGetProject
Fetches project data such as ID of the project (project variant) and file name.
Example:
<cmdGetProject/>
Return:
<project ID="zh7&hsbg%4e3" file="A:/TMP/xyz.pfs"/>
- cmdSaveProject
Save the current project. If no name has been assigned yet, the user must specify a name in the file dialog.
- cmdSaveProjectAs
Save project under new name or for the first time.
Example:
<cmdSaveProjectAs cmdID="1">
D:\02-desiteMD-SupportProjects/abc2/abc.pfs
</cmdSaveProjectAs>
- cmdAddDocument
Add document.
Attributes:
swap: swap coordinates
scale: scale factor, mm = 0.001, m = 1.0
Example:
<cmdAddDocument scale="0.001" swap="0 1 2">
C:/tmp/bsp.obj
</cmdAddDocument>
- cmdRemoveDocument
14. Create Model
- cmdCreateModel
Produce new model
<cmdCreateModel name="Model-Name" />
Rückgabe: ID des neuen Modells und ID des RootContainers
<newModel ID="mid123" rcID="rfgs213" />
15. Database
- cmdOpenDB
Open default database. The project must exist. If the project does not exist, it must be saved first.
- cmdCloseDB
Close default database.
- cmdSetPropertyValue
Write value of a property.
Example:
<cmdSetPropertyValue pName="Prop-A" pType="xs:string" pDomain="geometry" pValue="abc" >
Projektname::249d1d41-732b-42b7-b63c-664713800f26-0003b686;
Projektname::249d1d41-732b-42b7-b63c-664713800f26-0003b65a
</cmdSetPropertyValue>