Reference·Java SDK · nl.bimbase.bimworks.sdkJava

IfcApi

Java SDK: the IFC - Industry Foundation Classes operations, 21 methods, each with its parameters, result and a complete example.

Java SDK · nl.bimbase.bimworks.sdk.api · class · 21 methods

IFC related calls, for example queries and model checks

Construct it with the client of the connect step: new IfcApi(client). Each method is one operation of the API part, where it runs on its page.

MethodOperationDescription
checkCheckCheck one or more models
commitTransactionCommitTransactionCommit a BUL transaction against the head Version of a Node, producing a new Version
compareModelsCompareModelsCompare two models with a BCOL definition
compareObjectsCompareObjectsCompare two chosen objects
deleteComparePairOverrideDeleteComparePairOverrideTake a pair fixed by hand away again
exportCompareResultExportCompareResultDownload a stored compare result (deprecated, use GetCompareResult with a format)
getCompareBulGetCompareBulThe changes between two Versions as BUL
getCompareResultGetCompareResultRead a stored compare result
getMatchCandidatesGetMatchCandidatesThe added objects that could be a removed object
getObjectHistoryGetObjectHistoryThe change history of one object
getVersionChangesGetVersionChangesWhat changed in Versions since the Versions before them
listBuildingStoreysListBuildingStoreysThe building storeys of one or more models
listComparePairOverridesListComparePairOverridesThe pairs fixed by hand for two Versions
mapQidsMapQidsMap objects of one Version to their counterparts in another
parseQueryParseQueryParse a BQL query into its syntax tree
queryQueryQuery one or more IFC models
recordUploadAsTransactionRecordUploadAsTransactionReplace an upload by a transaction with the same changes
resolveBvlResolveBvlResolve a BVL script to what it shows, hides, selects and colours
setComparePairOverrideSetComparePairOverrideFix a pair by hand for two Versions
textSearchTextSearchFree-text search in models
upgradeSyntaxUpgradeSyntaxRewrite BQL, BVL and BCL written for 2.x in the 3.0 syntax

check#

Java#
public CheckResultsResponse check(CheckRequest checkRequest) throws ApiException

Check one or more models. Checks one or more models against an IDS definition (XML), a BCL definition (BIM.works Checking Language) or a stored check action. Pass exactly one of ids, bcl and action_uuid. A stored action is an IDS or a BCL (CHECK3) action; running it needs read rights on it, not actions:read.

OperationCheck · POST /openapi/ifc/Check
Scopechecks:run

Parameters#

NameTypeDescription
checkRequestCheckRequestrequiredThe request: its properties are those of the model, its JSON that of Check's request body.

Returns#

CheckResultsResponse — The check results in the requested format

Example#

Java#
import nl.bimbase.bimworks.sdk.api.AuthApi;
import nl.bimbase.bimworks.sdk.api.IfcApi;
import nl.bimbase.bimworks.sdk.client.ApiClient;
import nl.bimbase.bimworks.sdk.model.Auth;
import nl.bimbase.bimworks.sdk.model.CheckRequest;
import nl.bimbase.bimworks.sdk.model.LoginWithApiTokenRequest;

public class Example {
    public static void main(String[] args) throws Exception {
        // 1. Connect to BIM.works and log in with your API token
        ApiClient client = new ApiClient();
        client.updateBaseUri("https://bim.works/openapi");
        Auth auth = new AuthApi(client)
                .loginWithApiToken(new LoginWithApiTokenRequest().token("<your API token>"))
                .getAuth();
        client.setRequestInterceptor(builder -> builder.setHeader("Authorization", "Bearer " + auth.getBase64()));

        // 2. The request
        CheckRequest request = client.getObjectMapper().readValue("""
                {
                  "models": [
                    {
                      "type": "VersionModelIdentifier",
                      "uuid": "<version uuid of the first demo model>"
                    }
                  ],
                  "ids": "<ids xmlns=\\"http://standards.buildingsmart.org/IDS\\">…</ids>"
                }
                """, CheckRequest.class);

        // 3. The call
        var result = new IfcApi(client).check(request);

        // 4. The result
        System.out.println(client.getObjectMapper().writerWithDefaultPrettyPrinter().writeValueAsString(result));
    }
}

commitTransaction#

Java#
public CommitTransactionResult commitTransaction(CommitTransactionRequest commitTransactionRequest) throws ApiException

Commit a BUL transaction against the head Version of a Node, producing a new Version. Applies one or more BUL (BIM.works Update Language) statements to the given Version and creates a new Version on the same Node. The given Version must be the head (latest) Version of its Node: history is linear, and committing against an older Version fails with 409. The commit is atomic (either the complete new Version is created, or nothing is) and synchronous: the new Version is ready when the call returns.

OperationCommitTransaction · POST /openapi/ifc/CommitTransaction
Scopemodel:write

Parameters#

NameTypeDescription
commitTransactionRequestCommitTransactionRequestrequiredThe request: its properties are those of the model, its JSON that of CommitTransaction's request body.

Returns#

CommitTransactionResult — The transaction result. For a commit: transaction and node. For a dry run: updates, is_head and (only when the Version is not the head) head_version

Example#

Java#
import nl.bimbase.bimworks.sdk.api.AuthApi;
import nl.bimbase.bimworks.sdk.api.IfcApi;
import nl.bimbase.bimworks.sdk.client.ApiClient;
import nl.bimbase.bimworks.sdk.model.Auth;
import nl.bimbase.bimworks.sdk.model.CommitTransactionRequest;
import nl.bimbase.bimworks.sdk.model.LoginWithApiTokenRequest;

public class Example {
    public static void main(String[] args) throws Exception {
        // 1. Connect to BIM.works and log in with your API token
        ApiClient client = new ApiClient();
        client.updateBaseUri("https://bim.works/openapi");
        Auth auth = new AuthApi(client)
                .loginWithApiToken(new LoginWithApiTokenRequest().token("<your API token>"))
                .getAuth();
        client.setRequestInterceptor(builder -> builder.setHeader("Authorization", "Bearer " + auth.getBase64()));

        // 2. The request
        CommitTransactionRequest request = client.getObjectMapper().readValue("""
                {
                  "version_uuid": "<version uuid of the first demo model>",
                  "bul": [
                    "SET attribute.Name = \\"Standard door\\" WHERE type = IFCDOOR"
                  ],
                  "comment": "Normalize door names"
                }
                """, CommitTransactionRequest.class);

        // 3. The call
        var result = new IfcApi(client).commitTransaction(request);

        // 4. The result
        System.out.println(client.getObjectMapper().writerWithDefaultPrettyPrinter().writeValueAsString(result));
    }
}

compareModels#

Java#
public CompareResult compareModels(CompareModelsRequest compareModelsRequest) throws ApiException

Compare two models with a BCOL definition. Compares two models (usually two Versions of one Node, left the older one) and returns what was added, removed, changed and unchanged, by the categories of a BCOL (BIM.works Compare Language) definition: the built-in Default, another built-in definition, a stored compare action, or BCOL text.

OperationCompareModels · POST /openapi/ifc/CompareModels
Scopequery:run

Parameters#

NameTypeDescription
compareModelsRequestCompareModelsRequestrequiredThe request: its properties are those of the model, its JSON that of CompareModels's request body.

Returns#

CompareResult — The compare result, at the requested detail level

Example#

Java#
import nl.bimbase.bimworks.sdk.api.AuthApi;
import nl.bimbase.bimworks.sdk.api.IfcApi;
import nl.bimbase.bimworks.sdk.client.ApiClient;
import nl.bimbase.bimworks.sdk.model.Auth;
import nl.bimbase.bimworks.sdk.model.CompareModelsRequest;
import nl.bimbase.bimworks.sdk.model.LoginWithApiTokenRequest;

public class Example {
    public static void main(String[] args) throws Exception {
        // 1. Connect to BIM.works and log in with your API token
        ApiClient client = new ApiClient();
        client.updateBaseUri("https://bim.works/openapi");
        Auth auth = new AuthApi(client)
                .loginWithApiToken(new LoginWithApiTokenRequest().token("<your API token>"))
                .getAuth();
        client.setRequestInterceptor(builder -> builder.setHeader("Authorization", "Bearer " + auth.getBase64()));

        // 2. The request
        CompareModelsRequest request = client.getObjectMapper().readValue("""
                {
                  "left": {
                    "models": [
                      {
                        "type": "VersionModelIdentifier",
                        "uuid": "<version uuid of the first demo model>"
                      }
                    ]
                  },
                  "right": {
                    "models": [
                      {
                        "type": "VersionModelIdentifier",
                        "uuid": "<version uuid of the first demo model>"
                      }
                    ]
                  }
                }
                """, CompareModelsRequest.class);

        // 3. The call
        var result = new IfcApi(client).compareModels(request);

        // 4. The result
        System.out.println(client.getObjectMapper().writerWithDefaultPrettyPrinter().writeValueAsString(result));
    }
}

compareObjects#

Java#
public CompareObjectsResult compareObjects(CompareObjectsRequest compareObjectsRequest) throws ApiException

Compare two chosen objects. Compares two objects as one pair, whatever matching would say: of one model or of two. By default with the built-in everything definition. The answer says what differs (changed_features and changes, in the shape of a compare record) and what the definition watches.

OperationCompareObjects · POST /openapi/ifc/CompareObjects
Scopequery:run

Parameters#

NameTypeDescription
compareObjectsRequestCompareObjectsRequestrequiredThe request: its properties are those of the model, its JSON that of CompareObjects's request body.

Returns#

CompareObjectsResult — What differs between the two objects

Example#

Java#
import nl.bimbase.bimworks.sdk.api.AuthApi;
import nl.bimbase.bimworks.sdk.api.IfcApi;
import nl.bimbase.bimworks.sdk.client.ApiClient;
import nl.bimbase.bimworks.sdk.model.Auth;
import nl.bimbase.bimworks.sdk.model.CompareObjectsRequest;
import nl.bimbase.bimworks.sdk.model.LoginWithApiTokenRequest;

public class Example {
    public static void main(String[] args) throws Exception {
        // 1. Connect to BIM.works and log in with your API token
        ApiClient client = new ApiClient();
        client.updateBaseUri("https://bim.works/openapi");
        Auth auth = new AuthApi(client)
                .loginWithApiToken(new LoginWithApiTokenRequest().token("<your API token>"))
                .getAuth();
        client.setRequestInterceptor(builder -> builder.setHeader("Authorization", "Bearer " + auth.getBase64()));

        // 2. The request
        CompareObjectsRequest request = client.getObjectMapper().readValue("""
                {
                  "left": "",
                  "right": "",
                  "bcol": "",
                  "definition": "everything"
                }
                """, CompareObjectsRequest.class);

        // 3. The call
        var result = new IfcApi(client).compareObjects(request);

        // 4. The result
        System.out.println(client.getObjectMapper().writerWithDefaultPrettyPrinter().writeValueAsString(result));
    }
}

deleteComparePairOverride#

Java#
public ComparePairOverrides deleteComparePairOverride(DeleteComparePairOverrideRequest deleteComparePairOverrideRequest) throws ApiException

Take a pair fixed by hand away again. Needs read rights on both Versions and write rights on the right one.

OperationDeleteComparePairOverride · POST /openapi/ifc/DeleteComparePairOverride
Scopemodel:write

Parameters#

NameTypeDescription
deleteComparePairOverrideRequestDeleteComparePairOverrideRequestrequiredThe request: its properties are those of the model, its JSON that of DeleteComparePairOverride's request body.

Returns#

ComparePairOverrides — What the two Versions still have

Example#

Java#
import nl.bimbase.bimworks.sdk.api.AuthApi;
import nl.bimbase.bimworks.sdk.api.IfcApi;
import nl.bimbase.bimworks.sdk.client.ApiClient;
import nl.bimbase.bimworks.sdk.model.Auth;
import nl.bimbase.bimworks.sdk.model.DeleteComparePairOverrideRequest;
import nl.bimbase.bimworks.sdk.model.LoginWithApiTokenRequest;

public class Example {
    public static void main(String[] args) throws Exception {
        // 1. Connect to BIM.works and log in with your API token
        ApiClient client = new ApiClient();
        client.updateBaseUri("https://bim.works/openapi");
        Auth auth = new AuthApi(client)
                .loginWithApiToken(new LoginWithApiTokenRequest().token("<your API token>"))
                .getAuth();
        client.setRequestInterceptor(builder -> builder.setHeader("Authorization", "Bearer " + auth.getBase64()));

        // 2. The request
        DeleteComparePairOverrideRequest request = client.getObjectMapper().readValue("""
                {
                  "uuid": "<version uuid of the first demo model>"
                }
                """, DeleteComparePairOverrideRequest.class);

        // 3. The call
        var result = new IfcApi(client).deleteComparePairOverride(request);

        // 4. The result
        System.out.println(client.getObjectMapper().writerWithDefaultPrettyPrinter().writeValueAsString(result));
    }
}

exportCompareResult#

Java#
public File exportCompareResult(ExportCompareResultRequest exportCompareResultRequest) throws ApiException

Download a stored compare result (deprecated, use GetCompareResult with a format). Deprecated: GetCompareResult with format (document for this operation's json) answers the same files, and a 202 with the status while the result is computed. This operation will be removed in a later release.

OperationExportCompareResult · POST /openapi/ifc/ExportCompareResult
Scopequery:run

Parameters#

NameTypeDescription
exportCompareResultRequestExportCompareResultRequestrequiredThe request: its properties are those of the model, its JSON that of ExportCompareResult's request body.

Returns#

File — The file

Example#

Java#
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.StandardCopyOption;
import nl.bimbase.bimworks.sdk.api.AuthApi;
import nl.bimbase.bimworks.sdk.api.IfcApi;
import nl.bimbase.bimworks.sdk.client.ApiClient;
import nl.bimbase.bimworks.sdk.model.Auth;
import nl.bimbase.bimworks.sdk.model.ExportCompareResultRequest;
import nl.bimbase.bimworks.sdk.model.LoginWithApiTokenRequest;

public class Example {
    public static void main(String[] args) throws Exception {
        // 1. Connect to BIM.works and log in with your API token
        ApiClient client = new ApiClient();
        client.updateBaseUri("https://bim.works/openapi");
        Auth auth = new AuthApi(client)
                .loginWithApiToken(new LoginWithApiTokenRequest().token("<your API token>"))
                .getAuth();
        client.setRequestInterceptor(builder -> builder.setHeader("Authorization", "Bearer " + auth.getBase64()));

        // 2. The request
        ExportCompareResultRequest request = client.getObjectMapper().readValue("""
                {
                  "result_uuid": "00000000-0000-0000-0000-000000000000",
                  "format": "xlsx",
                  "categories": [
                    ""
                  ]
                }
                """, ExportCompareResultRequest.class);

        // 3. The call
        var result = new IfcApi(client).exportCompareResult(request);

        // 4. The result
        Files.move(result.toPath(), Path.of("export-compare-result.bin"), StandardCopyOption.REPLACE_EXISTING);
    }
}

getCompareBul#

Java#
public CompareBul getCompareBul(GetCompareBulRequest getCompareBulRequest) throws ApiException

The changes between two Versions as BUL. The changes of a compare of two Versions written as BUL statements on the left Version, verified by a dry run of that Version, and the changes BUL cannot write, each with the reason. Values carry their IFC type (IFCPOSITIVELENGTHMEASURE(1200 mm)), moves and rotations become TRANSFORM statements, removed objects DELETE OBJECT; added objects, materials, relations and changed shapes are never BUL. The compare compares every value exactly and is stored like any other; the BUL is made once per compare result and kept with it. record says whether the right Version, an upload, can be replaced by a transaction with these changes (RecordUploadAsTransaction).

OperationGetCompareBul · POST /openapi/ifc/GetCompareBul
Scopequery:run

Parameters#

NameTypeDescription
getCompareBulRequestGetCompareBulRequestrequiredThe request: its properties are those of the model, its JSON that of GetCompareBul's request body.

Returns#

CompareBul — The statements, the residual, the coverage and whether the upload can be recorded

Example#

Java#
import nl.bimbase.bimworks.sdk.api.AuthApi;
import nl.bimbase.bimworks.sdk.api.IfcApi;
import nl.bimbase.bimworks.sdk.client.ApiClient;
import nl.bimbase.bimworks.sdk.model.Auth;
import nl.bimbase.bimworks.sdk.model.GetCompareBulRequest;
import nl.bimbase.bimworks.sdk.model.LoginWithApiTokenRequest;

public class Example {
    public static void main(String[] args) throws Exception {
        // 1. Connect to BIM.works and log in with your API token
        ApiClient client = new ApiClient();
        client.updateBaseUri("https://bim.works/openapi");
        Auth auth = new AuthApi(client)
                .loginWithApiToken(new LoginWithApiTokenRequest().token("<your API token>"))
                .getAuth();
        client.setRequestInterceptor(builder -> builder.setHeader("Authorization", "Bearer " + auth.getBase64()));

        // 2. The request
        GetCompareBulRequest request = client.getObjectMapper().readValue("""
                {
                  "left_version_uuid": "00000000-0000-0000-0000-000000000000",
                  "right_version_uuid": "00000000-0000-0000-0000-000000000000"
                }
                """, GetCompareBulRequest.class);

        // 3. The call
        var result = new IfcApi(client).getCompareBul(request);

        // 4. The result
        System.out.println(client.getObjectMapper().writerWithDefaultPrettyPrinter().writeValueAsString(result));
    }
}

getCompareResult#

Java#
public CompareResult getCompareResult(GetCompareResultRequest getCompareResultRequest) throws ApiException

Read a stored compare result. Reads a result of CompareModels by its result_uuid, at a detail level and a page of its records, or its status while it is computed. Requires read access to both sides, and the same feature visibility as the caller that computed it (otherwise compare the models again).

OperationGetCompareResult · POST /openapi/ifc/GetCompareResult
Scopequery:run

Parameters#

NameTypeDescription
getCompareResultRequestGetCompareResultRequestrequiredThe request: its properties are those of the model, its JSON that of GetCompareResult's request body.

Returns#

CompareResult — The result in the requested format, or for format json its status while it is computed

Example#

Java#
import nl.bimbase.bimworks.sdk.api.AuthApi;
import nl.bimbase.bimworks.sdk.api.IfcApi;
import nl.bimbase.bimworks.sdk.client.ApiClient;
import nl.bimbase.bimworks.sdk.model.Auth;
import nl.bimbase.bimworks.sdk.model.GetCompareResultRequest;
import nl.bimbase.bimworks.sdk.model.LoginWithApiTokenRequest;

public class Example {
    public static void main(String[] args) throws Exception {
        // 1. Connect to BIM.works and log in with your API token
        ApiClient client = new ApiClient();
        client.updateBaseUri("https://bim.works/openapi");
        Auth auth = new AuthApi(client)
                .loginWithApiToken(new LoginWithApiTokenRequest().token("<your API token>"))
                .getAuth();
        client.setRequestInterceptor(builder -> builder.setHeader("Authorization", "Bearer " + auth.getBase64()));

        // 2. The request
        GetCompareResultRequest request = client.getObjectMapper().readValue("""
                {
                  "result_uuid": "4d1f2a3b-5c6d-4e7f-8a9b-0c1d2e3f4a5b",
                  "details": "changes",
                  "limit": 100
                }
                """, GetCompareResultRequest.class);

        // 3. The call
        var result = new IfcApi(client).getCompareResult(request);

        // 4. The result
        System.out.println(client.getObjectMapper().writerWithDefaultPrettyPrinter().writeValueAsString(result));
    }
}

getMatchCandidates#

Java#
public MatchCandidates getMatchCandidates(GetMatchCandidatesRequest getMatchCandidatesRequest) throws ApiException

The added objects that could be a removed object. For the review of a stored compare's unmatched objects. Per removed object the added objects that could be it, best first by the geometric matcher's cost (the distance between the box centres, the size, the type, the name). Objects a user confirmed are listed apart.

OperationGetMatchCandidates · POST /openapi/ifc/GetMatchCandidates
Scopequery:run

Parameters#

NameTypeDescription
getMatchCandidatesRequestGetMatchCandidatesRequestrequiredThe request: its properties are those of the model, its JSON that of GetMatchCandidates's request body.

Returns#

MatchCandidates — The removed objects with their candidates, the added objects, and what was confirmed

Example#

Java#
import nl.bimbase.bimworks.sdk.api.AuthApi;
import nl.bimbase.bimworks.sdk.api.IfcApi;
import nl.bimbase.bimworks.sdk.client.ApiClient;
import nl.bimbase.bimworks.sdk.model.Auth;
import nl.bimbase.bimworks.sdk.model.GetMatchCandidatesRequest;
import nl.bimbase.bimworks.sdk.model.LoginWithApiTokenRequest;

public class Example {
    public static void main(String[] args) throws Exception {
        // 1. Connect to BIM.works and log in with your API token
        ApiClient client = new ApiClient();
        client.updateBaseUri("https://bim.works/openapi");
        Auth auth = new AuthApi(client)
                .loginWithApiToken(new LoginWithApiTokenRequest().token("<your API token>"))
                .getAuth();
        client.setRequestInterceptor(builder -> builder.setHeader("Authorization", "Bearer " + auth.getBase64()));

        // 2. The request
        GetMatchCandidatesRequest request = client.getObjectMapper().readValue("""
                {
                  "result_uuid": "00000000-0000-0000-0000-000000000000",
                  "left_oids": [
                    0
                  ],
                  "left_qids": [
                    ""
                  ],
                  "limit": 5,
                  "radius_mm": 10000
                }
                """, GetMatchCandidatesRequest.class);

        // 3. The call
        var result = new IfcApi(client).getMatchCandidates(request);

        // 4. The result
        System.out.println(client.getObjectMapper().writerWithDefaultPrettyPrinter().writeValueAsString(result));
    }
}

getObjectHistory#

Java#
public Map<String, Object> getObjectHistory(GetObjectHistoryRequest getObjectHistoryRequest) throws ApiException

The change history of one object. Every transaction that changed the object (by its oid) in the Node's line of Versions, newest first (as ListTransactions), with what it changed, and the Version the object first appeared in. feature limits it to one feature (property.Pset_WallCommon.IsExternal); features_only answers only the features that ever changed.

OperationGetObjectHistory · POST /openapi/ifc/GetObjectHistory
Scopemodel:read

Parameters#

NameTypeDescription
getObjectHistoryRequestGetObjectHistoryRequestrequiredThe request: its properties are those of the model, its JSON that of GetObjectHistory's request body.

Returns#

Map<String, Object> — The history

Example#

Java#
import nl.bimbase.bimworks.sdk.api.AuthApi;
import nl.bimbase.bimworks.sdk.api.IfcApi;
import nl.bimbase.bimworks.sdk.client.ApiClient;
import nl.bimbase.bimworks.sdk.model.Auth;
import nl.bimbase.bimworks.sdk.model.GetObjectHistoryRequest;
import nl.bimbase.bimworks.sdk.model.LoginWithApiTokenRequest;

public class Example {
    public static void main(String[] args) throws Exception {
        // 1. Connect to BIM.works and log in with your API token
        ApiClient client = new ApiClient();
        client.updateBaseUri("https://bim.works/openapi");
        Auth auth = new AuthApi(client)
                .loginWithApiToken(new LoginWithApiTokenRequest().token("<your API token>"))
                .getAuth();
        client.setRequestInterceptor(builder -> builder.setHeader("Authorization", "Bearer " + auth.getBase64()));

        // 2. The request
        GetObjectHistoryRequest request = client.getObjectMapper().readValue("""
                {
                  "model": {
                    "type": "UrlModelIdentifier"
                  },
                  "oid": 0,
                  "feature": "",
                  "features_only": false
                }
                """, GetObjectHistoryRequest.class);

        // 3. The call
        var result = new IfcApi(client).getObjectHistory(request);

        // 4. The result
        System.out.println(client.getObjectMapper().writerWithDefaultPrettyPrinter().writeValueAsString(result));
    }
}

getVersionChanges#

Java#
public VersionChangesResult getVersionChanges(GetVersionChangesRequest getVersionChangesRequest) throws ApiException

What changed in Versions since the Versions before them. The counts of the built-in Default compare of each Version with the Version before it on its Node (the highest version number below it among the Node's live, processed IFC Versions): added, removed, changed, unchanged and ignored objects. New uploads are compared automatically when the server has compare.auto_on_upload on. A Version nothing compared yet is compared now, in the background (pending), unless only_stored asks for stored results only. Read the full result with GetCompareResult or map objects with MapQids.

OperationGetVersionChanges · POST /openapi/ifc/GetVersionChanges
Scopequery:run

Parameters#

NameTypeDescription
getVersionChangesRequestGetVersionChangesRequestrequiredThe request: its properties are those of the model, its JSON that of GetVersionChanges's request body.

Returns#

VersionChangesResult — Per Version its changes; for a single version_uuid the fields of that Version are also at the top level

Example#

Java#
import nl.bimbase.bimworks.sdk.api.AuthApi;
import nl.bimbase.bimworks.sdk.api.IfcApi;
import nl.bimbase.bimworks.sdk.client.ApiClient;
import nl.bimbase.bimworks.sdk.model.Auth;
import nl.bimbase.bimworks.sdk.model.GetVersionChangesRequest;
import nl.bimbase.bimworks.sdk.model.LoginWithApiTokenRequest;

public class Example {
    public static void main(String[] args) throws Exception {
        // 1. Connect to BIM.works and log in with your API token
        ApiClient client = new ApiClient();
        client.updateBaseUri("https://bim.works/openapi");
        Auth auth = new AuthApi(client)
                .loginWithApiToken(new LoginWithApiTokenRequest().token("<your API token>"))
                .getAuth();
        client.setRequestInterceptor(builder -> builder.setHeader("Authorization", "Bearer " + auth.getBase64()));

        // 2. The request
        GetVersionChangesRequest request = client.getObjectMapper().readValue("""
                {
                  "version_uuid": "<version uuid of the first demo model>",
                  "version_uuids": [
                    "<version uuid of the first demo model>"
                  ],
                  "only_stored": false
                }
                """, GetVersionChangesRequest.class);

        // 3. The call
        var result = new IfcApi(client).getVersionChanges(request);

        // 4. The result
        System.out.println(client.getObjectMapper().writerWithDefaultPrettyPrinter().writeValueAsString(result));
    }
}

listBuildingStoreys#

Java#
public BuildingStoreys listBuildingStoreys(ListBuildingStoreysRequest listBuildingStoreysRequest) throws ApiException

The building storeys of one or more models. The storeys of the models merged by name, highest first, each with the objects on it; the objects without a storey come last, under "[No BS]". What a storey picker or a walk mode needs in one call.

OperationListBuildingStoreys · POST /openapi/ifc/ListBuildingStoreys
Scopequery:run

Parameters#

NameTypeDescription
listBuildingStoreysRequestListBuildingStoreysRequestrequiredThe request: its properties are those of the model, its JSON that of ListBuildingStoreys's request body.

Returns#

BuildingStoreys — The storeys

Example#

Java#
import nl.bimbase.bimworks.sdk.api.AuthApi;
import nl.bimbase.bimworks.sdk.api.IfcApi;
import nl.bimbase.bimworks.sdk.client.ApiClient;
import nl.bimbase.bimworks.sdk.model.Auth;
import nl.bimbase.bimworks.sdk.model.ListBuildingStoreysRequest;
import nl.bimbase.bimworks.sdk.model.LoginWithApiTokenRequest;

public class Example {
    public static void main(String[] args) throws Exception {
        // 1. Connect to BIM.works and log in with your API token
        ApiClient client = new ApiClient();
        client.updateBaseUri("https://bim.works/openapi");
        Auth auth = new AuthApi(client)
                .loginWithApiToken(new LoginWithApiTokenRequest().token("<your API token>"))
                .getAuth();
        client.setRequestInterceptor(builder -> builder.setHeader("Authorization", "Bearer " + auth.getBase64()));

        // 2. The request
        ListBuildingStoreysRequest request = client.getObjectMapper().readValue("""
                {
                  "models": [
                    {
                      "type": "UrlModelIdentifier"
                    }
                  ]
                }
                """, ListBuildingStoreysRequest.class);

        // 3. The call
        var result = new IfcApi(client).listBuildingStoreys(request);

        // 4. The result
        System.out.println(client.getObjectMapper().writerWithDefaultPrettyPrinter().writeValueAsString(result));
    }
}

listComparePairOverrides#

Java#
public ComparePairOverrides listComparePairOverrides(ListComparePairOverridesRequest listComparePairOverridesRequest) throws ApiException

The pairs fixed by hand for two Versions. The objects a user linked as one object, and the objects a user confirmed as really removed or added. Every compare of the two Versions uses them. Needs read rights on both Versions.

OperationListComparePairOverrides · POST /openapi/ifc/ListComparePairOverrides
Scopequery:run

Parameters#

NameTypeDescription
listComparePairOverridesRequestListComparePairOverridesRequestrequiredThe request: its properties are those of the model, its JSON that of ListComparePairOverrides's request body.

Returns#

ComparePairOverrides — The overrides, oldest first

Example#

Java#
import nl.bimbase.bimworks.sdk.api.AuthApi;
import nl.bimbase.bimworks.sdk.api.IfcApi;
import nl.bimbase.bimworks.sdk.client.ApiClient;
import nl.bimbase.bimworks.sdk.model.Auth;
import nl.bimbase.bimworks.sdk.model.ListComparePairOverridesRequest;
import nl.bimbase.bimworks.sdk.model.LoginWithApiTokenRequest;

public class Example {
    public static void main(String[] args) throws Exception {
        // 1. Connect to BIM.works and log in with your API token
        ApiClient client = new ApiClient();
        client.updateBaseUri("https://bim.works/openapi");
        Auth auth = new AuthApi(client)
                .loginWithApiToken(new LoginWithApiTokenRequest().token("<your API token>"))
                .getAuth();
        client.setRequestInterceptor(builder -> builder.setHeader("Authorization", "Bearer " + auth.getBase64()));

        // 2. The request
        ListComparePairOverridesRequest request = client.getObjectMapper().readValue("""
                {
                  "left_version_uuid": "00000000-0000-0000-0000-000000000000",
                  "right_version_uuid": "00000000-0000-0000-0000-000000000000"
                }
                """, ListComparePairOverridesRequest.class);

        // 3. The call
        var result = new IfcApi(client).listComparePairOverrides(request);

        // 4. The result
        System.out.println(client.getObjectMapper().writerWithDefaultPrettyPrinter().writeValueAsString(result));
    }
}

mapQids#

Java#
public MapQidsResult mapQids(MapQidsRequest mapQidsRequest) throws ApiException

Map objects of one Version to their counterparts in another. The correspondence of a compare, for re-pointing stored object references after a new Version: every asked object of from_version with its counterpart in to_version, and the asked objects without one (added, removed, or outside the compare). Without via the built-in Default compare of the two Versions is used: a stored one in either direction (the automatic compare of an upload is one), else a new one.

OperationMapQids · POST /openapi/ifc/MapQids
Scopequery:run

Parameters#

NameTypeDescription
mapQidsRequestMapQidsRequestrequiredThe request: its properties are those of the model, its JSON that of MapQids's request body.

Returns#

MapQidsResult — The pairs, aligned, and the unmatched objects

Example#

Java#
import nl.bimbase.bimworks.sdk.api.AuthApi;
import nl.bimbase.bimworks.sdk.api.IfcApi;
import nl.bimbase.bimworks.sdk.client.ApiClient;
import nl.bimbase.bimworks.sdk.model.Auth;
import nl.bimbase.bimworks.sdk.model.LoginWithApiTokenRequest;
import nl.bimbase.bimworks.sdk.model.MapQidsRequest;

public class Example {
    public static void main(String[] args) throws Exception {
        // 1. Connect to BIM.works and log in with your API token
        ApiClient client = new ApiClient();
        client.updateBaseUri("https://bim.works/openapi");
        Auth auth = new AuthApi(client)
                .loginWithApiToken(new LoginWithApiTokenRequest().token("<your API token>"))
                .getAuth();
        client.setRequestInterceptor(builder -> builder.setHeader("Authorization", "Bearer " + auth.getBase64()));

        // 2. The request
        MapQidsRequest request = client.getObjectMapper().readValue("""
                {
                  "from_version": "00000000-0000-0000-0000-000000000000",
                  "to_version": "00000000-0000-0000-0000-000000000000",
                  "qids": [
                    ""
                  ],
                  "oids": [
                    0
                  ],
                  "all": false,
                  "via": "00000000-0000-0000-0000-000000000000"
                }
                """, MapQidsRequest.class);

        // 3. The call
        var result = new IfcApi(client).mapQids(request);

        // 4. The result
        System.out.println(client.getObjectMapper().writerWithDefaultPrettyPrinter().writeValueAsString(result));
    }
}

parseQuery#

Java#
public Map<String, Object> parseQuery(ParseQueryRequest parseQueryRequest) throws ApiException

Parse a BQL query into its syntax tree. The BQL query as its JSON syntax tree (the BQL JSON serialization, each node with a __type), with the parameters bound when given. A query that does not parse answers SYNTAX_ERROR with the line and column. No model is read.

OperationParseQuery · POST /openapi/ifc/ParseQuery
Scopeany login

Parameters#

NameTypeDescription
parseQueryRequestParseQueryRequestrequiredThe request: its properties are those of the model, its JSON that of ParseQuery's request body.

Returns#

Map<String, Object> — The syntax tree

Example#

Java#
import nl.bimbase.bimworks.sdk.api.AuthApi;
import nl.bimbase.bimworks.sdk.api.IfcApi;
import nl.bimbase.bimworks.sdk.client.ApiClient;
import nl.bimbase.bimworks.sdk.model.Auth;
import nl.bimbase.bimworks.sdk.model.LoginWithApiTokenRequest;
import nl.bimbase.bimworks.sdk.model.ParseQueryRequest;

public class Example {
    public static void main(String[] args) throws Exception {
        // 1. Connect to BIM.works and log in with your API token
        ApiClient client = new ApiClient();
        client.updateBaseUri("https://bim.works/openapi");
        Auth auth = new AuthApi(client)
                .loginWithApiToken(new LoginWithApiTokenRequest().token("<your API token>"))
                .getAuth();
        client.setRequestInterceptor(builder -> builder.setHeader("Authorization", "Bearer " + auth.getBase64()));

        // 2. The request
        ParseQueryRequest request = client.getObjectMapper().readValue("""
                {
                  "query": "",
                  "parameters": {}
                }
                """, ParseQueryRequest.class);

        // 3. The call
        var result = new IfcApi(client).parseQuery(request);

        // 4. The result
        System.out.println(client.getObjectMapper().writerWithDefaultPrettyPrinter().writeValueAsString(result));
    }
}

query#

Java#
public Object query(QueryRequest queryRequest) throws ApiException

Query one or more IFC models. Queries one or more models with BQL (BIM.works Query Language): the query text, or a stored query action by action_uuid. Running a stored query needs read rights on it, not actions:read.

OperationQuery · POST /openapi/ifc/Query
Scopequery:run

Parameters#

NameTypeDescription
queryRequestQueryRequestrequiredThe request: its properties are those of the model, its JSON that of Query's request body.

Returns#

Object — Query results in the requested format

Example#

Java#
import nl.bimbase.bimworks.sdk.api.AuthApi;
import nl.bimbase.bimworks.sdk.api.IfcApi;
import nl.bimbase.bimworks.sdk.client.ApiClient;
import nl.bimbase.bimworks.sdk.model.Auth;
import nl.bimbase.bimworks.sdk.model.LoginWithApiTokenRequest;
import nl.bimbase.bimworks.sdk.model.QueryRequest;

public class Example {
    public static void main(String[] args) throws Exception {
        // 1. Connect to BIM.works and log in with your API token
        ApiClient client = new ApiClient();
        client.updateBaseUri("https://bim.works/openapi");
        Auth auth = new AuthApi(client)
                .loginWithApiToken(new LoginWithApiTokenRequest().token("<your API token>"))
                .getAuth();
        client.setRequestInterceptor(builder -> builder.setHeader("Authorization", "Bearer " + auth.getBase64()));

        // 2. The request
        QueryRequest request = client.getObjectMapper().readValue("""
                {
                  "models": [
                    {
                      "type": "VersionModelIdentifier",
                      "name": "My model name",
                      "uuid": "<version uuid of the first demo model>"
                    }
                  ],
                  "query": "GET attribute.GlobalId, attribute.Name WHERE type = IFCWALL AND property.*.IsExternal = true"
                }
                """, QueryRequest.class);

        // 3. The call
        var result = new IfcApi(client).query(request);

        // 4. The result
        System.out.println(client.getObjectMapper().writerWithDefaultPrettyPrinter().writeValueAsString(result));
    }
}

recordUploadAsTransaction#

Java#
public RecordUploadAsTransactionResult recordUploadAsTransaction(RecordUploadAsTransactionRequest recordUploadAsTransactionRequest) throws ApiException

Replace an upload by a transaction with the same changes. Records an uploaded Version as a transaction on the Version before it: the BUL of GetCompareBul is committed on the previous Version, and the upload is deleted the way deleting the last Version does (a soft delete: its data stays). The new Version takes the upload's place and number, keeps the previous Version's object ids, and so keeps the history of every object and what refers to it. Only for the last Version of its Node, made by an upload, with a previous Version, when every change of the two is in the BUL (record.possible of GetCompareBul). Needs write rights on the Node and the user feature BUL (Model editing); without the feature the call answers 403 USER_FEATURE_REQUIRED.

OperationRecordUploadAsTransaction · POST /openapi/ifc/RecordUploadAsTransaction
Scopemodel:write

Parameters#

NameTypeDescription
recordUploadAsTransactionRequestRecordUploadAsTransactionRequestrequiredThe request: its properties are those of the model, its JSON that of RecordUploadAsTransaction's request body.

Returns#

RecordUploadAsTransactionResult — The committed transaction, the Node with its new Version, and the replaced upload

Example#

Java#
import nl.bimbase.bimworks.sdk.api.AuthApi;
import nl.bimbase.bimworks.sdk.api.IfcApi;
import nl.bimbase.bimworks.sdk.client.ApiClient;
import nl.bimbase.bimworks.sdk.model.Auth;
import nl.bimbase.bimworks.sdk.model.LoginWithApiTokenRequest;
import nl.bimbase.bimworks.sdk.model.RecordUploadAsTransactionRequest;

public class Example {
    public static void main(String[] args) throws Exception {
        // 1. Connect to BIM.works and log in with your API token
        ApiClient client = new ApiClient();
        client.updateBaseUri("https://bim.works/openapi");
        Auth auth = new AuthApi(client)
                .loginWithApiToken(new LoginWithApiTokenRequest().token("<your API token>"))
                .getAuth();
        client.setRequestInterceptor(builder -> builder.setHeader("Authorization", "Bearer " + auth.getBase64()));

        // 2. The request
        RecordUploadAsTransactionRequest request = client.getObjectMapper().readValue("""
                {
                  "version_uuid": "<version uuid of the first demo model>",
                  "comment": ""
                }
                """, RecordUploadAsTransactionRequest.class);

        // 3. The call
        var result = new IfcApi(client).recordUploadAsTransaction(request);

        // 4. The result
        System.out.println(client.getObjectMapper().writerWithDefaultPrettyPrinter().writeValueAsString(result));
    }
}

resolveBvl#

Java#
public ResolvedActions resolveBvl(ResolveBvlRequest resolveBvlRequest) throws ApiException

Resolve a BVL script to what it shows, hides, selects and colours. Runs a BVL (BIM.works Visualisation Language) script against one or more models and returns its effect, ready for a viewer: the objects to show, hide, select and fit, the colour per object, the labels and the annotations. The server evaluates every condition of the script (each one is a BQL expression); the client only applies the answer, in the JavaScript SDK with new BvlHelper(objectStateManager, viewer).processResults([answer]) of @bimworks/viewercommon.

OperationResolveBvl · POST /openapi/ifc/ResolveBvl
Scopeactions:read

Parameters#

NameTypeDescription
resolveBvlRequestResolveBvlRequestrequiredThe request: its properties are those of the model, its JSON that of ResolveBvl's request body.

Returns#

ResolvedActions — The resolved actions

Example#

Java#
import nl.bimbase.bimworks.sdk.api.AuthApi;
import nl.bimbase.bimworks.sdk.api.IfcApi;
import nl.bimbase.bimworks.sdk.client.ApiClient;
import nl.bimbase.bimworks.sdk.model.Auth;
import nl.bimbase.bimworks.sdk.model.LoginWithApiTokenRequest;
import nl.bimbase.bimworks.sdk.model.ResolveBvlRequest;

public class Example {
    public static void main(String[] args) throws Exception {
        // 1. Connect to BIM.works and log in with your API token
        ApiClient client = new ApiClient();
        client.updateBaseUri("https://bim.works/openapi");
        Auth auth = new AuthApi(client)
                .loginWithApiToken(new LoginWithApiTokenRequest().token("<your API token>"))
                .getAuth();
        client.setRequestInterceptor(builder -> builder.setHeader("Authorization", "Bearer " + auth.getBase64()));

        // 2. The request
        ResolveBvlRequest request = client.getObjectMapper().readValue("""
                {
                  "models": [
                    {
                      "type": "VersionModelIdentifier",
                      "uuid": "<version uuid of the first demo model>"
                    }
                  ],
                  "bvl": "if (type = IFCWALL AND property.*.IsExternal = true) { COLOR \\"red\\" VIEWFIT; }"
                }
                """, ResolveBvlRequest.class);

        // 3. The call
        var result = new IfcApi(client).resolveBvl(request);

        // 4. The result
        System.out.println(client.getObjectMapper().writerWithDefaultPrettyPrinter().writeValueAsString(result));
    }
}

setComparePairOverride#

Java#
public ComparePairOverrideSet setComparePairOverride(SetComparePairOverrideRequest setComparePairOverrideRequest) throws ApiException

Fix a pair by hand for two Versions. Links two objects as one object (the manual matcher pairs them before every other matcher), or confirms that an object really was removed or added (no matcher pairs it). Every compare of the two Versions uses it from then on; a stored result made before is computed again. An earlier override of either object is replaced. Needs read rights on both Versions and write rights on the right one.

OperationSetComparePairOverride · POST /openapi/ifc/SetComparePairOverride
Scopemodel:write

Parameters#

NameTypeDescription
setComparePairOverrideRequestSetComparePairOverrideRequestrequiredThe request: its properties are those of the model, its JSON that of SetComparePairOverride's request body.

Returns#

ComparePairOverrideSet — The new override and every override of the two Versions

Example#

Java#
import nl.bimbase.bimworks.sdk.api.AuthApi;
import nl.bimbase.bimworks.sdk.api.IfcApi;
import nl.bimbase.bimworks.sdk.client.ApiClient;
import nl.bimbase.bimworks.sdk.model.Auth;
import nl.bimbase.bimworks.sdk.model.LoginWithApiTokenRequest;
import nl.bimbase.bimworks.sdk.model.SetComparePairOverrideRequest;

public class Example {
    public static void main(String[] args) throws Exception {
        // 1. Connect to BIM.works and log in with your API token
        ApiClient client = new ApiClient();
        client.updateBaseUri("https://bim.works/openapi");
        Auth auth = new AuthApi(client)
                .loginWithApiToken(new LoginWithApiTokenRequest().token("<your API token>"))
                .getAuth();
        client.setRequestInterceptor(builder -> builder.setHeader("Authorization", "Bearer " + auth.getBase64()));

        // 2. The request
        SetComparePairOverrideRequest request = client.getObjectMapper().readValue("""
                {
                  "left_version_uuid": "00000000-0000-0000-0000-000000000000",
                  "right_version_uuid": "00000000-0000-0000-0000-000000000000",
                  "kind": "pair",
                  "left_oid": 0,
                  "right_oid": 0,
                  "note": ""
                }
                """, SetComparePairOverrideRequest.class);

        // 3. The call
        var result = new IfcApi(client).setComparePairOverride(request);

        // 4. The result
        System.out.println(client.getObjectMapper().writerWithDefaultPrettyPrinter().writeValueAsString(result));
    }
}

textSearch#

Java#
public TextSearchResult textSearch(TextSearchRequest textSearchRequest) throws ApiException

Free-text search in models. Searches the text of the models (names and values of attributes, properties, quantities, classifications, materials, layers) for words, not with BQL. Each group says where the text matched, how many objects match there and which (at most max_qids_per_group). A query that is a GlobalId (22 characters, or a UUID) also finds that object exactly, as a value match on the attribute GlobalId. Needs text indexing on the instance (features.text_indexing). Not available in a workspace whose filter limits the objects.

OperationTextSearch · POST /openapi/ifc/TextSearch
Scopequery:run

Parameters#

NameTypeDescription
textSearchRequestTextSearchRequestrequiredThe request: its properties are those of the model, its JSON that of TextSearch's request body.

Returns#

TextSearchResult — The matches

Example#

Java#
import nl.bimbase.bimworks.sdk.api.AuthApi;
import nl.bimbase.bimworks.sdk.api.IfcApi;
import nl.bimbase.bimworks.sdk.client.ApiClient;
import nl.bimbase.bimworks.sdk.model.Auth;
import nl.bimbase.bimworks.sdk.model.LoginWithApiTokenRequest;
import nl.bimbase.bimworks.sdk.model.TextSearchRequest;

public class Example {
    public static void main(String[] args) throws Exception {
        // 1. Connect to BIM.works and log in with your API token
        ApiClient client = new ApiClient();
        client.updateBaseUri("https://bim.works/openapi");
        Auth auth = new AuthApi(client)
                .loginWithApiToken(new LoginWithApiTokenRequest().token("<your API token>"))
                .getAuth();
        client.setRequestInterceptor(builder -> builder.setHeader("Authorization", "Bearer " + auth.getBase64()));

        // 2. The request
        TextSearchRequest request = client.getObjectMapper().readValue("""
                {
                  "models": [
                    {
                      "type": "UrlModelIdentifier"
                    }
                  ],
                  "query": "",
                  "fuzzy": true,
                  "max_edits": 0,
                  "prefix": true,
                  "search_values": true,
                  "search_names": true,
                  "kind": "attribute",
                  "set": "",
                  "name": "",
                  "type": "",
                  "max_qids_per_group": 100
                }
                """, TextSearchRequest.class);

        // 3. The call
        var result = new IfcApi(client).textSearch(request);

        // 4. The result
        System.out.println(client.getObjectMapper().writerWithDefaultPrettyPrinter().writeValueAsString(result));
    }
}

upgradeSyntax#

Java#
public UpgradeSyntaxResponse upgradeSyntax(UpgradeSyntaxRequest upgradeSyntaxRequest) throws ApiException

Rewrite BQL, BVL and BCL written for 2.x in the 3.0 syntax. For BQL, BVL and BCL texts that a client keeps itself, written for BIM.works 2.x: each text that no longer parses in 3.0 because of a known syntax change comes back in the 3.0 syntax, with the changes made. The known changes are the unit clause (IN mm is UNIT mm), CS LENGTH (is LENGTH) and names that 3.0 reserves as keywords (quoted: property.Dimensions."length", AS "status"). A text that parses already comes back as it is (UNCHANGED); a text with any other error comes back as it is too, with the 3.0 parser's message (NOT_REWRITTEN), also when it has known changes as well. Strings and comments are never changed. Up to 1000 texts per request, answered in the order they were sent. No model is read. A stored action needs no call: the instance rewrites its stored actions once, as new versions.

OperationUpgradeSyntax · POST /openapi/ifc/UpgradeSyntax
Scopeany login

Parameters#

NameTypeDescription
upgradeSyntaxRequestUpgradeSyntaxRequestrequiredThe request: its properties are those of the model, its JSON that of UpgradeSyntax's request body.

Returns#

UpgradeSyntaxResponse — One result per input, in the order of the inputs

Example#

Java#
import nl.bimbase.bimworks.sdk.api.AuthApi;
import nl.bimbase.bimworks.sdk.api.IfcApi;
import nl.bimbase.bimworks.sdk.client.ApiClient;
import nl.bimbase.bimworks.sdk.model.Auth;
import nl.bimbase.bimworks.sdk.model.LoginWithApiTokenRequest;
import nl.bimbase.bimworks.sdk.model.UpgradeSyntaxRequest;

public class Example {
    public static void main(String[] args) throws Exception {
        // 1. Connect to BIM.works and log in with your API token
        ApiClient client = new ApiClient();
        client.updateBaseUri("https://bim.works/openapi");
        Auth auth = new AuthApi(client)
                .loginWithApiToken(new LoginWithApiTokenRequest().token("<your API token>"))
                .getAuth();
        client.setRequestInterceptor(builder -> builder.setHeader("Authorization", "Bearer " + auth.getBase64()));

        // 2. The request
        UpgradeSyntaxRequest request = client.getObjectMapper().readValue("""
                {
                  "inputs": [
                    {
                      "id": "wall-heights",
                      "language": "BQL",
                      "text": "GET qid, quantity.Qto_WallBaseQuantities.Height IN mm WHERE type = IFCWALL"
                    },
                    {
                      "id": "lengths",
                      "language": "BCL",
                      "text": "select (type = IFCWALL) { require property.Dimensions.length > 0; }"
                    }
                  ]
                }
                """, UpgradeSyntaxRequest.class);

        // 3. The call
        var result = new IfcApi(client).upgradeSyntax(request);

        // 4. The result
        System.out.println(client.getObjectMapper().writerWithDefaultPrettyPrinter().writeValueAsString(result));
    }
}