Is there a method/way to get the version a .dwg file was last saved in?
I see GetDWGVersion but this consistently returns a value of 1.
DWG Version
Moderators: SDS, support, admin
Re: DWG Version
Hello Chris,
You can determine the DWG version using a CADImage.Converter.HeadStruct.Version field which returns a byte type value for different DWG versions:
Mikhail
You can determine the DWG version using a CADImage.Converter.HeadStruct.Version field which returns a byte type value for different DWG versions:
- 0 - DWG R9 (AC1004)
1 - DWG R10 (AC1006)
2 - DWG R11 (AC1009)
3 - DWG R12 (AC1009)
4 - DWG R13 (AC1012)
5 - DWG R14 (AC1014)
6 - DWG 2000 (AC1015)
7 - DWG 2004 (AC1018)
8 - DWG 2007 (AC1021)
9 - DWG 2010 (AC1024)
10 - DWG 2013 (AC1027)
Code: Select all
byte version = cadImage.Converter.GetDWGVersion("AC1027");
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support
Chat support on Skype: cadsofttools.support
Re: DWG Version
You can get AC#### code directly from dwg file by reading first six bytes :
Code: Select all
Function GetDwgVersion(ByVal sFileName As String) As String
Dim strVersion As String = ""
Using reader As New System.IO.BinaryReader(File.Open(sFileName, FileMode.Open, FileAccess.Read))
Dim bt() As Byte = reader.ReadBytes(6)
strVersion = System.Text.ASCIIEncoding.ASCII.GetString(bt)
reader.Close()
End Using
GetDwgVersion = strVersion
End Function