Delete object

Hello, everyone, I generate objects through workprocess, the robot grabs the workpiece, how to delete it when the robot releases the workpiece, can you help provide an example?thank you

Hi @tompetthsfdshfhshshs

You can delete a component in a works process. So, if you release to a process. You can delete it there.

In the receiving process you can have WaitProductPlace or just a Need task and then remove component based on its ProdID e.g. “myprod1”:

WaitProductPlace:
Remove:myprod1:False

thanks,but I want to delete the component through a Python script

comp.delete()

app. deleteComponent(comp)

They all do the job i guess.

Thank you. I have another question. If I grab artifacts by script, how can I script them to be deleted

Its the same way.
But i didnt really get why you grab it, if you gonna delete it finally?
You dont have to grab components to delete them.
For example:

> def OnRun():
    delay(20)
    comp = getComponent()
    path = comp.getBehaviour('Path__HIDE__')
    parts = path.Components
    for part in parts:
       part.delete()

Create a python script in a conveyor. Copy paste this code to the python script and you ll see, after you run the simulation 20 sec later all comps gonna be deleted on conveyor.

1 Like

Thank you, because I am using the robot output to grab the artifact, if the grab signal is FALSE, the artifact still exists, my purpose is to make the component disappear

  • Thank you very much for solving my problem
1 Like

Hi there,
my initial simulation-layout has a bunch of components with a few features, during the simulation I want to remove (delete) those features in different steps and sequences. This I do with the above methods, feature = comp.findFeature(‘x’), and when time comes -> feature.delete(). Works like a charm, however, when I reset my simulation, I want the feature to return, so when I start the simulation the second time, I once again have features to delete during the simulation.

So, is there a neat way to remove features during simulation, but when I reset the simulation, the features returns as the initial simulation-layout? For example, if I let a component run out of a path, it disappear from the simulation, but when I reset the simulation, it comes back :blush:

Thanks in advance//

You’ll need to make a copy of the component and then the copy unique before deleting features from it.
Generally hiding is much faster than deleting.

Okey, so how can I hide my feature of the component in question? I think also that if I can hide it it would make more sense, but how would I go about it to hide the feature through python script?

Thanks for your fast reply.

OK, I guess there isn’t really a way to hide features that wouldn’t require the feature tree rebuild, which is the slow operation here.

If you have only a somewhat limited set of features that you need to hide independently of each other then you could organize them into separate nodes (links) and use the vcNode.Visible property which doesn’t require a rebuild.