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
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
RE: How can I use VBA Code to Know a command has executed properly
Matt Lorono
CAD Engineer/ECN Analyst
Silicon Valley, CA
Lorono's SolidWorks Resources
Co-moderator of Solidworks Yahoo! Group
and Mechnical.Engineering Yahoo! Group
RE: How can I use VBA Code to Know a command has executed properly