Script forsetting all the Object properties of an object to "By Layer"

I often have to go in to the Object properties of an object and set the Display Color, Linetype, Print Color, and Print Width to By Layer. It would be a significant time saver if there was a script that could do this for us. Any chance?

Thank you.

Try Match Properties (not scripting)
https://docs.mcneel.com/rhino/6/help/en-us/index.htm#commands/matchproperties.htm?

-_runscript (
arrObjects = Rhino.GetObjects("Select objects to reset properties source",,,vbtrue)

    If IsArray(arrObjects) Then

    	For Each strObject In arrObjects
    		Rhino.print Rhino.ObjectColorSource(arrObjects, 0)
    		Rhino.print Rhino.ObjectLinetypeSource(arrObjects, 0)
    		Rhino.print Rhino.ObjectMaterialSource(arrObjects, 0)
    		Rhino.print Rhino.ObjectPrintColorSource(arrObjects, 0)
    		Rhino.print Rhino.ObjectPrintWidthSource(arrObjects, 0)
    	Next
    	
    end if

)

1 Like

This seems to work too, with fewer loops:

-_runscript (
arrObjects = Rhino.GetObjects("Select objects to reset properties source",,,vbtrue)

    If IsArray(arrObjects) Then

    	Rhino.print Rhino.ObjectColorSource(arrObjects, 0)
    	Rhino.print Rhino.ObjectLinetypeSource(arrObjects, 0)
    	Rhino.print Rhino.ObjectMaterialSource(arrObjects, 0)
    	Rhino.print Rhino.ObjectPrintColorSource(arrObjects, 0)
    	Rhino.print Rhino.ObjectPrintWidthSource(arrObjects, 0)
    	
    	
    end if

Here is a python version:

ResetSpecificObjAttributesToDefault.py (1.1 KB)

I also added changing the object material source back to by layer, you can set an optional argument to not do that, just change the last

ResetSpecificObjAttributesToDefault()

to

ResetSpecificObjAttributesToDefault(mt=False)

–Mitch

is the way to do it, (another distraction):roll_eyes:
The python is more sophisticated

You guys are awesome :smile: Thank you! Thank you! Thank you!