I need a way to get IfcBuildingStorey as that is the classification type assigned to the definition. I would’ve thought there was an API method, since we can add and delete classification types.
For now I stick with definition.get_attribute("AppliedSchemaTypes", "IFC 2x3")
But as far as I can see, there is no appropriate method to get the assigned type for a given scheme.
I would expect there to be a get_classification(scheme_name). Why is there a method that lets you remove a type if there is no method to know what type is assigned?
Specific types have specific attributes that are part of the classification, that is where get_classification_value and get_classification_value are for.
Oh yes, I know what you mean now. (needed a cup of coffee first)
Yes I remember this being discussed in the past. (see links below)
… has several code snippets for walking the classification attribute dictionary “trees”.
You could use a refinement module if you like …
refine Sketchup::ComponentDefinition do
self.get_attribute("AppliedSchemaTypes", "IFC 2x3")
# Code that makes calls like the following on instances ...
if obj.defintion.applied_IFC_type == "IFCBuildingStory"
# do something
The API authors are “minimalists”. If there is a simple alternative or workaround they don’t create a dedicated method(s). Ie, more work, more maintenance, etc. (Arguing for “robustness” doesn’t work, as I’ve tried it. They’ll just quote various “golden rules of APIs” and cite bibliographic references with subjective opinions that support minimalism.)