How to isolate/hide objects like command _isolateobjects?

How to isolate/hide objects like command _isolateobjects?

maisoui
Advocate Advocate
3,540 Views
5 Replies
Message 1 of 6

How to isolate/hide objects like command _isolateobjects?

maisoui
Advocate
Advocate

Hi,

 

I'd like to isolate or hide objects like command _isolateobjects. So my idea is to change the visibility for each object/entity, but how to tell AutoCAD that an isolation is active? My goal is to interact with the isolation icon in the status bar (bottom right) and to be able to click on End Object Isolation:

 

oarx_isolation.png

 

All suggestions are welcomed.

Regards,

Jonathan

 

--
Jonathan
0 Likes
Accepted solutions (1)
3,541 Views
5 Replies
Replies (5)
Message 2 of 6

Anonymous
Not applicable

Hi,

I'm also interested in driving this feature using object arx, I've unfortunately found nothing about this in the documentation. I should like to bring this topic up on the list in case of someone at autodesk could give us more information.

 

cheers

 

Loic Jourdan

0 Likes
Message 3 of 6

Anonymous
Not applicable

Hi Jonathan,

 

I belief that there is no API to interact with the isolate command or the icon in the status bar. But you can call the isolate command from your code.

Try something like that:

 

    AcDbObjectIdArray arrIds;

//    fill arrIds with the object ids of the objects you want to isolate
    ...
    ...

    if (arrIds.length())
        {
        ads_name ss;
        acedSSAdd(NULL,NULL,ss);

        for (int i=0; i<arrIds.length();++i)
            {
            ads_name eName;
            acdbGetAdsName(eName,arrIds.at(i));
            acedSSAdd(eName,ss,ss);
            }

        acedCommand(
                                    RTSTR, _T("_ISOLATEOBJECTS"),
                                    RTPICKS, ss,
                                    RTSTR, _T(""),
                                    RTNONE
                             );
        }

 

 

HTH

Arnold

Message 4 of 6

NikolayPoleshchuk
Enthusiast
Enthusiast
You can use "visible" property that is managed by 60 DXF code in entity's data (if it is set to 1 then entity becomes invisible).
Nikolay Poleshchuk
http://poleshchuk.spb.ru/cad/eng.html
Message 5 of 6

maisoui
Advocate
Advocate

Yes you're right, but it will not be integrated with AutoCad Object Isolation (as I mentionned).

Maybe you didn't read my entire question?

Regards,

--
Jonathan
0 Likes
Message 6 of 6

maisoui
Advocate
Advocate
Accepted solution

The solution of Anodl works very well, even if woking with AutoCAD commands is not my favorite code. A few remarks:

  • You can use _.hideobjects or _.isolateobjects to hide or isolate objects
  • If you have groups, you need to open group (for read) and retrieve all entities id with method allEntityIds()
  • In FIBERLESS world, you need to use acedCommandS (subroutine)
  • Add acedSSFree(ss) to clear selection set
Acad::ErrorStatus es;

//create selection set
ads_name ss;
acedSSAdd(NULL, NULL, ss);
for(int i=0; i<ids.length(); ++i)
{
	ads_name eName;
	es = acdbGetAdsName(eName, ids.at(i));
	acedSSAdd(eName, ss, ss);
}

//execute command
acedCommandS(RTSTR, bHide ? _T("_.hideobjects") : _T("_.isolateobjects"), RTPICKS, ss, RTSTR, _T(""), RTNONE);

acedSSFree(ss);

 

Regards,

--
Jonathan
0 Likes