Sketchup 2025 crashes when I use Layout::Document

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)

(Moved to the Developers section of the forum)

2 Likes

A quick look at your test snippet …

(1) I see that the doc object will go out of scope when the bug_layout() method returns.

(2) I see that you did not specify a template to start with and then you did not set up any of the page_info.


Regardless did you send in any BugSplat reports?

:innocent:

1 Like

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?

Thank you in advance for your feedback.

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.

1 Like

I am experiencing the same issue with one of my extensions that uses LayOut 2025.

With previous SketchUp / LayOut versions I did not experience this issue.

1 Like

Well.

I uninstalled SU2025 and deleted all related folder, rebooted and reinstalled SU2025, updated Geforce Game ready driver, to ver: 572.47.

And I no longer able to reproduce the crash!

Edit:
I was happy too soon, I opened a larger file, and it crashed again, silently.

Thank you for your confirmations @dezmo @nnijmeijer !

I looked for another way to use the LayOut API in SU2025, but without success.

If anyone can create or modify LayOut documents using SU2025’s Ruby API, I’d be very interested.

I hope this problem can be fixed soon.

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:

  doc = Layout::Document.open("D:/SketchUp/294W10.layout")
  width = doc.page_info.width
  puts width

results:

  doc = Layout::Document.open("D:/SketchUp/294W10.layout")
  width = doc.page_info.width
  puts width
16.0
=> nil
  doc = Layout::Document.open("D:/SketchUp/294W10.layout")
  width = doc.page_info.width
  puts width
16.535430908203125
=> nil

Not sure if it is related with the OP, but I can’t seem to figure out why this is happening
Tested on SketchUp 2025 and 2024

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.

1 Like

I’ve just tested version 2025.0.2, which has just been released, and the problem is still there!

I don’t understand how a bug which has no workaround can’t be fixed almost 2 months after release.

Doesn’t anyone use LayOut from an extension?