Associated dimensions question


#1

The “Model info… settings… dimensions… expert settings” window has a useful option to "highlight non-associated dimensions."
If you manually draw a line, add a dimension for its length, delete the line = the dimension is highlighted.
However if I use ruby to:

  • add the line from point1 to point2
  • find vertexes of line (you can add dimensions by point3d but that won’t connect it to the line)
  • add dimension to the vertices.

You can tell the dimension is connected the the line because moving the line will drag the dimension with it. But if I delete the line, the dimension is NOT highlighted. So something else must be going on here(??)

Here is code:

 model = Sketchup.active_model
 entities = model.active_entities
 point1 = Geom::Point3d.new(0,0,0)
 point2 = Geom::Point3d.new(200,0,0)
 line = entities.add_line point1,point2
 # get vertex for dimension
 vertex1 = line.start
 vertex2 = line.end
 #add dimension
 offset = [0,20,0] 
 dimension = entities.add_dimension_linear vertex1, vertex2, offset

#2

Seems like a bug to me.


#3

I can see this too and it surely seems to be a bug. Thanks for bringing it to our attention.


#4

I guess it takes a bugra to know one.
(Sorry, you must get that a lot.)


#5

:smile: yeah bad name for the job.


#6

If you add a dimension to point3ds instead of vertices it will not connect to the line at the same position (will not move with the line). But it will still not be highlighted as non-associated.

Strangely, lines that you add by point3d (either by hand or script) will be connected at a vertex: Moving one will stretch the other.

That’ because drawing a line always either creates vertices if there isn’t one at each point3d, or connects to one that exists.

Dimensions drawn be hand cannot be placed in space: there must be a vertex already a vertex at each end.

Yet Ruby API lets you add dimensions in space by Point3D. I suggest that should never have been allowed by the API.

Strange also that while the API allows Add_Line to only Point3ds, Entities.add_dimension_linear offers 6 options.
Yet manually user can add line to those same 6 options.