Is there another way to remove entities from selection set when user box select?

Is there another way to remove entities from selection set when user box select?

xiaozhihui1992
Observer Observer
422 Views
4 Replies
Message 1 of 5

Is there another way to remove entities from selection set when user box select?

xiaozhihui1992
Observer
Observer
void CMyAcEdSSGetFilter::ssgetAddFilter(int ssgetFlags, AcEdSelectionSetService& service, 
	const AcDbObjectIdArray& selectionSet, const AcDbObjectIdArray& subSelectionSet)
{
	auto stampBeg = std::chrono::steady_clock::now();
	AcGeIntArray arr;
	//arr.setLogicalLength(subSelectionSet.length());
	for (auto i = 0; i < subSelectionSet.length(); i++)
	{
		service.remove(i);
	}
	//service.remove(arr);
	auto stampEnd = std::chrono::steady_clock::now();
	double time_second = std::chrono::duration<double>(stampEnd - stampBeg).count();
}

up code sample is worked. But from test case :remove all 260000 entities in Autocad2018 costs 15 second. It's NOT 

acceptable.

Is there another way to remove entities by filters? like filter by AcRxClass? 

0 Likes
423 Views
4 Replies
Replies (4)
Message 2 of 5

daniel_cadext
Advisor
Advisor

have you tried acedSSDel? have a look at ArxDbgSelSet in ARXDBG

Python for AutoCAD, Python wrappers for ARX https://github.com/CEXT-Dan/PyRx
0 Likes
Message 3 of 5

xiaozhihui1992
Observer
Observer

May be, I raise a conflict with this problem. 

I am NOT use acedSSGet api or raise a command to lead user pick , but the 

command in "Quiescent State" . There NO command running, then user pick.
I want to remove the entities before the entities put into the pick first selection set.
0 Likes
Message 4 of 5

tbrammer
Advisor
Advisor

In your code

for (auto i = 0; i < subSelectionSet.length(); i++)
	service.remove(i);

you are calling AcEdSelectionSetService::remove(int index).

But there is also the method AcEdSelectionSetService::remove(const AcArray<int>& indices), which might be more performant. Try this:

AcArray<int> indices;
int count = subSelectionSet.length();
indices.setLogicalLength(count);
for (int i = 0; i < count; i++)
	indices[i] = i;
service.remove(indices);

 


Thomas Brammer ● Software Developer ● imos AGLinkedIn
If an answer solves your problem please [ACCEPT SOLUTION]. Otherwise explain why not.

0 Likes
Message 5 of 5

xiaozhihui1992
Observer
Observer

Yes.

Test results:

remove (const AcArray& indices) 

[

    Total entities: 264792

     remove costs: 15.5 sec

]

remove (int index)

[

   Total entities: 264792

    remove costs: 15.8 sec

]

 

Machine:

windows 10 profession 10.0.19045

cpu: Intel core i7-10700

memory:  16GB 2400MHZ

0 Likes