I have an extension that worked fine before and now crashes in SketchUp 2025. On closer inspection, I realized that as soon as I use a Layout::Document object, and particularly the add_entity method, SketchUp 2025 crashes.
What’s strange is that the crash will occur 10 to 30 seconds later and sometimes I get the BugSplat window, but most of the time SketchUp closes without displaying anything.
Here’s a snippet of code to test if you like:
module TEST
extend self
def bug_layout()
doc = Layout::Document.new
this_page = doc.pages.add("plan")
layer = doc.layers.add("layer")
upper_left = Geom::Point2d.new(1, 1)
lower_right = Geom::Point2d.new(2, 2)
bounds = Geom::Bounds2d.new(upper_left, lower_right)
# Creates a normal rectangle
rect = Layout::Rectangle.new(bounds)
doc.add_entity( rect, layer, this_page )
end
end
When I execute in the ruby console TEST::bug_layout
I get a crash a few seconds later (to speed things up, I change scene or import a component)
Sorry for the section error, I was a bit quick to post. Thanks @TheOnlyAaron .
Thank you @DanRathbun for your reply
(1) I’ve just tested without returning the doc object and the result is the same.
(2) I tried to make a reproducible test as simple as possible to show the problem, that’s why I don’t use any template or any setup for page_info.
Yes, I sent 2 BugSlat with 2 different PCs, but most of the time SketchUp closes without displaying the BugSplat…
As far as I can see, the problem occurs as soon as I use add_entity on a Layout::Document object.
If I deactivate all the extensions to keep just 1 that contains only this code and execute it via the ruby console, the crash will occur some time later. In general, I import a file into my project because if I do nothing, it can take a long time.
Have you tested the creation of Layout documents in SketchUp 2025 without crash?
I tested your snipped an I can confirm similar behaviour you describe above, that after certain time or activities SketchUp closes without displaying the BugSplat.
I have no idea of the reason.
I noticed when I call this method the first time, it produces a rounded numeric with one decimal (eg 16.0), but the second time a ‘normal’ float (eg 16.535430908203125)
test code with a local layout file:
I don’t know either. If it is a memory error perhaps it causes both?
The API docs say the return value is a Numeric rather than a Float.
But my tests are that the return value is a Float.
Jack, when you do puts some_float the #to_s method of the object gets called and the result is a string representation of the Float. So, the value is not really truncated to one decimal place. The value (I think) is still a double precision floating point number on the C-side of Ruby.
The real problem is that the width of the page is changing by more than half an inch. (Using a test document that is 11" wide, I cannot produce this changing width scenario.)
Okay, I finally had time to test this. Nothing happened (at first) after running your code. A Layout::Rectangle was returned.
I ALT+TABbed back and forth a few times from SketchUp 2025 and MS Edge with nothing happeneing.
I finally started garbage collection via the console by executing GC.start and SketchUp 25 closed without BugSplat appearing. Next, I’ll go find the WER report and see what it says.
BAD NEWS: No Windows Error Report nor memory dump was created.