Generate Report/ Influence Dynamic components by changing values in the Excel/CSV file


Does anyone know of a way to do the following?:

Step 1- Generate a report of custom dynamic component attributes.
Step 2- Save as MS Excel file
Step 3- Change a component attribute in the excel file and have that change replicated in the Sketchup model?


Sorry, but there’s no way to do that using only Excel and Dynamic Components. Why? Dynamic Components can’t reach beyond themselves. The ability to “set” attribute values only exists within all subcomponents nested within a single enclosing component. All predefined attributes are read/writeable only within the same scope. Finally, none of the available functions for setting attributes can read information from outside the DC.

Disclaimer for the rest of this reply: I have not used Ruby, so I’m speaking only from a vague understanding reached through monitoring this forum!

You might be able to do something using Ruby. Probably a pair of routines - 1 to draw the component and a 2nd one to be an “observer” watching for changes to the Excel file and causing a redraw with the new values.

Ok cool,

Thanks for the response sjdorst.

Hopefully this kind of functionality becomes available in future.

It would be really useful for maintaining a large database of dynamic components, for example building materials to generate bills of quantities. The cost information such as rate per unit would be much easier to update in and excel list format, rather than having to open each component in sketchup and updating the rate attribute.

Yes it would need to be done with Ruby. But currently only on PC, as it uses the Win32OLE class to talk to Excel.

This cannot be done from within SketchUp Ruby, as it cannot “observe” things in another process in the normal manner where the “observed” object (when it thinks it’s changes need to be broadcast,) makes calls to Ruby callback method(s), that responds to the change.

Instead, it’d need to be either a manual “Update” command, or a timer that periodically “polls” some property in the Excel file or worksheet (perhaps a modified flag?).

Another alternative is to check a modified date of the Excel file when SketchUp starts, or loads a model with a specific “Excel Syncing” attribute dictionary, and if the last updated date in the model’s dictionary is less than that of the Excel file, then the plugin could do an update routine, searching for differences between the Excel file and the component instances in the model.

I think that there are already a few extensions that link Excel and SketchUp models already. (May not be free however.)

It might be nice if it updated the component files in the library collection folder, so that the changes could percolate down to model files as they are opened, or as modeling activity inserts new component instances into models.

And again there may already be component updater plugins that will do the updating from the library part of this workflow.