Nested groups and export to file

Because the learning curve for Ruby and SketchUp extensions is so steep, I suggest first to learn to use attribute dictionaries.

You can assign custom dynamic attributes using the Dynamic Components dialogs, and/or special attributes in the Entity Info panel, and/or BIM attributes using the Classification toolbar.

Then, output a report file using File > Report Generator.

All of the above attribute types should be accessible in the Report Generator form.

See:

After running a report, the “Download” button will ask you to save a CSV data file.
This file then can be imported into Excel, OpenOffice Calc, LibreOffice Calc, etc.


Then after you are familiar with using attributes, if you still need more customization, explore the possibility of using one of the export extensions that output cutlist, or costing or integrate with Excel.

It may be more affordable (and faster) for you to subscribe to an existing extension(s) than to expend the time and cost learning Ruby and SketchUp programming.


But if you really want to learn SketchUp Ruby programming, then be prepared to spend 6 months to a year in intensive learning, coding and testing.

There is also a quick helper for those comng from Python progrmamming:

Your project covers many topics. It would be better to break it down into coding tasks and search the forum for these specific tasks.

Your request here in this topic is too general. Lets start with 1 task …

This task’s first step is to find a group by name.

So we search this API forum category for “find a group by name” and we find quickly this topic:

It has several code examples I and other coders have posted.

This is the 2nd step of the task. This is called “walking the hierarchy” (note the correct spelling).

You can iterate through a group definition’s entities collection or reuse the “find by name” paradigm to search it for a specific named object.

The same “search” paradigm can be used to find objects that have a specifically named attribute dictionary attached to them (such as “Petor_Project” or whatever your extension name is.)

I know that there are already numerous forum topic threads on searching and walking entities collections of the model and of groups or component definitions.

This would be another task. The Ruby Core has several classes IO and it’s subclass File for writing and reading files.

Also the Ruby Standard Library has a dedicated CSV library for dealing with csv text files.


So basically object hierarchy is normal for organizing geometry.

Tagging is usually for controlling what is displayed or hidden and in what scene.

Marking with attributes is for attaching any kind of data both to be used internally (for extensions) or for external export.

1 Like