Skip to content

Conversation

@jmarrec
Copy link
Collaborator

@jmarrec jmarrec commented Mar 20, 2025

Pull request overview

Pull Request Author

  • Model API Changes / Additions
  • Any new or modified fields have been implemented in the EnergyPlus ForwardTranslator (and ReverseTranslator as appropriate)
  • Model API methods are tested (in src/model/test)
  • EnergyPlus ForwardTranslator Tests (in src/energyplus/Test)
  • If a new object or method, added a test in NREL/OpenStudio-resources: Add Link
  • If needed, added VersionTranslation rules for the objects (src/osversion/VersionTranslator.cpp)
  • Verified that C# bindings built fine on Windows, partial classes used as needed, etc.
  • All new and existing tests passes
  • If methods have been deprecated, update rest of code to use the new methods

Labels:

  • If change to an IDD file, add the label IDDChange
  • If breaking existing API, add the label APIChange
  • If deemed ready, add label Pull Request - Ready for CI so that CI builds your PR

Review Checklist

This will not be exhaustively relevant to every PR.

  • Perform a Code Review on GitHub
  • Code Style, strip trailing whitespace, etc.
  • All related changes have been implemented: model changes, model tests, FT changes, FT tests, VersionTranslation, OS App
  • Labeling is ok
  • If defect, verify by running develop branch and reproducing defect, then running PR and reproducing fix
  • If feature, test running new feature, try creative ways to break it
  • CI status: all green or justified

jmarrec added 3 commits March 20, 2025 11:41
```
2652: /Users/julien/Software/Others/OpenStudio/src/model/test/ThreeJSForwardTranslator_GTest.cpp:427: Failure
2652: Expected equality of these values:
2652:   1
2652:   m.getConcreteModelObjects<RenderingColor>().size()
2652:     Which is: 2
```
@jmarrec jmarrec added severity - Minor Bug Pull Request - Ready for CI This pull request if finalized and is ready for continuous integration verification prior to merge. component - Geometry Translator labels Mar 20, 2025
@jmarrec jmarrec self-assigned this Mar 20, 2025
EXPECT_TRUE(checkIfMaterialExist(materials, "AirWall"));
}

TEST_F(ModelFixture, ThreeJSForwardTranslator_AirLoopHVAC_RenderingColors) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New test that creates an AirLoopHVAC, call modelToThreeJS twice and ensure we don't end up with 2 RenderingColors

Comment on lines +68 to +72
std::string name = getObjectThreeMaterialName(construction);
boost::optional<RenderingColor> color = construction.renderingColor();
if (!color) {
color = RenderingColor(model);
color->setName(name);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For all objects, name the rendering color!

Comment on lines 138 to 147
for (auto& airLoopHVAC : model.getConcreteModelObjects<AirLoopHVAC>()) {
std::string name = getObjectThreeMaterialName(airLoopHVAC);
boost::optional<RenderingColor> color = RenderingColor(model);
// AirLoopHVAC does not have a renderingColor method
boost::optional<RenderingColor> color = model.getConcreteModelObjectByName<RenderingColor>(name);
if (!color) {
color = RenderingColor(model);
color->setName(name);
}
addThreeMaterial(materials, materialMap,
makeThreeMaterial(name, toThreeColor(color->renderingRedValue(), color->renderingBlueValue(), color->renderingGreenValue()), 1,
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For AirLoopHVAC, where we don't have a renderingColor method, we check if the model contains the aptly-named one first before creating.

If we create it, we name it.

all good!

@jmarrec jmarrec merged commit 455bb64 into develop Mar 31, 2025
5 of 6 checks passed
@jmarrec jmarrec deleted the 5309-ThreeJSExtraRenderingCOlors branch March 31, 2025 09:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component - Geometry Translator Pull Request - Ready for CI This pull request if finalized and is ready for continuous integration verification prior to merge. severity - Minor Bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ThreeJSForwardTranslator adds unnecessary RenderingColor objects for AirLoopHVAC

4 participants