public void TestAnonyBlock() { Polyline pline = new Polyline(3); pline.AddVertexAt(0, new Point2d(0, 0), 0, 0, 0); pline.AddVertexAt(1, new Point2d(pline.GetPoint2dAt(0).X + 3, pline.GetPoint2dAt(0).Y), 0, 0.4, 0); pline.AddVertexAt(2, new Point2d(pline.GetPoint2dAt(1).X + 1.5, pline.GetPoint2dAt(1).Y), 0, 0, 0); pline.LineWeight = LineWeight.LineWeight020; AttributeDefinition ad = _createAttribute(pline.StartPoint, pline); Matrix3d ucs = CoordinateSystem.CoordinateTools.GetCurrentUcs(); var btrId = BlockTools.CreateBlockTableRecordEx(Point3d.Origin, "test11111", new[] { (Entity)pline, (Entity)ad }.ToList(), AnnotativeStates.True); var brId = BlockTools.AddBlockRefToModelSpace(btrId, new[] { "3" }.ToList(), new Point3d(10, 10, 10), ucs); using (Transaction trans = Tools.StartTransaction()) { BlockReference br = (BlockReference)brId.GetObject(OpenMode.ForRead, false, true); br.UpgradeOpen(); br.TransformBy(Matrix3d.Rotation(Math.PI / 2d, ucs.CoordinateSystem3d.Zaxis, br.Position)); //br.Erase(true); trans.Commit(); } AttributeReference ar; using (Transaction trans = Tools.StartTransaction()) { BlockReference br = (BlockReference)brId.GetObject(OpenMode.ForRead, true, true); ar = br.GetAttributeByTag(ad.Tag, trans); ar = (AttributeReference)ar.Id.GetObject(OpenMode.ForRead, true, true); var anBtrId = BlockTools.GetAnonymCopy(brId, trans, false); var anBrId = BlockTools.AddBlockRefToModelSpace(anBtrId, new[] { ar.TextString }.ToList(), new Point3d(0, 0, 0), ucs); trans.Commit(); } }