Skip to content

Commit

Permalink
Merge pull request #100 from openstudiocoalition/develop
Browse files Browse the repository at this point in the history
Merge to master for 1.3.0
  • Loading branch information
macumber authored Dec 16, 2021
2 parents a624f53 + 751daf3 commit 6405981
Show file tree
Hide file tree
Showing 208 changed files with 175 additions and 278 deletions.
2 changes: 1 addition & 1 deletion plugin/openstudio.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

module OpenStudio
SKETCHUPPLUGIN_NAME = "OpenStudio"
SKETCHUPPLUGIN_VERSION = "1.2.1"
SKETCHUPPLUGIN_VERSION = "1.3.0"
SKETCHUPPLUGIN_LAUNCH_GETTING_STARTED_ON_START = false
end

Expand Down
2 changes: 1 addition & 1 deletion plugin/openstudio/lib/DialogManager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def active_interface(interface_class)
#Plugin.log(OpenStudio::Trace, "#{OpenStudio.current_method_name}")

if interface_class == PluginInspectorDialog
return @inspector_dialog
return @inspector_dialog.isVisible
end
return(@dialog_interfaces.find { |interface| interface.is_a? interface_class })
end
Expand Down
230 changes: 80 additions & 150 deletions plugin/openstudio/lib/MenuManager.rb

Large diffs are not rendered by default.

16 changes: 10 additions & 6 deletions plugin/openstudio/lib/PluginManager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def self.current_call_stack
# PluginManager is an App level class, its members correspond to global variables
class PluginManager

attr_reader :name, :version, :dir, :profile_running
attr_reader :name, :version, :dir, :image_ext, :profile_running
attr_reader :event_queue
attr_reader :openstudio_application_dir

Expand All @@ -117,6 +117,8 @@ def initialize
@version = OpenStudio::SKETCHUPPLUGIN_VERSION
@dir = File.dirname(__FILE__) + "/.."
@profile_running = false
@image_ext = platform_select('.svg', '.pdf')
@refresh_toolbars = platform_select(false, true)

# this global variable is set by openstudio.rb
@openstudio_application_dir = eval("$OPENSTUDIO_APPLICATION_DIR")
Expand Down Expand Up @@ -199,7 +201,7 @@ def start
add_event( proc )

if OpenStudio::SKETCHUPPLUGIN_LAUNCH_GETTING_STARTED_ON_START
UI.openURL("http://nrel.github.io/OpenStudio-user-documentation/reference/sketchup_plugin_interface/")
UI.openURL("https://openstudiocoalition.org/reference/sketchup_plugin_interface/")
end

@process_events_timer_id = nil
Expand Down Expand Up @@ -300,6 +302,8 @@ def process_events
msg = "An error occurred in the OpenStudio SketchUp plug-in.\n\n"
msg += "It is advised that you save a backup of your current OpenStudio model and restart SketchUp."
UI.messagebox(msg)
elsif @refresh_toolbars
UI.refresh_toolbars
end

end
Expand Down Expand Up @@ -501,7 +505,7 @@ def disable_logging
end

def log(level, message)
if logging_enabled
if logging_enabled && !message.empty?
#puts "[#{level}] <OpenStudio.SketchUpPlugin> #{message}"
OpenStudio::logFree(level, "OpenStudio.SketchUpPlugin", message)
end
Expand Down Expand Up @@ -542,9 +546,9 @@ def log(level, message)

# initialize QApplication
OpenStudio::ApplicationClass::instance.application(true)
OpenStudio::ApplicationClass::instance.application.setOrganizationName("NREL")
OpenStudio::ApplicationClass::instance.application.setOrganizationDomain("nrel.gov")
OpenStudio::ApplicationClass::instance.application.setApplicationName("OpenStudio")
OpenStudio::ApplicationClass::instance.application.setOrganizationName("OpenStudio Coalition")
OpenStudio::ApplicationClass::instance.application.setOrganizationDomain("openstudiocoalition.org")
OpenStudio::ApplicationClass::instance.application.setApplicationName("OpenStudioSketchUpPlugIn")

# get SketchUp Qt Widget if possible
SketchUpWidget = OpenStudio::ApplicationClass::instance.sketchUpWidget
Expand Down
14 changes: 8 additions & 6 deletions plugin/openstudio/lib/dialogs/html/About.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,21 @@

<center>

<a href="https://openstudiocoalition.org/" target="_blank"><img src="sp_png_256x256.png" border="0"></a>
<a href="https://openstudiocoalition.org/" target="_blank"><img src="os_256.png" border="0" width="250" height="250"></a>

<br>

<span style="font-size:x-large;">OpenStudio SketchUp Plug-in</span><br><br>
SketchUp Plug-in Version:<br><input id="OPENSTUDIO_SKETCHUPPLUGIN_VERSION" name="OPENSTUDIO_SKETCHUPPLUGIN_VERSION" type="text" size="50" class="static_text" style="text-align:center; border:0; border-style:solid;" readonly><br>
OpenStudio Application Dir:<br><input id="OPENSTUDIO_APPLICATION_DIR" name="OPENSTUDIO_APPLICATION_DIR" type="text" size="50" class="static_text" style="text-align:center; border:0; border-style:solid;" readonly><br>
<span style="font-size:x-large;">OpenStudio SketchUp Plug-in</span><br><br><br><br>

<b>SketchUp Plug-in Version:</b><br><input id="OPENSTUDIO_SKETCHUPPLUGIN_VERSION" name="OPENSTUDIO_SKETCHUPPLUGIN_VERSION" type="text" size="50" class="static_text" style="text-align:center; border:0; border-style:solid;" readonly><br>
<a href="https://openstudiocoalition.org/" target="_blank">https://openstudiocoalition.org/</a><br><br>

OpenStudio SDK (core) Version:<br><input id="OPENSTUDIO_VERSION" name="OPENSTUDIO_VERSION" type="text" size="50" class="static_text" style="text-align:center; border:0; border-style:solid;" readonly><br>
<b>OpenStudio Application Dir:</b><br><input id="OPENSTUDIO_APPLICATION_DIR" name="OPENSTUDIO_APPLICATION_DIR" type="text" size="50" class="static_text" style="text-align:center; border:0; border-style:solid;" readonly><br><br>

<b>OpenStudio SDK (core) Version:</b><br><input id="OPENSTUDIO_VERSION" name="OPENSTUDIO_VERSION" type="text" size="50" class="static_text" style="text-align:center; border:0; border-style:solid;" readonly><br>
<a href="https://openstudio.net" target="_blank">https://openstudio.net/</a><br><br>

Copyright &copy; 2020-2021, OpenStudio Coalition and other contributors<br><br>
<b>Copyright &copy; 2020-2021:</b><br>OpenStudio Coalition and other contributors<br><br>

<input id="ok" onclick="onOK()" type="button" class="button" value=" OK ">

Expand Down
4 changes: 2 additions & 2 deletions plugin/openstudio/lib/dialogs/html/SurfaceMatching.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
<body onload="onLoad()" link="#0000FF" alink="#0000FF" vlink="#0000FF" class="label">

<fieldset>
<legend>Intersect and Divide Inter-Zone Surfaces <a href="http://nrel.github.io/OpenStudio-user-documentation/reference/sketchup_plugin_interface/#surface-matching" target="_blank">(help)</a></legend>
<legend>Intersect and Divide Inter-Zone Surfaces <a href="http://openstudiocoalition.org/reference/sketchup_plugin_interface/#surface-matching" target="_blank">(help)</a></legend>

<i>Some users have reported issues with the intersect functionality in this dialog. If you experience problems, please try to using the "IntersectSpaceGeometry" user script.</i>

Expand All @@ -58,7 +58,7 @@


<fieldset>
<legend>Surface Matching <a href="http://http://nrel.github.io/OpenStudio-user-documentation/reference/sketchup_plugin_interface/#surface-matching" target="_blank">(help)</a></legend>
<legend>Surface Matching <a href="http://openstudiocoalition.org/reference/sketchup_plugin_interface/#surface-matching" target="_blank">(help)</a></legend>

<table border="0" cellpadding="4" width="100%" align="center">

Expand Down
2 changes: 1 addition & 1 deletion plugin/openstudio/lib/dialogs/html/SurfaceSearch.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<body onload="onLoad()" link="#0000FF" alink="#0000FF" vlink="#0000FF" class="label">

<fieldset>
<legend>Surface Search <a href="http://nrel.github.io/OpenStudio-user-documentation/reference/sketchup_plugin_interface/#surface-search" target="_blank">(help)</a></legend>
<legend>Surface Search <a href="https://openstudiocoalition.org/reference/sketchup_plugin_interface/#surface-search" target="_blank">(help)</a></legend>

<table border="0" cellpadding="4" width="100%" align="center">

Expand Down
Binary file added plugin/openstudio/lib/dialogs/html/os_256.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
15 changes: 12 additions & 3 deletions plugin/openstudio/lib/interfaces/PlanarSurface.rb
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ def update_entity
Plugin.log(OpenStudio::Info, "redraw polygon")

# do the erasing now
group = self.OpenStudio.get_drawing_interface(containing_entity)
group = OpenStudio.get_drawing_interface(containing_entity)
group_had_observers = group.remove_observers if group
all_children = recurse_children
erase_entity
Expand Down Expand Up @@ -686,9 +686,14 @@ def model_object_polygon=(polygon)

vertices = vertices_from_polygon(polygon)

Plugin.log(OpenStudio::Info, "model_object_polygon=, polygon = #{polygon.points}")
Plugin.log(OpenStudio::Info, "vertices=, #{vertices.class} #{vertices}")
Plugin.log(OpenStudio::Info, "polygon = #{polygon.points}")
Plugin.log(OpenStudio::Info, "vertices= #{vertices.map {|v| v.to_s}}")
old_tilt = OpenStudio::radToDeg(@model_object.tilt)
@model_object.setVertices(vertices)
new_tilt = OpenStudio::radToDeg(@model_object.tilt)
if old_tilt != new_tilt
on_tilt_updated(old_tilt, new_tilt)
end
end

# unknown if vertices_from_polygon may throw
Expand All @@ -706,6 +711,10 @@ def vertices_from_polygon(polygon)
return vertices
end

# Override in subclasses.
def on_tilt_updated(old_tilt, new_tilt)
end

# Override in subclasses.
def paint_surface_type(info=nil)
Plugin.log(OpenStudio::Trace, "#{OpenStudio.current_method_name}")
Expand Down
13 changes: 13 additions & 0 deletions plugin/openstudio/lib/interfaces/Surface.rb
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,19 @@ def on_undelete_entity(entity)

##### Begin override methods for the interface #####

def on_tilt_updated(old_tilt, new_tilt)
super

# SU 2021 and above create new floor faces pointing up but then reverse them on extrude
if old_tilt && new_tilt && (old_tilt - new_tilt).abs > 179
@model_object.assignDefaultSurfaceType
@model_object.assignDefaultBoundaryCondition
@model_object.assignDefaultSunExposure
@model_object.assignDefaultWindExposure
paint_entity
end
end

def paint_surface_type(info=nil)
Plugin.log(OpenStudio::Trace, "#{OpenStudio.current_method_name}")

Expand Down
12 changes: 6 additions & 6 deletions plugin/openstudio/lib/observers/FaceObserver.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,15 @@ def onChangeEntity(entity)

#Plugin.log(OpenStudio::Trace, "#{OpenStudio.current_method_name}, @drawing_interface = #{@drawing_interface.class}")

# when push/pull tool is used not all changed faces will get this observer called
if(Sketchup.active_model.tools.active_tool_id == 21041) # PushPullTool
#Plugin.log(OpenStudio::Trace, "#{OpenStudio.current_method_name}, calling @drawing_interface.parent.on_change_entity")
@drawing_interface.parent.on_change_entity

# Need to check the parent entity to make sure this face didn't find itself outside of a Group after an explode.
elsif (@drawing_interface.valid_entity? and @drawing_interface.parent_from_entity)
if (@drawing_interface.valid_entity? and @drawing_interface.parent_from_entity)
#Plugin.log(OpenStudio::Trace, "#{OpenStudio.current_method_name}, calling @drawing_interface.on_change_entity")
@drawing_interface.on_change_entity

# when push/pull tool is used not all changed faces will get this observer called
if(Sketchup.active_model.tools.active_tool_id == 21041) # PushPullTool
@drawing_interface.parent.on_change_entity
end
end

end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ def onElementAdded(entities, entity)

return if not @enabled

return if entity.is_a?(Sketchup::Edge)

proc = Proc.new {

Plugin.log(OpenStudio::Info, "SurfaceGroupEntitiesObserver.onElementAdded: adding #{entity} to #{@drawing_interface.entity}")
Expand Down
Binary file added plugin/openstudio/lib/resources/icons.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed plugin/openstudio/lib/resources/icons/Forward16.png
Binary file not shown.
Binary file removed plugin/openstudio/lib/resources/icons/Forward24.png
Binary file not shown.
Binary file removed plugin/openstudio/lib/resources/icons/ForwardFull16.png
Binary file not shown.
Binary file removed plugin/openstudio/lib/resources/icons/ForwardFull24.png
Binary file not shown.
Binary file removed plugin/openstudio/lib/resources/icons/Help-16.png
Binary file not shown.
Binary file removed plugin/openstudio/lib/resources/icons/Help-24.png
Binary file not shown.
Binary file removed plugin/openstudio/lib/resources/icons/HideRest-16.png
Binary file not shown.
Binary file removed plugin/openstudio/lib/resources/icons/HideRest-24.png
Binary file not shown.
Binary file removed plugin/openstudio/lib/resources/icons/IDFExport-16.png
Binary file not shown.
Binary file removed plugin/openstudio/lib/resources/icons/IDFExport-24.png
Binary file not shown.
Binary file removed plugin/openstudio/lib/resources/icons/IDFImport-16.png
Binary file not shown.
Binary file removed plugin/openstudio/lib/resources/icons/IDFImport-24.png
Binary file not shown.
Binary file removed plugin/openstudio/lib/resources/icons/InfoTool-16.png
Binary file not shown.
Binary file not shown.
Binary file removed plugin/openstudio/lib/resources/icons/Inspector-16.png
Binary file not shown.
Binary file not shown.
Binary file removed plugin/openstudio/lib/resources/icons/ModelMaker-16.png
Binary file not shown.
Binary file not shown.
Binary file not shown.
Diff not rendered.
Binary file removed plugin/openstudio/lib/resources/icons/NewGlare-16.png
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Binary file removed plugin/openstudio/lib/resources/icons/NewShading-16.png
Diff not rendered.
Binary file removed plugin/openstudio/lib/resources/icons/NewShading-24.png
Diff not rendered.
Binary file removed plugin/openstudio/lib/resources/icons/NewSpace-16.png
Diff not rendered.
Binary file removed plugin/openstudio/lib/resources/icons/NewSpace-24.png
Diff not rendered.
Binary file not shown.
1 change: 1 addition & 0 deletions plugin/openstudio/lib/resources/icons/OSC_IDFexport.svg
Binary file not shown.
1 change: 1 addition & 0 deletions plugin/openstudio/lib/resources/icons/OSC_IDFimport.svg
Binary file not shown.
Binary file not shown.
Loading

0 comments on commit 6405981

Please sign in to comment.