Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to judge a Components or drawing file is OPen?

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
Stakin
480 Views, 4 Replies

How to judge a Components or drawing file is OPen?

I have a assembly,I want to judge all the occ referenced file state, opened or not?

Is there has a simple way to do it?

4 REPLIES 4
Message 2 of 5
Vladimir.Ananyev
in reply to: Stakin

You may access all the in-memory documents through a collection InventorApplication.Documents.


Vladimir Ananyev
Developer Technical Services
Autodesk Developer Network

Message 3 of 5
Stakin
in reply to: Vladimir.Ananyev

Like:

 

Dim ofilename As string

ofilename = "C:\xxx\xxx.xxx"

Dim otdoc As Document

Dim t As Integer =0

For Each otdoc In ThisApplication.Documents

If otdoc.FullFileName=ofilename Then

t=t+1

End If

Next

If t>0 Then

MsgBox("The File had opened!")

Else

MsgBox("The File isn't opened yet!")

End If

Message 4 of 5
Stakin
in reply to: Vladimir.Ananyev

it's great.

thank you very much!

 

Is there another way to do this work?

 

maybe like:

 

Dim odoc As Document

Dim ofilename As String

ofilename="C:\xx\xx.xxx"

Try

odoc=ThisApplication.Documents.ItemByName(ofilename)

MsgBox("The file had been opened ")

Catch

MsgBox("The file isn't opened yet!")

End Try

 

 

OR Is there has a  efficient way to do this work??

 

 

Message 5 of 5
Vladimir.Ananyev
in reply to: Stakin

The second version is OK.


Vladimir Ananyev
Developer Technical Services
Autodesk Developer Network

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report