How to buy
Privacy | Do not sell or share my personal information | Cookie preferences | Report noncompliance | Terms of use | Legal | © 2025 Autodesk Inc. All rights reserved
*UPDATE* I solved this before posting, but thought I would post anyhow so google-search can help anyone else wondering this stuff.
I've done something this:
try:
section[ps]['foil']['patch']=patches.add(section[ps]['foil']['patchInput'])
except:
ps=ps+1 # try again, with the next one along
because there are occasions where the section I'm patching is too "twisted" to be patchable - which I can't find any easy way to determine in advance.
That works OK, except I end up with an unwanted item on the timeline:-
Can anyone think of a way to get rid of the thing that failed (preferably inside my exception handler)? It's throwing the exception, so I don't have a reference to try to delete of course...
Alternatively - is there a way to "snapshot and revert" or some other setting to prevent it half-creating that broken feature?
Solved! Go to Solution.
The solution that worked for me was to count how many features exist before trying the operation, then after it fails, if there's now more in there, delete the last one.
pcount=patchFeats.count # see how many features currently exist
try:
section[ps]['foil']['patch']=patchFeats.add(section[ps]['foil']['patchInput']) # this might throw an exception
except:
if pcount < patchFeats.count: # something broken got created
dudpatch=patchFeats.item(patchFeats.count-1)
dudpatch.deleteMe()
If you want to be certain that the thing you're about to delete really is bad, you can check
should check:
dudpatch.healthState != 0
-or-
dudpatch.errorOrWarningMessage isn't empty
I'm having the same problem with creating a SplitFaceFeature. Sometimes it doesn't work because the split tool doesn't quite extend all the way to the edge of the face. Totally my issue, but I'd like to just extend the cut line and try again. Unfortunately, SplitFaceFeatures.add does add the feature successfully, but something else within the bowels of the implementation raises a RuntimeError exception, preventing me from ever getting a reference to the unhealthy feature itself.
As far as I've been able to determine, there is no way to fix this except by poking around in the Timeline as described above. I suppose if you are not in "capture design history" mode, you can just ignore the exception.
How to buy
Privacy | Do not sell or share my personal information | Cookie preferences | Report noncompliance | Terms of use | Legal | © 2025 Autodesk Inc. All rights reserved
Type a product name