Kattmandu
Automotive
- Oct 31, 2022
- 7
How do I add code to check the user input for .CATPart or .CATProduct?
Code:
Dim strFilename As String
strFilename = InputBox("Enter filename with extension", strFilename)
Dim partDocument1 As Document
Set partDocument1 = CATIA.Documents.Item(strFilename)
Dim viewBehavior As DrawingViewGenerativeBehavior
Set viewBehavior = drawingView1.GenerativeBehavior
[COLOR=#CC0000]If (strFilename is a CATPart) Then[/color]
viewBehavior.Document = partDocument1
viewBehavior.Update
[COLOR=#CC0000]ElseIf (strFilename is a CATProduct) Then[/color]
viewBehavior.Document = partDocument1.Product
viewBehavior.Update
[COLOR=#CC0000]Else (Neither CATProduct or CATPart)[/color]
MsgBox "Neither CATPart nor CATProduct!"
End If