Table of contents
Mesh Export
This API is a Technical Preview and is available for testing purposes only. Do not use in production.

Export

Download API definition:

POST https://api.bentley.com/mesh-export/

Start a mesh export from the iModel. Exports are persisted until deleted.

When a mesh export succeeds, the _links.mesh returns a URL to download the resulting mesh from the blob container. You can list the contents of the container by appending the query parameters restype=container&comp=list to the URL. Note: Anyone with this URL has access to download the resultant mesh, share with care. The link is valid for one hour.

GLTF Meshes

Exporting GLTF meshes produces two files: Export.gltf and Export.bin. To download these files you must split the URL provided in _links.mesh.href and append the file name to the URL before the query parameters. For example: SASUrl/Export.gltf?SASKey and SASURL/Export.bin?SASKey. Use these URLs to download the relevant files. Note: The files will always be named Export.gltf and Export.bin.

3DFT Meshes

When exporting 3DFT meshes, feed the URL to the Unreal Engine Plugin to stream the mesh in Unreal.

Authentication

Requires Authorization header with valid Bearer token for scope mesh-export:modify.

For more documentation on authorization and how to get access token visit OAUTH2 Authorization page.

Request headers

Name
Required?
Description
Authorization
Yes

OAuth access token with scope mesh-export:modify

Accept
No

Setting to application/vnd.bentley.itwin-platform.v1+json is recommended.

Request body

StartExport

Name
Type
Required?
Description
iModelId
String
Yes

ID of the iModel to extract from.

changesetId
String
Yes

ID of the changeset to extract from. If omitted, export latest.

exportType
String
Yes

Type of mesh to create. Currently, only GLTF and 3DFT are supported.

geometryOptions
No

ExportGraphicsOptions. If omitted, use defaults from ExportGraphicsOptions.

viewDefinitionFilter
No

View filtering options to limit the scope of the export.

Example

json
{
    "iModelId": "b80f4fc2-4dbb-42c5-bb1f-f5aace3977dc",
    "changesetId": "e3a5dece-c1eb-477c-a782-32a4c43ba2ad",
    "exportType": "GLTF",
    "geometryOptions": {
        "includeLines": true,
        "chordTol": 0.01,
        "angleTol": 0.4,
        "decimationTol": 0.005,
        "maxEdgeLength": 0.1,
        "minBRepFeatureSize": 0.05,
        "minLineStyleComponentSize": 0.1
    },
    "viewDefinitionFilter": {
        "models": [
            "0x20000000031",
            "0x3000000000d",
            "0x4000000000e",
            "0x5000000000e"
        ],
        "categories": [
            "0x20000000009",
            "0x30000000008",
            "0x40000000009",
            "0x50000000009"
        ],
        "neverDrawn": [
            "0x50000000549"
        ]
    }
}

Response 202 Accepted

The export was accepted and will be processed

json
{
    "export": {
        "id": "fc3aa1e5-5196-4dd9-a73e-4cfda693e576",
        "displayName": "iModel Name",
        "status": "NotStarted",
        "request": {
            "iModelId": "b80f4fc2-4dbb-42c5-bb1f-f5aace3977dc",
            "changesetId": "e3a5dece-c1eb-477c-a782-32a4c43ba2ad",
            "exportType": "GLTF",
            "geometryOptions": {
                "includeLines": true,
                "chordTol": 0.01,
                "angleTol": 0.4,
                "decimationTol": 0.005,
                "maxEdgeLength": 0.1,
                "minBRepFeatureSize": 0.05,
                "minLineStyleComponentSize": 0.1
            },
            "viewDefinitionFilter": {
                "models": [
                    "0x20000000031",
                    "0x3000000000d",
                    "0x4000000000e",
                    "0x5000000000e"
                ],
                "categories": [
                    "0x20000000009",
                    "0x30000000008",
                    "0x40000000009",
                    "0x50000000009"
                ],
                "neverDrawn": [
                    "0x50000000549"
                ]
            }
        }
    }
}

Response 401 Unauthorized

This response indicates that request lacks valid authentication credentials. Access token might not been provided, issued by the wrong issuer, does not have required scopes or request headers were malformed.

json
{
    "error": {
        "code": "HeaderNotFound",
        "message": "Header Authorization was not found in the request. Access denied."
    }
}

Response 403 Forbidden

The user has insufficient permissions for the requested operation.

json
{
    "error": {
        "code": "InsufficientPermissions",
        "message": "The user has insufficient permissions for the requested operation."
    }
}

Response 422 Unprocessable Entity

Cannot create export job.

json
{
    "error": {
        "code": "InvalidMeshExportRequest",
        "message": "Cannot create export job.",
        "details": [{
            "code": "InvalidRequestBody",
            "message": "iModelId cannot be empty.",
            "target": "iModelId"
        }]
    }
}

Response 429 Too many requests

This response indicates that the user has sent too many requests in a given amount of time.

json
{
    "error": {
        "code": "TooManyRequests",
        "message": "More requests were received than the subscription rate-limit allows."
    }
}

Response headers

Name
Description
retry-after

The number of requests exceeds the rate-limit for the client subscription.

Link

TableSchema
Name
Type
Description
href
String

Http reference

ViewDefinitionFilter

TableSchema
Name
Type
Description
models
String[]

Array of included model IDs.

categories
String[]

Array of included category IDs.

neverDrawn
String[]

Array of element IDs to filter out.

GeometryOptions

TableSchema
Name
Type
Description
includeLines
Boolean

Control whether linework is exported. If omitted, linework is included.

chordTol
Number

Max distance from a face to the original geometry.

angleTol
Number

Max angle difference in radians for approximated face.

decimationTol
Number

Max distance between mesh vertices for them to be collapsed.

maxEdgeLength
Number

Max length of any edge in generated faces.

minBRepFeatureSize
Number

BRep features with bounding boxes smaller than this size will not generate graphics.

minLineStyleComponentSize
Number

The longest dimension of a line style's largest component must be at least this size.

ExportResponse

TableSchema
Name
Type
Description
export

Requested export

ExportStatus

Status of the export.

TableSchema
Name
Type
Description
No data.

Export

TableSchema
Name
Type
Description
id
String

ID of the export request.

displayName
String

Name of the exported iModel.

status

Status of the export.

request

Copy of the initial export request.

_links.mesh

URL where the result of the export is stored.

StartExport

TableSchema
Name
Type
Description
iModelId
String

ID of the iModel to extract from.

changesetId
String

ID of the changeset to extract from. If omitted, export latest.

exportType
String

Type of mesh to create. Currently, only GLTF and 3DFT are supported.

geometryOptions

ExportGraphicsOptions. If omitted, use defaults from ExportGraphicsOptions.

viewDefinitionFilter

View filtering options to limit the scope of the export.

Error

Contains error information and an optional array of more specific errors.

TableSchema
Name
Type
Description
code
String

One of a server-defined set of error codes.

message
String

A human-readable representation of the error.

target
String

The target of the error.

details

Optional array of more specific errors.

Error Details

Contains error information.

TableSchema
Name
Type
Description
code
String

One of a server-defined set of error codes.

message
String

A human-readable representation of the error.

target
String

The target of the error.

Error Response

Gives details for an error that occurred while handling the request. Note that clients MUST NOT assume that every failed request will produce an object of this schema, or that all of the properties in the response will be non-null, as the error may have prevented this response from being constructed.

TableSchema
Name
Type
Description
error

Error information.