.NET

Reply
Mentor
Posts: 699
Registered: ‎04-21-2006
Message 1 of 19 (999 Views)
Accepted Solution

Document CloseAndDiscard In 2013

999 Views, 18 Replies
04-25-2012 04:27 AM

 

The Doc.CloseAndDiscard() method on documents returns message of ' not a member of 'Autodesk.AutoCAD.ApplicationServices.Document'. 

 

How do we close a dwg file in AutoCAD 2013?

 

Thanks

Moderator
Alexander.Rivilis
Posts: 1,346
Registered: ‎04-09-2008
Message 2 of 19 (996 Views)

Re: Document CloseAndDiscard In 2013

04-25-2012 06:05 AM in reply to: Hugh_Compton
DocumentExtension.CloseAndDiscard
P.S.: Also read ObjectARX for AutoCAD 2013 Docs: Managed Class Reference -> Migration Guide->.NET Migration Guide

Пожалуйста не забывайте про Утвердить в качестве решения! Утвердить в качестве решения и Give Kudos!Баллы
Please remember to Accept Solution! Accept as Solution and Give Kudos!Kudos

Mentor
Posts: 699
Registered: ‎04-21-2006
Message 3 of 19 (988 Views)

Re: Document CloseAndDiscard In 2013

04-25-2012 06:41 AM in reply to: Hugh_Compton

 

Works great, thanks.

Mentor
Posts: 244
Registered: ‎03-11-2008
Message 4 of 19 (674 Views)

Re: Document CloseAndDiscard In 2013

03-01-2013 06:16 AM in reply to: Alexander.Rivilis

more clearly, it's DocumentExtension.CloseAndDiscard(doc)

 


just in case anyone would expect it to be an extension method, like i did

Valued Mentor
Posts: 319
Registered: ‎05-12-2009
Message 5 of 19 (666 Views)

Re: Document CloseAndDiscard In 2013

03-01-2013 10:06 AM in reply to: matus.brlit

It is a extension method

 

public static void CloseAndDiscard(this Document doc)
{
    CloseInternal(doc, true, null);
}

 

You can also find your answers @ TheSwamp
Mentor
Posts: 244
Registered: ‎03-11-2008
Message 6 of 19 (639 Views)

Re: Document CloseAndDiscard In 2013

03-03-2013 11:07 PM in reply to: jeff

I checked it and you're right, but I am using VB.net. And there it isn't an extension method.

 

Taken from MSDN:

 

Notice that the extension method definition is marked with the extension attribute <Extension()>. Marking the module in which the method is defined is optional, but each extension method must be marked. System.Runtime.CompilerServices must be imported in order to access the extension attribute.

Extension methods can be declared only within modules.

 

 

Valued Mentor
Posts: 319
Registered: ‎05-12-2009
Message 7 of 19 (624 Views)

Re: Document CloseAndDiscard In 2013

03-04-2013 05:49 AM in reply to: matus.brlit

With C# you import the namespace and VB you import the module, but it still is a extension method.

You can also find your answers @ TheSwamp
Mentor
Posts: 244
Registered: ‎03-11-2008
Message 8 of 19 (593 Views)

Re: Document CloseAndDiscard In 2013

03-07-2013 10:26 PM in reply to: jeff

I am importing 

 

Imports Autodesk.AutoCAD.ApplicationServices.DocumentExtension

which is a class. I couldn't find the module I am supposed to import in VB. Do you know where I can find it?

Moderator
Alexander.Rivilis
Posts: 1,346
Registered: ‎04-09-2008
Message 9 of 19 (588 Views)

Re: Document CloseAndDiscard In 2013

03-08-2013 01:07 AM in reply to: matus.brlit

In AutoCAD 2013 class Autodesk.AutoCAD.ApplicationServices.DocumentExtension is in acmgd.dll

 

08-03-2013 11-08-47.png


Пожалуйста не забывайте про Утвердить в качестве решения! Утвердить в качестве решения и Give Kudos!Баллы
Please remember to Accept Solution! Accept as Solution and Give Kudos!Kudos

Mentor
Posts: 244
Registered: ‎03-11-2008
Message 10 of 19 (583 Views)

Re: Document CloseAndDiscard In 2013

03-08-2013 01:14 AM in reply to: Alexander.Rivilis

I know that, Alexander. I was asking about the module for VB.

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Welcome to the new Autodesk Community!
If this is your first visit, click here to get started and make the most of the Community. Let us know what you think of the new experience in the Community Feedback Forum.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community