Bugs in dimension API?


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

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

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

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