Fenix1986 发表于 2010-6-4 16:14:00

[求助]版本号的问题

<p>在我的2008的版本CAD中</p>
<p>&nbsp;</p>
<p><font face="Verdana">AutoCAD 2000/LT2000 图形(*.dwg) 的版本号是<font face="Verdana">DwgVersion.AC1015</font></font></p>
<p>&nbsp;</p>
<p><font face="Verdana"><font face="Verdana">AutoCAD 2004/LT2004 图形(*.dwg) 的版本号是<font face="Verdana"><font face="Verdana">DwgVersion.AC1800</font></font></font></font></p>
<p>&nbsp;</p>
<p><font face="Verdana">AutoCAD 2007 图形(*.dwg)<font face="Verdana">的版本号是<font face="Verdana"><font face="Verdana"><font face="Verdana">DwgVersion.Current</font></font></font></font></font></p>
<p>&nbsp;</p>
<p>那么<font face="Verdana">AutoCAD R14/LT98/LT97 图形(*.dwg)的版本代码是什么呢?我试了所有的可以取的枚举变量。从AC1001到1014都试过了,都不可以。</font></p>
<p>&nbsp;</p>
<p>请高手指点我下。</p>

雪山飞狐_lzh 发表于 2010-6-4 17:15:00

<table class="Table4" cellspacing="0">
<tbody>
<tr>
<td class="Element262" valign="top" width="50%">
<div class="Element263">AC1001 = 8&nbsp;</div></td>
<td class="Element266" valign="top" width="50%">
<div class="Element267">&nbsp;</div></td></tr>
<tr>
<td class="Element262" valign="top" width="50%">
<div class="Element263">AC1002 = 9&nbsp;</div></td>
<td class="Element266" valign="top" width="50%">
<div class="Element267">AutoCAD 2.5&nbsp;</div></td></tr>
<tr>
<td class="Element262" valign="top" width="50%">
<div class="Element263">AC1003 = 10&nbsp;</div></td>
<td class="Element266" valign="top" width="50%">
<div class="Element267">AutoCAD 2.6&nbsp;</div></td></tr>
<tr>
<td class="Element262" valign="top" width="50%">
<div class="Element263">AC1004 = 11&nbsp;</div></td>
<td class="Element266" valign="top" width="50%">
<div class="Element267">Release 9&nbsp;</div></td></tr>
<tr>
<td class="Element262" valign="top" width="50%">
<div class="Element263">AC1005 = 12&nbsp;</div></td>
<td class="Element266" valign="top" width="50%">
<div class="Element267">&nbsp;</div></td></tr>
<tr>
<td class="Element262" valign="top" width="50%">
<div class="Element263">AC1006 = 13&nbsp;</div></td>
<td class="Element266" valign="top" width="50%">
<div class="Element267">Release 10&nbsp;</div></td></tr>
<tr>
<td class="Element262" valign="top" width="50%">
<div class="Element263">AC1007 = 14&nbsp;</div></td>
<td class="Element266" valign="top" width="50%">
<div class="Element267">&nbsp;</div></td></tr>
<tr>
<td class="Element262" valign="top" width="50%">
<div class="Element263">AC1008 = 15&nbsp;</div></td>
<td class="Element266" valign="top" width="50%">
<div class="Element267">&nbsp;</div></td></tr>
<tr>
<td class="Element262" valign="top" width="50%">
<div class="Element263">AC1009 = 0x10&nbsp;</div></td>
<td class="Element266" valign="top" width="50%">
<div class="Element267">R11 and R12&nbsp;</div></td></tr>
<tr>
<td class="Element262" valign="top" width="50%">
<div class="Element263">AC1010 = 0x11&nbsp;</div></td>
<td class="Element266" valign="top" width="50%">
<div class="Element267">&nbsp;</div></td></tr>
<tr>
<td class="Element262" valign="top" width="50%">
<div class="Element263">AC1011 = 0x12&nbsp;</div></td>
<td class="Element266" valign="top" width="50%">
<div class="Element267">&nbsp;</div></td></tr>
<tr>
<td class="Element262" valign="top" width="50%">
<div class="Element263">AC1012 = 0x13&nbsp;</div></td>
<td class="Element266" valign="top" width="50%">
<div class="Element267">R13&nbsp;</div></td></tr>
<tr>
<td class="Element262" valign="top" width="50%">
<div class="Element263">AC1013 = 20&nbsp;</div></td>
<td class="Element266" valign="top" width="50%">
<div class="Element267">&nbsp;</div></td></tr>
<tr>
<td class="Element262" valign="top" width="50%">
<div class="Element263">AC1014 = 0x15&nbsp;</div></td>
<td class="Element266" valign="top" width="50%">
<div class="Element267">R14&nbsp;</div></td></tr>
<tr>
<td class="Element262" valign="top" width="50%">
<div class="Element263">AC1015 = 0x17&nbsp;</div></td>
<td class="Element266" valign="top" width="50%">
<div class="Element267">&nbsp;</div></td></tr>
<tr>
<td class="Element262" valign="top" width="50%">
<div class="Element263">AC1021 = 0x1b&nbsp;</div></td>
<td class="Element266" valign="top" width="50%">
<div class="Element267">2007 Final&nbsp;</div></td></tr>
<tr>
<td class="Element262" valign="top" width="50%">
<div class="Element263">AC1500 = 0x16&nbsp;</div></td>
<td class="Element266" valign="top" width="50%">
<div class="Element267">&nbsp;</div></td></tr>
<tr>
<td class="Element262" valign="top" width="50%">
<div class="Element263">AC1800 = 0x19&nbsp;</div></td>
<td class="Element266" valign="top" width="50%">
<div class="Element267">&nbsp;</div></td></tr>
<tr>
<td class="Element262" valign="top" width="50%">
<div class="Element263">AC1800a = 0x18&nbsp;</div></td>
<td class="Element266" valign="top" width="50%">
<div class="Element267">2004 Final&nbsp;</div></td></tr>
<tr>
<td class="Element262" valign="top" width="50%">
<div class="Element263">AC1To2 = 1&nbsp;</div></td>
<td class="Element266" valign="top" width="50%">
<div class="Element267">&nbsp;</div></td></tr>
<tr>
<td class="Element262" valign="top" width="50%">
<div class="Element263">AC1To40 = 2&nbsp;</div></td>
<td class="Element266" valign="top" width="50%">
<div class="Element267">&nbsp;</div></td></tr>
<tr>
<td class="Element262" valign="top" width="50%">
<div class="Element263">AC1To50 = 3&nbsp;</div></td>
<td class="Element266" valign="top" width="50%">
<div class="Element267">&nbsp;</div></td></tr>
<tr>
<td class="Element262" valign="top" width="50%">
<div class="Element263">AC2100a = 0x1a&nbsp;</div></td>
<td class="Element266" valign="top" width="50%">
<div class="Element267">&nbsp;</div></td></tr>
<tr>
<td class="Element262" valign="top" width="50%">
<div class="Element263">AC2To10 = 5&nbsp;</div></td>
<td class="Element266" valign="top" width="50%">
<div class="Element267">&nbsp;</div></td></tr>
<tr>
<td class="Element262" valign="top" width="50%">
<div class="Element263">AC2To20 = 4&nbsp;</div></td>
<td class="Element266" valign="top" width="50%">
<div class="Element267">&nbsp;</div></td></tr>
<tr>
<td class="Element262" valign="top" width="50%">
<div class="Element263">AC2To21 = 6&nbsp;</div></td>
<td class="Element266" valign="top" width="50%">
<div class="Element267">&nbsp;</div></td></tr>
<tr>
<td class="Element262" valign="top" width="50%">
<div class="Element263">AC2To22 = 7&nbsp;</div></td>
<td class="Element266" valign="top" width="50%">
<div class="Element267">&nbsp;</div></td></tr></tbody></table><a name="4465736372697074696F6E"></a>
<div class="Element14">&nbsp;</div>

chengw 发表于 2012-3-12 16:19:11

雪山飞狐_lzh 发表于 2010-6-4 17:15 static/image/common/back.gif
AC1001 = 8&nbsp;

&nbsp;


我想请教下你。。如果我已知一个*.dwg文件,如何得到该文件的版本号啊???得到DWG文件的版本号、、、谢谢。。。。

sieben 发表于 2012-3-12 17:56:59

本帖最后由 sieben 于 2012-3-12 18:00 编辑

不打开文件获取版本号
    /// <summary>
    /// 获取Dwg文件的版本字符串
    /// 从第0位开始,读入6个字节
    /// Version:2011.10.23 Sieben
    /// 备注:
    /// 1,内容没有加密
    /// </summary>
    /// <param name="fileName">dwg文件全名</param>
    /// <returns>成功返回Dwg文件的版本字符串,举例:AC1021</returns>
    public static string GetDwgVersion(string fileName)
    {
      try
      {
      if (!System.IO.File.Exists(fileName)) return "";
      if (!fileName.Split('.').Equals("Dwg", StringComparison.OrdinalIgnoreCase)) return "";
      FileStream dwgStream = new FileStream(fileName, FileMode.Open, FileAccess.Read);//文件流   
      BinaryReader binReader = new BinaryReader(dwgStream);
      dwgStream.Seek(0, SeekOrigin.Begin);//从第0位开始
      try
      {
          byte[] byteArr = binReader.ReadBytes(6);//读入6个字节
          StringBuilder strB = new StringBuilder();
          foreach (byte b in byteArr)
          {
            strB.Append(Convert.ToChar(b));
          }
          return strB.ToString();
      }
      catch { return ""; }
      }
      catch (System.Exception ex)
      {
      System.Windows.Forms.MessageBox.Show(ex.Message);
      return "";
      }
    }

sieben 发表于 2012-3-12 18:00:12

软件的版本号
1, public static System.Version Version { get; }
    Autodesk.AutoCAD.ApplicationServices.Application 的成员
2, 系统变量 ACADVER

sieben 发表于 2012-3-12 18:02:28

本帖最后由 sieben 于 2012-3-12 18:33 编辑

已打开Dwg文件从Database获取版本号
public Autodesk.AutoCAD.DatabaseServices.DwgVersion OriginalFileVersion { get; }
    Autodesk.AutoCAD.DatabaseServices.Database 的成员
public Autodesk.AutoCAD.DatabaseServices.DwgVersion OriginalFileSavedByVersion { get; }
    Autodesk.AutoCAD.DatabaseServices.Database 的成员
public Autodesk.AutoCAD.DatabaseServices.DwgVersion LastSavedAsVersion { get; }
    Autodesk.AutoCAD.DatabaseServices.Database 的成员

ps122hb 发表于 2012-3-13 12:06:20

sieben 兄回答的很详细,谢谢
页: [1]
查看完整版本: [求助]版本号的问题