水贴一族 发表于 2006-9-29 11:13:08

给我一点时间来阐述一下,我'我会发回一些起始代码。

顺水行舟 发表于 2006-9-29 12:01:29

这段C代码应该会让你开始学习 我是从我的一些类似C++代码中翻译出来的,但希望.NET专家会来指出我可能做过的任何愚蠢的事情
using System;
using System.IO;
using System.Text;
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.DatabaseServices;
namespace MetricOrImperial
{
    public class Main
    {
      public static int metricOrImperial(string fileName)
      {
            if(!File.Exists(fileName)) return -1;
            Database db = new Database(false, true);
            try
            {
                db.ReadDwgFile(fileName, System.IO.FileShare.Read, false, string.Empty);
                return db.Measurement == MeasurementValue.English ? 1 : 0;
            }
            catch (Exception e)
            {
                Application.DocumentManager.MdiActiveDocument.Editor.WriteMessage(e.ToString());
                return -1;
            }
      }
    }
}

糖果 发表于 2006-9-29 12:22:50

谢谢Chuck Gabriel

树屋酒吧 发表于 2006-9-29 12:33:43

你'欢迎再次光临
顺便说一句,我想返回值是倒过来的(假设你想遵循测量系统变量的约定) 它应该为英语返回0,为英制返回1。

别样春天在线 发表于 2006-9-29 13:54:44

AutoCAD系统变量测量;是我认为的autocad方式;我写的Autocad Mechanical;此函数和;将尝试将C代码中的此函数转换为布尔函数Mcad\u standarismetric(),设置symbb=ThisDrawing.Application.GetInterfaceObject("symbauto.McadSymbolBBMgr")
设置Ge=ThisDrawing.Application.GetInterfaceObject(“Ge.Application”)
设置stdmgr=symbb。标准管理器------------------------------------------------------------
Set currStand=stdmgr。当前标准;Mcad_StandardIsMetric=当前状态。IsMetric端函数
页: 1 [2]
查看完整版本: ObjectDBX