I need to exclude any blank iproperties stock number from existing sort.

I need to exclude any blank iproperties stock number from existing sort.

Anonymous
Not applicable
344 Views
2 Replies
Message 1 of 3

I need to exclude any blank iproperties stock number from existing sort.

Anonymous
Not applicable

i have a rule that works just need to exclude any part that doesn't have a stock number

Dim oDoc As AssemblyDocument
oDoc = ThisApplication.ActiveDocument

oUOM = oDoc.UnitsOfMeasure

Dim oOccs As ComponentOccurrencesEnumerator
oOccs = oDoc.ComponentDefinition.Occurrences.AllLeafOccurrences

Dim oMass As Double = 0
Dim oOcc As ComponentOccurrence
For Each oOcc In oOccs
	        If iProperties.MaterialOfComponent(oOcc.Name) = "Steel, Mild" Then		                         
                       If iProperties.Value(oOcc.Name, "Custom", "M/P") = "F" Or
                             iProperties.Value(oOcc.Name, "Custom", "M/P") = "M" Or
				    iProperties.Value(oOcc.Name, "Custom", "M/P") = "P" Then
				 oMass = oMass + iProperties.MassOfComponent(oOcc.Name)  
			   End If
               End If                 
    Next

sMass =  oMass  & " " & oUOM.GetStringFromType(oUOM.MassUnits)
MessageBox.Show(sMass, "FABRICATED Steel, Mild")

.

 

 

 

 

 

 

 

 

0 Likes
Accepted solutions (1)
345 Views
2 Replies
Replies (2)
Message 2 of 3

Curtis_Waguespack
Consultant
Consultant
Accepted solution

Hi @Anonymous 

 

I think you can use a Continue For line to skip to the next occurrence.

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

Dim oDoc As AssemblyDocument
oDoc = ThisApplication.ActiveDocument

oUOM = oDoc.UnitsOfMeasure

Dim oOccs As ComponentOccurrencesEnumerator
oOccs = oDoc.ComponentDefinition.Occurrences.AllLeafOccurrences

Dim oMass As Double = 0
Dim oOcc As ComponentOccurrence
For Each oOcc In oOccs
	
	If iProperties.Value(oOcc.Name, "Project", "Stock Number") = "" Then
		 Continue For 'skip to next oOcc
	End If 
	
	If iProperties.MaterialOfComponent(oOcc.Name) = "Steel, Mild" Then		                         
		If iProperties.Value(oOcc.Name, "Custom", "M/P") = "F" Or
	    	iProperties.Value(oOcc.Name, "Custom", "M/P") = "M" Or
			iProperties.Value(oOcc.Name, "Custom", "M/P") = "P" Then
				oMass = oMass + iProperties.MassOfComponent(oOcc.Name)  
		End If
	End If 
Next

sMass =  oMass  & " " & oUOM.GetStringFromType(oUOM.MassUnits)
MessageBox.Show(sMass, "FABRICATED Steel, Mild")

EESignature

0 Likes
Message 3 of 3

Anonymous
Not applicable

You Da Man. works perfect

0 Likes