{"action":"created","issue":{"url":"https://api.github.com/repos/NREL/OpenStudio/issues/937","labels_url":"https://api.github.com/repos/NREL/OpenStudio/issues/937/labels{/name}","comments_url":"https://api.github.com/repos/NREL/OpenStudio/issues/937/comments","events_url":"https://api.github.com/repos/NREL/OpenStudio/issues/937/events","html_url":"https://github.com/NREL/OpenStudio/issues/937","id":30135450,"number":937,"title":"Create From External File + facility.exteriorLights crashes ruby","user":{"login":"asparke2","id":2009290,"avatar_url":"https://avatars.githubusercontent.com/u/2009290?v=3","gravatar_id":"","url":"https://api.github.com/users/asparke2","html_url":"https://github.com/asparke2","followers_url":"https://api.github.com/users/asparke2/followers","following_url":"https://api.github.com/users/asparke2/following{/other_user}","gists_url":"https://api.github.com/users/asparke2/gists{/gist_id}","starred_url":"https://api.github.com/users/asparke2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/asparke2/subscriptions","organizations_url":"https://api.github.com/users/asparke2/orgs","repos_url":"https://api.github.com/users/asparke2/repos","events_url":"https://api.github.com/users/asparke2/events{/privacy}","received_events_url":"https://api.github.com/users/asparke2/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/NREL/OpenStudio/labels/severity%20-%20Major%20Bug","name":"severity - Major Bug","color":"eb6420"}],"state":"open","locked":false,"assignee":{"login":"macumber","id":1327850,"avatar_url":"https://avatars.githubusercontent.com/u/1327850?v=3","gravatar_id":"","url":"https://api.github.com/users/macumber","html_url":"https://github.com/macumber","followers_url":"https://api.github.com/users/macumber/followers","following_url":"https://api.github.com/users/macumber/following{/other_user}","gists_url":"https://api.github.com/users/macumber/gists{/gist_id}","starred_url":"https://api.github.com/users/macumber/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/macumber/subscriptions","organizations_url":"https://api.github.com/users/macumber/orgs","repos_url":"https://api.github.com/users/macumber/repos","events_url":"https://api.github.com/users/macumber/events{/privacy}","received_events_url":"https://api.github.com/users/macumber/received_events","type":"User","site_admin":false},"milestone":null,"comments":4,"created_at":"2014-03-25T15:47:41Z","updated_at":"2015-07-24T22:37:07Z","closed_at":null,"body":"If you have a model and run the \"AddExteriorLights\" measure, the measure works fine.  However, if you create a PAT project, load this same model as a design alternative using the \"Create From External File\" feature, and have \"AddExteriorLights\" as an always-run measure, ruby crashes on the last line of this code inside the \"AddExteriorLights\" measure:\r\n```ruby\r\n    facility = model.getFacility\r\n    starting_exterior_lights_power = 0\r\n    starting_exterior_lights = facility.exteriorLights\r\n```\r\nThis was reproduced with 1.2.4 and 1.2.5\r\n@elainethale Perhaps something to do with how \"ReplaceModel\" is copying the model?\r\n"},"comment":{"url":"https://api.github.com/repos/NREL/OpenStudio/issues/comments/124750197","html_url":"https://github.com/NREL/OpenStudio/issues/937#issuecomment-124750197","issue_url":"https://api.github.com/repos/NREL/OpenStudio/issues/937","id":124750197,"user":{"login":"asparke2","id":2009290,"avatar_url":"https://avatars.githubusercontent.com/u/2009290?v=3","gravatar_id":"","url":"https://api.github.com/users/asparke2","html_url":"https://github.com/asparke2","followers_url":"https://api.github.com/users/asparke2/followers","following_url":"https://api.github.com/users/asparke2/following{/other_user}","gists_url":"https://api.github.com/users/asparke2/gists{/gist_id}","starred_url":"https://api.github.com/users/asparke2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/asparke2/subscriptions","organizations_url":"https://api.github.com/users/asparke2/orgs","repos_url":"https://api.github.com/users/asparke2/repos","events_url":"https://api.github.com/users/asparke2/events{/privacy}","received_events_url":"https://api.github.com/users/asparke2/received_events","type":"User","site_admin":false},"created_at":"2015-07-24T22:37:07Z","updated_at":"2015-07-24T22:37:07Z","body":"Actually accidentally just reproduced again with the Measure AddCostperFloorAreaToUnusedLights.  It works fine when applied to the seed model, it just crashes with the following error on the External File model (which is the same model as the seed model in my case).\r\n\r\n```\r\nC:/Users/aparker/Desktop/Testing/PAT External File/PEA Example 180/dataPoint18/236-UserScript/mergedjob-1/user_script.rb:34:in `quantity': bad_weak_ptr (RuntimeError)\r\n\r\n\tfrom C:/Users/aparker/Desktop/Testing/PAT External File/PEA Example 180/dataPoint18/236-UserScript/mergedjob-1/user_script.rb:34:in `block in arguments'\r\n\r\n\tfrom C:/Users/aparker/Desktop/Testing/PAT External File/PEA Example 180/dataPoint18/236-UserScript/mergedjob-1/user_script.rb:32:in `map'\r\n\r\n\tfrom C:/Users/aparker/Desktop/Testing/PAT External File/PEA Example 180/dataPoint18/236-UserScript/mergedjob-1/user_script.rb:32:in `arguments'\r\n\r\n\tfrom mergedjob-0/in.rb:266:in `<main>'\r\n```\r\nwhich points to:\r\n```\r\nif value.quantity > 0 and not value.wattsperSpaceFloorArea.empty?\r\n```\r\nSeems like something is different after a model is loaded from external file vs. how the seed model is loaded.\r\n\r\n\r\n\r\n"}}