Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More robust 'addSkylights' (+ dependencies) #20

Merged
merged 3 commits into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions lib/osut/utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ module OSut
# DEBUG for devs; WARN/ERROR for users (bad OS input), see OSlg
extend OSlg

TOL = 0.01 # default distance tolerance (m)
TOL2 = TOL * TOL # default area tolerance (m2)
DBG = OSlg::DEBUG # see github.com/rd2/oslg
INF = OSlg::INFO # see github.com/rd2/oslg
WRN = OSlg::WARN # see github.com/rd2/oslg
ERR = OSlg::ERROR # see github.com/rd2/oslg
FTL = OSlg::FATAL # see github.com/rd2/oslg
NS = "nameString" # OpenStudio object identifier method
TOL = 0.01 # default distance tolerance (m)
TOL2 = TOL * TOL # default area tolerance (m2)
DBG = OSlg::DEBUG.dup # see github.com/rd2/oslg
INF = OSlg::INFO.dup # see github.com/rd2/oslg
WRN = OSlg::WARN.dup # see github.com/rd2/oslg
ERR = OSlg::ERROR.dup # see github.com/rd2/oslg
FTL = OSlg::FATAL.dup # see github.com/rd2/oslg
Copy link
Member Author

@brgix brgix Oct 4, 2024

Choose a reason for hiding this comment

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

This is an attempt to circumvent (often numerous) Ruby warnings related to duplication of constants. These pop up when building/using parent applications relying on gems (like TBD), which have OSut as a dependency. That's possibly 3 to 4 gems harmonizing constants, while trying to keep things concise (e.g. not having to drag module namespaces if extended). It will take a while to update/build/test larger, multi-gem applications before making a definitive decision.

NS = "nameString" # OpenStudio object identifier method

HEAD = 2.032 # standard 80" door
SILL = 0.762 # standard 30" window sill
Expand Down Expand Up @@ -4335,7 +4335,7 @@ def boundedBox(pts = nil)
# cloned polygon vertices are rotated so the longest axis of symmetry of its
# bounded box lies parallel to the X-axis; :o being the midpoint of the narrow
# side (of the bounded box) nearest to grid origin (0,0,0). If the axis of
# symmetry of the boudned box is already parallel to the X-axis, then the
# symmetry of the bounded box is already parallel to the X-axis, then the
# rotation step is skipped (unless force == true). Whether rotated or not,
# polygon vertices are then translated as to ensure one or more vertices are
# aligned along the X-axis and one or more vertices are aligned along the
Expand Down Expand Up @@ -4489,7 +4489,7 @@ def alignedHeight(pts = nil, force = false)
# corner of one or more (smaller) subsets (free-floating within the parent)
# - see follow-up 'genInserts'. Subsets may hold several 'tagged' vertices
# (e.g. :box, :cbox). By default, the solution seeks to anchor subset :box
# vertices. Users can select other tags, e.g. tag == :cbox). The solution
# vertices. Users can select other tags, e.g. tag == :cbox. The solution
# minimally validates individual subsets (e.g. no self-intersecting polygons,
# coplanarity, no inter-subset conflicts, must fit within larger set).
# Potential leader lines cannot intersect each other, similarly tagged subsets
Expand Down Expand Up @@ -4972,7 +4972,7 @@ def genInserts(s = nil, set = [])
# 'sides' rely on space coordinates (not building or site coordinates). Also,
# 'sides' are exclusive (not inclusive), e.g. walls strictly north-facing or
# strictly east-facing would not be returned if 'sides' holds [:north, :east].
# No outside boundary consition filters if 'boundary' argument == "all". No
# No outside boundary condition filters if 'boundary' argument == "all". No
# surface type filters if 'type' argument == "all".
#
# @param spaces [Set<OpenStudio::Model::Space>] target spaces
Expand Down Expand Up @@ -6114,7 +6114,7 @@ def toToplit(spaces = [], opts = {})
# modellers to correctly flag such cases - can't safely guess in lieu of
# design/modelling team.
#
# A friendly reminder: 'addSkylights 'should be called separately for
# A friendly reminder: 'addSkylights' should be called separately for
# strictly SEMIHEATED spaces vs REGRIGERATED spaces vs all other CONDITIONED
# spaces, as per 90.1 and NECB requirements.
if spaces.respond_to?(:spaceType) || spaces.respond_to?(:to_a)
Expand Down
18 changes: 9 additions & 9 deletions spec/osut_tests_spec.rb
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
require "osut"

RSpec.describe OSut do
TOL = OSut::TOL
TOL2 = TOL * TOL
DBG = OSut::DEBUG
INF = OSut::INFO
WRN = OSut::WARN
ERR = OSut::ERR
FTL = OSut::FATAL
HEAD = OSut::HEAD
SILL = OSut::SILL
TOL = OSut::TOL.dup
TOL2 = OSut::TOL2.dup
DBG = OSut::DEBUG.dup
INF = OSut::INFO.dup
WRN = OSut::WARN.dup
ERR = OSut::ERR.dup
FTL = OSut::FATAL.dup
HEAD = OSut::HEAD.dup
SILL = OSut::SILL.dup

let(:cls1) { Class.new { extend OSut } }
let(:cls2) { Class.new { extend OSut } }
Expand Down
2 changes: 2 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
# Disable RSpec exposing methods globally on `Module` and `main`
config.disable_monkey_patching!

# config.warnings = true
Copy link
Member Author

Choose a reason for hiding this comment

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

Sometimes useful to switch on during development.


config.expect_with :rspec do |c|
c.syntax = :expect
end
Expand Down
Loading