Jump to content

Foreach Sop


AndrewVK

Recommended Posts

Lets suppose i have an polygon and i want to split it randomly into pieces.

grid -> clip (keep both mode) -> clip (new parameters) -> clip (new parameters) e.t.c

It can be done with help of hscript...but help for "ForEach SOP" says:

For Each Number:

Repeat the set of SOPs a set number of times,

feeding the result of each iteration back to the start.

Unfortunately i can not reproduce this functionality.

If i turn off "merge result" - i have an polygon splitted in last iteration.

If i turn on "merge result" - i have 10 splitted polygons

But I have expected polygon splitted 10 times.

Can it be done?

Link to comment
Share on other sites

Lets suppose i have an polygon and i want to split it randomly into pieces.

grid -> clip (keep both mode) -> clip (new parameters) -> clip (new parameters) e.t.c

It can be done with help of hscript...but help for "ForEach SOP" says:

For Each Number:

Repeat the set of SOPs a set number of times,

feeding the result of each iteration back to the start.

Unfortunately i can not reproduce this functionality.

If i turn off "merge result" - i have an polygon splitted in last iteration.

If i turn on "merge result" - i have 10 splitted polygons

But I have expected polygon splitted 10 times.

Can it be done?

Forgive me if I'm completely wrong about this, but are you putting the sops you want to repeat inside the foreach node? It's not documented like that, and I actually have no idea if that's how it's supposed to be used, but that's the only way I've been able to get results I want with it.

So for instance, if I wanted to subdivide geometry twice, jump inside the foreach, apppend the subdivide to the each node, put input geometry into input 1 of the ForEach, and turn "merge results" off.

Of course, subdividing with depth 2 is easier, but I'm trying to make a point!

Edited by Darric
Link to comment
Share on other sites

Forgive me if I'm completely wrong about this, but are you putting the sops you want to repeat inside the foreach node? It's not documented like that, and I actually have no idea if that's how it's supposed to be used, but that's the only way I've been able to get results I want with it.

So for instance, if I wanted to subdivide geometry twice, jump inside the foreach, apppend the subdivide to the each node, put input geometry into input 1 of the ForEach, and turn "merge results" off.

Of course, subdividing with depth 2 is easier, but I'm trying to make a point!

Here what i want and what i have

foreachtest.hipnc

Link to comment
Share on other sites

Hey Andrew,

Good you bring this topic again, I was struggling with similar problem some time ago, but just today found the way to fix that. The answer is pretty simple, just change the order of your each and clip SOPs and you will get the right result.

cheers

kuba

foreachtest2.hipnc

Edited by kubabuk
Link to comment
Share on other sites

Hey Andrew,

Good you bring this topic again, I was struggling with similar problem some time ago, but just today found the way to fix that. The answer is pretty simple, just change the order of your each and clip SOPs and you will get the right result.

cheers

kuba

Thank You kuba!

I think this strange fact should be noted in the documentation...

Link to comment
Share on other sites

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.   Paste as plain text instead

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