需要使用.NET API在CAD绘图中添加/删除在标题栏区域中绘制为单个CAD实体的项目,该项目不是属性。有没有办法在CAD图纸或任何其他方法上使用点引用,这可以通过API完成?
已要求CAD实体删除图像,客户端地址和网址。
用它来访问属性
BlockTableRecord blkTblRecTitle =
transaction.GetObject(blockTable[BlockTableRecord.PaperSpace],
OpenMode.ForWrite) as BlockTableRecord;
foreach (ObjectId id in blkTblRecTitle)
{
DBObject obj = transaction.GetObject(id, OpenMode.ForWrite);
BlockReference blkRef = obj as BlockReference;
if (blkRef != null)
{
AttributeCollection attCol = blkRef.AttributeCollection;
foreach (ObjectId objID in attCol)
{
DBObject dbObj = transaction.GetObject(objID,
OpenMode.ForWrite) as DBObject;
AttributeReference acAttRef = dbObj as
AttributeReference;
}
}
}
设法找到如何在一个位置添加多行文本
using (MText acText = new MText())
{
acText.Location = new Point3d(802, 106.5, 0);
acText.TextHeight = 2;
acText.Contents = "Hello World.\nNow need to right align text.";
blkTblRecTitle.AppendEntity(acText);
transaction.AddNewlyCreatedDBObject(acText, true);
}
理想情况下,想要对齐,但无法在任何地方看到我如何使用必须用于多行的MText。
如果在Paper Space中添加文本时出现问题,则无法查看如何添加图像。
要编辑.DWG文件,您需要AutoCAD引擎,它可以是:
然后我会建议查看博客documentation和here的示例代码。