1

still learning about Ruby + Sketchup!

Today,I would like to add a measurement (good english word ?) as I can do manually with the 'cotation' (french version) tool when I click to point then drag the measure text.

Can't find that in the docs to do with Ruby and API ...

Thanks for your help

1 Answers1

1

You are probably looking for the Sketchup::Entities::add_dimension_linear method. http://ruby.sketchup.com/Sketchup/Entities.html#add_dimension_linear-instance_method

Assuming a and b below are edges

voffset = [-20, 0, 0]
Sketchup.active_model.entities.add_dimension_linear(a.start, b.start, voffset)

The value of voffset controls not just how far offset the dimension is, but also the axis along which the measurement is made. You may need to experiment with different values to get a feeling for how that determination is done. As with many things in SketchUp, it often guesses (or 'infers') at what you want.

avariant
  • 2,234
  • 5
  • 25
  • 33