There is an issue with the return value of the method <model_to_paper_point> in Layout 2023

Bug Reports

  1. SketchUp/LayOut Version: 2023.1.340
  2. OS Platform: windows 10

I can not get right value by Layout::SketchUpModel#model_to_paper_point.
When I mapped the edges from the model to the drawing, the drawn results did not overlap.

ruby code

Sketchup.active_model.entities.add_line(ORIGIN, ORIGIN +,
page = Sketchup.active_model.pages.add
camera =
camera.perspective = false
eye =, 0, 10)
up = Y_AXIS
target =, 0, 0)
camera.set eye, target, up
g = Sketchup.active_model.entities.add_group
p1 = ORIGIN -,
p2 = ORIGIN +,
g.entities.add_line(p1, p2)
Sketchup.active_model.active_view.zoom g
page.update PAGE_USE_ALL'F:/desktop/test.skp')

doc =
page = Sketchup.active_model.pages.selected_page
bounds =,,,
model =, bounds)
doc.add_entity(model, doc.layers.first, doc.pages.first)
model.current_scene = Sketchup.active_model.pages.to_a.index(page) + 1
model.render_mode = Layout::SketchUpModel::RASTER_RENDER
model.scale = 1.0 / 15
model.perspective = # 平行投影
model.line_weight = 0.1

edge = Sketchup.active_model.entities.to_a[0]
s_p = model.model_to_paper_point(edge.start.position)
e_p = model.model_to_paper_point(edge.end.position)
doc.add_entity(, e_p), doc.layers.first, doc.pages.first)'F:/desktop/test.layout')
puts "edge length in model : #{(edge.end.position - edge.start.position).length.to_mm} mm"
puts "edge length in paper : #{(s_p - e_p).length.to_mm} mm"

out put

edge length in model : 854.4003745317531 mm
edge length in paper : 359.9118903742617 mm

Generally, with the LayOut API, always add the entity to the document object before setting or changing any of the entity’s properties. LayOut uses a hardcoded set of default properties whenever an entity is added to the document, rather than what you might have attempted to set the properties as.

Otherwise, there might be some bugs related to display scaling.

Looking in the API Issue tracker, I see that a bug has already been reported …

1 Like