×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

ABAQUS: Adding an exception if "InstanceFromBooleanCut" operation happens to fail

ABAQUS: Adding an exception if "InstanceFromBooleanCut" operation happens to fail

ABAQUS: Adding an exception if "InstanceFromBooleanCut" operation happens to fail

(OP)
Hi,

I am trying to add some exceptions to my code when running the "InstanceFromBooleanCut" operation. Basically I am cutting a series of parts and I do not want my script to stop if the operations happens to fail.
Say that I have a part called "pr1" (my cutting instance) and I want to use it to cut parts "pr2", "pr3" and "pr4".
Let's assume that the operation will be successful for the cut with pr2 and pr4 but will fail for pr3.

I have tried using a "try-except" in my code but it doesn't do what I want. Basically it cuts pr1 and pr2 successfully, then fails when cutting pr1 and pr3 and the process breaks here and it never tries to perform the cut operation for pr1 and pr4.

How could I fix this?

Thank you very much!

My code:

pr1 = model.parts['Part-1-r']
pr2 = model.parts['Part-2-r']
pr3 = model.parts['Part-3-r']
pr4 = model.parts['Part-4-r']

#Try to cut pr2 using pr1 (success)
try:
cut12=assy.InstanceFromBooleanCut(cuttingInstances=(assy.instances['Part-1-r'], ), instanceToBeCut=assy.instances['Part-2-r'], name='Part-1-2', originalInstances=SUPPRESS)
except ValueError:
print "Oops! Not good" #we should not get here

#Try to cut pr3 using pr1 (cut operation fails)
try:
cut13=assy.InstanceFromBooleanCut(cuttingInstances=(assy.instances['Part-1-r'], ), instanceToBeCut=assy.instances['Part-3-r'], name='Part-1-3', originalInstances=SUPPRESS)
except ValueError:
print "Oops! Not good" # in this example an exception must show up

#Try to cut pr4 using pr1 (not happening at the moment due to the previous failed operation)
try:
cut14=assy.InstanceFromBooleanCut(cuttingInstances=(assy.instances['Part-1-r'], ), instanceToBeCut=assy.instances['Part-4-r'], name='Part-1-4', originalInstances=SUPPRESS)
except ValueError:
print "Oops! Not good" #we should not get here

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources