I have placed a text on a dwg file and placed a polyline around the same text.
But now I want to make both the text and the polyline as a Group, so that once we select text, the polyline should automatically be selected and vice-versa.
Could anyone please povide me a sample code for the same?
The attachment shows the Group, the Polyline and the Text.
May be you can get some inspiration from this :
private static void Group(ObjectIdCollection ids)
Database db = ids.Database;
Transaction tr = db.TransactionManager.TopTransaction;
DBDictionary NOD =
DBDictionary groups =
using (Autodesk.AutoCAD.DatabaseServices.Group grp = new Autodesk.AutoCAD.DatabaseServices.Group())
foreach (ObjectId id in ids)
Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register
Start with some of our most frequented solutions to get help installing your software.