故城 发表于 2012-8-30 09:48:00

三维点集合创建引线标注的问题

using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.Colors;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.Geometry;
using Autodesk.AutoCAD.Runtime;
using System;

    class ModelSpace
{
    public static ObjectId AddLeader(Point3dCollection pts, bool splBool)      //由三维点集合创建引线标注的函数.      
      {

            Leader ent = new Leader();
            ent.IsSplined = splBool;
            for (int i = 0; i < pts.Count; i++)
            {
                ent.AppendVertex(pts);
                ent.SetVertexAt(i, pts);
            }
            ObjectId entId = AppendEntity(ent);
            return entId;
      }
}
建立上面的函数后,错误列表总提示:
错误                “Autodesk.AutoCAD.Geometry.Point3dCollection”不包含“Count”的定义,并且找不到可接受类型为“Autodesk.AutoCAD.Geometry.Point3dCollection”的第一个参数的扩展方法“Count”(是否缺少 using 指令或程序集引用?)       
我有使用到该函数,运行的时候错误列表却可以自动清空。对上面函数的使用:            // 引线----------------------------------------------------            Point3dCollection pts_x_1 = new Point3dCollection();            pts_x_1.Add(new Point3d(48.8731, 64.5189, 0));            pts_x_1.Add(new Point3d(57.4477, 59.5999, 0));            pts_x_1.Add(new Point3d(69.406, 59.5999, 0));            ModelSpace.AddLeader(pts_x_1, false);该段程序却可以执行,这是为什么?

nigma 发表于 2012-9-1 22:20:41

你什么版本的autocad?
我这里没提示有这个错误

故城 发表于 2012-9-3 08:54:51

nigma 发表于 2012-9-1 22:20 static/image/common/back.gif
你什么版本的autocad?
我这里没提示有这个错误

我用的是CAD2007
代码写在vS2008,未运行的时候就有改错误提示,运行VS2008后该错误又会消失!

故城 发表于 2012-9-6 08:58:06

我是用.net2.0,以为如果改为.net3.5则会和 Media类起冲突。

huaxiamengqing 发表于 2012-9-7 12:50:06

acdbmgd 估计是dll引用问题。

故城 发表于 2012-9-8 15:24:28

huaxiamengqing 发表于 2012-9-7 12:50 static/image/common/back.gif
acdbmgd 估计是dll引用问题。

我有引用,可能是什么问题呢?
页: [1]
查看完整版本: 三维点集合创建引线标注的问题