Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
pball
in reply to: pball

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)

 

Check out my style edits for the Autodesk forums
pball's Autodesk Forum Style