×
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

How can I use VBA Code to Know a command has executed properly

How can I use VBA Code to Know a command has executed properly

How can I use VBA Code to Know a command has executed properly

(OP)
I am using VBA code to create a multiple cavities in a solid.

I have noticed in the Feature Tree that some of the cavity features were not created as intended.

On stepping thought the code, it appears that the the reason why some cavities did not build is because there was no material removed from the workpiece so the operation failed.

Is there some macro coding that I can add that identifies that this has happened so that I can properly carry on to the next step in the creation of the model.

The code that I am currently using is as follows:


boolstatus = Part.Extension.SelectByID2("FG-" & I & "-1@FG Assembly-" & I, "COMPONENT", 0, 0, 0, False, 0, Nothing, 0)
Part.AssemblyPartToggle
Part.EditPart
Part.ClearSelection2 True
boolstatus = Part.Extension.SelectByID2("Cutter-" & I & "-1@FG Assembly-" & I, "COMPONENT", 0, 0, 0, True, 0, Nothing, 0)
Part.InsertCavity4 0, 0, 0, True, 1, -1
Part.AssemblyPartToggle
Part.EditAssembly
Part.ClearSelection2 True
 

RE: How can I use VBA Code to Know a command has executed properly

You could check the volume of the part before and after the operation.

RE: How can I use VBA Code to Know a command has executed properly

(OP)
I guess what I am looking for is a way to identify in the feature tree that a Cavity2  or Cavity3 feature has been added.  Is there coding that can check the last feature?

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