First time here? Check our help page!
2

SketchUp Measure Multiplier to Selected Thermal Zones

I am attempting to write a Sketchup Measure that takes the selected Thermal Zones and applies a Multiplier to them from a user input.

The code is below but I am having two problems:

  • (Solved) I am getting an end-of-file error that I can't figure out.
    • I discovered that a next if does not require an end.
  • Defining the multiplier to the thermal zone is not working. I don't believe my method is correct.

I iterate through each thermal zone and try to override the multiplier using:

thermal_zone.multiplier = 2

Is this the correct method or does it operate more like:

thermal_zone.multiplier(2)

I have also tried:

thermal_zone.setMultiplier(2)

My code can be found here GitHub

EDIT 10/15/2019

The script is now working and can be found at the above GitHub link. The solution was a combination of factors. @Julien Marrec answer below helped find several errors and troubleshoot.

The biggest mistake was that it doesn't appear the runner.isSelection() works on thermal zones in SketchUp as the interface is highlighting spaces, not thermal zones.

Instead, I had to use the runner.isSelection() on a space and then get the thermal zone for that space. After getting the thermal zone I could use the .setMultiplier(int) function that @Julien Marrec highlighted.

JustinShultz's avatar
1.3k
JustinShultz
asked 2019-10-14 15:07:37 -0500
__AmirRoth__'s avatar
4.4k
__AmirRoth__
updated 2020-01-18 10:14:02 -0500
edit flag offensive 0 remove flag close merge delete

Comments

It probably depends on what Rendering mode you're in. If you switch to Render by Thermal Zone, it probably selects thermal zones. (you can see what the inspector shows...)

Julien Marrec's avatar Julien Marrec (2019-10-15 15:22:00 -0500) edit

That is a really good tip! I didn't realize that render by thermal zone would select the thermal zones. I'll try another script that takes this into account.

JustinShultz's avatar JustinShultz (2019-10-15 15:30:20 -0500) edit
add a comment see more comments

1 Answer

3

The SDK Documentation is your friend. See ThermalZone:

bool openstudio::model::ThermalZone::setMultiplier(int multiplier)

From a cursory look, on line 71 you aren't using the right method either, you have a typo here, registerAsNotApplication:

virtual void openstudio::measure::OSRunner::registerAsNotApplicable     (   const std::string &     message )

SDK doc for OSRunner

Julien Marrec's avatar
29.7k
Julien Marrec
answered 2019-10-14 16:06:40 -0500, updated 2019-10-14 16:11:08 -0500
edit flag offensive 0 remove flag delete link

Comments

add a comment see more comments