AI generated extensions

Isn’t AI a wonderful thing?

I wanted to solve a problem for which native SU provides no solution. Say you have a multi-nested Group. You sometimes want to explode all the groups and just retain the geometry. It’s a pain to have to do several explode operations. So I asked AI if there was a solution. It told me there were extensions already available that did that but that it could write a short bit of Ruby code for me. I couldn’t resist the temptation to try!

You wouldn’t want to do this very often on a Component if there was more than one instance. So the code is written so as to exclude them. If they are nested inside a Group, it leaves them intact whilst exploding everything else.

It wrote the code for me in a second or two. No doubt other developers out there are using AI to do the same with much more complicated extensions. But it’s kinda cute to be able to do it with zero knowledge of coding!

If anyone is interested, here is the extension:

CE Group Explode_v1.0.0.rbz (1.6 KB)

I would be interested to know if it falls over for anyone.

With my non-AI hat on [and I haven’t tried your script, just read it…] - a few pointers.
It seems well structured code generally - although it uses some syntax which I avoid, but Ruby has several ways to skin a cat.
If you want to end up with all of the raw geometry within the group, you could also process nested component-instances [adjust title and closing messages accordingly] - exploding them leaves their parent definition unchanged, so that’s not an issue.
When you explode a group [or instance] the tag [aka layer] previously associated with that parent container is applied to all of the resultant entities - including any geometry [against the basic principals of keeping all geometry untagged], so it’d be a good idea to include a few lines of code to reset the tag [ =nil] from and edges or faces [and everything else ?] that might result from the explode operation. If you are retaining any nested instances unexploded then to the re-tagging of those would need you to get each instance’s persistent_id [NOT its entityID which changes] and any associated tag, before the explode runs of the container, then after the explode operation you can reassign the appropriate tag to each instance as needed - otherwise a nested instance might end up with unexpected tag, different to its original one.

That is really helpful advice from someone who I know is an expert in the field (well above my pay grade!). I will take what you say onboard.

I thought they fixed that “exploded group entities inheriting in the original tag” Bug years ago ? it contradicts all good practice in SketchUP as has been stated for years by all the guru’s here !

It would be nice but no, it hasn’t been fixed.

I’m on a roll here!

Sometimes, you want to know the structure of a Group or Component. Of course, Outliner is designed to do that job. But it isn’t always easy to see at a glance everything you might want to know. So I again asked AI to create an extension to do the job. This is what it came up with:

CE_Structure_Report_v1.0.0.rbz (5.6 KB)

Select a Group or Component and run the extension.

I would be interested to hear if others find it buggy, too detailed, unnecessary, whatever.

Congratulations on your first plugin! Looking forward to seeing what you build next.

My second today, I think? But you should really be congratulating ChatGPT and @TIG for his analysis of my first one.

Incidentally, I have often used this forum in the past for answers to problems I have had. And there are some excellent people out there who regularly patrol these corridors and offer first class, free, advice. Three of them have contributed to this very thread. But I find that AI is a second string to the bow and delivers solutions in the blink of an eye.

On a tangent… I occasionally us AI to solve an issue I can’t see an easy solution to. One in particular was very clever and I’d never have thought of it myself - involving Scene tab contents updating using timers to allow things to refresh properly etc. But conversely AI can tell you there’s no easy solution to an issue, when you already know a very simple way. So it’s not there yet, but it will catch up shortly !
I also write AHK scripts for Windows, and I have found AI better at helping with that than with Ruby, but then you have to have several iterations of its solutions to hit on the really good one…

Yes, I have been using AI recently to create small programs that I could never have created on my own. But even to achieve what appears at first to be a simple task can take many iterations. And it can take several minutes for each so the whole project extends to hours. Obviously, compared to me learning Ruby scripting, and Python, and HTML, etc, that is a very short time indeed. And persistence pays off!

Hi Simon, just an FYI: I created an extension that you can use to check extensions for problems. There were none when I scanned yours. But if you keep playing around and something crops up, it could help you to fix the issue.

Extension Preflight: local checks before Extension Warehouse submission - Extensions - SketchUp Community

I´m working on this App these days.. Ai writes all the code for me in swift and ruby..

Sorry for flooding.. I didn´t think