Question-and-Answer Resource for the Building Energy Modeling Community
Get started with the Help page
Ask Your Question

Geometry diagnostic steps in OpenStudio Sketchup mode

asked 2014-12-01 11:04:18 -0500

xfang's avatar

When we generate a geometry in OpenStudio Sketchup mode, for someone not so experienced, it's common to see the geometry generated, surface matching working fine, and we save and close the file thinking it's all good to go. And then we reopen the Sketchup .osm file, only to find the model file is open in all wire frame mode with no surfaces shown, and we get all frustrated but not really knowing what went wrong. Sometimes, we run the OSM diagnostic script and reopen the diagnostic.osm file and things are fixed, but other times, we are not so lucky and end up recreating the entire geometry from step 1. Is there a way or code to follow to diagnose what went wrong when I reopen the .osm file so we can find the problem surfaces or sub-surfaces that accidentally didn't get created correctly? That would save us tons of time.

edit retag flag offensive close merge delete


@macumber I am also not familiar with code and I have only recently started using sketchup and openstudio. I tried to follow your steps but I am a bit lost. Could you please explain what it means to to "loop"? I made an array by copying your script and I got this:

all_entities = [] Sketchup.active_model.entities.each {|e| all_entities.concat(e.entities.to_a) if e.typename == "Group" }


But I don't know what the next steps mean exactly. I would really appreciate your help. Thanks in advance!

Mana.Fana's avatar Mana.Fana  ( 2018-08-14 01:49:38 -0500 )edit

3 Answers

Sort by ยป oldest newest most voted

answered 2014-12-01 11:14:23 -0500

Hey @xfang, I'm sorry that this happens to you, we are working on plans to help avoid these types of situations. However, in the meantime if this happens to you here are some steps you can use to try to find the problem objects in your model. When you first start SketchUp, open the Ruby console by going to "Window->Ruby Console". Then open the OSM file that you are having trouble with. You will likely see some messages like this:

Counterclockwise:  Fix unintended reversed face
Space.cleanup_entity:  unhandled swap for #<Sketchup::Face:0x203cfa44>
Space.cleanup_entity:  duplicate drawing interface for #<Sketchup::Face:0x20476aec>, #<Sketchup::Face:0x203cfa44>
DrawingInterface.create_from_entity:  create_model_object failed

This tells you that the plugin had trouble drawing SketchUp faces 0x203cfa44 and 0x20476aec. However, it doesn't tell you which OpenStudio model objects those correspond to. You can use the SketchUp Ruby API to find these. First, make an array of all SketchUp entities within groups:

all_entities = []
Sketchup.active_model.entities.each {|e| all_entities.concat(e.entities.to_a) if e.typename == "Group" }

Then loop through these looking for the problem SketchUp faces:

found_entities = []
all_entities.each {|e| found_entities << e if (e.to_s == "#<Sketchup::Face:0x1e69b838>" || e.to_s == "#<Sketchup::Face:0x1ea7cf88>")}

Finally, print the OpenStudio handle associated with these SketchUp faces:

found_entities.each {|e| puts e.model_object_handle }

You can close SketchUp, find these problem objects in your OSM using a text editor, delete the problem objects (make sure to save a backup of your OSM first!), then re-open in SketchUp. Hopefully this will allow you to get started working with your model again.

edit flag offensive delete link more


@xfang The code above will work with SketchUp 8 as well as SketchUp 2014

macumber's avatar macumber  ( 2014-12-01 11:15:04 -0500 )edit

Thanks @macumber!!! This totally works!! Made my day!!

xfang's avatar xfang  ( 2014-12-01 11:29:23 -0500 )edit

Hey @macumber, your solution worked for me as well on a similar issue to the OP. Thanks!

NickC's avatar NickC  ( 2015-08-06 09:32:31 -0500 )edit

@macumber: this code no longer works in Sketchup 2016.

xfang's avatar xfang  ( 2016-01-19 16:44:10 -0500 )edit

Hi @xfang, what is no longer working? I just tried it and it works for me. The actual identifiers (e.g. "#<sketchup::face:0x1e69b838>") will change from model to model but the rest of the code is working in SketchUp 2016 with OS 1.10.

macumber's avatar macumber  ( 2016-01-19 18:36:19 -0500 )edit

answered 2016-02-05 16:36:20 -0500

xfang's avatar

@macumber: it's working. My bad for not responding promptly. I didn't copy the right identifiers.

edit flag offensive delete link more


@xfang can you move this from the answers section to a comment?

MatthewSteen's avatar MatthewSteen  ( 2016-02-05 17:38:15 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Training Workshops

Question Tools



Asked: 2014-12-01 11:04:18 -0500

Seen: 3,053 times

Last updated: Mar 08 '16