question

Skovdestudents avatar image
0 Likes"
Skovdestudents asked Skovdestudents commented

Remove all 3D-objects

Hello im trying to create a processflow that:

1. Simulation starts

2. Destroys all objects (queue, processor etc.)

3. Create objects from a table (solved)


But the first run or if some changes are made in the table I need this "destroy function" to find all objects in the model and return or destroy them all without referencing to a table, specific object or name.

Any ideas on how to solve this?

Kind regards

FlexSim 23.0.5
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.

Jason Lightfoot avatar image
2 Likes"
Jason Lightfoot answered Skovdestudents commented
Table.query("DELETE  FROM Objects()")
· 1
5 |100000

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

Skovdestudents avatar image Skovdestudents commented ·
Thanks a lot!
0 Likes 0 ·
Joerg Vogel avatar image
1 Like"
Joerg Vogel answered Skovdestudents commented

I would build all object in a container. This can be a plane. Then I can destroy the content of the container node!

· 5
5 |100000

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

Skovdestudents avatar image Skovdestudents commented ·

Good idea! We have an issue with creating the object in the plane though...

We create the plane as intended but...

We create a processor like this:

createinstance(library().find("?Processor"), model());

We have also tried: createinstance(library().find("?Processor"), model().find("Plane"));
and it does not work.

We have also tried the moveobject function but no luck either..


What function can we use to move it to the plane? and if possible also move it to a specific coordinate in the plane, rather than using Vec3?


0 Likes 0 ·
Felix Möhlmann avatar image Felix Möhlmann Skovdestudents commented ·

It's hard to know what is going wrong without access to the model.

Is the plane itself a subnode of another object? In that case you have to give the whole path or use the "?", like you do to find the processor in the library.

createinstance(..., model().find("ContainerObject/Plane");
createinstance(..., model().find("?Plane");

Once the object is inside the plane, you can use "object.setLocation" to change its location. This will use the coordinate system of its direct parent node, so in this case, the plane.

1679310743763.png

1 Like 1 ·
1679310743763.png (48.8 KiB)
Skovdestudents avatar image Skovdestudents Felix Möhlmann commented ·
This works to some extent for us but the problem is it doesnt seem to be able to find "?Plane" in the way we createinstance (Plane), and we also dont get it to work with looking up name from table such as: "?Table([x][y].. Thanks for the reply though, question is now answered but will upload the model for future questions in the forum.
0 Likes 0 ·
Jason Lightfoot avatar image Jason Lightfoot ♦ Skovdestudents commented ·
Object plane=Object.create("VisualTool");
Object.create("Processor").up=plane;
1 Like 1 ·
Skovdestudents avatar image Skovdestudents Jason Lightfoot ♦ commented ·
This works like a charm! Huge thanks!
0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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