ObjectARX
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

acedsset select visible or invisible entity

6 REPLIES 6
SOLVED
Reply
Message 1 of 7
421232206
987 Views, 6 Replies

acedsset select visible or invisible entity

Can acedssget do this jop?

I want to select all the visible or invisible entities, the code below shows my way, but it  can only select all entities. 

 

    ads_name ssName;
    static int nSel = 0;
    if (!Acad_System::GetInputInt(_T("0-可见 1-不可见"),nSel))
    {
        return;
    }
    resbuf* rb = ads_buildlist(RTDXF0,_T("line"),60,(nSel),RTNONE);// 0 select all, 1 nothing. why?
    int es  = acedSSGet(_T("A"),NULL,NULL,rb,ssName);
    ads_relrb(rb);
    
    long lNumber = 0;
    ads_sslength(ssName,&lNumber);
    acutPrintf(_T("\n%d"),lNumber);
    ads_ssfree(ssName);

Technology change world! Coding change technology! We coders are coding!
6 REPLIES 6
Message 2 of 7
421232206
in reply to: 421232206

I want to select entites whose layer is on.   but with (60,0), i get all the entities.

Technology change world! Coding change technology! We coders are coding!
Message 3 of 7


@cnngtdly wrote:

I want to select entites whose layer is on.   but with (60,0), i get all the entities.


You're absolutely wrong. Flag of visibility does not depend on or off the layer to which the entity belongs. It's completely different things. Visibility flag (dxf-Group 60) is determined with AcDbEntity::setVisibility() method.

Відповідь корисна? Клікніть на "ВПОДОБАЙКУ" цім повідомленням! | 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 4 of 7

I understand your meaning. but is there any way to get what i want with acedssget?

Or is there a quick method to get  entities whose layers are on or off?

 

My way is like this:

I get all entities, then iterator the result,

get the layer of each entity,  check the layer's state,....

 

I believe this is not effecient.

Technology change world! Coding change technology! We coders are coding!
Message 5 of 7


@cnngtdly wrote:
My way is like this:

I get all entities, then iterator the result,

get the layer of each entity,  check the layer's state,....

 

I believe this is not effecient.


This method can be very effective if you first make AcDbObjectIdArray for all layers which turn on and not frozen.
And then check that the layer of each primitive from selectionset contained in this AcDbObjectIdArray.

Відповідь корисна? Клікніть на "ВПОДОБАЙКУ" цім повідомленням! | 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 6 of 7

thanks for your advice. it seems that there is no arx api to do this job.

If i have to write code by myself , i will use std::set or map to increase speed.

Technology change world! Coding change technology! We coders are coding!
Message 7 of 7


@cnngtdly wrote:

...it seems that there is no arx api to do this job...


There is another method, but I would not recommend it. You can list all turned on and thawed layers and add it to the filter in the form:

resbuf* rb = ads_buildlist(
  RTDXF0,_T("line"),
  -4, _T("<OR"),
    8,_T("layerOn1"),
    8,_T("layerOn2"),
    ...
  -4, _T("OR>"), 
  RTNONE
);

 

Відповідь корисна? Клікніть на "ВПОДОБАЙКУ" цім повідомленням! | 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

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost