Is there any way to get/set the state of CheckNewObjects in a script?

…as per the title…

Specifically to know which way this is set before running a script, in order to be able to shut it off temporarily and then reinstate it if it was originally active.

Hi @Helvetosaur,

I don’t see a way of doing this from RhinoCommon.

– Dale

Hmm, I really could use this right now… :frowning_face:

Hi @Helvetosaur, below seems to work for me:

import clr, Rhino, System


def DoSomething():
    a = Rhino.RhinoApp.GetDataDirectory(True, False)
    d = "settings"
    f = "settings-Scheme__Default.xml"
    p = System.IO.Path.Combine(a, d, f)
    if System.IO.File.Exists(p):
        x = System.Xml.XmlDocument()
        n = x.SelectSingleNode("//command[@name='CheckNewObjects']/entry")
        print "CheckNewObjects: {}".format(n.InnerText)


Note that Rhino reads that value on startup and writes it on close. So if the user does not change the state during the session i asume it is safe to use.


1 Like

Seems like the dashed version of the command prints the current state to the command line. So one other way to go about it would be to clear command history, run the -_CheckNewObjects command and cancel it, read the history strings and parse them to find out the current state (setting it is easy just via command). I have used this method on many other commands, works well. Can’t write the code now but I know you can, better than me, if the general idea works for your application.