Message 1 of 2
how to catch failed chamfers
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I'm having chamfers fail quite often, I thought the returnvalue would be a good way to catch for this but when this line of code fails it doesn't return true or false it just hard fails and stops the program
chamfers.add(chamferInput)
from the below
# Create the sweep. sweep = sweeps.add(sweepInput) #prepare chamfer faces = sweep.faces edges = adsk.core.ObjectCollection.create() for f in range(faces.count): for e in range(faces.item(f).edges.count): edges.add(faces.item(f).edges.item(e)) chamfers = rootComp.features.chamferFeatures chamferInput = chamfers.createInput(edges,False) radiusMult = 0.5 returnvalue = False while returnvalue is False and radiusMult > 0.1: returnvalue = chamferInput.setToEqualDistance(adsk.core.ValueInput.createByReal(radius*radiusMult)) radiusMult *= 0.9 if returnvalue is True: returnvalue = chamfers.add(chamferInput) if returnvalue is True: chamfer = chamfers.add(chamferInput)
Is there another approach that would cause the program to continue and just not chamfer that Sweep object if it will fail?