An example of iLogic code that can be used to verify that the current document is a sheet metal part (sheetmetal .IPT) and whether or not it contains holes (both modeled and flat pattern holes).
You can use one of these three suggested methods to determine the type, resp. subtype of the "Sheet Metal" document:
If iProperties.Value("Project", "Document SubType Name") = "Sheet Metal" Then
MsgBox("This is sheet metal 1")
End If
If ThisApplication.ActiveDocument.SubType = "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" Then
MsgBox("This is sheet metal 2")
End If
Dim oPDoc As PartDocument = ThisDoc.Document
If TypeOf oPDoc.ComponentDefinition Is SheetMetalComponentDefinition Then
MsgBox("This is sheet metal 3")
End If
Then use this iLogic code snippet to verify the presence of holes in the current sheet metal part:
i = 0
'folded model holes?
For Each oFeature In ThisDoc.Document.ComponentDefinition.Features
If oFeature.Type = ObjectTypeEnum.kHoleFeatureObject Then
i = i + 1
End If
Next
'flat pattern holes?
For Each oFeature In ThisDoc.Document.ComponentDefinition.FlatPattern.Features
If oFeature.Type = ObjectTypeEnum.kHoleFeatureObject Then
i= i + 1
End If
Next
If i > 0 Then
MsgBox("Contains holes")
Else
MsgBox("Does NOT contain holes")
End If