I write a function to pad a sketch.
Code: Select all
def pad(profile, direction, length):
pad = myobj.newObject('PartDesign::Pad', 'Pad')
pad.Profile = profile
pad.Length = length
pad.UseCustomVector = 1
pad.Direction = direction
FreeCAD.ActiveDocument.recompute()
profile.Visibility = 0
Now I want to catch the exception when the profile couldn't be padded and delete the 'myobj.newObject('PartDesign::Pad', 'Pad')'.
What should I do? Thank you!