资源简介
添加两个dll引用,CAD安装文件夹下的acdb,acmgd;设置启动程序为acad.exe

代码片段和文件信息
/* Author:hyb
* Tele:18323432139
* Time:2014-8-11
* Discribtion:凸边界搜索函数
* */
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.Geometry;
using Autodesk.AutoCAD.Runtime;
using Autodesk.AutoCAD.EditorInput;
using System.Collections.Generic;
using System.Linq;
namespace Search
{
public class Class1
{
[CommandMethod(“hyb_T“)]
public void search()
{
DBPoint Ap;
DBPoint temp;
//获取图纸点集,并进行排序
DBobjectCollection dbc= Collection();
List pts = new List();
foreach (DBobject dbo in dbc)
{
if (dbo.GetType().Name.ToString() == “DBPoint“)
{
DBPoint pt = (DBPoint)dbo;
pts.Add(pt);
}
}
var m= pts.OrderBy(i => i.Position.X);
pts = m.ToList();
DBPoint[] DBps = pts.ToArray();
//计算临近边界点集,并绘制边界
Ap = pts[0];
temp = pts[1];
List ls=new List();
DBPoint End=new DBPoint();
do{
End = select(Ap temp DBps);
ls.Add(new Line(Ap.Position End.Position));
temp = Ap;
Ap = End;
} while (End != pts[0]);
foreach (Line l in ls)
{
ToModelSpace(l);
}
}
///
/// 选择集合
///
///
public static DBobjectCollection Collection()
{
Database db = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Database;
Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;
Entity entity = null;
DBobjectCollection EntityCollection = new DBobjectCollection();
PromptSelectionResult ents = ed.GetSelection();
if (ents.Status == PromptStatus.OK)
{
using (Transaction transaction = db.TransactionManager.StartTransaction())
{
SelectionSet SS = ents.Value;
foreach (objectId id in SS.GetobjectIds())
{
entity = (Entity)transaction.Getobject(id OpenMode.ForWrite true);
if (entity != null)
EntityCollection.Add(entity);
}
transaction.Commit();
}
}
return EntityCollection;
}
///
/// 计算临近边界点
///
/// 起点
/// 终点
/// 点集
///
private DBPoint select(DBPoint spDBPoin
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 7680 2014-08-12 10:08 Search\Search\bin\Debug\Search.dll
文件 15872 2014-08-12 10:08 Search\Search\bin\Debug\Search.pdb
文件 4718 2014-08-11 16:43 Search\Search\Class1.cs
文件 5819 2014-08-12 10:08 Search\Search\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache
文件 83467 2014-08-11 13:34 Search\Search\obj\Debug\ResolveAssemblyReference.cache
文件 7680 2014-08-12 10:08 Search\Search\obj\Debug\Search.dll
文件 15872 2014-08-12 10:08 Search\Search\obj\Debug\Search.pdb
文件 320 2014-08-11 14:42 Search\Search\obj\Debug\Search_T.csproj.FileListAbsolute.txt
文件 1362 2014-08-11 12:59 Search\Search\Properties\AssemblyInfo.cs
文件 2690 2014-08-11 13:34 Search\Search\Search_T.csproj
文件 386 2014-08-11 13:34 Search\Search\Search_T.csproj.user
文件 912 2014-08-11 13:34 Search\Search.sln
..A..H. 17920 2014-08-12 17:32 Search\Search.suo
文件 10 2014-08-12 10:23 Search\说明.txt
目录 0 2014-08-11 12:59 Search\Search\obj\Debug\TempPE
目录 0 2014-08-11 13:34 Search\Search\bin\Debug
目录 0 2014-08-12 10:08 Search\Search\obj\Debug
目录 0 2014-08-11 12:59 Search\Search\bin
目录 0 2014-08-11 12:59 Search\Search\obj
目录 0 2014-08-11 12:59 Search\Search\Properties
目录 0 2014-08-11 13:00 Search\Search
目录 0 2014-08-12 10:23 Search
----------- --------- ---------- ----- ----
164708 22
相关资源
- 在delphi7下进行autocad二次开发的一个简
- AutoCAD二次开发在直齿圆柱齿轮参数化
- lisp源代码 ***工具箱代码 cad二次开发
- AUTOCAD二次开发零件自动拆图自动标注
- 1 AutoCAD .NET开发指南2012版》.rar
- 利用AutoCAD二次开发功能实现自动提取
- 深居浅出AutoCAD二次开发教程
-
CAD arxob
ject二次开发入门之动态属性 - 清华大学的《CAD二次开发》(附动态
- 清华大学cad二次开发
- ZDM2014v13.0 141103网络&单机版.7z
- AutoCAD二次开发API全文档英文
- 用lsp语言进行cad二次开发
-
AutoCAD ob
jectARX(VC)开发基础与教程 - EzCad二次开发源代码三
-
ob
jectArx通过Jig拖动绘制自定义实体 -
基于ob
jectARX的AUTOCAD二次开发文档 - EzCad二次开发源代码一
- EzCad二次开发源代码二
- CAD二次开发
- AutoCAD .NET API进行AutoCAD二次开发基础代
- 金橙子easycad二次开发sdk 各版本MarkE
- [深入浅出AutoCAD.NET二次开发].李冠亿
- CAD二次开发LISP程序源码 90个源码代码
- Z轴归零-CAD二次开发LISP源代码
- 槽孔绘制-CAD二次开发LISP源代码
评论
共有 条评论