iLogic to Check if iPart exists

iLogic to Check if iPart exists

Anonymous
Not applicable
558 Views
1 Reply
Message 1 of 2

iLogic to Check if iPart exists

Anonymous
Not applicable

how would i go about trying to see if an ipart exists? for example, say i have a part with members/part numbers 10,20,30...100 which corresponds to extrusion height. 

i have an excel sheet where there are some calculation being made which gives me the extrusion height. then, i would want to use the ipart.changerow() command to change to the correct ipart IF the calculated ipart part number exists. 

so say the formula gives me a 20 for the height, then the part in my assembly would change to the 20 row, but if the formula gave me 25, then the part would do nothing and would not change configuration.

is this possible?

hopefully this makes sense

0 Likes
559 Views
1 Reply
Reply (1)
Message 2 of 2

philip1009
Advisor
Advisor

The easiest solution to use is to wrap the ChangeRow function in a Try statement.  Here's an example:

 

SyntaxEditor Code Snippet

oLength = 20 'input the Length your looking for here.
Try
	iPart.FindRow("iComponentName:1", "Length", "=", oLength)
Catch
	MessageBox.Show("Part Length of " + CStr(oLength) + " not found!", _
	"Length Error", _
	MessageBoxButtons.OK, _
	MessageBoxIcon.Hand, _
	MessageBoxDefaultButton.Button1)
End Try 

 It will try to find a row where the column "Length" has a value of 20, if it's found, it will automatically change to that row.  If an error occurs, it will catch that error and display a message box for you.

0 Likes