In this episode, we discuss how to edit the OpenStudio user script programs. We show where to locate the user script ruby files and give a quick example of changing text within the code.
Transcript:
Today we are going to talk about the SketchUp OpenStudio User Scripts. Those are located in: Extensions-OpenStudio User Scrips; it is all of these right here...
These are all written using the Ruby programming language. In particular, I am going to show you how to locate the Ruby Files and how to edit those; I am going to give an easy example.
There is a handy User Script here that Renames Thermal Zones Based On Space Names.
If we have a Space Name, and we want to have the Thermal Zone Name also very similar to that Space Name (so it is easier to locate the information in the Output Files);
You can use this User Script. It just puts a prefix on the Space Name; that is what it calls the: "Thermal Zone."
The prefix in this instance is: "Thermal Zone," and then it uses the Space Name. Although this is handy, it does tend to make the Thermal Zone names very long.
Sometimes they do not fit on the whole page. I like to shorten those with just: "TZ," which makes it easier to read.
How do you locate the Ruby File for this User Script? First, you need to go to your Computer, your Hard Drive, and then you would go to Users, your username, and AppData-Roaming.
We will search for "SketchUp" and the SketchUp version you are using, SketchUp again, Plugins-OpenStudio, and then we can go to: "user_scripts."
I think it is on the: "Altar Or Add Model Elements" Submenu. So, yes, we will go to: "Altar Or Add Model Elements," and then we need to search for it.
Here we go: "Rename Thermal Zones based on Space Names," and you can see it is a Ruby File, a "DOT RB" file (.RB file). So this is the program that renames those Space Names.
We will double-click to edit it. The quickest way to find that information is to search for this string of text.
So do a: "Ctrl-F" to find, and then we will: "Find All" in the Open Document..."Thermal Zone." And...so we will do "Find" in the Open Document and "Find All"; you can see it found in one instance here.
This is the string of text that puts the prefix on those Thermal Zone Names. So let us first get rid of some of these spaces.
We will change it to: "TZ. Then, we will hit: "save," which saves the Ruby file. After that, we have to close out SketchUp and reopen it, and this recompiles the program...
We have reopened it, and you can see right now it is Thermal Zone. If we rerun this User Script and look at the thermal zones again;
You can see it has now been shortened to simply: "TZ." That is how you edit the: "OpenStudio User Scripts"; and in the: "Ruby programming language."
Thank you. Please like and subscribe!
... Complete transcript: https: //www.helix-engineers.net/technical-articles
On this page of the site you can watch the video online OpenStudio SketchUp - Editing the User Script Ruby Programs with a duration of hours minute second in good quality, which was uploaded by the user Helix Energy Partners LLC 07 April 2023, share the link with friends and acquaintances, this video has already been watched 915 times on youtube and it was liked by 13 viewers. Enjoy your viewing!