SketchUp / api-issue-tracker

Public issue tracker for the SketchUp and LayOut's APIs
https://developer.sketchup.com/
38 stars 10 forks source link

Can not drow a horizontal LinearDimension! #738

Open LItterBoy-GB opened 3 years ago

LItterBoy-GB commented 3 years ago
  1. SketchUp/LayOut Version: 21.1.332
  2. OS Platform: Windows 10 x64

When I want to mark the oblique line, I can not place the dimension horizontally.

doc = Layout::Document.open('test.layout')
start_point = Geom::Point2d.new(50.mm, 70.mm)
end_point = Geom::Point2d.new(100.mm, 75.mm)
dim = Layout::LinearDimension.new(start_point, end_point, 25.mm)
dim.start_extent_point = Geom::Point2d.new(50.mm, 50.mm)
dim.end_extent_point = Geom::Point2d.new(100.mm, 50.mm)
doc.add_entity dim, doc.layers.first
doc.save('test.layout')

image

Interim solution

doc = Layout::Document.open('test.layout')
# start_point = Geom::Point2d.new(50.mm, 65.mm)
start_point = Geom::Point2d.new(50.mm, 75.mm)   # change the start point
end_point = Geom::Point2d.new(100.mm, 75.mm)
dim = Layout::LinearDimension.new(start_point, end_point, 25.mm)
dim.start_extent_point = Geom::Point2d.new(50.mm, 50.mm)
dim.start_offset_length = 10.mm    # use the start_offset_length
dim.end_extent_point = Geom::Point2d.new(100.mm, 50.mm)
doc.add_entity dim, doc.layers.first
doc.save('test.layout')

image

sketchupbot commented 3 years ago

Logged as: SKEXT-3275

Whaat commented 1 month ago

This issue caused me a lot of pain and wasted time until I found this. Should be fixed or at least provide proper documentation for how to create a horizontal dimension when the connected points are not at the same y position in paper space.