If you experience lag in SketchUp after importing geometry from another program, the tips I’m going to share in this post will help you speed up your model. From simple things like choosing a fast style and assigning geometry to layers in order to limit what is visible, to advanced tips like writing a custom Ruby script to process the model, you are guaranteed to learn something in this article.
Simple fixes for Performance
There are many times where you need to import a model that was exported from another program. For example, a truss manufacturer might use the specialized software from Mitek, called Sapphire. You might request a 3D DWG export from the subcontractor to import into SketchUp in order to analyze how the trusses sit on the building.
After a raw import into SketchUp by going to File > Import, and selecting the appropriate file type from the dropdown menu, you’re left with a slow, laggy, juttery, slog of a model to work in.
So what are some things you can do to speed up this model?
Fast Style = Fast Render
The very first thing you should do is change the style to something that is very simple. By simple, I mean something that renders a straight edge (no sketchy edges, extensions, profiles, etc), and a style that displays solid colors instead of textures. There are actually little icons in the style thumbnails to help you identify styles that can render quickly. Go to Window > Default Tray > Styles to view the Styles panel.
I’d recommend choosing Shaded. This style uses simple edges, and solid colors on the faces. But any of the fast styles will work well.
I know it sounds crazy, but it’s sometimes worth going a step further and turning edges off altogether, which you can do by overriding the style setting manually in the Edit tab of the Styles panel. This will get you a slight performance boost as well, but it will be harder to see the model because only the faces will render. This can be temporary, just to give you a bit more performance while you complete additional performance tweaks.
And of course, it goes without saying that you should not have View > Shadows or View > Fog turned on if you are having performance issues. Fog and shadows take up a lot of processing power.
Purge or Hide Layers
Next, hide or delete layers that contain geometry that you don’t need. Of course, if you can help it, you’d talk to your subcontractor and ask that they only export what you need, and nothing else. But sometimes, due to the limitations of the software export, you don’t have the ability to limit certain things from being exported. Sometimes it’s worth opening the CAD file in a CAD program to remove things you don’t need, before importing it into SketchUp.
Regardless, if you’ve imported geometry into SketchUp that you don’t need, you can just go to the Layers panel, and select the layers that you don’t need, and click the minus sign. Holding down CTRL will allow you to select multiple layers at once. This will prompt you to ask what you want to do with the geometry on the layers you are deleting. It can either be moved to a new layer, or deleted from the model. If you’re unsure about geometry on a layer, you can always just hide it for now, and that will help increase performance too.
Group/Component Navigation
SketchUp Pro has a great organizational tool called the Outliner, which displays a hierarchy of groups and components in your model. Unfortunately, in large models, there is a significant lag experienced if you have the Outliner panel open while navigating in and out of groups/components. So, in large models, try to keep the Outliner window closed.
When double-clicking in and out of groups/components, it can also be really beneficial to enable View > Component Edit > Hide Rest of Model. This will only display the entities that are inside of the group/component you are editing, which greatly increases performance as well.
Divide the model
One of the best things you can do to increase performance is to reduce the amount of geometry that is visible on the screen at any given moment. So if you can identify ways to divide your model into groups that can be assigned to layers that we can keep hidden while we aren’t working on them, that will greatly improve the performance.
In this example, it would seem logical to group these trusses by floor, and then only have one floor visible at once. So I can drag a selection box around all entities on the first floor, right-click > Make Group, then assign that group to the LO_1st Floor layer. Then repeat that process on the 2nd floor trusses and the roof trusses.
OpenGL settings
There are some settings you can toggle in Window > Preferences to help speed up performance. Your experience may vary, but with this model at least, these improvements didn’t offer too much of a difference in performance.
- Anti-Aliasing – Set to lower number to increase performance. (Lines will appear more jagged.)
- Max texture size – Disable this to restrict textures to 1024×1024.
- Fast Feedback – Enable Fast feedback. (Honestly, no idea what this does, but SketchUp Help suggests having this on, especially in large models)
Advanced performance tweaks
SketchUp doesn’t do well with models that have a lot of polygons, but it can also get bogged down when there are a lot of poorly organized components. In this specific example, I think the lag is really coming down to the fact that every single object inside each truss, is actually a unique component.
Instead of using a single component definition everywhere an identical object appears, the model defines a new, separate component definition. It’s crazy.
Like the metal mending plates probably repeat hundreds of times throughout the model, but they import as unique components. Honestly, for what I need, I’d prefer not even having these plates import at all, so it’s just insult to injury. There are many other objects that could be proper component copies, but they just don’t import that way. Looking at Window > Model Info > Statistics, I see that there are 19592 unique component definitions. Yikes!
Aside from getting a better quality file from the source, is there anything else that can be done to speed up this model?
Custom Ruby scripting
The answer is yes. It’s not an easy solution, but it is incredibly powerful. Using a custom Ruby script that interfaces with the SketchUp API, I can programmatically loop through every truss in the model, and explode its child components. This dramatically increases the performance of the model, and virtually eliminated ALL lag in the model.
After purging the model, I now have only 603 component definitions (as opposed to 19,592!)
So what is Ruby, and how do you use it? Ruby is a popular programming language, that you can use to control SketchUp and execute commands using the SketchUp API. An API is a programming interface and library of functions that you can call upon to have SketchUp do stuff for you through code.
https://ruby.sketchup.com/ – This site shows all of the ways you can interact with SketchUp using the API
Now I’m the first to admit that this is far from simple, but if this is something that you do on a regular basis, it can be worth it.
The first thing to do is to learn some Ruby. There are plenty of Ruby courses and training you can take to give you a basic understanding to start from. Here are some resources to get you started.
- Code Academy – Learn Ruby – Basic Ruby course available for free
- The Well-Grounded Rubyist (Affiliate Link) – The Ruby book I personally own and recommend. There is a new version coming out in March, 2019.
- SketchUp Developer forum – Great resource for SketchUp-specific Ruby questions.
- Automatic SketchUp – A great book (that’s now available for free), although it has been criticized for teaching poor habits, or being inaccurate. I read this book to help me get started, and definitely found it helpful.
A word of warning, programming can be addictive, lol. You start to feel like a wizard learning new magical spells, when you discover that you can automate things that would take hours to do manually.