Message 1 of 7
add text to points, without block creation.

Not applicable
10-14-2012
09:22 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
{ Entity e = (Entity)tr.GetObject(id, OpenMode.ForRead); DBPoint p = (DBPoint)e; ed.WriteMessage(" p.Position.X --> " + p.Position.X + " / Y= " + p.Position.Y + " / Z= " + p.Position.Z); DBText acText = new DBText(); acText.SetDatabaseDefaults(); acText.Position = new Point3d(Convert.ToDouble(p.Position.X), Convert.ToDouble(p.Position.Y), 0); acText.Height = 0.5; acText.TextString = "Hello, World."; ents.Add(acText); acBlkTblRec.AppendEntity(acText); tr.AddNewlyCreatedDBObject(acText, true); } tr.Commit();
In the above I can add text to the drawing with the blocks defined as below:
BlockTable acBlkTbl; acBlkTbl = tr.GetObject(db.BlockTableId, OpenMode.ForRead) as BlockTable; BlockTableRecord acBlkTblRec; acBlkTblRec = tr.GetObject(acBlkTbl[BlockTableRecord.ModelSpace], OpenMode.ForWrite) as BlockTableRecord;
Can I add text to a dwg file which has shp data imported, without using a block. The above code to add text to a new file with points works well.
But if my file has some points imported from a SHP file, the text does not get created.
Please suggest a way to add a text to this dwg file with imported shp data.
Thanks.