How to use SUClassificationsLoadSchema

Did anyone ever use the C SDK to load a classification schema into a model?
struct_s_u_classifications_ref.html
I can’t get it to work and am unable to find any examples anywhere :slightly_frowning_face:

SUClassificationsRef classifications = SU_INVALID;
const char* schema_path = "IFC 2x3.skc";
res = SUClassificationsLoadSchema(classifications, schema_path);

if (res == SU_ERROR_INVALID_INPUT) {
	std::cout << "not a valid schema path!";
	return 1;
}
if (res != SU_ERROR_NONE) {
	std::cout << "Unable to get schema!";
	return 1;
}

Your classifications object is still invalid when you make the call to load the schema, ie …

SUClassificationsRef classifications = SU_INVALID;

The same error is returned for an invalid classification collection reference as is for a bad schema path.

Use the SUModelGetClassifications function to set the reference to the model’s classifications collection before loading the schema.


P.S.:

The C++ SDK was discontinued years ago. You are using the newer C API.

Ah wow, just had to uncomment a single line and it worked, thanks @DanRathbun ![quote=“DanRathbun, post:2, topic:171851, full:true”]
The C++ SDK was discontinued years ago. You are using the newer C API.
[/quote]
You are right, typo… I’m using the C API from C++…

1 Like