public Polyline CopyPolyline(BlockTableRecord spaceRecord, ref Polyline pline, Transaction tr) { Polyline newpLine = new Polyline(); int max = pline.NumberOfVertices; for (int i = 0; i < max; i++) { newpLine.AddVertexAt(i, pline.GetPoint2dAt(i), pline.GetBulgeAt(i), pline.GetStartWidthAt(i), pline.GetEndWidthAt(i)); } newpLine.Closed = pline.Closed; //newpLine.Layer = pline.Layer.Split('|').Last(); newpLine.Layer = frameBlockAboveLayer; newpLine.Normal = pline.Normal; newpLine.Color = pline.Color; newpLine.ColorIndex = pline.ColorIndex; spaceRecord.UpgradeOpen(); spaceRecord.AppendEntity(newpLine); tr.AddNewlyCreatedDBObject(newpLine, true); spaceRecord.DowngradeOpen(); return(newpLine); }