.NET

Reply
Member
freddy.meichtry
Posts: 3
Registered: ‎11-18-2009
Message 1 of 3 (200 Views)

Retrieve SaveAs version in Database.BeginSave

200 Views, 2 Replies
03-30-2012 07:05 AM

Is there a way to retrieve the fileversion in the Database.BeginSave event when the user has choosen like version 2004 in the default SAVEAS command?

 

I only found the OriginalFileVersion and LastSaveAsVersion property, however I have to add something in the database for version 2004 before it is saved. Or is there another approach?

 

Thank you

*Expert Elite*
arcticad
Posts: 1,285
Registered: ‎06-21-2004
Message 2 of 3 (196 Views)

Re: Retrieve SaveAs version in Database.BeginSave

03-30-2012 07:16 AM in reply to: freddy.meichtry

The Data is stored in the registry

HKEY_CURRENT_USER\Software\Autodesk\AutoCAD\R18.0\ACAD-8001:409\Profiles\Initial Setup Profile\General
DefaultFormatForSave

value 30 for 2010
value 24 for 2007
value 18 for 2004


This might help depending on what your doing. it will check the
file and see which version it's currently saved as.  

History of the version numbers is found here
http://en.wikipedia.org/wiki/.dwg

   Function is2010(ByVal filename As String) As Boolean
        'Return False
        'Exit Function
        Dim rtnCheck As Boolean = False

        Dim objReader As IO.StreamReader
        Dim txtContents As String
        ' Check if File Exists
        If IO.File.Exists(filename) Then
            objReader = IO.File.OpenText(filename)
            'Read all the Text in the File
            Do While objReader.Peek <> -1
                txtContents = objReader.ReadLine()
                If txtContents.Substring(0, 6) = "AC1024" Then
                    rtnCheck = True
                End If
                Exit Do
            Loop
            ' Don't forget to close the file
            objReader.Close()
            objReader = Nothing
        End If

        Return rtnCheck

    End Function

---------------------------



(defun botsbuildbots() (botsbuildbots))
Member
freddy.meichtry
Posts: 3
Registered: ‎11-18-2009
Message 3 of 3 (158 Views)

Re: Retrieve SaveAs version in Database.BeginSave

04-01-2012 11:07 PM in reply to: arcticad

Thanks for the answer but this is not quite what I'm looking for. However I would have found a solution in c++ : There is a method in the AcApDocument class:



virtual SaveFormat formatForSave() const = 0;

 

Is there a .NET property or method anywhere that I could query in the Document.BeginSave event?

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Are You Going To Be @ AU 2014? Feel free to drop by our AU topic post and share your plans, plug a class that you're teaching, or simply check out who else from the community might be in attendance. Ohh and don't forgot to stop by the Autodesk Help | Learn | Collaborate booths in the Exhibit Hall and meet our community team if you get a chance!