Jump to content
Developer Wiki and Function Reference Links ×

How to create a loop


Recommended Posts

  • Vectorworks, Inc Employee

I wonder if an option could be added to create a loop that will be executed until some condition is met. Think about filling up a shelf until full and then stop. I haven't found a way to do this other than repeating a wrapper n times and using valves to stop the unused wrappers getting executed. Unfortunately, this makes debugging inside of Marionettes very slow because the valve does not seem to start working until the object has been exited. Also, with each repeated wrapper, the compile time gets longer. This makes duplicating the object slow in the document (although I am sure my wiring could be optimised 🙂 ).

Any ideas? Could this even be implemented at node level?

Edited by Stephan Moenninghoff
Link to comment

At the node level this can't work as far as I know. But mostly a loop can be bypassed. In your case you could divide the length of your shelf by the width of your objects and get the number of objects that fit into your shelf. Now that you know how many objects it takes, you can use a range node and some math to calculate the insertion points and then place the objects.

 

With objects of different widths it gets more difficult, but there should be a solution here as well.

Otherwise you will not be able to avoid a user-defined node.

 

Is this about your books or another project?

Link to comment
  • Vectorworks, Inc Employee
8 minutes ago, MRoth said:

Is this about your books or another project?

 

A new project. I'm filling up a shelf with plates, bowls, glasses etc. Mainly round or roughly that shape. So I'm doing the math but it is impossible to guess the total length as the filling is not linear, as with the books because I have the shelf depth to take into account. So, I'm looping through the process until I have filled the shelf. I can see no other way.

Shelf.thumb.gif.9593d7bd69cad2d82e90e6d5c17d9353.gif

 

Edited by Stephan Moenninghoff
Link to comment
  • Vectorworks, Inc Employee
20 hours ago, MRoth said:

Are these all individual objects that can be placed completely randomly or would it be possible, for example, to pack the glasses in a predefined block. This block would have a length that could be used again.

They are stacked symbols and symbols outside of the max vertical shelf space get deleted. That's all straightforward . The hard part is: objects get placed randomly. That's kind of the point of the object. You want each shelf with a different set of objects and different placement. So, it's not about the stacking, it's about placement on the horizontal plane in x and y and filling up the shelf in x and y. Does that make sense? I'm posting the object soon anyway. Maybe it becomes clearer then. 

Stacked.thumb.gif.9963785f5205d5ca9a90e96e556f282b.gif

Edited by Stephan Moenninghoff
  • Like 3
Link to comment

Maybe I have an idea. But I'd like to run a few tests of my own before I promise too much.

 

For these tests I would need some more details.

 

- It seems as if you always fill one half of the shelf with plates and the other with glasses and bowls. Is that correct?

- What are the diameters of your dishes?

- Are there any specifications for your shelf regarding size? For example, only with certain depths?

Link to comment
  • Vectorworks, Inc Employee
18 hours ago, MRoth said:

- It seems as if you always fill one half of the shelf with plates and the other with glasses and bowls. Is that correct?

Not strictly. Diameters are used to determine which is the largest object participating in the zig-zag array. Objects falling below a certain diameter are assembled in rows, then the remaining space is used to distribute them and as a last step they are shuffled about by a random value.

18 hours ago, MRoth said:

- What are the diameters of your dishes?

It doesn't matter.

18 hours ago, MRoth said:

- Are there any specifications for your shelf regarding size? For example, only with certain depths?

Not really. The only limit is that I will stop filling up the shelf once I have finished the last of the distributor modules (because I cannot loop).

 

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...