08-31-2016
11:25 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
08-31-2016
11:25 AM
I really dislike the short edit allotted on this forum.
Updated code. Added the try/catch since I just found out parts that have never had iLogic rules apparently do not have that property set.
Dim docFile As Document
If ThisDoc.ModelDocument IsNot Nothing Then
docFile = ThisDoc.ModelDocument
Else
Return
End If
'Check if part has external iLogic rule named Material_Part or Material_Assembly
Dim iLogicFound = False
Dim iLogicE As propertyset
Try
iLogicE = docFile.PropertySets.Item("{2C540830-0723-455E-A8E2-891722EB4C3E}")
For i As Integer = 1 To ilogicE.count
If (InStr(ilogicE.item(i).Value,"Material_Part")) Or (InStr(iLogicE.item(i).Value,"Material_Assembly")) Then iLogicFound = True
Next
Catch
'No iLogic I guess
End Try
MsgBox("Does part/assembly have a matching external iLogic rule. " & iLogicFound)