MagicDraw 18.5 Documentation

Skip to end of metadata
Go to start of metadata

Using the Generate command

You can enter the Generate command in the command line to generate a report.

 

To generate a report from the package scope


  • generate - project projectFileName -output outputFileName -template templateName -package packageNameList

 

To generate a report from the element scope


  • generate -project projectFileName -output outputFileName -template templateName -element elementNameList

 

To generate a report from the option specified in the properties file


  • generate -properties propertiesFileName

 

To generate an encrypted password for Teamwork or Teamwork Cloud


  • generate -generatepassword password

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 parameters that are invoked. If the -properties option is specified, the argument is the name of a properties file. A properties file contains other parameters with the specified data of each parameter.

Synopsis

CommandFunction
-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 to be used for generating 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 -report reportName) will be used instead.
-package packageNameList

Specifies the name of one or more packages from a MagicDraw project that will be included in the report. Package entries must be separated by a semicolon (;).

Warning: Duplicate qualified name

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 that will be included in the report. Element entries must be separated by a semicolon (;).
[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.

Note

  • For -element and -package, one or more element name/qualifiedName can be specified to the parameter.
-package "package_A;package_B"
-element "package_A::B1;package_B::B2"
-element "B1;B2"
  • The value that can be entered to these parameters will be used to search for the element as a qualifiedName at first. If the element is found, the value will be used as a name.
  • If there is a duplicate name of element in your project, only the first found element will be retrieved.

Options

The command line feature supports a set of options that are useful in adding more configuration possibilities.

CommandFunction
-report reportName
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. If the reportName 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 report variable and value as Report Data does. The variables defined by the -fields parameter will override the value with the same variable names in Report Data.

-fields "[var_A=value1][var_B=value2][var_C=value3]"
-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 onto 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 onto Teamwork Server. This option is available only in a properties file.
-upload serverAddress
This command specifies 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, Report Wizard will generate a new report, and use it to replace the previous one. If you type n or no, Report Wizard will generate no 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 Secured Connection (SSL) is used. The default value is false.

  • true - Use Secured Connection (SSL)
  • false - Do not use Secured Connection (SSL)
-usagepackage usagePackageNameList

This command specifies the name of one or more packages in Project Usages of TWCloud project that will be included in the report. Package entries must be separated by a semi-colon (;). 

For a TWCloud project, -package is used to select one or more packages in Primary Model of the TWCloud project only. To select packages in Project Usages, specify -usagepackage and set -includeAuxiliary as true. This -usagepackage argument can be used with -package to select packages in both Primary Model and Project Usages.

-usageelement usageElementNameList

This command specifies the name of one or more elements in Project Usages of TWCloud project that will be included in the report. Element entries must be separated by a semi-colon (;).

For a TWCloud project, -element is used to select one or more elements in Primary Model of the TWCloud project only. To select elements in Project Usages, specify -usageelement and set -includeAuxiliary as true. This -usageelement argument can be used with -element to select elements in both Primary Model and Project Usages.

-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.
-projectpassword projectPassword
This command specifies a password to open a password-protected Teamwork Cloud project. The password is required for the project to generate a report.

Using command line

You can use the command line on Windows, Linux, or Unix.


To use the command line on Windows


  1. Run a command line console. In the Console window, go to the local installation of the MagicDraw application.
  2. Go to the plugins\com.nomagic.magicdraw.reportwizard folder, and type the command line there.


To use the command line on Linux or Unix


  1. Run a terminal (command line console). In the Console window, go to the local installation of the MagicDraw application.
  2. 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 Unix respectively.

On Windows
generate -properties "C:\\output\\prop.properties"


On Windows
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"


On Linux or Unix
./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 

Multiple projects can be opened and multiple reports generated 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”

Note

Template, output, package, and project are the required data for each property file (see Properties filename for more information regarding -properties parameter).

  • No labels