Message 1 of 1
I want to change the modeled property of the hole command.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi everyone,
I am working on a script to switch Modeled for all threads.
Threads are also present in the hole command, but I am unable to switch threads in hole.
Is there any way to switch this?
# Fusion360API Python script
import traceback
import adsk.core as core
import adsk.fusion as fusion
def run(context):
ui: core.UserInterface = None
try:
app: core.Application = core.Application.get()
ui = app.userInterface
des: fusion.Design = app.activeProduct
root: fusion.Component = des.rootComponent
timeline: fusion.Timeline = des.timeline
state = timeline.markerPosition
threadList = list(root.features.threadFeatures)
for occ in root.allOccurrences:
comp: fusion.Component = occ.component
threadList.extend(list(comp.features.threadFeatures))
threadFeat: fusion.ThreadFeature = None
for threadFeat in threadList:
try:
threadFeat.timelineObject.rollTo(True)
threadFeat.isModeled = not threadFeat.isModeled
success = "OK"
except:
hole = threadFeat.linkedFeatures[0]
success = "NG"
finally:
app.log(f"{threadFeat.name}:{success}")
timeline.markerPosition = state
except:
if ui:
ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))