question

Martin K5 avatar image
0 Likes"
Martin K5 asked Matthew Gillespie commented

Is it possible to delete Object by Code?

Hi,

I would like to ask, if it is possible to delete an object by code? I was searching through the community and I did not find any advice. Does anyone knows please?

Thank you.


Martin

FlexSim 21.1.4
codepath
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Patryk avatar image
0 Likes"
Patryk answered Matthew Gillespie commented

Try this code "destroyobject()"

1633074327352.png



1633074327352.png (51.3 KiB)
· 2
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Martin K5 avatar image Martin K5 commented ·
Thanks a lot.
0 Likes 0 ·
Matthew Gillespie avatar image Matthew Gillespie ♦♦ commented ·
@Patryk @Martin K5 @Tomasz MG

treenode.destroy() is the preferred method since destroyobject() is a deprecated command.

0 Likes 0 ·
Krzysztof J avatar image
2 Likes"
Krzysztof J answered Krzysztof J edited

Use such a syntax:

Object objectCodeName = Model.find("Yourobject");
objectCodeName.destroy();


Anyway you can use old syntax - destroyobject("objectCodeName") but I wouldn't reccommend it.

5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Tomasz MG avatar image
0 Likes"
Tomasz MG answered

Hi

destroyobject(your_object)
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.