明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 3171|回复: 2

利用CAD的API怎么画一个带箭头的“引线”(Leader)?

[复制链接]
发表于 2007-10-17 16:02 | 显示全部楼层 |阅读模式

请问各位大虾:利用CAD的API怎么画一个带箭头的“引线”(Leader)?就像输入“Leader”命令一样。是不是和画直线,圆等实体一样的画法啊?有没有其它其它画带箭头直线的方法?

 楼主| 发表于 2007-10-17 16:23 | 显示全部楼层
我用的是以下这个方法,怎么没有反应?
         public static ObjectId DrawLeader(Point3d startPoint,Point3d endPoint)
        {
            ObjectId leaderId = ObjectId.Null;// The return value for this function
            Database db = HostApplicationServices.WorkingDatabase;//获得当前工作空间的数据库
            using (Transaction trans = db.TransactionManager.StartTransaction())
            {
                BlockTable bt =  trans.GetObject(db.BlockTableId, OpenMode.ForWrite) as BlockTable;
                BlockTableRecord btr = bt[BlockTableRecord.ModelSpace].GetObject(OpenMode.ForWrite) as BlockTableRecord;
                Leader leader = new Leader();// 标注线(带箭头)              
                leader.AppendVertex(startPoint);
                leader.AppendVertex(endPoint);
                lineId = btr.AppendEntity(leader);
                trans.AddNewlyCreatedDBObject(leader, true);
                trans.Commit();
            }
            return leaderId ;
        }
 楼主| 发表于 2007-10-18 10:11 | 显示全部楼层

这个方法是可以的,原来参数startPoint和endPoint设置有问题。一定要设置成New Point3d(X,Y,0)的形式才行。

您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-5-3 12:24 , Processed in 0.442743 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表