title: Split Vector 3D Array Based on Z Value ~ Python
body: <p>I am making a C4D plugin and was wondering: <strong>How do you use groupby to split an array based on a contained value?</strong></p>
  
  <p>I send this code over to a splinebuilder function, but if I send the splinelist as is, I get a connection between lines, which don't want.</p>
  
  <p><a href="https://i.stack.imgur.com/lAEya.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/lAEya.png" alt="enter image description here"></a></p>
  
  <p>So I need to send separated lists so the <strong>splinebuilder</strong> creates sets of those lines, avoiding the interconnection.</p>
  
  <p><a href="https://i.stack.imgur.com/UGzJH.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/UGzJH.png" alt="enter image description here"></a></p>
  
  <pre><code>#initial contains XYZ vectors
  
  splinelist = [(-200, 0, -200), (0, 0, -200), (200, 0, -200), (-200, 0, 0), (0, 0, 0), (200, 0, 0), (-200, 0, 200), (0, 0, 200), (200, 0, 200)]
  
  
  #desired handcoded for example separated based on Z value
  
  la = [(-200, 0, -200), (0, 0, -200), (200, 0, -200)]
  lb = [(-200, 0, 0), (0, 0, 0), (200, 0, 0)]
  lc = [(-200, 0, 200), (0, 0, 200), (200, 0, 200)]
  
  
  #desired list of lists based on Z value
  
  desiredlist = [[(-200, 0, -200), (0, 0, -200), (200, 0, -200)],[(-200, 0, 0), (0, 0, 0), (200, 0, 0)],[(-200, 0, 200), (0, 0, 200), (200, 0, 200)]]
  </code></pre>