Hi,
I’m trying to make an importer for SketchUp using the C API that will download some dynamic components from the 3D warehouse, places them in a file and changes some properties on these components. I have a couple of problems with these components:
- I cannot set some parameters from some components, while I can set them on others. I will provide more information below.
- I have to call Redraw from the Dynamic Components menu manually after importing a component, otherwise the visualization doesn’t update. I would like to be able to call this function from the C API, but I haven’t found a way thus far.
All help is greatly appreciated!
Extra information for problem 1:
I can set the height of the following component: https://3dwarehouse.sketchup.com/warehouse/v1.0/publiccontent/d68c504c-a4cc-4640-b5ea-5b3a6cff2a6e
But I cannot set the height for this component: https://3dwarehouse.sketchup.com/warehouse/v1.0/publiccontent/cff9cf2a-8a69-4bca-a9a5-157c69fc8f78
I’ve written the following code to set the height:
SetDoubleAttribute(entity, "dynamic_attributes", "lenz", 114.7244094f);
SetDoubleAttribute(SUEntityRef& entity, const char* dictionary, const char* key, double value)
{
// Prepare value
SUTypedValueRef typedValue;
SUSetInvalid(typedValue);
SUTypedValueCreate(&typedValue);
SUTypedValueSetDouble(typedValue, value);
// Set the value
SUAttributeDictionaryRef dic;
SUSetInvalid(dic);
SUEntityGetAttributeDictionary(entity, dictionary, &dic);
SUAttributeDictionarySetValue(dic, key, typedValue);
}