acedSSGet – multi select in :N mode

By Xiaodong Liang

We have known acedSSGet can select nested entities with the argument :N. But in default, it supports single selection. If you select by window, no any nested entity is returned. If you select by cross, only one nested entity will be returned.

The following code is a solution:

static void multi-select_nested_entity()    {    // switch on the multi selection of nested entities    setAllowDuplicateSelection(curDoc(), true);        curDoc()->inputPointManager()->turnOnSubentityWindowSelection();           ads_name sset, eName;     AcDbObjectId id;          // in the mode "_:n"       //     if (RTNORM == acedSSGet(L"_:n", NULL, NULL, NULL, sset))     {          acutPrintf(L"n");          long len = 0;          acedSSLength(sset, &len);          for (long i = 0; i < len; i++)          {                             resbuf *rb = NULL;               //  ssnamex() returns all selected nested entities               //                  if (RTNORM == acedSSNameX(&rb, sset, i))               {                    resbuf *rbWalk = rb;                    while (NULL != rbWalk)                    {                         if (RTENAME ==                              rbWalk->restype)                         {                              eName[0] =                                  rbWalk->resval.rlname[0];                              eName[1] =                                  rbWalk->resval.rlname[1];          if(Acad::eOk == acdbGetObjectId(id, eName))                              {                                   acutPrintf(L"Entity %d: %x",                                       i,                                        id.asOldId());                      &#16
0;            AcDbEntity *pEnt;                                   if (Acad::eOk ==                                       acdbOpenObject(pEnt,                                       id,                                        AcDb::kForRead))                                   {                                     acutPrintf(L"(%s)n",                                    pEnt->isA()->name());                                                                  pEnt->close();                                   }                                   else                                   {                         acutPrintf(L"nCouldn't open object");                                   }                              }                              //rbWalk = NULL;                           }                         //else                         {                              rbWalk = rbWalk->rbnext;                         }                    }                    acutRelRb(rb);               }          }          acedSSFree(sset);          }            // swtich off       setAllowDuplicateSelection(curDoc(), false);       curDoc()->inputPointManager()->turnOffSubentityWindowSelection();     }

Comments

3 responses to “acedSSGet – multi select in :N mode”

  1. Jeff Suffet Avatar
    Jeff Suffet

    Is it possible to select multiple nested entities in VB.NET or C# Managed? Selecting 1 Nested Entity at a time is not really a good option…

  2. Kirill Zakharov Avatar
    Kirill Zakharov

    Yes. You can find the solution on .NET there: http://adn-cis.org/forum/index.php?topic=7683.msg25135#msg25135 made by Alexander Rivilis.

Leave a Reply

Discover more from Autodesk Developer Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading