Page tree

MagicDraw 19.0 LTR SP3 Documentation


On this page

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 a Teamwork password for a properties file


  • 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 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

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 used to generate a report document.

Note

  • 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.

Note

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 (;).

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 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 (;).

Note

  • 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]

Command-line options. 

-properties propertiesFileName
Specifies the name of a properties file to utilize. Use only with -properties.
-generatepassword password
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.

CommandFunction
-report reportDataName|reportDataElementID

Specifies the name of a Report Data file or Report Data element.

Note

  • 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.

  • If you want to generate a report from the server project, use an Element Server ID value instead.
-autoImage 0|1|2|3

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

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

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
Selects packages, including auxiliary packages. The default value is false.
-outputOnBlankField stringValue
Shows a string value in a blank field in a report document. The default value for this argument is “”.
-category categoryName
Specifies a template category.
-fields[name=value]
Specifies a variable.
-server serverName|IPAddress
Specifies the name or IP Address of a Teamwork Server project.
-login loginName
Specifies a login name to log on to Teamwork Server.
-password password
Specifies a password to log on to Teamwork Server.
-spassword encryptedPassword

Specifies an encrypted password to log on to the server. This option is available only in a properties file.

You can get encrypted password by entering this command below in command line prompt.

generate -generatepassword "enter_your_password_here"
-upload serverAddress
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

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
Specifies a Teamwork project version. 
-servertype tw | twcloud

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 

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
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.
-leaveprojectopen
Leaves the project open per property file after generating the report, in a series of report generation. The default value is false.


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" -fields "[Author=NMA][Company=No Magic]"


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" -fields "[Author=NMA][Company=No Magic]"


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”

Note

Template, output, package, and project are the required data for each property file.

The following parameters are reset when finishing generating a report for each property file. Other parameter values affect subsequent property files, if there are no overridden values.

  • -project
  • -output
  • -template
  • -templatePath
  • -tag
  • -pVersion
  • -recursive
  • -category
  • -includeAuxiliary

Tip

When large-size projects need to be loaded and closed for many property files, it takes longer time to generate reports. In this case, you can use -leaveprojectopen as an option to reduce memory for loading each project when starting to generate a new report.

generate -leaveprojectopen true -properties “property1.properties” “property2.properties”

Note

-leaveprojectopen needs to be specified before -properties.

  • No labels