Is there any possiblity to loop through already opened .CATDrawing files in catia v5 using vba.
If yes please help me with code
BR Siddu
I found below code but its counting sheets inside the same catdraing file.
Dim drawingDocument1 As Document
Set drawingDocument1 = CATIA.ActiveDocument
Set oDrwView = drawingDocument1.Sheets.ActiveSheet.Views
Debug.Print drawingDocument1.Sheets.Count
For i = 1 To drawingDocument1.Sheets.Count
Set oSheet = drawingDocument1.Sheets.Item(i)
oSheet.Activate
Debug.Print oSheet.Name
Next
Is there any possiblity to loop through already opened .CATDrawing files in catia v5 using vba.
If yes please help me with code
BR Siddu
I found below code but its counting sheets inside the same catdraing file.
Dim drawingDocument1 As Document
Set drawingDocument1 = CATIA.ActiveDocument
Set oDrwView = drawingDocument1.Sheets.ActiveSheet.Views
Debug.Print drawingDocument1.Sheets.Count
For i = 1 To drawingDocument1.Sheets.Count
Set oSheet = drawingDocument1.Sheets.Item(i)
oSheet.Activate
Debug.Print oSheet.Name
Next
Share
Improve this question
asked Mar 17 at 13:16
SidduSiddu
11 bronze badge
1 Answer
Reset to default 0Therefor you can loop over the documents collection:
Sub CATMain()
Dim oDoc as Document
for each oDoc in CATIA.Documents
if TypeName(oDoc) = "DrawingDocument" then
MsgBox "Drawing: " & oDoc.Name & " is opened"
'Do something with the drawing
End If
next
End Sub
Be aware, the documents
collection include not only the documents which are opened in a own window, also these which are referenced. (e.g. PartDocument in a ProcuctDocument)