最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

How to loop through already opened .CATDrawing files in catia v5 using vba - Stack Overflow

programmeradmin4浏览0评论

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
Add a comment  | 

1 Answer 1

Reset to default 0

Therefor 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)

发布评论

评论列表(0)

  1. 暂无评论