Command-line commands

The commands that can be used on the command line are listed here. Unless otherwise noted, commands can be used both with Rhapsody.exe and RhapsodyCL.exe.

Note: Information on the commands to use for importing and exporting AUTOSAR XML can be found in Importing and Exporting AUTOSAR XML files.

In general, the following types of commands cannot be used with RhapsodyCL: diagram commands, configuration management commands, commands for running macros.

If you try to use a non-supported command with RhapsodyCL, the behavior of RhapsodyCL depends on whether you have set the -verbose switch:

  • If you have set the switch, RhapsodyCL reports the problem and ignores the command.
  • If you have not set the switch, RhapsodyCL ignores the command without any notification to the user.

    For more information about the -verbose switch, see Command-line switches

Note: When making changes to projects under source control, check out the project before running RhapsodyCL.

-cmd=addtomodel <file location> <withdescendants><withdeps><asreference><asexternalunit>

Adds to the current model from the specified file location.

The optional arguments reflect the options in the Add To Model window:

  • -withdescendants (subunits)
  • -withdeps (dependents)
  • -asreference (as reference)
  • -asexternalunit (as unit, without copy into model)

For example:

rhapsodycl.exe -cmd=open myProj.rpy -cmd=addtomodel package.sbs withdescendants withdeps asreference
rhapsody.exe -cmd=open myProj.rpy -cmd=addtomodel package.sbs asexternalunit

-cmd=arccheckout <file name> <label/revision> <locked|unlocked> <recursive|nonrecursive>

(Cannot be used with RhapsodyCL.exe)

Checks out a file from the archive.

If you do not want to specify a <label/revision>, use NULL.

-cmd=buildwithdep

Builds a component with all its dependencies.

-cmd=call <plugin> <parameters for plug-in>

Calls one of the Rhapsody plug-ins and forwards the provided parameters to the plug‑in.

In contrast to all the other commands, the parameters for this command are provided as a single string enclosed in quotation marks (which are removed during processing). The first parameter in the string specifies the plug-in that is being called. The remainder of the string contains any parameters to be sent to the plug-in. You can send as many parameters to the plug-in as you want, but keep in mind that a parameter cannot contain spaces.

The following example shows the call command that is used to run TestConductor, where the plug-in name is rtc:

  • -cmd=call rtc run all runs all the tests that are defined in TestConductor.
For example,:
D:\RhapsodyModels\Pbx.PBX.rpt -cmd=call rtc run all

For more information about calling .dll plug-ins, see http://www.ibm.com/support/docview.wss?uid=swg21411451.

To learn how to load a .dll plug-in into your Rhapsody project, see http://www.ibm.com/support/docview.wss?uid=swg21411455.

-cmd=checkin <unit name> <label/revision> <locked|unlocked> <recursive|nonrecursive> <description>

(Cannot be used with RhapsodyCL.exe)

Checks in a unit to an archive. If you do not want to specify a <label/revision>, use NULL.

For example, -cmd=checkin p1.sbsx NULL locked recursive my description

-cmd=checkmodel

Starts a Check Model operation.

Set the current configuration before issuing this command.

-cmd=checkout <unit name> <label/revision> <locked|unlocked> <recursive|nonrecursive>

(Cannot be used with RhapsodyCL.exe)

Checks out a unit from the archive. If you do not want to specify a <label/revision>, use NULL.

-cmd=close <NoSave>

Closes the open Rhapsody model. By default, Rhapsody automatically saves any changes you have made to the model before closing. If you do not want the product to save changes upon closing, use the NoSave parameter.

-cmd=close_all_diagrams

Closes all diagrams that are open.

-cmd=closediagram <diagram type><diagram name>

(Cannot be used with RhapsodyCL.exe)

Closes the specified diagram.

The first parameter specifies the type of diagram. This parameter can take one of the following values: omd, ucd, msc, collaboration, component.

The second parameter is the name of the diagram in the model.

Connecttoarc <archive location>

(Cannot be used with RhapsodyCL.exe)

Connects to an archive. <archive location> includes the full path.

-cmd=creatediagram <diagram type><diagram name>

(Cannot be used with RhapsodyCL.exe)

Creates a diagram.

The first parameter specifies the type of diagram. This parameter can take one of the following values: activity, collaboration, communication, component, deployment, flowchart, msc, msd, omd, panel, statechart, structure, timing, ucd.

The second parameter is the name of the diagram in the model.

-cmd=exit

Closes the project and exits Rhapsody.

-cmd=forceroundtrip

Performs a roundtrip regardless of the timestamps of the files.

-cmd=full_screen

(Cannot be used with RhapsodyCL.exe)

Opens Rhapsody in Full Screen mode.

-cmd=genentire

Generates code for the entire project.

Like the corresponding option in the GUI, this command generates code only for modified elements. To regenerate all of the code in the project, use the regenentire command.

Note: Do not use this command with RhapsodyCL.exe if you are using customized code generation or if you are generating code for the INTEGRITY operating system. Use the command with Rhapsody.exe instead.

-cmd=generate <component> <configuration>

Generates code for the specified component and configuration.

<component> and <configuration> are optional parameters. If not specified, the active component and configuration are used. Like the generate option in the GUI, this generates code only for modified elements. To regenerate all code, use the -regenerate command.

For example, -cmd=generate EXE Acme

If you want to generate code for more than one component, or for more than one configuration for a given component, you must repeat the generate command for each component/configuration combination, for example:

-cmd=generate compA cfg1 -cmd=generate compA cfg2 -cmd=generate compB cfg1

If you want to generate code for a nested component, use the syntax outerComponent::innerComponent, for example:

-cmd=generate def::abc DefaultConfig

Note: Do not use this command with RhapsodyCL.exe if you are using customized code generation or if you are generating code for the INTEGRITY operating system. Use the command with Rhapsody.exe instead.

-cmd=genwithdep

Generates a component with all its dependencies.

-cmd=GetCommandResult

Sends the result of the last command that was run to the standard output (or through the relevant socket in socket mode).

This command can be used only with RhapsodyCL.

Note: If you are using RhapsodyCL in socket mode, and you send the GetCommandResult command after sending various commands in a single line, the results of the individual commands must be read one at a time from the socket.

-cmd=gmr

Performs generate/make/run.

-cmd=hide_model_browser

(Cannot be used with RhapsodyCL.exe)

Hides the model browser.

-cmd=import

Imports classes according to the reverse engineering settings stored in the current configuration. This command is equivalent to selecting Tools > Reverse Engineering in Rhapsody.

Alternatively, the command can take up to six parameters, each representing a single file or folder to import.

For example, -cmd=import D:/temp/files_to_import/class_two.h D:/temp/files_to_import/class_two.cpp D:/temp/files_to_import/new_files

-cmd=load_hep

Loads helpers defined in a .hep file.

For example, -cmd=load_hep D:\rhp_profiles\helpers_for_new_profile.hep

If the path to the .hep file contains spaces, the path should be enclosed in quotation marks.

-cmd=loadjvm

Loads the JVM dll when Rhapsody is launched rather than loading the dll only when it is required by Rhapsody components.

-cmd=make

Builds the application, by using the current configuration.

Make is an asynchronous command and must be the last of all commands in a script.

Because exit is a synchronous command, you cannot follow a make command with an exit (to close your project and exit Rhapsody); doing so will cause the make to cease prematurely.

If you plan to run the application immediately after the make function, use -syncmake instead of -make. This waits for the make to complete before running any additional commands.

-cmd=new <project location> <project name> <project type>

Creates a project in the specified location and assigns it the specified name. The third argument, which is optional, can be used to specify the type of project that should be created, for example, SysML. This argument corresponds to the Project Type field in the New Project window in the user interface. The possible values for the <project type> argument are:

  • AR32_BMT
  • AR3x_BMT
  • AR4x_BMT
  • AutomotiveC
  • AUTOSAR_315
  • AUTOSAR_323
  • AUTOSAR_403
  • AUTOSAR_413
  • AUTOSAR_422
  • AUTOSAR_431
  • AUTOSAR_431_R1803
  • AUTOSAR_440
  • AUTOSAR_440_R1810
  • DDS
  • FunctionalC
  • MicroC
  • SysML
  • UPDM2_DoDAF
  • UPDM2_MODAF

-cmd=open <path to the .rpyx file> <readonly>

Opens the specified project. (The RhapsodyCL.exe file can only open projects. Whereas the Rhapsody.exe file can open units as well.)

The optional readonly argument can be used to open a model as read-only.

Note: When using the open command to open a model enabled for Rhapsody Model Manager, you must first run the command wait_for_ewm to specify various seconds to wait for communication to be established with the server, for example, -cmd=wait_for_ewm 5.

-cmd=opendiagram <diagram type><diagram name>

(Cannot be used with RhapsodyCL.exe)

Opens the specified diagram.

The first parameter specifies the type of diagram. This parameter can take one of the following values: omd, ucd, msc, collaboration, component.

The second parameter is the name of the diagram in the model.

-cmd=openmatrix <MatrixIdentifier>

(Cannot be used with RhapsodyCL.exe)

Opens the specified Matrix View. The matrix identifier can be the name of the Matrix View or its GUID. If the Matrix View is directly under the project, you can use its name. If the Matrix View is contained in a package hierarchy, the syntax to use is nameOfMatrixView in packageA::packageB.

Sample usage:

Rhapsody.exe -cmd=open modelName.rpyx -cmd=openmatrix GUID 3c2dea80-97d1-4a07-9db6-1d4e8d0d2bcd -cmd=full_screen -cmd=hide_model_browser

Rhapsody.exe -cmd=open modelName.rpyx -cmd=openmatrix matrixview_6 in Default::package_1::package_0

-cmd=opentable <TableIdentifier>

(Cannot be used with RhapsodyCL.exe)

Opens the specified Table View. The table identifier can be the name of the Table View or its GUID. If the Table View is directly under the project, you can use its name. If the Table View is contained in a package hierarchy, the syntax to use is nameOfTableView in packageA::packageB.

Sample usage:

Rhapsody.exe -cmd=open modelName.rpyx -cmd=opentable GUID 3c2dea80-97d1-4a07-9db6-1d4e8d0d2bcd

Rhapsody.exe -cmd=open modelName.rpyx -cmd=opentable tableview_5 in Default::package_1::package_0 -cmd=full_screen -cmd=hide_model_browser

-cmd=populatediagram <diagram type><diagram name>

(Cannot be used with RhapsodyCL.exe)

Populates the specified diagram.

The first parameter specifies the type of diagram. This parameter can take one of the following values: omd, ucd, msc, collaboration, component.

The second parameter is the name of the diagram in the model.

-cmd=printcurrentdiagram

(Cannot be used with RhapsodyCL.exe)

Prints the open diagram.

-cmd=publishreport <type> <base-template> <output-folder> <scope-identifier><exitRhapsody>

Generates an HTML report based on an auto-generated Engineering Publishing template.

<type> - value must be autogeneratedtemplate

<base-template> - full path to the base Engineering Publishing template (.dta file) to use for the report.

<output-folder> - folder to which the report should be generated. If the path provided is a relative path, the project folder is used as the base.

<scope-identifier> - the name or GUID of the package or project that the report should cover. This parameter is optional - if you do not use it, the report is generated for the entire project. If you want to generate a report for a nested package, use the syntax PackageA::PackageB::PackageC.

<exitRhapsody> - add this argument if you want Rhapsody to close after report generation is finished.

-cmd=regenentire

Generates code for the entire project, including the code for elements that were not modified.

Note: Do not use this command with RhapsodyCL.exe if you are using customized code generation or if you are generating code for the INTEGRITY operating system. Use the command with Rhapsody.exe instead.

-cmd=regenerate <component> <configuration>

If model elements have been modified, generates code for the specified component and configuration.

<component> and <configuration> are optional parameters. If not specified, the active component and configuration are used.

If you want to generate code for more than one component, or for more than one configuration for a given component, you must repeat the regenerate command for each component/configuration combination, for example:

-cmd=regenerate compA cfg1 -cmd=regenerate compA cfg2 -cmd=regenerate compB cfg1

If you want to regenerate code for a nested component, use the syntax outerComponent::innerComponent, for example:

-cmd=regenerate def::abc DefaultConfig

Note: Do not use this command with RhapsodyCL.exe if you are using customized code generation or if you are generating code for the INTEGRITY operating system. Use the command with Rhapsody.exe instead.

-cmd=report <format> <name + location>

Generates a report.

<format> is the report format (RTF or ASCII). The file extension is added automatically (.rtf for RTF and .txt for ASCII).

<name + location> specifies the name and location of the report. These parameters are optional.

If you do not specify a name, the default file name is used (RhapsodyRep.rtf).

If you do not specify a location, the default location is used (the project directory).

Set the current configuration before issuing this command.

For example, -cmd=report RTF myReport

For RhapsodyCL, the report command uses the Rhapsody internal reporter and does not extract diagrams.

-cmd=roundtrip

Roundtrips code changes back into the model.

Set the current configuration before issuing this command.

-cmd=runexternalprogram

Runs the specified external program.

(With RhapsodyCL.exe, cannot be used to run COM-based programs.)

-cmd=save

Saves the open project. Can be used after making changes like roundtrip, reverse engineering.

-cmd=saveas <project name>

Saves the project to a specified location. <project name> Can include the path.

-cmd=setcomponent <active component name>

Sets the active component.

If you want to make a nested component the active component, use the syntax outerComponent::innerComponent, for example:

-cmd=setcomponent def::abc

-cmd=setconfiguration <active configuration name>

Sets the active configuration.

For example, -cmd=setconfiguration AcmeDebug

-cmd=setlog <log file>

Redirects the output that is normally sent to the output window to the specified log file. If the parameter does not specify the path, the log file is put in the current Rhapsody directory. If a log file is specified, output is not sent to the standard output.

-cmd=setomroot <alternative OMROOT>

Sets the variable OMROOT to a new location. This variable specifies the root directory of the Rhapsody installation.

For this command to take effect, this must be the first option that is specified in the command line.

-cmd=syncmake

Builds the application by using the current configuration.

As opposed to the make command, the syncmake command waits until the make has completed before running any additional commands. So if you plan to run the application immediately after building it, use syncmake instead of make.

-cmd=wait_for_ewm <number of seconds>

Used to specify that Rhapsody should wait various seconds to establish communication with Engineering Workflow Management. This is necessary in situations where an Engineering Workflow Management action must be automatically performed after a Rhapsody action, for example, having changes checked-in automatically after they are saved in Rhapsody. (The Engineering Workflow Management action to perform automatically after changes are saved in the model is controlled by the property ConfigurationManagement::EngineeringWorkflowManagement::UnitAutomaticOperationOnSave).

The number of seconds parameter is optional. If no value is provided, 3 seconds are used. Three seconds are also the minimum value for this parameter.

Example:

Rhapsody.exe -cmd=wait_for_ewm 5 -cmd=open modelName.rpy -cmd=saveAs C:\sandbox\modelName.rpy -cmd=AddToModel C:\programs\rhapsody_83\Share\Profiles\RhapsodyModelManager\RhapsodyModelManager.sbs -cmd=save -cmd=exit

Note: Before release 9.0, this command was called wait_for_rtc.

-cmd=update_view_on_server <diagram-type> <diagram-identifier> <enforceRefresh>

Updates view on the server.

Parameters:
  • <diagram-type> – Add the diagram metaclass, for example, ObjectModelDiagram.
  • <diagram-identifier> – Add the full path name or GUID.
  • <enforceRefresh> – Set True to enforce refresh of the view. The default value is false.

-cmd=update_contained_views_on_server <container-metaclass> <container-identifier> <enforceRefresh>

This command can be used to update views of the diagrams containers, such as Project, Package, Class, etc. on the server.

Parameters:
  • <container-metaclass> – Add the container metaclass, for example, Package, Class.
  • <container-identifier> – Add the full path name or GUID.
  • <enforceRefresh> – Set True to enforce refresh of the view. The default value is false.