Create an Exchange Using IFC (Industry Foundation Classes) Filters
Create an exchange using the ifcClass and/or ifGlobalId filters to
extract detailed, granular data subsets from an IFC model. An IFC
exchange helps ensure that only relevant and necessary information is
shared, enhancing collaboration, data integrity, and usability across
different stages of the project.
To filter the data based on ifcClass or ifcGlobalId and create an exchange that contains only IfcDoor as an extracted element from the whole IFC model, provide the filter:
ifcClass=in=('ifcDoor')
If you want to create an exchange where the ifcClass is a specific type, such as an ifcDoor, you can use the filter ifcClass=in=('ifcDoor').
To create an exchange that contains only IfcDoor elements from the whole IFC model, you can filter the data based on ifcClass using the filter ifcClass=in=('IfcDoor') or based on ifcGlobalId.
Presently, exchange creation on ifc file supports only two filters: ifcClass and ifcGlobalId.
Note
When providing filters for creating the exchange, use only the =in= Comparison operation. Other operators such as ==, !=, >, <, <=, >= are not supported and may result in failed exchange creation. To learn more about these operators, see RSQL Parser.
Here are some filter patterns supported by IFC that demonstrate how different conditions can be applied:
| Filter Type | Example | Description |
|---|---|---|
ifcClass filter |
ifcClass=in=('IFCDOOR','IFCWINDOW') |
Filters all objects that are either of class IFCDOOR or IFCWINDOW. |
ifcGlobalId filter |
ifcGlobalId=in=('2pboVG_iTEAxRAlSBZpuEx','2pboVG_iTEAxRAlSBZpuFQ') |
Filters only those objects that match one of the specified global IDs. |
| Combined with or logical operator | ifcClass=in=('IFCDOOR','IFCWINDOW') or ifcGlobalId=in=('2pboVG_iTEAxRAlSBZpuEx','2pboVG_iTEAxRAlSBZpuFQ') |
Filters objects that are either of class IFCDOOR or IFCWINDOW, or have one of the specified global IDs. |
| Combined with , (comma) logical operator | ifcClass=in=('IFCDOOR','IFCWINDOW'), ifcGlobalId=in=('2pboVG_iTEAxRAlSBZpuEx','2pboVG_iTEAxRAlSBZpuFQ') |
Same as the or operator. Filters objects that match either the IFC class or the global ID. |
You can refine the selection further by applying additional filters under ifcGlobalId as needed.
Here is how to create an exchange using the IFCClass filter, specifically focusing on the IfcDoor class.
Use the following mutation in this task:
| Type | Operation | Description |
|---|---|---|
| Mutation | createExchange | Creates a data exchange. |
Step 1: Create an Exchange based on the filter class “IfcDoor”
The following steps demonstrate how you can run the createExchange mutation to create an exchange based on the IFC filter
ifcClass=in=('ifcDoor').
Note
Alternatively, you can import a cURL command into Postman, Insomnia, or similar tools and customize it to create a collection. This allows you to run the createExchange mutation directly from these tools. For more information, see Instructions for Using the IFC Exchange cURL.
- Enter the following query in the Query Pane of the Data Exchange Explorer.
Create Exchange Using IFC Filter.
mutation CreateExchange(
$filter: String
$sourceFileId: String!
$targetExchangeName: String!
$targetFolderId: String!
) {
createExchange(
input: {
filter: $filter
source: { fileId: $sourceFileId }
target: { name: $targetExchangeName, folderId: $targetFolderId }
}
) {
exchange {
id
name
elements {
results {
id
name
}
}
}
}
}
- In the Query Variables pane, enter the values for the following fields:
- filter: The RSQL IFC filter string that specifies the criteria for data extraction. In this case, the filter is based on the
IfcDoorclass. - sourceFileId: The ID of the source IFC file from which the exchange is being created. For more information on acquiring SourceFileId, see Folder (Query Reference).
- targetFolderId: The ID of the target folder for storing the exchange. For more information on acquiring targetFolderId, see Folder (Query Reference).
- targetExchangeName: The name of the exchange that is being created.
Query Variables
{
"filter": "ifcClass=in=('IfcDoor')",
"sourceFileId": "aXRlbX5iLjVjMDdjODRjLWJiZDktNDc2ZS04NzEyLTU0N2Y3NGM1Yjc2Yn5iLjg0ZmJiNTg3LTJmYWUtNDlkNy1iYmZhLTVjYmJkNWIxNjgyOH51cm46YWRzay53aXBzdGc6ZnMuZm9sZGVyOmNvLmFlNzlOOFJIUTJtWnYyOHo3cF9vekF-dXJuOmFkc2sud2lwc3RnOmRtLmxpbmVhZ2U6RG5ySVZRNVNUd2FINk5XZXNDVS1Pdw",
"targetExchangeName": "IFC Filter based Exchange - IFC Class - IfcDoor",
"targetFolderId": "Zm9sZH5iLjVjMDdjODRjLWJiZDktNDc2ZS04NzEyLTU0N2Y3NGM1Yjc2Yn5iLjg0ZmJiNTg3LTJmYWUtNDlkNy1iYmZhLTVjYmJkNWIxNjgyOH51cm46YWRzay53aXBzdGc6ZnMuZm9sZGVyOmNvLmFlNzlOOFJIUTJtWnYyOHo3cF9vekE"
}
- Click Play. The exchange is created based on the filter
ifcClass=in=('ifcDoor'), and the response looks similar to the following code block.
{
"data": {
"createExchange": {
"exchange": {
"id": "ZXhjfkJ3WlJiS01jYU9lUDhuOTZSZWtpYVFfTDJDfjNlOTkzY2E0LWVlNzctMzkzNi05Zjg1LTUyZTk1MGRkZGJkNg",
"name": "IFC Filter based Exchange - IFC Class - IfcDoor",
"elements": {
"results": [
{
"id": "66C096214CF868C87897CAAE800045B5CC9B0FA6",
"name": "Single-Flush:36\" x 84\":359363"
},
{
"id": "16F8B0BE54FA26AD8F2FE96CF062A70DB02657D1",
"name": "Frame/Mullion"
},
{
"id": "B9DA087FECCF4CE128318B08AA19D9D8256BF986",
"name": "Panel"
},
{
"id": "0700F206A1D9E0CFB8D785262788D8B59A3476CC",
"name": "Level 1"
}
]
}
}
}
}
}
Step 2: Get Exchange Status
The following steps demonstrate how you can run the getExchangeCreationStatus query to check the status of the exchange that was created in the previous step. 1. Enter the following query in the Query Pane of the Data Exchange Explorer.
query GetExchangeStatus($exchangeId: ID!) {
getExchangeCreationStatus(exchangeId: $exchangeId) {
status
versionNumber
exchange {
id
name
elements {
results {
id
name
}
}
}
}
}
- In the Query Variables pane, enter the value for the exchangeId field:
Query Variables
{
"exchangeId": "ZXhjfkJ3WlJiS01jYU9lUDhuOTZSZWtpYVFfTDJDfjNlOTkzY2E0LWVlNzctMzkzNi05Zjg1LTUyZTk1MGRkZGJkNg"
}
- Click Play. The response should look similar to the following code block.
Response
{
"data": {
"getExchangeCreationStatus": {
"status": "COMPLETED",
"versionNumber": 1,
"exchange": {
"id": "ZXhjfkJ3WlJiS01jYU9lUDhuOTZSZWtpYVFfTDJDfjNlOTkzY2E0LWVlNzctMzkzNi05Zjg1LTUyZTk1MGRkZGJkNg",
"name": "IFC Filter based Exchange - IFC Class - IfcDoor",
"elements": {
"results": [
{
"id": "66C096214CF868C87897CAAE800045B5CC9B0FA6",
"name": "Single-Flush:36\" x 84\":359363"
},
{
"id": "16F8B0BE54FA26AD8F2FE96CF062A70DB02657D1",
"name": "Frame/Mullion"
},
{
"id": "B9DA087FECCF4CE128318B08AA19D9D8256BF986",
"name": "Panel"
},
{
"id": "0700F206A1D9E0CFB8D785262788D8B59A3476CC",
"name": "Level 1"
}
]
}
}
}
}
}
The exchange status is COMPLETED. To retrieve exchange-related information, follow the steps in Retrieve Elements from IFC Exchange.
If the status is IN_PROGRESS, wait for the exchange to complete and then follow the same steps to retrieve the information.
Instructions for Using the IFC Exchange cURL
- Make sure authentication is set up with the data:read and data:write permissions. For more information, see GraphQL Endpoint.
- Import the cURL command into postman\insomnia or any other similar client.
curl --location 'https://developer.api.autodesk.com/dataexchange/2023-05/graphql' \
--header 'Authorization: Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6Im1EVUVQ ….' \
--header 'Content-Type: application/json' \
--data '{"query": "mutation CreateExchange( $filter: String $sourceFileId: String! $targetExchangeName: String! $targetFolderId: String!) { createExchange( input: { filter: $filter source: { fileId: $sourceFileId } target: { name: $targetExchangeName, folderId: $targetFolderId } }) { exchange { id name elements { results { id name } } } } }",
"variables":{
"filter":"ifcClass=in=('IfcDoor')",
"sourceFileId":"aXRlbX5iLjVjMDdjODRjLWJiZDktNDc2ZS04NzEyLTU0N2Y3NGM1Yjc2Yn5iLjg0ZmJiNTg3LTJmYWUtNDlkNy1iYmZhLTVjYmJkNWIxNjgyOH51cm46YWRzay53aXBzdGc6ZnMuZm9sZGVyOmNvLmFlNzlOOFJIUTJtWnYyOHo3cF9vekF-dXJuOmFkc2sud2lwc3RnOmRtLmxpbmVhZ2U6RG5ySVZRNVNUd2FINk5XZXNDVS1Pdw",
"targetExchangeName":"IFC Filter based Exchange - IFC Class- IfcDoor",
"targetFolderId":"Zm9sZH5iLjVjMDdjODRjLWJiZDktNDc2ZS04NzEyLTU0N2Y3NGM1Yjc2Yn5iLjg0ZmJiNTg3LTJmYWUtNDlkNy1iYmZhLTVjYmJkNWIxNjgyOH51cm46YWRzay53aXBzdGc6ZnMuZm9sZGVyOmNvLmFlNzlOOFJIUTJtWnYyOHo3cF9vekE"
}}'
- In the Authorization header, pass your three-legged bearer token.
4. Replace the following variables in the request body as per your requirement:
sourceFileIdtargetFolderId