I am trying to retrieve the number of component definitions from a given SketchUp model. The values I am getting are not same in SketchUp C SDK and the Ruby API.
model = Sketchup.active_model
definitions = model.definitions
definitions.count
In the above Ruby code definitions.count is giving a value “101”.
SUResult res = SUModelCreateFromFile(&model, skp_file_path);
if (res != SU_ERROR_NONE) {
std::cout << "Unable to open SketchUp file!" << std::endl;
return -1;
}
//Component Definitions
size_t componentDefinitionsCount = 0;
size_t retrived = 0;
SUModelGetNumComponentDefinitions(model,&componentDefinitionsCount);
SUComponentDefinitionRef *definitions = new SUComponentDefinitionRef[componentDefinitionsCount];
SUModelGetComponentDefinitions(model, componentDefinitionsCount,definitions,&retrived);
std::cout << "Number of component definitions: " << retrived<< std::endl;
Above C code prints the count as “23”.
I am seeing the same issue when counting the total number of entities in both Ruby and C.
Am I doing something fundamentally wrong ?