.NET

Reply
Valued Contributor
NKCAUTOCAD01
Posts: 86
Registered: ‎08-31-2011
Message 1 of 4 (194 Views)
Accepted Solution

Document Object by a drawing file name

194 Views, 3 Replies
11-27-2012 09:29 PM

In AutoCAD.NET API, please tell me.

From DocumentManager, I want to acquire Document Object by a drawing file name. 

Please tell me the method.

I would like it in VB.NET if possible.
Thanking you in advance.

Think you need all documents what is already opened

then you can try this code

 

 <CommandMethod("tfl")> _
Public Sub testDrawings()
Dim dm As DocumentCollection = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager
Dim doc As Document = dm.GetDocument(HostApplicationServices.WorkingDatabase)
Dim ed As Editor = doc.Editor
ed.WriteMessage(vbLf + "Current Document: {0}", doc.Name)
Dim ienum As IEnumerator = dm.GetEnumerator
While ienum.MoveNext
Dim idoc As Document = DirectCast(ienum.Current, Document)
ed.WriteMessage(vbLf + " Document item in collection: {0}", idoc.Name)
End While
End Sub

 

 

 

*Expert Elite*
Hallex
Posts: 1,569
Registered: ‎10-08-2008
Message 2 of 4 (186 Views)

Re: Document Object by a drawing file name

11-28-2012 01:57 AM in reply to: NKCAUTOCAD01

Think you need all documents what is already opened

then you can try this code

 

       <CommandMethod("tfl")> _
        Public Sub testDrawings()

            Dim dm As DocumentCollection = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager
            Dim doc As Document = dm.GetDocument(HostApplicationServices.WorkingDatabase)
            Dim ed As Editor = doc.Editor
            ed.WriteMessage(vbLf + "Current Document: {0}", doc.Name)

            Dim ienum As IEnumerator = dm.GetEnumerator
            While ienum.MoveNext
                Dim idoc As Document = DirectCast(ienum.Current, Document)
                ed.WriteMessage(vbLf + " Document item in collection: {0}", idoc.Name)
            End While

        End Sub

 

 

 

_____________________________________
C6309D9E0751D165D0934D0621DFF27919
Valued Contributor
NKCAUTOCAD01
Posts: 86
Registered: ‎08-31-2011
Message 3 of 4 (167 Views)

Re: Document Object by a drawing file name

11-28-2012 04:43 PM in reply to: NKCAUTOCAD01

Dear Mr. Hallex
Thank you for immediate advice.

It was saved very much.Yours sincerely,
NKCAUTOCAD01 (M.Tsukamoto).

*Expert Elite*
Hallex
Posts: 1,569
Registered: ‎10-08-2008
Message 4 of 4 (160 Views)

Re: Document Object by a drawing file name

11-28-2012 09:23 PM in reply to: NKCAUTOCAD01

You're welcome, M.Tsukamoto

Keep coding,

Cheers :smileyhappy:

 

_____________________________________
C6309D9E0751D165D0934D0621DFF27919
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.