How can I remove Somengines from the existing O.engines?

Asked by JINSUN LEE

For example,

O.engines=O.engines+[DomainLimiter(lo=(-.05,-.05,-.05), hi=(.05,.05,.05), iterPeriod = 100, label = 'Domain')]

DomainLimiter is appended to the existing engines.
As I know, O.engines is list type variable.
So, I have tried to remove DomainLimiter as follows:

In [2]: O.engines[5]
Out[2]: <DomainLimiter instance at 0x5610901b5220>

del O.engines[5]

However, it does not work

So, How can I remove the Someengines from the existing O.engines?

Regards.

Question information

Language:
English Edit question
Status:
Solved
For:
Yade Edit question
Assignee:
No assignee Edit question
Solved by:
JINSUN LEE
Solved:
Last query:
Last reply:
Revision history for this message
Karol Brzezinski (kbrzezinski) said :
#1

Hi,

To remove the last engine from the list do this:

O.engines = O.engines[:-1]

That means take all the engines from the existing list, except of the last one.

Cheers,
Karol

Revision history for this message
Jan Stránský (honzik) said :
#2

Hello,

It is documented in [1]:
"The O.engines sequence must be always assigned at once ..."

To delete specific engine, you simple assign new O.engines without it (possibly using already assigned engines), e.g. to delete some engine "in the middle" you could do
O.engines = O.engines[:2] + O.engines[3:] # deleting engine with index 2

Cheers
Jan

[1] https://yade-dem.org/doc/user.html#base-engines

Revision history for this message
JINSUN LEE (ppk21) said :
#3

Thank you for your kind answer! Appreciate.