Way to see if part is iPart

Way to see if part is iPart

s.mich
Enthusiast Enthusiast
989 Views
3 Replies
Message 1 of 4

Way to see if part is iPart

s.mich
Enthusiast
Enthusiast

Hello,

 

I am currently trying to automatically fill the stock number of a part to "SEE CHART" if the part is an iPart and simply fill the part number of it's a regular part. I have this bit of an iLogic rule I got working looking at some other variable for the time being, but I'm not sure how to code in to see if something is an iPart or not. 

 

Any help is much appreaciated.

 

 

Dim oPN As String
oPN = iProperties.Value("Project", "Part Number")

Dim oSN As String
oSN = iProperties.Value("Project", "Stock Number")

If "Part is an iPart" Then
	
	iProperties.Value("Project", "Stock Number") = "SEE CHART"
	
	Else 
		iProperties.Value("Project", "Stock Number") = oPN

End If

 

 

0 Likes
Accepted solutions (2)
990 Views
3 Replies
Replies (3)
Message 2 of 4

DRoam
Mentor
Mentor
Accepted solution

Hi @s.mich, you can check if a part is an iPart by checking the "IsiPartFactory" property of its ComponentDefinition:

 

If ThisDoc.Document.ComponentDefinition.IsiPartFactory Then
	' Do stuff...
Else
	' Do other stuff...
End If

 

Message 3 of 4

s.mich
Enthusiast
Enthusiast

It worked perfectly thank you!

0 Likes
Message 4 of 4

Matthew_Policelli
Advocate
Advocate
Accepted solution

Quick note for anyone else referencing this: If this iLogic might possibly run on an assembly document or drawing document, you will need to first make sure that the document is a part document, otherwise it will throw an exception.

 

If ThisDoc.Document.DocumentType = documenttypeenum.kPartDocumentObject _
AndAlso ThisDoc.Document.ComponentDefinition.IsiPartFactory Then
	' Do stuff...
Else
	' Do other stuff...
End If