.NET

Reply
Contributor
khushboo.singh
Posts: 20
Registered: ‎11-09-2011
Message 1 of 2 (154 Views)

Group text and polyline

154 Views, 1 Replies
11-30-2012 06:29 AM

Hi,

 

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.

*Expert Elite*
Posts: 1,981
Registered: ‎04-29-2006
Message 2 of 2 (148 Views)

Re : Group text and polyline

11-30-2012 07:19 AM in reply to: khushboo.singh

Hi,

 

May be you can get some inspiration from this :

 

        private static void Group(ObjectIdCollection ids)
        {
            Database db = ids[0].Database;
            Transaction tr = db.TransactionManager.TopTransaction;
            DBDictionary NOD =
                (DBDictionary)tr.GetObject(db.NamedObjectsDictionaryId, OpenMode.ForRead);
            DBDictionary groups =
                (DBDictionary)tr.GetObject(NOD.GetAt("ACAD_GROUP"), OpenMode.ForWrite);
            using (Autodesk.AutoCAD.DatabaseServices.Group grp = 
new Autodesk.AutoCAD.DatabaseServices.Group()) { foreach (ObjectId id in ids) { grp.Append(id); } groups.SetAt("*", grp); } }

 

Gilles Chanteau

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Welcome to the new Autodesk Community!
If this is your first visit, click here to get started and make the most of the Community. Let us know what you think of the new experience in the Community Feedback Forum.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community