Using acedSSGet with :V selection mode

Using acedSSGet with :V selection mode

Anonymous
Not applicable
2,146 Views
7 Replies
Message 1 of 8

Using acedSSGet with :V selection mode

Anonymous
Not applicable

Hello,

 

I need to assign some XData values to a solid (box) face.

I try to use:

 

ads_name selSet;

acedSSGet( L"_:V", nullptr, nullptr, nullptr, selSet );

 

to let user specify the face. It seems to work fine, but how can I then get the face(s) selected ?

I tried:

 

ads_name entity;
acedSSName( selSet, 0, entity );

 

but it returns the entire solid...

 

0 Likes
Accepted solutions (1)
2,147 Views
7 Replies
Replies (7)
Message 2 of 8

Alexander.Rivilis
Mentor
Mentor

You have to use not  acedSSName but acedSSNameX. As an example you can see in the ObjectARX SDK: samples\entity\polysamp

hilit.cpp has the function hilitSolid which allow to highlight selected Face/Edge of AcDb3dSolid.

Відповідь корисна? Клікніть на "ВПОДОБАЙКУ" цім повідомленням! | Do you find the posts helpful? "LIKE" these posts!
Находите сообщения полезными? Поставьте "НРАВИТСЯ" этим сообщениям!
На ваше запитання відповіли? Натисніть кнопку "ПРИЙНЯТИ РІШЕННЯ" | Have your question been answered successfully? Click "ACCEPT SOLUTION" button.
На ваш вопрос успешно ответили? Нажмите кнопку "УТВЕРДИТЬ РЕШЕНИЕ"


Alexander Rivilis / Александр Ривилис / Олександр Рівіліс
Programmer & Teacher & Helper / Программист - Учитель - Помощник / Програміст - вчитель - помічник
Facebook | Twitter | LinkedIn
Expert Elite Member

0 Likes
Message 3 of 8

Alexander.Rivilis
Mentor
Mentor

@Anonymous wrote:

...I need to assign some XData values to a solid (box) face....

but it returns the entire solid...

 


It is impossible to assign Xdata to AcDb3dSolid  face, because XData can be assigned only to the whole object/entity

Face of AcDb3dSolid is not independent entity.

Відповідь корисна? Клікніть на "ВПОДОБАЙКУ" цім повідомленням! | Do you find the posts helpful? "LIKE" these posts!
Находите сообщения полезными? Поставьте "НРАВИТСЯ" этим сообщениям!
На ваше запитання відповіли? Натисніть кнопку "ПРИЙНЯТИ РІШЕННЯ" | Have your question been answered successfully? Click "ACCEPT SOLUTION" button.
На ваш вопрос успешно ответили? Нажмите кнопку "УТВЕРДИТЬ РЕШЕНИЕ"


Alexander Rivilis / Александр Ривилис / Олександр Рівіліс
Programmer & Teacher & Helper / Программист - Учитель - Помощник / Програміст - вчитель - помічник
Facebook | Twitter | LinkedIn
Expert Elite Member

0 Likes
Message 4 of 8

Anonymous
Not applicable

I've tried this solution. The problem is that I want to use:

acedSSGet( L"_:V", NULL, NULL, NULL, sset )

and not the:

acedSSGet(NULL, NULL, NULL, NULL, sset)

Because in the first case user can see what he selects. The faces get highlighted when mouse hovers over them. In the latter case the entire solid is being selected.

And when I use the selection mode string the

pEnt->getSubentPathsAtGsMarker( AcDb::kFaceSubentType, marker, pickpnt, xform, numIds, subentIds );

returns different face, then the one I've selected.

 

By the way, it is very strange, that there is a new special selection mode and no sample code uses it...

0 Likes
Message 5 of 8

Anonymous
Not applicable

@Alexander.Rivilis wrote:

It is impossible to assign Xdata to AcDb3dSolid  face, because XData can be assigned only to the whole object/entity

Face of AcDb3dSolid is not independent entity.



I expected this. AFAIK the face is not a DBRO. But I suppose I could assign to the solid the xdata containing face number along with the data which belongs to the face. I suppose there is some kind of consistent face numbering, to know for example which is the first face of the solid box, the second, etc.

0 Likes
Message 6 of 8

Alexander.Rivilis
Mentor
Mentor
Accepted solution

Maybe this code will be a sample:

 

static void RivilisTestGetSubent() {
  ads_name ss;
  AcArray<SubentType> subTypes;   subTypes.append(kFaceSubentType);
  acedSSSetSubentTypes(subTypes);
  if (acedSSGet(_T("_:V"), nullptr, nullptr, nullptr, ss) == RTNORM)
  {
    Adesk::Int32 nEnts = 0, nSubs = 0;
    acedSSLength(ss, &nEnts);
    for (int i = 0; i < nEnts; i++) 
    {
      acedSSSubentLength(ss, i, &nSubs);
      for (int j = 0; j < nSubs; j++)
      {
        AcDbFullSubentPath path;
        acedSSSubentName(ss, i, j, path);
        AcDbObjectId id = path.objectIds()[0];
        AcDbObjectPointer<AcDb3dSolid> pSolid(id, AcDb::kForWrite);
        if (pSolid.openStatus() == Acad::eOk) {
          AcCmColor cm; cm.setColorIndex(1);
          pSolid->setSubentColor(path.subentId(), cm);
        } else {
          acutPrintf(_T("\nSelected entity is not solid!"));
          break;
        }
      }
    }
    acedSSFree(ss);
  }
}


 

Відповідь корисна? Клікніть на "ВПОДОБАЙКУ" цім повідомленням! | Do you find the posts helpful? "LIKE" these posts!
Находите сообщения полезными? Поставьте "НРАВИТСЯ" этим сообщениям!
На ваше запитання відповіли? Натисніть кнопку "ПРИЙНЯТИ РІШЕННЯ" | Have your question been answered successfully? Click "ACCEPT SOLUTION" button.
На ваш вопрос успешно ответили? Нажмите кнопку "УТВЕРДИТЬ РЕШЕНИЕ"


Alexander Rivilis / Александр Ривилис / Олександр Рівіліс
Programmer & Teacher & Helper / Программист - Учитель - Помощник / Програміст - вчитель - помічник
Facebook | Twitter | LinkedIn
Expert Elite Member

Message 7 of 8

Anonymous
Not applicable

This is really a sample! Thanks a lot, Alex.

It would take me a long time to invent this solution.

 

One more question, if you be so kind:

As I mentioned earlier I need to know which face is it (geometrically). For this I would need the coords of the face vertices. For now, I found the not very elegant solution for this task. Namely:

 

AcDbEntity* pEnt = nullptr;
pSolid->copyFace( path.subentId( ), pEnt );
AcDbRegion* pFace = AcDbRegion::cast( pEnt );
AcGePlane regionPlane;
pFace->getPlane( regionPlane );

 

and having the plane I could identify, which face it was and get the coords of vertices from the solid. Any better idea, please ?

0 Likes
Message 8 of 8

Alexander.Rivilis
Mentor
Mentor
This way is look like easiest. Other way is use BREP API.

Відповідь корисна? Клікніть на "ВПОДОБАЙКУ" цім повідомленням! | Do you find the posts helpful? "LIKE" these posts!
Находите сообщения полезными? Поставьте "НРАВИТСЯ" этим сообщениям!
На ваше запитання відповіли? Натисніть кнопку "ПРИЙНЯТИ РІШЕННЯ" | Have your question been answered successfully? Click "ACCEPT SOLUTION" button.
На ваш вопрос успешно ответили? Нажмите кнопку "УТВЕРДИТЬ РЕШЕНИЕ"


Alexander Rivilis / Александр Ривилис / Олександр Рівіліс
Programmer & Teacher & Helper / Программист - Учитель - Помощник / Програміст - вчитель - помічник
Facebook | Twitter | LinkedIn
Expert Elite Member

0 Likes