CityEngineModelGenerator
Generates 3D models from input geometries and ArcGIS CityEngine rule packages (*.rpk).
Typical Uses
- Read in a geometry file of a building footprint with an FME Reader and pass the generated Feature to a CityEngineModelGenerator transformer to output 3D geometry in FME.
- Analyze an input .rpk file and generate a config JSON attribute of the CGA attributes defined in the .rpk file which can be used to customize the model generation process.
How does it work?
The CityEngineModelGenerator uses CityEngine to apply rule packages to input geometry to produce textured 3D models. The input geometry is provided as FME geometry on the input feature. The generated model is output as 3D geometry on the feature.
Note: This transformer uses PyPRT, which is a Python Binding for the CityEngine SDK.
Legal Disclaimer: It is free for non-commercial use, however, commercial use requires at least one commercial license of the latest Esri CityEngine version installed in the organization.
See PyPRT for further details.
Examples
Use the “Generate Model” action to apply an extrusion .rpk file to a building footprint provided as FME input geometry read in using an FME Reader.
Use the “Generate Configuration Template” action to generate a config JSON template attribute of the CGA attributes defined in an extrusion .rpk file. Edit the JSON attribute to change the building color and building height. In another CityEngineModelGenerator, use the “Generate Model” action to apply the JSON attribute and .rpk on input footprint geometry.
Usage Notes
- The rule package file can contain CGA attributes which can be specified for model generation. To edit these attributes for model generation, run the transformer with ‘Action’ as ‘Generate Configuration Template’ to generate a config JSON as an FME attribute which can be edited to insert these values.
-
When editing the configuration JSON string of CGA attributes, the data type (such as float, int, string) is STRICT. The attribute values inserted into the JSON must be of that data type for the CGA attribute value to be applied to the resulting geometry output. The transformer will attempt to convert the value to the correct data type but it is recommended that you input the CGA attribute with the correct data type to avoid unexpected results.
For example below:
-
For example, “input”: null should have the value "input": 30.0 to be applied correctly because of the “type: float”.
-
"input": 30 is incorrect and will be converted into a float at runtime and trigger a warning.
-
The specified input must be within the “range” of 28 and 150.
-
Example Output:
{
"BuildingHeight" : {
"input" : null,
"range" : [28, 150],
"type" : "float",
}
}
- The specifications of the CGA attribute values are defined individually in each rule package. It is important to understand the rule package you are using.
For example:- There could be a rule package that has a color attribute buildingColor that specifically requires a hex color string. The configuration JSON string will define the type as "string", but "buildingColor": {“input” : "blue" } is not valid, whereas "buildingColor": { “input”: "#0000FF" } is valid.
-
CityEngine stores geometry internally in a y-Up orientation, which does not match the standard z-Up orientation of FME and other GIS applications. As a result, the CityEngineModelGenerator will transform input geometry from an assumed z-Up orientation to y-Up before processing through the PyPRT module. The generated geometry model will be transformed to a z-Up orientation on output.
-
The input geometry is expected to be in a projected coordinate system. Any input Feature in a geographic coordinate system will be rejected by the transformer and will need to be reprojected to a projected coordinate system beforehand.
- Caution: When using an expensive rpk file that applies lots of textures to the models, the FME Data Inspector can take a significant amount of time to load the rasters.
Configuration
Input Ports
Geometry taken as input to the transformer should have non-zero total area. Input Feature cannot be in a geographic coordinate system.
Output Ports
For the Generate Model action - the original FME Feature with the geometry set to the generated models (FME Mesh or Aggregate).
For the Generate Configuration Template action - the original FME Feature with a CGA attribute template JSON string attribute.
Attributes
_file_base_name |
The specified base file name for all generated files. |
_output_destination |
The destination where the model and files are generated. |
The incoming feature is output through this port.
Features that cause the operation to fail are output through this port. An fme_rejection_code attribute describing the category of the error will be added, along with a more descriptive fme_rejection_message attribute which contains more specific details as to the reason for the failure. Rejection codes include:
INVALID_PARAMETER - An input parameter is unrecognized.
CITY_ENGINE_MODEL_GENERATOR_ERROR - General error that will be explained in the fme_rejection_message.
PYPRT_ERROR - The ESRI 3rd party dependency PyPRT generated an error.
INVALID_GEOMETRY_ERROR - The geometry on the input feature is unsupported.
OUTDATED_TRANSFORMER - The transformer needs to be upgraded before proceeding.
MISSING_LEGAL_USER_AGREEMENT - The legal terms need to be reviewed and agree before proceeding.
UNRECOGNIZED_OUTPUT_FILE_TYPE - The specified output file type is not recognized or supported.
UNRECOGNIZED_INPUT_FILE_TYPE - The specified input file is not recognized or supported.
Rejected Feature Handling: can be set to either terminate the translation or continue running when it encounters a rejected feature. This setting is available both as a default FME option and as a workspace parameter.
Parameters
Action |
Select the mode for the transformer to take:
|
The remaining parameters available depend on the value of the Action parameter. Parameters for each Action are detailed below.
Rule Package |
The file path to the rule package (*.rpk) file |
Configuration JSON Attribute |
The attribute name to write the generated CGA JSON configuration to.
Default is _cga_attr_json Example output: Copy
input: the value you would like to specify range: the range of possible values that can be accepted as input type: the value type accept as input (strict) |
Method |
The output method of Feature or File.
|
File |
Specify the location of the 2D geometry file. Supported file types include:
|
Rule Package |
The file path to the rule package (*.rpk) file |
Configuration JSON |
Specify the CGA JSON configuration attribute name. If not specified, no user-defined CGA attributes will be applied to the model generation process and all defaults defined by the .rpk file will be used. On input, only the attribute’s “input” key is required. Example Input: Copy
|
Method |
The output method of Feature or File.
|
File Type |
Select a file type to output 3D geometry to. Supported types include:
|
File Base Name |
Specify a base file name for all generated files. |
Destination |
Specify a destination where the output 3D geometry and assets are output to. |
CGA Report |
The attribute name for the generated CGA report. Default is _cga_report |
CGA Print |
The attribute name for the generated CGA print. Default is _cga_print |
Editing Transformer Parameters
Using a set of menu options, transformer parameters can be assigned by referencing other elements in the workspace. More advanced functions, such as an advanced editor and an arithmetic editor, are also available in some transformers. To access a menu of these options, click beside the applicable parameter. For more information, see Transformer Parameter Menu Options.
Defining Values
There are several ways to define a value for use in a Transformer. The simplest is to simply type in a value or string, which can include functions of various types such as attribute references, math and string functions, and workspace parameters. There are a number of tools and shortcuts that can assist in constructing values, generally available from the drop-down context menu adjacent to the value field.
Using the Text Editor
The Text Editor provides a convenient way to construct text strings (including regular expressions) from various data sources, such as attributes, parameters, and constants, where the result is used directly inside a parameter.
Using the Arithmetic Editor
The Arithmetic Editor provides a convenient way to construct math expressions from various data sources, such as attributes, parameters, and feature functions, where the result is used directly inside a parameter.
Conditional Values
Set values depending on one or more test conditions that either pass or fail.
Parameter Condition Definition Dialog
Content
Expressions and strings can include a number of functions, characters, parameters, and more.
When setting values - whether entered directly in a parameter or constructed using one of the editors - strings and expressions containing String, Math, Date/Time or FME Feature Functions will have those functions evaluated. Therefore, the names of these functions (in the form @<function_name>) should not be used as literal string values.
These functions manipulate and format strings. | |
Special Characters |
A set of control characters is available in the Text Editor. |
Math functions are available in both editors. | |
Date/Time Functions | Date and time functions are available in the Text Editor. |
These operators are available in the Arithmetic Editor. | |
These return primarily feature-specific values. | |
FME and workspace-specific parameters may be used. | |
Creating and Modifying User Parameters | Create your own editable parameters. |
Dialog Options - Tables
Transformers with table-style parameters have additional tools for populating and manipulating values.
Row Reordering
|
Enabled once you have clicked on a row item. Choices include:
|
Cut, Copy, and Paste
|
Enabled once you have clicked on a row item. Choices include:
Cut, copy, and paste may be used within a transformer, or between transformers. |
Filter
|
Start typing a string, and the matrix will only display rows matching those characters. Searches all columns. This only affects the display of attributes within the transformer - it does not alter which attributes are output. |
Import
|
Import populates the table with a set of new attributes read from a dataset. Specific application varies between transformers. |
Reset/Refresh
|
Generally resets the table to its initial state, and may provide additional options to remove invalid entries. Behavior varies between transformers. |
Note: Not all tools are available in all transformers.
Reference
Processing Behavior |
|
Feature Holding |
No |
Dependencies | Esri ArcGIS CityEngine Commercial license for commercial use |
Operating System Restrictions |
Windows 64-bit only |
Aliases | |
History |
FME Community
The FME Community is the place for demos, how-tos, articles, FAQs, and more. Get answers to your questions, learn from other users, and suggest, vote, and comment on new features.
Search for all results about the CityEngineModelGenerator on the FME Community.
Examples may contain information licensed under the Open Government Licence – Vancouver and/or the Open Government Licence – Canada.