> For the complete documentation index, see [llms.txt](https://www.opal-rt.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://www.opal-rt.com/docs/rt-lab/automation-api-and-scripting/rt-lab-api/c-rt-lab-api-reference/enumeration-and-define/op_command.md).

# OP\_COMMAND

<table data-header-hidden><thead><tr><th width="199.77777099609375"></th><th></th></tr></thead><tbody><tr><td><strong>Description</strong></td><td><p>Use this enumeration to specify the type of command to be issued to the target object with attributea you want to use on a given object with OpalCommand.</p><p>For each command, the requirements vary depending on the owner ID supplied to OpalCommand. All possible combinations of commands and owner ID classes are listed in the table of elements below.</p></td></tr><tr><td><strong>Usage</strong></td><td><p>typedef enum{</p><p>CMD_UNKNOWN,</p><p>CMD_NEW,</p><p>CMD_ADD,</p><p>CMD_OPEN,</p><p>CMD_SAVE,</p><p>CMD_CLOSE,</p><p>CMD_REMOVE,</p><p>CMD_REFRESH,</p><p>CMD_EXECUTE,</p><p>CMD_FIND,</p><p>CMD_PAUSE,</p><p>CMD_RESUME,</p><p>CMD_CANCEL};</p></td></tr><tr><td><strong>Elements</strong></td><td><ul><li><p><strong>New Project:</strong></p><ul><li><strong>Owner ID class</strong>: OP_RTLAB_OBJ</li><li><strong>Command:</strong> CMD_NEW</li><li><strong>Description:</strong> Create a new project in the current RTLab session. If a project is already open it is closed.</li><li><strong>Required control:</strong> None</li><li><strong>Required attributes:</strong> ATT_FILENAME</li><li><strong>Optional attributes</strong>: None</li><li><strong>Output ID class</strong>: OP_PROJECT_OBJ</li></ul></li><li><p><strong>Open Project:</strong></p><ul><li><strong>Owner ID class</strong>: OP_RTLAB_OBJ</li><li><strong>Command</strong>: CMD_OPEN</li><li><strong>Description</strong>: Open an existing project from file or connect to an active project. After this action, the project opened becomes the current project in the<br>current RT-Lab session. If a project is open beforehand it is closed. When connecting to a previously active project, control of this project may also be requested.</li><li><strong>Required control</strong>: None</li><li><strong>Required attributes:</strong> None</li><li><strong>Optional attributes</strong>: ATT_FILENAME, ATT_API_INSTANCE_ID, ATT_FUNCTIONAL_BLOCK, ATT_CONTROL_PRIOTRITY, ATT_RETURN_ON_AMBIGUUITY</li><li><strong>Output ID class</strong>: OP_PROJECT_OBJ</li></ul></li><li><p><strong>Add Default Environment Variable:</strong></p><ul><li><strong>Owner ID class</strong>: OP_RTLAB_OBJ</li><li><strong>Command</strong>: CMD_ADD</li><li><strong>Description</strong>: Add an environment variable to the default RT-LAB settings. This variable will NOT affect the current project directly.</li><li><strong>Required control</strong>: OP_FB_CONFIG</li><li><strong>Required attributes:</strong> ATT_OBJECT_TYPE, ATT_NAME</li><li><strong>Required attribute values</strong>: ATT_OBJECT_TYPE = OP_ENVIRONMENT_VARIABLE_OBJ</li><li><strong>Optional attributes</strong>: ATT_VALUE</li><li><strong>Output ID class:</strong> OP_ENVIRONMENT_VARIABLE_OBJ</li></ul></li><li><p><strong>Add Target:</strong></p><ul><li><strong>Owner ID class</strong>: OP_RTLAB_OBJ</li><li><strong>Command</strong>: CMD_ADD</li><li><strong>Description</strong>: Add a target that may be used by any RT-LAB project.</li><li><strong>Required control</strong>: OP_FB_CONFIG</li><li><strong>Required attributes</strong>: ATT_OBJECT_TYPE, ATT_NAME, ATT_IP_ADDRESS, ATT_TARGET_PLATFORM</li><li><strong>Required attribute values</strong>: ATT_OBJECT_TYPE = OP_TARGET_OBJ</li><li><strong>Optional attributes</strong>: None.</li><li><strong>Output ID class</strong>: OP_TARGET_OBJ</li></ul></li><li><p><strong>Remove Object from RT-LAB:</strong></p><ul><li><strong>Owner ID class</strong>: OP_RTLAB_OBJ</li><li><strong>Command</strong>: CMD_REMOVE</li><li><strong>Description</strong>: Removes an object from the default RTLAB settings.</li><li><strong>Required control</strong>: OP_FB_CONFIG</li><li><strong>Required attributes</strong>: ATT_REF_ID</li><li><strong>Optional attributes</strong>: None.</li><li><strong>Output ID class</strong>: Same as the value of ATT_REF_ID</li></ul></li><li><p><strong>Add Model:</strong></p><ul><li><strong>Owner ID class</strong>: OP_PROJECT_OBJ</li><li><strong>Command</strong>: CMD_ADD</li><li><strong>Description</strong>: Add a model to the current project.</li><li><strong>Required control</strong>: OP_FB_SYSTEM</li><li><strong>Required attributes</strong>: ATT_FILENAME</li><li><strong>Optional attributes</strong>: None</li><li><strong>Output ID class</strong>: OP_MODEL_OBJ</li></ul></li><li><p><strong>Save Project:</strong></p><ul><li><strong>Command</strong>: CMD_SAVE</li><li><strong>Description</strong>: Save the existing project’s settings to a file.</li><li><strong>Owner type</strong>: OP_TYPE_PROJECT</li><li><strong>Required control</strong>: OP_FB_SYSTEM</li><li><strong>Required attributes:</strong> None</li><li><strong>Optional attributes</strong>: ATT_FILENAME</li><li><strong>Output ID class</strong>: OP_PROJECT_OBJ</li></ul></li><li><p><strong>Close Project:</strong></p><ul><li><strong>Command</strong>: CMD_CLOSE</li><li><strong>Description</strong>: Close the currently open project.</li><li><strong>Owner type</strong>: OP_TYPE_PROJECT</li><li><strong>Required control:</strong> None</li><li><strong>Required attributes</strong>: None</li><li><strong>Optional attributes</strong>: None</li><li><strong>Output ID class</strong>: OP_PROJECT_OBJ</li></ul></li><li><p><strong>Remove Model:</strong></p><ul><li><strong>Command</strong>: CMD_REMOVE</li><li><strong>Description</strong>: Remove a model from the current project.</li><li><strong>Owner type</strong>: OP_TYPE_PROJECT</li><li><strong>Required control</strong>: OP_FB_SYSTEM</li><li><strong>Required attributes</strong>: ATT_REF_ID</li><li><strong>Optional attributes</strong>: None</li><li><strong>Output ID class</strong>: OP_MODEL_OBJ</li></ul></li><li><p><strong>Add EnvironmentVariable:</strong></p><ul><li><strong>Owner ID class</strong>: OP_MODEL_OBJ</li><li><strong>Command</strong>: CMD_ADD</li><li><strong>Description</strong>: Add an environment variable a model.</li><li><strong>Required control</strong>: OP_FB_SYSTEM</li><li><strong>Required attributes</strong>: ATT_OBJECT_TYPE, ATT_NAME</li><li><strong>Required attribute values</strong>: ATT_OBJECT_TYPE = OP_ENVIRONMENT_VARIABLE_OBJ</li><li><strong>Optional attributes</strong>: ATT_VALUE</li><li><strong>Output ID class</strong>: OP_ENVIRONMENT_VARIABLE_OBJ</li></ul></li><li><p><strong>Load Model Configuration:</strong></p><ul><li><strong>Name</strong>: CMD_OPEN</li><li><strong>Description</strong>: Load an existing model’s settings from a file.</li><li><strong>Owner type</strong>: OP_TYPE_MODEL</li><li><strong>Required control</strong>: OP_FB_SYSTEM</li><li><strong>Required attributes</strong>: ATT_FILENAME</li><li><strong>Optional attributes</strong>: None</li><li><strong>Output ID class</strong>: Same as the value of ATT_REF_ID</li></ul></li><li><p><strong>Save Model</strong></p><ul><li><strong>Name</strong>: CMD_SAVE</li><li><strong>Description</strong>: Save an existing model’s settings to a file.</li><li><strong>Owner type</strong>: OP_TYPE_MODEL</li><li><strong>Required control</strong>: OP_FB_SYSTEM</li><li><strong>Required attributes</strong>: None</li><li><strong>Optional attributes</strong>: ATT_FILENAME</li><li><strong>Output ID class</strong>: Same as the value of ATT_REF_ID</li></ul></li><li><p><strong>Remove Object from Model</strong></p><ul><li><strong>Owner ID class:</strong> OP_MODEL_OBJ</li><li><strong>Command</strong>: CMD_REMOVE</li><li><strong>Description</strong>: Removes an object from a model.</li><li><strong>Required control:</strong> OP_FB_SYSTEM</li><li><strong>Required attributes:</strong> ATT_REF_ID</li><li><strong>Optional attributes:</strong> None.</li><li><strong>Output ID class:</strong> Same as the value of ATT_REF_ID</li></ul></li><li><p><strong>Add to Selection:</strong></p><ul><li><strong>Owner ID class</strong>: OP_SLECTION_OBJ</li><li><strong>Command</strong>: CMD_ADD</li><li><strong>Description</strong>: Add an object to a selection.</li><li><strong>Required control</strong>: None</li><li><strong>Required attributes</strong>: ATT_REF_ID</li><li><strong>Optional attributes</strong>: None</li><li><strong>Output ID class</strong>: Same as the value of ATT_REF_ID</li></ul></li><li><p><strong>Remove from Selection:</strong></p><ul><li><strong>Owner ID class</strong>: OP_SLECTION_OBJ</li><li><strong>Command</strong>: CMD_REMOVE</li><li><strong>Description</strong>: Removes an object from a selection.</li><li><strong>Required control</strong>: None.</li><li><strong>Required attributes</strong>: ATT_REF_ID</li><li><strong>Optional attributes</strong>: None.</li><li><strong>Output ID class</strong>: Same as the value of ATT_REF_ID</li></ul></li></ul></td></tr><tr><td><strong>Examples</strong></td><td>None</td></tr><tr><td><strong>Related Items</strong></td><td>OP_ATTRIBUTE, OpalCommand.</td></tr></tbody></table>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://www.opal-rt.com/docs/rt-lab/automation-api-and-scripting/rt-lab-api/c-rt-lab-api-reference/enumeration-and-define/op_command.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
