# Select Dynotopo field and check it as true

I would like to select the dynotopo and place a check into the field, yet I can only find a toggle script. bpy.ops.sculpt.dynamic_topology_toggle() I'm not sure where I am going wrong. All other sculpt options seem to work.

• You want it to only check it, and not uncheck it when the script is run again? – Nate_Sycro27 Feb 1 at 4:47
• It needs to be checked when the script runs. – Michael Teiniker Feb 1 at 4:54

All objects have the use_dynamic_topology_sculpting property, which allows you to check whether or not dynamic topology is activated. Therefore your script could look like this:

import bpy

active_object = bpy.context.view_layer.objects.active

if active_object.mode == "SCULPT" and not active_object.use_dynamic_topology_sculpting:
bpy.ops.sculpt.dynamic_topology_toggle()

• BTW: The "use_...._sculpting" link above goes nowhere?! Anyway were would said code go? in a timer firing every second or is there a handler or event listener for when sculpting mode is switched to? and a View3D window becomes active? – Master James Mar 11 at 9:39
• @MasterJames Fixed the link. Like I wrote as a comment to your own question, you likely want to use the msgbus. Unfortunately I currently don't have the time to write an answer. The code above simply enables dynamic topology if it isn't already enabled, which was the topic of this question. – Robert Gützkow Mar 11 at 9:47
• Yes thanks very useful it does show the value for this toggle to add the listener for the properties change. Your input is valued and much appreciated. – Master James Mar 11 at 10:25