# Bugs in dimension API?

**URL:** <https://forums.sketchup.com/t/bugs-in-dimension-api/43050>\
**Category:** Ruby API\
**Tags:** dimensions, bug\
**Created:** [April 16, 2017, 4:13pm UTC](https://forums.sketchup.com/t/bugs-in-dimension-api/43050 "2017-04-16T16:13:45Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ittayd](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/ittayd/32/17981_2.png) [@ittayd](https://forums.sketchup.com/u/ittayd)\
**Post date:** [April 16, 2017, 4:13pm UTC](https://forums.sketchup.com/t/bugs-in-dimension-api/43050/1 "2017-04-16T16:13:45Z")

</div>

Hi,

First, I think there’s a bug in Sketchup itself:

1. start a new model
2. draw a vertical (blue) line, top to bottom
3. make a group of the line (create another line, make group, open the group, delete the second line, close the group)
4. create a linear dimension of the line (outside of the group), top to bottom

result: the dimension is not associated with the bottom point. That is, if you open the group and move the bottom point of the line, the dimension is not updated (if you move the top point, it does)

now , to the API part, if I do  
entities.add\_dimension\_linear(dim.start, dim.end, dim.offset\_vector)

where ‘dim’ is the dimension above (e.g. select it, then model.selection[0]), then: you get an ArgumentError, since dim.end is invalid. But I think it should be valid.

now, do entities.add\_dimension\_linear(dim.start, dim.end[1], dim\_offset\_vector). the result is that the new dimension has a weird start position. E.g. dim.start is `[#<Sketchup::Vertex:0x0000000d38a128>, Point3d(33.9892, 101.274, 0)]`, but dim2.start (dim2 is the new dimension) is `[#<Sketchup::Vertex:0x0000000d38a128>, Point3d(0, 0, 58.8976)]`

Trying to create the dimension by specifying the start as [dim.start[0], dim.start[1]] doesn’t help, nor explicitly specifying the point in the second element of the array

This all seems to be since the end point is the origin of the group. This seems like a pretty common scenario to me

---

<div class="post-metadata">

**Author:** ![ittayd](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/ittayd/32/17981_2.png) [@ittayd](https://forums.sketchup.com/u/ittayd)\
**Post date:** [April 16, 2017, 4:48pm UTC](https://forums.sketchup.com/t/bugs-in-dimension-api/43050/2 "2017-04-16T16:48:19Z")

</div>

Also, create two edges, each within its own group. create a dimension outside of the groups. Create a new one using add\_dimension\_linear. The new dimension is not associated with one of the points. It seems to be, but when moving the lines, it doesn’t change with one of them

---

<div class="post-metadata">

**Author:** ![ittayd](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/ittayd/32/17981_2.png) [@ittayd](https://forums.sketchup.com/u/ittayd)\
**Post date:** [April 16, 2017, 6:21pm UTC](https://forums.sketchup.com/t/bugs-in-dimension-api/43050/3 "2017-04-16T18:21:50Z")

</div>

Seems like also creating a group (from two lines) and rotating it create a similar bug where a dimension that is created from the start/end/offset of another comes out skewed and returning different start/end/offset

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/sketchup/original/3X/f/2/f2a121500b085ed60806607a82720b092d800bb3.png) [@system](https://forums.sketchup.com/u/system)\
**Post date:** [July 17, 2017, 8:19am UTC](https://forums.sketchup.com/t/bugs-in-dimension-api/43050/4 "2017-07-17T08:19:39Z")

</div>

Closed on July 17, 2017, 8:19am UTC

This topic was automatically closed after 91 days. New replies are no longer allowed.
