Adding an OBJ IfcShapeRepresentation?

Is there a schema-compliant way to add a textual ShapeRepresentation, like OBJ?

I can create an IfcShapeRepresentation, and declare its RepresentationType to be "OBJ":

#10= IfcShapeRepresentation($, $, "OBJ", (#20))

And now I’d like to have some kind of IfcRepresentationItem as its target, like
#20= IfcGeometricRepresentationItem(...)

that somehow encodes a text literal representing the OBJ geometry, e.g.:
"v 0 0 0\nv 0 0 2.3\nv 0 0.3 2.3\nv 0 0.3 0\nv 5 0 0\n..."

Is this possible within IFC4.x?

I don’t think it’s possible and I also wouldn’t be in favour of this. OBJ is a pretty poorly standardized specification, e.g some implementations support only triangular faces, some polygons, some implementations only support positive some relative indexing, some prefer g for groups other o for objects to distinguish between parts. The mtllib referencing would be awkward within an IFC context.

I would say IfcTriangulatedFaceSet is a really a much more precise, strict and roughly equivalent choice for this kind of geometry.

Thanks @aothms. OBJ was just an example. The intent was to understand whether IFC has support for encoding/caching secondary ShapeRepresentations (as blobs or text strings) that aren’t part of the standard itself. The answer seems to be no. Appreciate the follow-up.

Actually, one clarifying question:

If it’s not possible to support custom IfcRepresentationItems, why does the standard say IfcRepresentations can have a RepresentationType defined by implementers agreements?

“The supported values for [RepresentationType] context type are to be specified by implementers agreements.” – IfcRepresentation

It’s almost like the specification intended to support extensibility here, but then constrained the behavior of subentity definitions so that predefined types are the only ones that can be used in practice.

Are there any existing implementers agreements that use a custom RepresentationType?

I don’t know, the fact that it mentions the wrong attribute name is not promising in that regard :wink:

Also the subtypes IfcShapeRepresentation I think has different tone to it in this regard, although the headings on the table are still a bit non-normative.

I think the Body-fallback idea comes from implementer agreements, but that’s a RepresentationIdentifier not a -Type. Adapting the semantic meaning of a shape item (the identifier) is not the same as a extending the schema vocabulary (the type).

Overall the ecosystem is moving into restricting these ifc-gherkin-rules/features/GEM004_Constraints-on-representation-identifiers.feature at main · buildingSMART/ifc-gherkin-rules · GitHub

Also, are you aware that the value actually has validity implications also in the schema? 8.18.6.3 IfcShapeRepresentationTypes - IFC 4.3.2 Documentation Unknown values result in indeterminate though, not invalid/false.

I’d have a more nuanced answer. There is no reason that we couldn’t do what you said, because it’s a text file. But it would be unique to represent a “blob” (that is, something you would have to know how to interpret) in an IFC file as a standard. It would require an implementer’s agreement and given IFC has an OBJ-alternative, it probably wouldn’t get accepted as such.

@angel.velez - that’s what I’m interested in: can we even theoretically encode these secondary “blob” representations, instead of having to generate them at runtime, every time. I can’t find a IfcBlobRepresentationItem (a theoretical subentity of IfcRepresentationItem that supports secondary representations identified by a custom RepresentationType) or similar in the schema. So it looks like there’s no way to achieve this, even as an experiment, without inventing new schema entity definitions.

@aothms - Good note on the IfcRepresentationTypes Function callout. This alone doesn’t seem problematic, because the the result of the function is an EXPRESS Logical, where the default response is a Logical “Unknown”. What is problematic for this use case is that Gherkin Rule, because it’s stricter than the current schema in declaring that the only valid RepresentationTypes are those that are predefined.

If the ecosystem is moving to restrict valid RepresentationTypes, will the schema be updated accordingly (e.g., will the Function IfcRepresentationTypes have its return value changed to an EXPRESS Boolean, so anything other than a predefined RepresentationType fails?) or do the Gherkin rules take precedence over the EXPRESS definitions?

@devonsparks I think it depends on what you mean by “invent”. You could have an entity with an empty representation and a property in a property set called “OBJRepresentation” and a property called “Data” that had the encoding. I’m not suggesting you do that of course. But if you are looking for an existing IfcRepresentationItem sub-class that allows for arbitrary data, that doesn’t exist.

Yeah, wasn’t willing to go quite as far as new PSets :slightly_smiling_face:

That only leaves one remaining curiosity - will the schema be updated to reflect the Gherkin Rules, or should we interpret the Gherkin Rules to have a higher precedence than the schema itself?

will the schema be updated to reflect the Gherkin Rules

My guess is no. Creating these backwards incompatibilities (possible serializations that are no longer deemed valid) on a express level is near impossible in the context of an ISO standard.

But in the greater specification (property sets, concept templates, supplementary rules in the validation service) bSI is not so constrained.

Maybe one last (?) concluding remark. Did you consider something like ICDD as a container zipping up heterogeneous data and still allowing fairly granular links? It’s maybe even a bit more interoperable, unzip and open the OBJ in any tool of your liking, as opposed to burying it into some SPF serialization leaving you in the hands of the few parsing libraries that exist to extract it.

That IfcPropertySingle value could also have the type IfcBinary and allow for even more exotic representations.

Yep - agreed on the value of something like ICDD as an alternative here. Generate your secondary format however you like off the IFC, and stash it together with the original in a zipped container.

Appreciate the consult :slight_smile:

1 Like

Couldn’t external “OBJ” (or GLTF or …) geometric “blobs” be covered with a Document Reference?

In the spirit of a “container”-based implementer agreement, a document reference could work. Something like:

  1. Generate one or more secondary representations off of the IFC.
  2. Relate these representations to their Elements via DocumentReferences.
  3. Set the DocumentInformation metadata for each reference, especially ElectronicFormat (to dispatch on mime type), Location (for its URI), and Purpose.

Consuming systems conforming to the implementer agreement could then check for the presence of these external documents, try to resolve them, and load the cached models as needed.