Message 1 of 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Strange...when using this it's literally exploding my original polyline. Is clone inttended to work this way?
Polyline newpoly = new Polyline(); Document doc = Application.DocumentManager.MdiActiveDocument; Database db = doc.Database; Editor ed = doc.Editor; PromptEntityResult per = ed.GetEntity("Select a polyline"); if (per.Status == PromptStatus.OK) using (Transaction Tx = db.TransactionManager.StartTransaction()) { // Open the Block table for read BlockTable acBlkTbl; acBlkTbl = Tx.GetObject(db.BlockTableId, OpenMode.ForRead) as BlockTable; // Open the Block table record Model space for write BlockTableRecord acBlkTblRec; acBlkTblRec = Tx.GetObject(acBlkTbl[BlockTableRecord.ModelSpace], OpenMode.ForWrite) as BlockTableRecord; DBObject obj = Tx.GetObject(per.ObjectId, OpenMode.ForRead); Polyline lwp = obj as Polyline; newpoly = lwp.Clone() as Polyline; newpoly.ColorIndex = 1; acBlkTblRec.AppendEntity(newpoly); Tx.AddNewlyCreatedDBObject(newpoly, true); Tx.Commit(); }
"Very funny, Scotty. Now beam down my clothes.
Solved! Go to Solution.