ObjectARX

ObjectARX

Reply
Mentor
167 Posts
0 Kudos
Registered: ‎10-21-2010
Post 1 of 7
Accepted Solution

acedsset select visible or invisible entity

276 Views, 6 Replies
04-18-2012 08:23 PM

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!

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.

Mentor
167 Posts
0 Kudos
Registered: ‎10-21-2010
Post 2 of 7

Re: acedsset select visible or invisible entity

04-18-2012 11:18 PM 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!
Moderator
1,467 Posts
277 Kudos
Registered: ‎04-09-2008
Post 3 of 7

Re: acedsset select visible or invisible entity

04-19-2012 01:21 AM in reply to: 421232206

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.


Пожалуйста не забывайте про Утвердить в качестве решения! Утвердить в качестве решения и Give Kudos!Баллы
Please remember to Accept Solution! Accept as Solution and Give Kudos!Kudos

Mentor
167 Posts
0 Kudos
Registered: ‎10-21-2010
Post 4 of 7

Re: acedsset select visible or invisible entity

04-19-2012 01:47 AM in reply to: Alexander.Rivilis

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!
Moderator
1,467 Posts
277 Kudos
Registered: ‎04-09-2008
Post 5 of 7

Re: acedsset select visible or invisible entity

04-19-2012 02:24 AM in reply to: 421232206

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.


Пожалуйста не забывайте про Утвердить в качестве решения! Утвердить в качестве решения и Give Kudos!Баллы
Please remember to Accept Solution! Accept as Solution and Give Kudos!Kudos

Mentor
167 Posts
0 Kudos
Registered: ‎10-21-2010
Post 6 of 7

Re: acedsset select visible or invisible entity

04-19-2012 02:36 AM in reply to: Alexander.Rivilis

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!
Moderator
1,467 Posts
277 Kudos
Registered: ‎04-09-2008
Post 7 of 7

Re: acedsset select visible or invisible entity

04-19-2012 02:45 AM in reply to: 421232206

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
);

 


Пожалуйста не забывайте про Утвердить в качестве решения! Утвердить в качестве решения и Give Kudos!Баллы
Please remember to Accept Solution! Accept as Solution and Give Kudos!Kudos

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Are you interested in helping shape the future of the Autodesk Community? To participate in this brief usability study, please click here. Your time and input is greatly appreciated!