• Industries
  • Products
  • Buy
  • Services & Support
  • Communities
  • Discussion Groups

    .NET

    Reply
    Distinguished Contributor
    Posts: 635
    Registered: ‎04-21-2006
    Accepted Solution

    Document CloseAndDiscard In 2013

    613 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

    Please use plain text.
    Moderator
    Alexander.Rivilis
    Posts: 1,168
    Registered: ‎04-09-2008

    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

    Please use plain text.
    Distinguished Contributor
    Posts: 635
    Registered: ‎04-21-2006

    Re: Document CloseAndDiscard In 2013

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

     

    Works great, thanks.

    Please use plain text.
    Mentor
    Posts: 220
    Registered: ‎03-11-2008

    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

    Please use plain text.
    Mentor
    Posts: 241
    Registered: ‎05-12-2009

    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
    Please use plain text.
    Mentor
    Posts: 220
    Registered: ‎03-11-2008

    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.

     

     

    Please use plain text.
    Mentor
    Posts: 241
    Registered: ‎05-12-2009

    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
    Please use plain text.
    Mentor
    Posts: 220
    Registered: ‎03-11-2008

    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?

    Please use plain text.
    Moderator
    Alexander.Rivilis
    Posts: 1,168
    Registered: ‎04-09-2008

    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

    Please use plain text.
    Mentor
    Posts: 220
    Registered: ‎03-11-2008

    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.

    Please use plain text.