In this section you will find the creator object of the same name.
Creator objects control the creation of child objects of a certain ID. If the condition for creating a new generation of child objects is fulfilled, then these are created as copies of your parent objects at the position of their parent objects.
With the creator objects, you can create object sources in a system, e.g. to supply conveying elements with parts.
The following steps are necessary to create a dynamic object from a creator:
- Create the dynamic object (e.g. a dynamic ellipse).
- In the section "Main settings -> Creator/destroyer settings", enter a ID that is unique in the project in the property "Object is a parent object with the ID". This ID must be between 1 and 30.
- Fix the parent object at the position where the child objects are to be created. A fixed object is often used for this purpose, to which the parent object is connected via a constant distance joint.
- Create a creator object on the drawing board and enter the ID set on the parent object at the property "Creator has the ID".
- Specify an operand (or a constant) at the property "Create trigger", which controls the creation of the parent objects as trigger.
- The property "Trigger type" must be used to specify when the creation is to take place. For example, with a positive edge of the operand specified to "Create trigger". If the constant '1' is specified for "Create trigger", then "If status 1 with pause" must be selected as the type. In this case, a "trigger pause time" must also be specified.
Optionally, the maximum number of create cycles (i.e. the maximum number of existing generations) can be specified in the property "Max. create cycles". If this maximum number is reached, no more new child objects are created, even if the condition for it is fulfilled. Only if the number of existing generations falls below the maximum number because of the destruction of generations with the help of destroy objects, new child objects can be created again.
The following image shows a layout with the creator.
The parent object to be created by the creator is a circle. The parent object has the ID = 1, i.e. the property "Object is a parent-object with the id" is set to the value "1".
The circle is attached to a fixed object via a constant distance joint. In this way, the parent object always remains at the same position and the child objects are inserted into the layout from there.
The creator is symbolized by a blue rectangle. The property "Creator has the ID" is set to "1", so the Creator is "responsible" for this ID. The bit operand IM.M0.0 was specified as the "Create trigger operand"; this should trigger the creation at a positive edge. This means that the "Trigger type" must be selected as "Positive edge".
The switching of the trigger operand IM.M0.0 is carried out via a push-button to which this operand has been assigned.
The generated child objects are collected in a container located below the parent object and assembled using fixed rectangles.
This describes all parts of the layout and the simulation can be started.
The first thing to notice is that the creator object is no longer visible in the simulation; this is because it has no function as an object.
When you press the push-button, a child object is created and falls into the container. All child objects are collected there. In this way you can supply a layout with objects, which can then be used later.
Using a destroyer¶
In the above example, child objects were created and then left in the layout. In most cases, child objects are processed in a system operation and removed at another point. This makes sense to keep the number of objects in a simulation as low as possible. After all, each physical object "loads" the physics engine and thus costs computing time.
In order to eliminate child objects, destroyers are used. Each geometric object can be configured as a destroyer. For this purpose, you have to set the properties "Object is a destroyer" and "Object destroys child objects with ID" in the section "Main settings -> Creator/destroyer settings" accordingly.
The above example is expanded with a destroyer. The following image shows the changed layout.
The lateral boundary on the right side of the container was replaced by a rectangle which is attached to the piston rod of a cylinder. A solid joint was used as a joint.
As a result, the rectangle moves to the left as soon as the cylinder extends.
IDWith the red rectangle the property "Object is a destroyer" was selected and in "Object destroys child objects with ID" the number "1" was entered. This is because the destroyer should only remove the child objects with this ID.
If the number "0" is specified here, the destroyer destroys all child objects regardless of their ID.
So the layout shows the following behavior in the simulation:
After some child objects have been created, the cylinder is extended by means of a push-button. Now the destroyer with the piston rod moves to the left. Any child object touched by the destroyer will be removed.
Activate and deactivate a destroyer via a operand (V220.127.116.11 or higher)¶
As of version 18.104.22.168 it is possible to specify an additional operand for the Destroyer. For this purpose a bit operand is entered at the property "Operand for Destroyer". If such an operand exists, child objects are only destroyed if the status of the operand also has the value 1 (true). If the operand has the value 0 (false), the child objects are not destroyed.
If the value 0 and thus no operand is specified for the property, the destroyer is always active.
Creating and destroying multiple objects¶
In the previous explanations, the term generation was used in connection with child objects. This expression suggests that it is not only possible to create individual objects.
If you want to create several objects in one process, which then belong to one generation, you assign the same ID to all parent objects. It is irrelevant whether these parent objects have a relation to each other or not. Also, the parent objects do not have to be at the same place; they can be spread over the entire layout.
The parent objects can also form a (body) unit or be related to each other via other joints.
Our example has been changed again. The circle object has been replaced by a more complex form.
The new body consists of a total of 6 dynamic geometric shapes, which were joined together to form a body by means of a body group. All objects are configured as parent objects with the same ID (in the example the ID = 1). This way their child objects are created in a creator cycle, forming a generation of child objects. If one of these child objects touches a destroyer, then the entire generation is eliminated and not just the child object that touches the destroyer.
When the destroyer touches a child object of the body, the entire body is removed. Any additional body is not affected at first because it belongs to another generation.
With the creator and destroyer objects, you can implement the sources and sinks of a layout. The ID combines the objects into one generation. This ID is also used to create the affiliation to the creator.
Each geometric shape can be configured as a destroyer if it is a physics object (dynamic or static). If a certain ID is specified, then only child objects with this ID will be removed. If all child objects are to be removed regardless of their ID, then "0" must be specified as ID at the destroyer.
Please note that a destroyer always destroys the entire generation of child objects even if only one child object touches it.
Several destroyers can be set to the same ID, because it is entirely possible that child objects have to be removed at different locations in the layout.
However, setting several creators to the same ID makes no sense.