Loading dynamic components

I have dynamic components saved in a separate .skp file and I’m loading them into new Sketchup drawings via use of a toolbar via Ruby (see below code snippet)

button = UI::Command.new("Button") { load_component("/location/Button.skp") 

}

Issue I’m having is this is creating a group around the dynamic component so I can not see the attributes in the options window unless I click into/explode the group.

Is there a way to remove this behavior so the dynamic component options are immediately accessible when importing?

I suspect that it’s nothing to do with your code, rather that you did not save your DCs properly.
If you make a DC in a model and save that model SKP, then the DC is nested inside the SKP you just saved.
Hence your need to explode it to get at the DC-ness.
The proper way to save a DC is to select an instance of that DC and use Save As… in the context-menu.
That way the ‘raw’ DC is saved out as a functioning DC component - without the ‘wrapper’.

2 Likes

Brilliant that’s sorted it thanks for your help

This doesn’t just applu to DCs but all components. By saving out components this way you don’t get an extra wrapper, but instead retain the name, axes location, attributes and other properties of the component when loading it back in.