Add a default DimensionStyle when missing

Hi @alain,

i have documents from other countries where all build in dimension styles are missing and only some chinese character named ones are present. So i try to add eg. “Millimeter Small” to these documents and add my scripted dimensions using this style.

My attempts to find out if the “Millimeter Small” style is missing do work reliable, but adding the missing style by eg. getting the “Template Millimeter Small” style from


results into something strange. I can add this style and rename it properly. But the model space scale and many other style properties are wrong compared to the style in the Template files when opening a new document.

Do you have an example how to add a missing dim style like “Millimeter Small” ? I am trying to avoid re-building this dim_style and all properties from scratch.


Hi @clement,
I’m not sure about this. @lowell can you help?

Maybe something like

from scriptcontext import doc
from Rhino.FileIO import File3dm
import System

def pp():
    dss = doc.DimStyles.BuiltInStyles
    for ds in dss:
        print ds.Name
        print ds.DimensionLengthDisplayUnit(doc.RuntimeSerialNumber)
        print ds.DimensionScale
        print '---'
        if "Millimeter Small" in ds.Name:
            newds = ds.Duplicate("MyNewMMSmall", System.Guid.NewGuid(), System.Guid.Empty)
            doc.DimStyles.Add(newds, False)

Hi @lowell, thank you for the example. It replicates what i have done and do not understand. The dimension style “MyNewMMSmall” you created based on “Millimeters Small” has a model space scale of 10. My dimension looks like this then:

When i open a new empty file using the template for “Small Objects Millimeters” and choose the “Millimeter Small” dimension style, it has a model space scale of 1 and looks like this (which is what i want to achieve):

It seems that the style uses different settings, eg. for model space scale and arrow types. Why does your style “MyNewMMSmall” look so different ? I was expecting that the built in styles look the same as the ones stored in the template or did i miss something ?


@clement - It looks like the default template is different from the built-in dimstyle.
I’m a little surprised by that, but I can imagine how it could have happened.
I can look at making the built-in styles match the default templates. I think that would be fine in V7. I’d be hesitant to change that in V6 at this point.
For the time being, you’ll need a few more lines in your script in V6 to match up.

Hi @lowell, ok i’ll try to build the style from scratch.