iLogic count all opened drawing

iLogic count all opened drawing

Anonymous
Not applicable
764 Views
4 Replies
Message 1 of 5

iLogic count all opened drawing

Anonymous
Not applicable

Hello,

 

I need to count how much drawing (IDW) are opened in Inventor.

 

I tried with this, but doesn't work...

 

Dim a As Integer = 0
a = ThisApplication.DrawingDocument.count

 

 

What do I do wrong ?

 

 

 

0 Likes
765 Views
4 Replies
Replies (4)
Message 2 of 5

frederic.vandenplas
Collaborator
Collaborator
Dim i, iDrawCounter As Integer
For i = 1 To ThisApplication.Documents.VisibleDocuments.Count
If ThisApplication.Documents.VisibleDocuments.Item(i).DocumentType = kDrawingDocumentObject Then
    iDrawCounter = iDrawCounter + 1
    End If
Next i

MessageBox.Show(iDrawCounter &" drawing(s) is/are open", "My iLogic Dialog", MessageBoxButtons.OK, MessageBoxIcon.Asterisk, MessageBoxDefaultButton.Button1)
If you think this answer fullfilled your needs, improved your knowledge or leads to a solution,
please feel free to "kudos"
0 Likes
Message 3 of 5

Anonymous
Not applicable

No, I'm looking for a simple code in one line, like "ThisApplication.DrawingDocuments.count".

 

 

Actually I use this :

Dim nbrIDW As Integer = 0
	
For Each doc In ThisApplication.Documents 
	If doc.DocumentType = kDrawingDocumentObject Then nbrIDW = nbrIDW + 1
Next

 

 

How can I use it with .count method ?

0 Likes
Message 4 of 5

frederic.vandenplas
Collaborator
Collaborator

Good luck then! Smiley Happy

 

 

If you think this answer fullfilled your needs, improved your knowledge or leads to a solution,
please feel free to "kudos"
Message 5 of 5

MechMachineMan
Advisor
Advisor
When newbs both ask for help and tell you how to do things at the same time.........

Just make it a sub/function to call the counter in one line then.

--------------------------------------
Did you find this reply helpful ? If so please use the 'Accept as Solution' or 'Like' button below.

Justin K
Inventor 2018.2.3, Build 227 | Excel 2013+ VBA
ERP/CAD Communication | Custom Scripting
Machine Design | Process Optimization


iLogic/Inventor API: Autodesk Online Help | API Shortcut In Google Chrome | iLogic API Documentation
Vb.Net/VBA Programming: MSDN | Stackoverflow | Excel Object Model
Inventor API/VBA/Vb.Net Learning Resources: Forum Thread

Sample Solutions:Debugging in iLogic ( and Batch PDF Export Sample ) | API HasSaveCopyAs Issues |
BOM Export & Column Reorder | Reorient Skewed Part | Add Internal Profile Dogbones |
Run iLogic From VBA | Batch File Renaming| Continuous Pick/Rename Objects

Local Help: %PUBLIC%\Documents\Autodesk\Inventor 2018\Local Help

Ideas: Dockable/Customizable Property Browser | Section Line API/Thread Feature in Assembly/PartsList API Static Cells | Fourth BOM Type
0 Likes