文档介绍:1、Teigha中DWG数据库结构:
Vie a Tctjie
T&tStMe
川u
Layer
Fjjle
UredypE
Table
DrnStyle
1 tiIh
Vev/port
Tabe
UCB
Tadeobject to the table. 添加对象(记录)到表 styleId = (pStyle);
// 设置剩下的属性。 (可以添加后设置也可以添加之前设置)
= textSize;
= xScale;
= priorSize;
= obliquing;
= fileName;
if (isShapeFile)
= ;
if (! string .IsNullOrEmpty(ttFaceName)) = newFontDescriptor (ttFaceName, bold, italic, charset,
pitchAndFamily);
return styleId;
}
}
注: pDb 为 Database
添加线型
using ( LinetypeTable pLinetypes =
( LinetypeTable )( )) {
// 线表记录
using ( LinetypeTableRecord pLinetype = new LinetypeTableRecord ())
{
= name;// 必须命名
ObjectId linetypeId = (pLinetype); // 添加记录
return linetypeId;
}
}
注:线型要有相应的线型文件,且不一定能够加成功,线型可以在使用之前手动加在
模板中,从其他文件向 dwg 文件复制线型,可能不成功。
dwg
添加块
例:
using ( BlockTable blockTable = ( BlockTable )( ))
{ ObjectId annoBlockId; using ( BlockTableRecord btr = new BlockTableRecord ()) { ="AnnoBlock" ;
annoBlockId = (btr);
using ( Circle pCircle = new Circle ())
{
(pDb);
(pCircle);
Point3d center = new Point3d (0, 0, 0);
= center;
=