Using the Generate cod
You can enter the o generate a report.
To generate a report from the package scope
To generate a report from the element scope
To generate a report from the option specified in the properties file
To generate a Teamwork password for a properties file
Description
The Generate command creates a report document with a received set of information from arguments and parameters. The information will then be generated as a report document to the specified output file. By default, an argument is the specified data of the invoked parameters. If the -properties option is specified, the argument is the name of a properties file. A properties file contains other parameters, along with the specified data of each parameter. Synopsis Command | Function |
---|
-project projectFileName | Specifies the MagicDraw project path as a file name. | -output outputFileName | Specifies the output file path as a file name. | -template templateName | Specifies a template name used to generate a report document. - The template must exist in MagicDraw prior to using this command, otherwise an error will occur.
- If the template name is not specified, the template specified in the Report Data (specified in the -report parameter) will be used instead.
|
| -templatePath templatePath | Specifies a template path used to generate a report document. Both absolute and relative paths are allowed for this command. The specified template file must have proper structure as it has been added through the Report Wizard dialog. If both -template and -templatePath are specified in the same command, the error will occur. |
| -package packageNameList | Specifies the name of one or more packages in a MagicDraw project to be included in the report. Multiple package entries must be separated by a semicolon (;). Do not enter a duplicate name of a root Model package or its immediate child package to the -package option. |
| -element elementNameList | Specifies the name of one or more elements from a MagicDraw project to be included in a report. Element entries must be separated by a semicolon (;). | -elementID | Specifies the element ID of one or more elements in a MagicDraw project to be included in the report. Multiple element entries must be separated by a semicolon (;). - You can get an element ID by using $element.elementID.
- The element ID will change when the local project is added to Teamwork Cloud. Please make sure the element ID is up-to-date.
|
| [options] | The command-line options. | -properties propertiesFileName | This command specifies the name of a properties file to utilize. Use only with -properties. | -generatepassword password | This command generates an encrypted password to be used with a properties file. |
Options
The command line feature supports a set of options useful in adding additional configuration possibilities. Command | Function |
---|
-report reportDataName|reportDataElementID | This command specifies the name of a Report Data file or Report Data element. The Report Data file must exist in MagicDraw prior to using this command, otherwise an error will occur. The value for this command can be either a Report Data name or Report Data element ID. If the -report parameter is not specified, the previous Report Data will be set and used instead.
|
| -autoImage 0|1|2|3 | This command specifies how an image will be shown in a report document. The default value for this argument is 1. - 0 – No resize.
- 1 – Fit image to paper (large only).
- 2 – Fit and rotate image (clockwise) to paper (large only).
- 3 – Fit and rotate image (counter-clockwise) to paper (large only)
| -imageFormat jpg|png|svg|emf|wmf | This command specifies an image format in a report document. The default value for this argument is jpg. - jpg – Joint Photographic Expert Group
- png – Portable Network Graphics
- svg – Scaling Vector Image
- emf – Microsoft Windows Enhanced Metafile
- wmf – Windows Metafile
| -recursive true|false | This command specifies how to select a package in a MagicDraw project. The default value for this argument is true. - true – Select the specified package and its recursive package.
- false – Select only the specified package.
| -includeAuxiliary true|false | This command is used to select packages, including auxiliary packages. The default value is false. | -outputOnBlankField stringValue | This command will show a string value in a blank field in a report document. The default value for this argument is “”. | -category categoryName | This command specifies a template category. | -fields[name=value] | This command specifies a variable. | -server serverName|IPAddress | This command specifies the name or IP Address of a Teamwork Server project. | -login loginName | This command specifies a login name to log on to Teamwork Server. | -password password | This command specifies a password to log on to Teamwork Server. | -spassword encryptedPassword | This command specifies an encrypted password (Teamwork password) to log on to Teamwork Server. This option is available only in a properties file. | -upload serverAddress | This command specifies a serverAddress consisting of a scheme, userInfo, host, port, and path to connect and upload a generated report to a server (see Upload generated report to server). | -overwrite true|false | This command overwrites any previously generated files. The default value for this argument is true. - true – Overwrites all files automatically (removes any existing file before generating a report.)
- false – If the file exists, the following prompt message will open:
Output file already exists. Would you like to replace the existing file? [y][n]: |
If you type ‘y’ or ‘yes’, the Report Wizard will generate a new report that replaces the previous one. If you type ‘n’ or ‘no’, the Report Wizard will not generate a report and terminate the process. | -pversion projectVersion | This command specifies a Teamwork project version. | -servertype tw | twcloud | This command specifies a type of server to connect. The default value is tw. - tw - Connect to Teamwork Server
- twcloud - Connect to Teamwork Cloud
| -ssl true | false | This command specifies if a Secured Connection (SSL) is used. The default value is false. - true - Use Secured Connection (SSL)
- false - Do not use Secured Connection (SSL)
| -tag tagValue | This is an additional argument to generate reports from a server project by specifying a server project tag name. The tagValue is non-case sensitive. More than one project version may be returned from specifying one tag value. Hence, one report generation process may generate multiple reports. You cannot use this command with –pversion. | -incremental true|false | Specifies the incremental method. The default value is true.- true - The output report shall be generated by appending a new generated output file name with the incremental number.
- false - The latest project version in the returned project collection. Use this command with -tag only.
|
Using command line
You can use the command line on Windows, Linux, or Unix.
To use the command line on Windows
- Run a command line console. In the Console window, go to the local installation of the MagicDraw application.
- Go to the plugins\com.nomagic.magicdraw.reportwizard folder, and type the command line there.
To use the command line on Linux or Unix
- Run a terminal (command line console). In the Console window, go to the local installation of the MagicDraw application.
- Go to the plugins\com.nomagic.magicdraw.reportwizard folder, and type the command line there.
See the following examples of command line on Windows and Linux or Uni generate -properties "C:\\output\\prop.properties" |
generate -project "C:\\MagicDraw\\samples\\diagrams\\class diagram.mdzip" -output "C:\\output\\output.rtf" -template "Class Specification Report" -package "Model" -report "Built-in" -autoImage 1 -imageFormat png -recursive false -outputOnBlankField "#NA" |
./generate.sh -project "/home/project/project.mdzip" -output "/home/output/output.rtf" -template "Class Specification Report" -package "Model" -report "Built-in" -autoImage 1 -imageFormat png -recursive false -outputOnBlankField "#NA" |
Generating multiple reports
You can open multiple projects and generate multiple reports before MagicDraw shuts down. The generate command with the -properties option accepts multiple properties files as shown below. generate -properties <file1.properties> <file2.properties> <file3.properties>... |
For example generate -properties “property1.properties” “property2.properties” |
Template, output, package, and project are the required data for each property file. |
|