使用Teigha.NET操作DWG基本配置
Posted 编程圈子
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了使用Teigha.NET操作DWG基本配置相关的知识,希望对你有一定的参考价值。
一、安装下载需要的环境。
VS2012、Teigha.NET3.03_9的demo
二、新建C# 项目,选择Framework2.0作为目标框架。
添加引用“TD_Mgd_3.03_9.dll"
三、开始写代码,首先初始化Teigha.NET
using (Services svcs = new Services())
Teigha.NET的命名空间主要有以下这些:
- Teigha.Colors Namespace — Corresponds to OdCm unmanaged classes. Contains classes for working with colors.
- Teigha.DatabaseServices Namespace — Corresponds to OdDb unmanaged classes. Contains database classes.
- Teigha.Geometry Namespace — Corresponds to OdGe unmanaged classes. Used to carry out general 2D and 3D geometric operations.
- Teigha.GraphicsInterface Namespace — Corresponds to OdGi unmanaged classes. Contains classes for entity vectorization.
- Teigha.GraphicsSystem Namespace — Corresponds to OdGs unmanaged classes. Contains graphical system classes.
- Teigha.Runtime Namespace — Contains system-level functionality classes, such as classes for runtime class registration and identification.
五、示例:
using Teigha.Runtime;
using Teigha.DatabaseServices;
using Teigha.Geometry;
namespace BatchReplaceText
class Program
static void Main(string[] args)
using (Services svcs = new Services())
Database db=new Database();
Circle cirl = new Circle();
cirl.Center = new Point3d(100, 100, 0);
cirl.Radius = 14;
BlockTableRecord btr = (BlockTableRecord)db.CurrentSpaceId.Open(OpenMode.ForWrite);
btr.AppendEntity(cirl);
db.SaveAs("C:\\\\test.dwg", DwgVersion.Current);
以上是关于使用Teigha.NET操作DWG基本配置的主要内容,如果未能解决你的问题,请参考以下文章