.Net AutoCAD添加客户属性

时间:2019-02-25 03:57:12

标签: c# .net autocad autocad-plugin

下面是命令结果:命令-> (entget(car(entsel))(list "*"))

  

((-1 . <xx: 7ffffb14000>) (0 . "LWPOLYLINE") (330 . <xx: 7ffffb06a30>) (5 . "5968") (100 . "AcDbEntity") (67 . 0) (410 . "Model") (8 . "LayerName") (6 . "Continuous") (100 . "AcDbPolyline") (90 . 2) (70 . 0) (43 . 0.0) (38 . 0.0) (39 . 0.0) (10 10035.5 13933.3) (40 . 0.0) (41 . 0.0) (42 . 0.0) (91 . 0) (10 9323.13 14915.2) (40 . 0.0) (41 . 0.0) (42 . 0.0) (91 . 0) (210 0.0 0.0 1.0) (-3 ("CLEAR_WIRE" (1000 . "CWIRE") (1000 . "0") (1000 . "1") (1000 . "")) ("Wire Index" (1071 . 1))))

在我的代码PolyLineObject中,我没有看到“电线索引”。 如果要添加“电线索引”,该怎么办?

using (BlockTable BlockList = OperateTransaction.GetObject(ActiveDatabase.BlockTableId, OpenMode.ForRead) as BlockTable)
{
    foreach (ObjectId BlockId in BlockList)
    {
      BlockRecord = OperateTransaction.GetObject(BlockId, OpenMode.ForRead) as BlockTableRecord;
      foreach (ObjectId BlockRecordId in BlockRecord)
      {          
        if (BlockRecordId.ObjectClass.DxfName.Equals("LWPOLYLINE"))
        {
          PolylineObject = OperateTransaction.GetObject(BlockRecordId, OpenMode.ForRead) as Polyline;
        }
      }
    }
}

1 个答案:

答案 0 :(得分:0)

此“属性”称为XData,表示扩展数据。 .net使用它的示例您可以找到例如here