Change Dynamic Attributes

I have a model with dynamic attributes-width and height.
dynamicObject.skp (338.4 KB)

The current code allows you to access all the attributes of the model.


  SUModelRef model = SU_INVALID;
  SUModelLoadStatus status;
  SUResult res = SUModelCreateFromFileWithStatus(&model, "dynamicObject.skp", &status);

  if (res != SU_ERROR_NONE) {
    std::cout << "Failed creating model from a file" << std::endl;
    return 1;

  SUEntitiesRef entities = SU_INVALID;
  SUModelGetEntities(model, &entities);

  size_t instanceCount = 0;
  size_t instanceLength = 1;
  SUComponentInstanceRef instance = SU_INVALID;
  SUEntitiesGetInstances(entities, instanceLength, &instance, &instanceCount);

  SUDynamicComponentInfoRef dc_info = SU_INVALID;
  SUComponentInstanceCreateDCInfo(instance, &dc_info);

  size_t attributesLength = 3;
  size_t attributesCount = 0;
  SUDynamicComponentAttributeRef attributes[] = SU_INVALID;
  SUResult result = SUDynamicComponentInfoGetDCAttributes(dc_info, attributesLength, attributes, &attributesCount);
  if (result == SU_ERROR_NONE) {
      // TODO something with attributes

Need help implementing code that changes the values of dynamic attributes when using the Sketchup C API.