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

Geometry diagnostic steps in OpenStudio Sketchup mode

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

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

Comments

@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" }

<sketchup::entities:0x0002653ecd84d0>

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 -0600 )edit

3 Answers

Sort by » oldest newest most voted
9

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

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

Comments

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

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

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

xfang's avatar xfang  ( 2014-12-01 11:29:23 -0600 )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 -0600 )edit

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

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

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 -0600 )edit
1

Hi @macumber, yeah, I used the unhandled swap entities. I tried again this morning, it generated one problematic surface. So it's working. Sorry for the confusion. Still very useful!

xfang's avatar xfang  ( 2016-01-20 11:12:49 -0600 )edit

Hi @macumber,,As you said, first I made an array of all SketchUp entities within groups by your scripts(code) and I got this: Done. Ruby says: #<sketchup::entities:0x0000004bc8a528> But when I ran your scrip(code) to loop through these looking for the problem SketchUp faces: I got this error Done. Ruby says: undefined local variable or method ‘all_entities’ for #<as_rubyeditor::rubyeditor:0x000000535dff18> Could you please let me know what is wrong? my sketchup is 2016 with OS 1.10.0,Thanks in advance.

4Designer's avatar 4Designer  ( 2016-03-06 08:47:31 -0600 )edit

@Khub, what is 'as_rubyeditor'? Are you using some plugin editor or something? In order to use the variable all_entities you need to use it in the same scope as you have created it and populated it. I recommend copying these commands directly into the SketchUp Ruby console and executing them one after another.

macumber's avatar macumber  ( 2016-03-06 10:34:57 -0600 )edit

Hi @macumber, yeah I did not know this and I used plugin Ruby code editor,thank you for your response,now I go to try directly into the SketchUp Ruby console and executing them.

4Designer's avatar 4Designer  ( 2016-03-08 02:50:32 -0600 )edit

@macumber, first of all I made an array of all SketchUp entities within groups by your command and I got this:#<Sketchup::Entities:0x0000004c129098> and when I ran your command to loop through these looking for the problem SketchUp faces I got tons of output:#<Sketchup::ConstructionPoint:0x00000050f9eca0>, #<Sketchup::Edge:0x00000053e8b9f0>, #<Sketchup::Edge:0x00000053e8b950>, #<Sketchup::Edge:0x00000053e8b8d8>, #<Sketchup::Edge:0x00000053e8b860>, #<Sketchup::Face:0x00000050fcd988>, #<Sketchup::Edge:0x00000053e8b7c0> ,...and so on.

4Designer's avatar 4Designer  ( 2016-03-08 03:05:54 -0600 )edit

Finally I executed command of printing the OpenStudio handle associated with these SketchUp faces, but unfortunately nothing happened , there was no output, would you please let me know whats wrong?

4Designer's avatar 4Designer  ( 2016-03-08 03:12:33 -0600 )edit

Hello @macumber , I'm not very familiar with code, so I got a few issues to run this. I make an array of all SketchUp entities within groups by copying the text that you shared. But after that for the loop, I don't know what to put, which face to pic. Could you precise how we fill the loop? Thank you very much in advance for your answer

lcmbs's avatar lcmbs  ( 2016-11-07 15:13:09 -0600 )edit
0

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

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

Comments

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

MatthewSteen's avatar MatthewSteen  ( 2016-02-05 17:38:15 -0600 )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

Careers

Question Tools

3 followers

Stats

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

Seen: 3,449 times

Last updated: Mar 08 '16