Import Assemblies


You can mimic the import functionality you see in Operator by making your own import process for IFC, RVT, BRZ, etc files.

We'll assume you know how to upload files through the API and that you have access to a TempFile.ID.

Analysis

This is an optional step to the process that gets you the bounding box size and an attribute schema definition.

In Operator, this step lets the user pick what attribute to use for creating new Entity Types.

Assembly Analysis

Request body
interface IPostBody {
    // Previously uploaded temp file ID.
    "TempFile.ID": string;
    // The file name is used to determine the file extension.
    // Internally we processes everything as a BRZ, which means IFC or other are first converted to BRZ.
    // This name is also used to create a file import record in the database.
    // Eg: 'my-file.ifc'.
    "TempFile.Name": string;
}
Response
interface IResponse {
    "PendingActionID": number;
}
Javascript example

When the Pending Action is marked as completed, here is the result to expect:

interface IResult {
    // Assembly bounding box.
    // You can use this to estimate the size of the assembly.
    // If it's all zeros, or missing, that indicates we couldn't determine the size.
    // That is usually a bad sign.
    "BoundingBox"?: any;
    // Root data schema item. Includes a hierarchy of attribute definitions.
    "DataSchema"?: any;
    // The converted file ID if we went from a non-BRZ to a BRZ format.
    // Pass this into the import step to avoid re-conversion.
    "Converted.TempFile.ID"?: string;
}

Import

In this step we import the Entities and relationships from the assembly into Nextspace.

Assembly Import

Request body
interface IPostBody {
    // Previously uploaded temp file ID.
    "TempFile.ID": string;
    // The file name is used to determine the file extension.
    // Internally we processes everything as a BRZ, which means IFC or other are first converted to BRZ.
    // This name is also used to create a file import record in the database.
    // Eg: 'my-file.ifc'.
    "TempFile.Name": string;

    // Optional temp file ID from the analysis step.
    // If you have this, provide both the temp file ID and this converted temp file ID.
    "Converted.TempFile.ID"?: string;

    // Optional parent Entity Type ID.
    // New assembly Entity Types will be created underneath this parent.
    "Parent.EntityType.ID"?: string;
    // If 'Parent.EntityType.ID' is not provided then this name is used to create a new parent Entity Type.
    // If this is not set, the file's name is used to create a new parent Entity Type.
    "NewParentTypeName"?: string;

    // Attribute path to sort Entity Types by.
    // Attribute path segments are separated by a forward slash. Eg: 'address/city'.
    // Attribute values are used to get-or-create Entity Types.
    // Eg: if you sort by 'IFCType', you'll get-or-create Entity Types based on the IFC Type attribute.
    "SortAttrPath"?: string;

    // If you provided a parent Entity Type ID, then this indicates if newly found Entity Types should be created.
    // Default is true.
    "ExtendEntityTypes"?: boolean;
    // If you provided a parent Entity Type ID, then this indicates if the data schemas are allowed to be extended.
    // Default is true.
    "ExtendTypeSchemas"?: boolean;
    // Indicates if newly created Entity Types should look for global definitions to extend from.
    // Default is true, however our Operator has this on 'false' for the time being.
    "LoadTypeTemplates"?: boolean;
    // Indicates if newly created Entity Types should be 'strict'.
    // Default is true.
    // When an Entity Type is not strict then newly found attributes are NOT added to its schema.
    // This is useful for Entity Types where each Entity has a different set of attributes.
    "CreateStrictTypes"?: boolean;
}
Response
interface IResponse {
    "PendingActionID": number;
}
Javascript example

When the Pending Action is marked as completed, here is the result to expect:

interface IResult {
    // Array of assembly root Entity IDs.
    // Typically there is only one, and you take the first one.
    RootEntityIDs: string[];
}