Automate Removing Dimension Overrides

I’m working on a project where I need to remove the overrides for certain selected text objects. I’m able to remove the overrides by following the video in this post below:

However, I have hundred of files and multiple text objects that need to have the overrides removed. It seems like you need to only select text objects of the same style for the little arrow to appear to remove the overrides using the GUI. This is very time consuming so I was hoping I could script something to remove all of overrides on selected dimensions.

I’ve found the rhinoscript method DimStyleFieldOverride, but there seems to be some fields missing (model space scale). And even for the fields that exist as options, I haven’t been able to get them to remove the override.

It seems like the methods related to annotations only apply to dimensions, not text that uses the annotation styles. That is, if I make a textobject that uses one of the annotation styles, the rhinoscript methods uses to change the annotation styles only apply to dimensions.

Any advice for clearing the overrides on textobjects? It would be great if clearing dimension and/or text overrides would be exposed as a command line method.

Hi @matsys,

I think this Python script should do the trick.

import Rhino
import scriptcontext as sc

def __textobject_filter(rhObject, geometry, componentIndex):
    return isinstance(rhObject, Rhino.DocObjects.TextObject)

def test_clear_text_overrides():
    go = Rhino.Input.Custom.GetObject()
    go.SetCommandPrompt("Select text to remove overrides")
    go.GetMultiple(1, 0)
    if go.CommandResult() != Rhino.Commands.Result.Success:
    for objref in go.Objects():
        rhobj = objref.Object()
        if isinstance(rhobj, Rhino.DocObjects.TextObject):
            s = rhobj.TextGeometry.PlainTextWithFields
            t = Rhino.Geometry.AnnotationBase.PlainTextToRtf(s)
            rhobj.TextGeometry.RichText = t

if( __name__ == "__main__" ):
    test_clear_text_overrides() (951 Bytes)

– Dale

Thanks so much Dale! That worked beautifully! Saved thousands of manual clicks!