Hi,
First, I think there’s a bug in Sketchup itself:
- start a new model
- draw a vertical (blue) line, top to bottom
- make a group of the line (create another line, make group, open the group, delete the second line, close the group)
- 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