Output - Selected Attributes of Dynamic Components to CSV
-
I know it is early days yet regarding availability of Dynamic components, and I know there are some Ruby Scripts already available for generating reports of component attributes but.....
With the ability to easily add attributes to DC, particularly custom attributes, it would be nice if there was a way to do a CSV report where the output was specified by the user. For example a script which would display all available attributes of 'selected components' by attribute name, with a tick box for each. If the box is ticked and the report run, a csv file is produced for all the components selected, showing all the attributes ticked by the user. If a component does not have all the attributes which were ticked, the csv column for that attribute is left empty, if it has none of the attributes ticked, the component is ignored for the purposes of the report.
I don't think such a script exists - if it does I'd be pleased to hear about it.
I don't even know (not being a coder) if it is even possible and if it is, how complex it would be to write it, but if there are any script writers interested in undertaking a project like this, again -I'd be pleased to hear. -
@peweuk said:
I don't even know (not being a coder) if it is even possible and if it is, how complex it would be to write it, but if there are any script writers interested in undertaking a project like this, again -I'd be pleased to hear.
This is quite doable. The Dynamic Components attributes are stored like any other SketchUp attributes, so both existing reporting tools and future ones are able to view (and modify) DC attributes.
If there are any coders out there who'd like to contribute some time toward building a custom DC reporting tool, I'd be happy to lend technical guidance. It's really just a matter of writing a recursive script that looks at each entity in the drawing or selection and dumping out the attributes of interest.
Cheers,
-
Thanks for the input Scott.
I guessed it would be relatively straightforward for a coder - but did not want to be presumptious.
Let's hope someone my be interested and have some time to do something
-
Does anyone know where I might contact someone who may be interested in doing this
-
Todd burch and jim would probably be good people to start your enquiries with. If theyre too busy or cant help for whatever reason its probably worth putting out a plea in the ruby forums, as well, as theyre is usually quite a few keen coding types that hang around there.
-
@unknownuser said:
If there are any coders out there who'd like to contribute some time toward building a custom DC reporting tool, I'd be happy to lend technical guidance
Scott, that is a generous offer and difficult to pass on!
The first part - retrieving the attributes is straightforward, as is the final stage of compiling and writing the file.
I think the more challenging aspect is coming up with a strategy for creating the WebDialog, filling it with the checkbox form, and then passing the selected options back to Ruby in a cross-platform way.
If we assume we have a Ruby Array of unique attributes collected from the Components, how best to get the Array into a WebDialog so users can select them for reporting?
This is something I've been thinking about but haven't investigated - Can the DC Javascripy/Ruby library be used by user-created scripts? Are there possibly some JSON functions in there that we can use for passing strings between Ruby/Javascript?
-
@jim said:
This is something I've been thinking about but haven't investigated - Can the DC Javascripy/Ruby library be used by user-created scripts? Are there possibly some JSON functions in there that we can use for passing strings between Ruby/Javascript?
Jim,
Yes. That's exactly what the Dynamic Components do. You can create a JSON string inside ruby, and then use WebDialog.execute_script to push that data up into javascript and do something with it.
In this thread we just posted an example script (ruby only, no web dialogs) that might be helpful.
Cheers,
-
Thanks Scott,
I just want to make sure.. I was asking if there were routines in the Ruby/Javascript files used by DC's that I could use in my scripts, or are they unavailable outside the DC world?
Advertisement