.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to check drawing file is opened

7 REPLIES 7
Reply
Message 1 of 8
RamanSBV
460 Views, 7 Replies

How to check drawing file is opened

Hi,

 

I have scenario where user can  open the drawing using filepath like given below

 

Application.DocumentManager.Open(filePath, IsReadOnly);

 

And it is working fine.

 

I should allow to open the file, if file is already opened state.

 

Please guide me, how i can achive same

 

Regards,

Raman

7 REPLIES 7
Message 2 of 8


@RamanSBV wrote:
...I should allow to open the file, if file is already opened state...

Opened with this AutoCAD session or opened with other AutoCAD session? Opened on this PC or opened from network?

Відповідь корисна? Клікніть на "ВПОДОБАЙКУ" цім повідомленням! | Do you find the posts helpful? "LIKE" these posts!
Находите сообщения полезными? Поставьте "НРАВИТСЯ" этим сообщениям!
На ваше запитання відповіли? Натисніть кнопку "ПРИЙНЯТИ РІШЕННЯ" | Have your question been answered successfully? Click "ACCEPT SOLUTION" button.
На ваш вопрос успешно ответили? Нажмите кнопку "УТВЕРДИТЬ РЕШЕНИЕ"


Alexander Rivilis / Александр Ривилис / Олександр Рівіліс
Programmer & Teacher & Helper / Программист - Учитель - Помощник / Програміст - вчитель - помічник
Facebook | Twitter | LinkedIn
Expert Elite Member

Message 3 of 8

Sorry Yeh....

 

I should not allow user to open same file, if file is already in Opened on this PC.

 

Regards,

Raman

Message 4 of 8

So allow or not allow? I no longer understand you. Smiley Sad  Describe a scenario clearly paragraph by paragraph.

Відповідь корисна? Клікніть на "ВПОДОБАЙКУ" цім повідомленням! | Do you find the posts helpful? "LIKE" these posts!
Находите сообщения полезными? Поставьте "НРАВИТСЯ" этим сообщениям!
На ваше запитання відповіли? Натисніть кнопку "ПРИЙНЯТИ РІШЕННЯ" | Have your question been answered successfully? Click "ACCEPT SOLUTION" button.
На ваш вопрос успешно ответили? Нажмите кнопку "УТВЕРДИТЬ РЕШЕНИЕ"


Alexander Rivilis / Александр Ривилис / Олександр Рівіліс
Programmer & Teacher & Helper / Программист - Учитель - Помощник / Програміст - вчитель - помічник
Facebook | Twitter | LinkedIn
Expert Elite Member

Message 5 of 8

I should not allow user to open the same file again, if file is in opend state. by current session

 

Regards,

Raman

Message 6 of 8

Now I understand. Smiley Happy

Enough to compare the full path to the file with all full pathes of Documents in Application.DocumentManager and if fullpath found then do not open file, but switch Application.DocumentManager.MdiActiveDocument to founded with full path Document.

Відповідь корисна? Клікніть на "ВПОДОБАЙКУ" цім повідомленням! | Do you find the posts helpful? "LIKE" these posts!
Находите сообщения полезными? Поставьте "НРАВИТСЯ" этим сообщениям!
На ваше запитання відповіли? Натисніть кнопку "ПРИЙНЯТИ РІШЕННЯ" | Have your question been answered successfully? Click "ACCEPT SOLUTION" button.
На ваш вопрос успешно ответили? Нажмите кнопку "УТВЕРДИТЬ РЕШЕНИЕ"


Alexander Rivilis / Александр Ривилис / Олександр Рівіліс
Programmer & Teacher & Helper / Программист - Учитель - Помощник / Програміст - вчитель - помічник
Facebook | Twitter | LinkedIn
Expert Elite Member

Message 7 of 8

I got it what i want

 

Using below code.

               

DocumentCollection docs = Application.DocumentManager;

               

foreach (Document doc in docs)

                {

                   

if (doc.Name == filePath)

                    {

               return true;

                    }

                }

 

Thankyou very much

 

Regards,

Raman

 

 

 

 

Message 8 of 8

I hope filePath is a full path to file. Also it will be right to compare paths uppercases (or lowercases).

P.S.: By the way for thanking on this forum there is a Kudos and Accept solution.

And code have to be posted with Insert Code button.

Відповідь корисна? Клікніть на "ВПОДОБАЙКУ" цім повідомленням! | Do you find the posts helpful? "LIKE" these posts!
Находите сообщения полезными? Поставьте "НРАВИТСЯ" этим сообщениям!
На ваше запитання відповіли? Натисніть кнопку "ПРИЙНЯТИ РІШЕННЯ" | Have your question been answered successfully? Click "ACCEPT SOLUTION" button.
На ваш вопрос успешно ответили? Нажмите кнопку "УТВЕРДИТЬ РЕШЕНИЕ"


Alexander Rivilis / Александр Ривилис / Олександр Рівіліс
Programmer & Teacher & Helper / Программист - Учитель - Помощник / Програміст - вчитель - помічник
Facebook | Twitter | LinkedIn
Expert Elite Member

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

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost