How to get IFC object position and rotation (+ other attributes)

Hello Speckle Community, I’m Felix :wave:

I’m very new (~3 weeks) to Speckle and the architecture/planning space, having just started working at a new company (as software dev), so full disclose: I probably make quite a few bad assumptions, sorry in advance :pray:

And also first of all: A big Thank You to the Speckle Team for their hard work!

About my problem:

I am working with the GraphQL API to extract certain data from Speckle models, and specifically I need the position and rotation of some IFC objects (doors, windows, furniture etc.) as well as some additional data like door hinge rotation.

The data is uploaded to Speckle with the Speckle Revit Connector.

Here are the attributes for a door in one of our projects:


(Notably missing any transformation data)

If I use the GraphQL API I can additionally get the structured geometry data (with the meshes referenced in @displayValue and defined in children).
Notably the geometry doesn’t seem to reference any transformation matrices so the geometry is already in world space (?, definitely not sure about this one).

So if my assumptions are correct I can only really get the position by reconstructing it from the vertices (e.g. by averaging) and I can’t really get a rotation at all.
Also I assume I can’t get information like hinge rotation either? (This might be an unreasonable expectation anyway, again my knowledge about this space, including the IFC format, is very limited)

I found this topic which suggests that maybe this is not yet implemented (though it is almost 2 years old and I don’t know if it’s related):
IFC Positioning

Also Snaptrude wrote here about how they enriched the Speckle data from Revit with custom scripting, which led me to assume I might need to do something similar to get there.

So yeah, my question in short: Am I (massively) overthinking/overengineering this and is there a way to get the data I need much easier? :smile:

Thank you very much in advance for any help :pray:

2 Likes

Hey @Felix_Balda ,

Welcome to the forum! Would love to know more about what you’re building.

I’m not too familiar with how the data looks like when uploaded as IFC via the Revit connector, but can share a couple of things that might help in the meantime.

  • the new frontend (the one you’re using) does not display ALL the properties an object has - we’re in the process of upgrading the scene explorer so it can do that
  • the old frontend, instead, does. So I’d suggest logging in there to double check

If the position and rotation props are missing there too, I’ll log an issue so we can look into it more.

Hey @teocomi ,

thank you for your response!
I’m trying to get Revit project data into a web-based planning tool, and I’m evaluating Speckle as a way to do that.
I really like how easy the bootstrapping is, but as mentioned I’m missing some data unfortunately.

Regarding the Speckle frontend version: I just used the frontend screenshot because it looks nicer/is smaller than a JSON file dump, but I get identical data to what I posted from the GraphQL API (in addition to the geometry data, which isn’t shown in the frontend property inspector but instead rendered in 3d of course). The API response is what I actually care about because I need to get the data from there and I currently only use the Speckle frontend for debugging.

And yes, the position and rotation is missing in the GraphQL data as well unfortunately.

For reference:
The GraphQL query I used for this test:

query FetchAllWithQuery(
    $streamId: String!
    $refId: String!
    $limit: Int!
    $select: [String]
    $cursor: String
    $query: [JSONObject!]
  ) {
    stream(id: $streamId) {
      object(id: $refId) {
        id
        speckleType
        totalChildrenCount
        children(
          limit: $limit
          select: $select
          cursor: $cursor
          query: $query
        ) {
          totalCount
          cursor
          objects {
            id
            data
            children {
              totalCount
              objects {
                id
                data
              }
            }
          }
        }
      }
    }
  }

(Notably I didn’t use a ‘select’ filter to not accidentally hide data)

And here is the ‘data’ property JSON object of a door from the same project as the screenshot as received from above GraphQL query:

{
  "id": "01b92a55c772bd826ca8cbb219e2a76b",
  "Tag": "355300",
  "Name": "Single-Flush:36\" x 84\":355300",
  "type": "IFCDOOR",
  "GlobalId": "29$5_RYsHCJhYOSdCnjOMB",
  "elements": [],
  "__closure": {
    "5d656ce3c457718c44f36153b4b06ba2": 1,
    "9232c9857bd42651d142d825e58ffc51": 1,
    "fa0efaae42b2c45b6c8cc2df71767be1": 1
  },
  "expressID": 1206,
  "ObjectType": "Single-Flush:36\" x 84\"",
  "properties": null,
  "Description": null,
  "OverallWidth": 3,
  "OwnerHistory": 20,
  "speckle_type": "IFCDOOR",
  "@displayValue": [
    {
      "referencedId": "5d656ce3c457718c44f36153b4b06ba2",
      "speckle_type": "reference"
    },
    {
      "referencedId": "fa0efaae42b2c45b6c8cc2df71767be1",
      "speckle_type": "reference"
    },
    {
      "referencedId": "9232c9857bd42651d142d825e58ffc51",
      "speckle_type": "reference"
    }
  ],
  "OverallHeight": 6.999999999999999,
  "Representation": 1202,
  "ObjectPlacement": 2702,
  "Pset_DoorCommon": { "Reference": "36\" x 84\"", "IsExternal": "F" },
  "Pset_QuantityTakeOff": { "Reference": "36\" x 84\"" },
  "Pset_ProductRequirements": { "Category": "Doors" }
}

And then the ‘children’ property contains the geometry data but that one is of course much larger, so I’m not gonna post that here :sweat_smile:

So yeah, it feels like there is some data missing here.

If I can provide anything else please let me know, and thanks again for the help!

Thanks for the additional details!

If those props are not in the GQL responses, then it means they need to be added in the conversion routine. We’ll make a note to tackle this internally (cc @gokermu) but cannot guarantee a timeframe for it.

If you’d like to give it stab yourself at making a PR, I’d suggest starting by debugging how the door gets converted in the main switch statement, and then by dynamically adding the missing props.

1 Like