Conditions in vex

   4743   7   1
User Avatar
Member
44 posts
Joined: April 2017
Offline
Hi! I want to have 2 separate branches. One used, if blast node is empty, other - it blast node has some primitives filled in. Is there any sane way to do so? I could not find any conditional if/else nodes, only ‘foreach’ made on two blocks - ‘begin’ and ‘end’.

Like, right now, no matter what - all blocks are going to be executed from top to bottom no matter what, I don't see any way to ‘stop’ some block from execution based on some condition.
User Avatar
Member
2042 posts
Joined: Sept. 2015
Offline
You can do that with a wrangle node. No need for “if/else nodes” or foreach.

Just post your file setup and later this evening when I'm back I'll have a look, or someone might chime in the meantime.
User Avatar
Member
44 posts
Joined: April 2017
Offline
Hi! Thank you for getting back. This is not possible with wrangle node. Here I will explain why (see attachment image):

In step 1, I load geometry.
In step 2, I extrude it.
In step 3, I group it with normal filter set to Y==1, so I get only ‘roof’ part of my house, i.e. flat facing top.
In step 4, based on that, I divide model using blast into roof and house


Sometimes, in step 1 geometry winding is reversed, so in that case in step 4 I get empty roof. So, if I get empty roof in step 4, I want to get back and redo everything, but this time just with reversed winding using clean node to reverse it.

In order to do so, I need to ‘drop’ existing branch and switch to some other branch. This is not possible with attribute wrangle I suppose.
Edited by assignators - May 3, 2017 15:59:51

Attachments:
branchTest.png (65.3 KB)

User Avatar
Member
8579 posts
Joined: July 2007
Offline
just use switch sop to switch your branches based on some condition like npoints(0)==0 or something
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
2042 posts
Joined: Sept. 2015
Offline
So set up your wrangle at the start that will take care of different windings and group accordingly, then also in another wrangle further down your stream select what you want to ‘block’ out and so on.
User Avatar
Member
44 posts
Joined: April 2017
Offline
Ah, there is ‘switch’ node. Wonder how did I miss it 0_0 Yes, thank you all, will get on from here now
User Avatar
Member
10 posts
Joined: April 2015
Offline
Ok, well i think you can use switch node with a condition in the input. For example this:

if(nprims('../roof_A/')==0, 1, 0)

This code, checks if roof_A node not contain primitives. If condition is true it shows second branch, if not true shows the first one.

Attachments:
Screen Shot 2017-05-03 at 23.21.54.png (162.8 KB)
switchWithConditional.hipnc (85.7 KB)

User Avatar
Member
44 posts
Joined: April 2017
Offline
Thank you, all works perfectly now
  • Quick Links