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.
| Method | Operation | Description |
|---|---|---|
check | Check | Check one or more models |
commitTransaction | CommitTransaction | Commit a BUL transaction against the head Version of a Node, producing a new Version |
compareModels | CompareModels | Compare two models with a BCOL definition |
compareObjects | CompareObjects | Compare two chosen objects |
deleteComparePairOverride | DeleteComparePairOverride | Take a pair fixed by hand away again |
exportCompareResult | ExportCompareResult | Download a stored compare result (deprecated, use GetCompareResult with a format) |
getCompareBul | GetCompareBul | The changes between two Versions as BUL |
getCompareResult | GetCompareResult | Read a stored compare result |
getMatchCandidates | GetMatchCandidates | The added objects that could be a removed object |
getObjectHistory | GetObjectHistory | The change history of one object |
getVersionChanges | GetVersionChanges | What changed in Versions since the Versions before them |
listBuildingStoreys | ListBuildingStoreys | The building storeys of one or more models |
listComparePairOverrides | ListComparePairOverrides | The pairs fixed by hand for two Versions |
mapQids | MapQids | Map objects of one Version to their counterparts in another |
parseQuery | ParseQuery | Parse a BQL query into its syntax tree |
query | Query | Query one or more IFC models |
recordUploadAsTransaction | RecordUploadAsTransaction | Replace an upload by a transaction with the same changes |
resolveBvl | ResolveBvl | Resolve a BVL script to what it shows, hides, selects and colours |
setComparePairOverride | SetComparePairOverride | Fix a pair by hand for two Versions |
textSearch | TextSearch | Free-text search in models |
upgradeSyntax | UpgradeSyntax | Rewrite BQL, BVL and BCL written for 2.x in the 3.0 syntax |
check#
public CheckResultsResponse check(CheckRequest checkRequest) throws ApiExceptionCheck 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.
| Operation | Check · POST /openapi/ifc/Check |
|---|---|
| Scope | checks:run |
Parameters#
| Name | Type | Description |
|---|---|---|
checkRequest | CheckRequestrequired | The 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#
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#
public CommitTransactionResult commitTransaction(CommitTransactionRequest commitTransactionRequest) throws ApiExceptionCommit 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.
| Operation | CommitTransaction · POST /openapi/ifc/CommitTransaction |
|---|---|
| Scope | model:write |
Parameters#
| Name | Type | Description |
|---|---|---|
commitTransactionRequest | CommitTransactionRequestrequired | The 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#
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#
public CompareResult compareModels(CompareModelsRequest compareModelsRequest) throws ApiExceptionCompare 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.
| Operation | CompareModels · POST /openapi/ifc/CompareModels |
|---|---|
| Scope | query:run |
Parameters#
| Name | Type | Description |
|---|---|---|
compareModelsRequest | CompareModelsRequestrequired | The 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#
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#
public CompareObjectsResult compareObjects(CompareObjectsRequest compareObjectsRequest) throws ApiExceptionCompare 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.
| Operation | CompareObjects · POST /openapi/ifc/CompareObjects |
|---|---|
| Scope | query:run |
Parameters#
| Name | Type | Description |
|---|---|---|
compareObjectsRequest | CompareObjectsRequestrequired | The 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#
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#
public ComparePairOverrides deleteComparePairOverride(DeleteComparePairOverrideRequest deleteComparePairOverrideRequest) throws ApiExceptionTake a pair fixed by hand away again. Needs read rights on both Versions and write rights on the right one.
| Operation | DeleteComparePairOverride · POST /openapi/ifc/DeleteComparePairOverride |
|---|---|
| Scope | model:write |
Parameters#
| Name | Type | Description |
|---|---|---|
deleteComparePairOverrideRequest | DeleteComparePairOverrideRequestrequired | The 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#
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#
public File exportCompareResult(ExportCompareResultRequest exportCompareResultRequest) throws ApiExceptionDownload 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.
| Operation | ExportCompareResult · POST /openapi/ifc/ExportCompareResult |
|---|---|
| Scope | query:run |
Parameters#
| Name | Type | Description |
|---|---|---|
exportCompareResultRequest | ExportCompareResultRequestrequired | The request: its properties are those of the model, its JSON that of ExportCompareResult's request body. |
Returns#
File — The file
Example#
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#
public CompareBul getCompareBul(GetCompareBulRequest getCompareBulRequest) throws ApiExceptionThe 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).
| Operation | GetCompareBul · POST /openapi/ifc/GetCompareBul |
|---|---|
| Scope | query:run |
Parameters#
| Name | Type | Description |
|---|---|---|
getCompareBulRequest | GetCompareBulRequestrequired | The 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#
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#
public CompareResult getCompareResult(GetCompareResultRequest getCompareResultRequest) throws ApiExceptionRead 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).
| Operation | GetCompareResult · POST /openapi/ifc/GetCompareResult |
|---|---|
| Scope | query:run |
Parameters#
| Name | Type | Description |
|---|---|---|
getCompareResultRequest | GetCompareResultRequestrequired | The 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#
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#
public MatchCandidates getMatchCandidates(GetMatchCandidatesRequest getMatchCandidatesRequest) throws ApiExceptionThe 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.
| Operation | GetMatchCandidates · POST /openapi/ifc/GetMatchCandidates |
|---|---|
| Scope | query:run |
Parameters#
| Name | Type | Description |
|---|---|---|
getMatchCandidatesRequest | GetMatchCandidatesRequestrequired | The 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#
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#
public Map<String, Object> getObjectHistory(GetObjectHistoryRequest getObjectHistoryRequest) throws ApiExceptionThe 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.
| Operation | GetObjectHistory · POST /openapi/ifc/GetObjectHistory |
|---|---|
| Scope | model:read |
Parameters#
| Name | Type | Description |
|---|---|---|
getObjectHistoryRequest | GetObjectHistoryRequestrequired | The request: its properties are those of the model, its JSON that of GetObjectHistory's request body. |
Returns#
Map<String, Object> — The history
Example#
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#
public VersionChangesResult getVersionChanges(GetVersionChangesRequest getVersionChangesRequest) throws ApiExceptionWhat 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.
| Operation | GetVersionChanges · POST /openapi/ifc/GetVersionChanges |
|---|---|
| Scope | query:run |
Parameters#
| Name | Type | Description |
|---|---|---|
getVersionChangesRequest | GetVersionChangesRequestrequired | The 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#
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#
public BuildingStoreys listBuildingStoreys(ListBuildingStoreysRequest listBuildingStoreysRequest) throws ApiExceptionThe 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.
| Operation | ListBuildingStoreys · POST /openapi/ifc/ListBuildingStoreys |
|---|---|
| Scope | query:run |
Parameters#
| Name | Type | Description |
|---|---|---|
listBuildingStoreysRequest | ListBuildingStoreysRequestrequired | The request: its properties are those of the model, its JSON that of ListBuildingStoreys's request body. |
Returns#
BuildingStoreys — The storeys
Example#
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#
public ComparePairOverrides listComparePairOverrides(ListComparePairOverridesRequest listComparePairOverridesRequest) throws ApiExceptionThe 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.
| Operation | ListComparePairOverrides · POST /openapi/ifc/ListComparePairOverrides |
|---|---|
| Scope | query:run |
Parameters#
| Name | Type | Description |
|---|---|---|
listComparePairOverridesRequest | ListComparePairOverridesRequestrequired | The request: its properties are those of the model, its JSON that of ListComparePairOverrides's request body. |
Returns#
ComparePairOverrides — The overrides, oldest first
Example#
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#
public MapQidsResult mapQids(MapQidsRequest mapQidsRequest) throws ApiExceptionMap 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.
| Operation | MapQids · POST /openapi/ifc/MapQids |
|---|---|
| Scope | query:run |
Parameters#
| Name | Type | Description |
|---|---|---|
mapQidsRequest | MapQidsRequestrequired | The 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#
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#
public Map<String, Object> parseQuery(ParseQueryRequest parseQueryRequest) throws ApiExceptionParse 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.
| Operation | ParseQuery · POST /openapi/ifc/ParseQuery |
|---|---|
| Scope | any login |
Parameters#
| Name | Type | Description |
|---|---|---|
parseQueryRequest | ParseQueryRequestrequired | The request: its properties are those of the model, its JSON that of ParseQuery's request body. |
Returns#
Map<String, Object> — The syntax tree
Example#
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#
public Object query(QueryRequest queryRequest) throws ApiExceptionQuery 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.
| Operation | Query · POST /openapi/ifc/Query |
|---|---|
| Scope | query:run |
Parameters#
| Name | Type | Description |
|---|---|---|
queryRequest | QueryRequestrequired | The 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#
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#
public RecordUploadAsTransactionResult recordUploadAsTransaction(RecordUploadAsTransactionRequest recordUploadAsTransactionRequest) throws ApiExceptionReplace 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.
| Operation | RecordUploadAsTransaction · POST /openapi/ifc/RecordUploadAsTransaction |
|---|---|
| Scope | model:write |
Parameters#
| Name | Type | Description |
|---|---|---|
recordUploadAsTransactionRequest | RecordUploadAsTransactionRequestrequired | The 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#
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#
public ResolvedActions resolveBvl(ResolveBvlRequest resolveBvlRequest) throws ApiExceptionResolve 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.
| Operation | ResolveBvl · POST /openapi/ifc/ResolveBvl |
|---|---|
| Scope | actions:read |
Parameters#
| Name | Type | Description |
|---|---|---|
resolveBvlRequest | ResolveBvlRequestrequired | The request: its properties are those of the model, its JSON that of ResolveBvl's request body. |
Returns#
ResolvedActions — The resolved actions
Example#
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#
public ComparePairOverrideSet setComparePairOverride(SetComparePairOverrideRequest setComparePairOverrideRequest) throws ApiExceptionFix 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.
| Operation | SetComparePairOverride · POST /openapi/ifc/SetComparePairOverride |
|---|---|
| Scope | model:write |
Parameters#
| Name | Type | Description |
|---|---|---|
setComparePairOverrideRequest | SetComparePairOverrideRequestrequired | The 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#
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#
public TextSearchResult textSearch(TextSearchRequest textSearchRequest) throws ApiExceptionFree-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.
| Operation | TextSearch · POST /openapi/ifc/TextSearch |
|---|---|
| Scope | query:run |
Parameters#
| Name | Type | Description |
|---|---|---|
textSearchRequest | TextSearchRequestrequired | The request: its properties are those of the model, its JSON that of TextSearch's request body. |
Returns#
TextSearchResult — The matches
Example#
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#
public UpgradeSyntaxResponse upgradeSyntax(UpgradeSyntaxRequest upgradeSyntaxRequest) throws ApiExceptionRewrite 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.
| Operation | UpgradeSyntax · POST /openapi/ifc/UpgradeSyntax |
|---|---|
| Scope | any login |
Parameters#
| Name | Type | Description |
|---|---|---|
upgradeSyntaxRequest | UpgradeSyntaxRequestrequired | The 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#
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));
}
}