How to force dimensions to align to dimension line?

My plugin imports AutoCAD dwg to Sketchup. For example
dimensions.skp (51.8 KB). But its dimensions are not correct.

Then I set Dimensions to Align to dimension line to get the correct result:

How can I force all dimensions to align to dimension line in my plugin? I checked API document https://ruby.sketchup.com/Sketchup/DimensionLinear.html and https://ruby.sketchup.com/Sketchup/Entities.html#add_dimension_linear-instance_method, but not found clue.

dimension.has_aligned_text = true

Note that DimensionLinear inherits from Dimension.

3 Likes

FYI: SketchUp does not have dimension styles like ACAD has. In fact, after some 20 years, we still cannot set the font face, size or boldness of dimension or callout text via extension code.

So, whereas ACAD combines model space and paper space in a single application, it is separated into SketchUp and LayOut in the Trimble application.

This type of dimension styling has instead been implemented in the LayOut paper space API.

So an extension could create the SKP model file without dimensions, and then a LayOut viewport that uses the model and imports ACAD dimensions into the LayOut document.