hello everyone
i have a square surface which is divided in 4 part in u and v direction(16 cell in total). i want to choose 8 of this 16 cell each time and extrude it for making my form.
i could write this code in ghpython but the problem is condition statement:
1.every cell should at least have one border connection to other cells(just corner connection is not acceptable)
2.totally it should be an integrated form not in 2 or … part
Not sure if you are searching for a way in code(you tagged it with python), if this is the case you could have a look at topology lists(Mesh or Brep).
Than it’s kind of a maze logic.
from itertools import combinations
from ghpythonlib.parallel import run
import ghpythonlib.treehelpers as th
from Rhino.Geometry.Brep import JoinBreps
from ghpythonlib.treehelpers import list_to_tree
def qualify(indices):
if len(JoinBreps([cells[index] for index in indices], 0.1)) == 1:
return indices
a = list_to_tree(list(filter(None, run(qualify, list(combinations(range(len(cells)), n)), False))))
thanks for your reply its an amazing code, brief and correct.
i could solve first part with combination but for the second part finally i used number of boundary line and put a condition for that if there is one boundary line my form is acceptable but your code is wonderful
i want to try it but after test there is an error:
cannot import treehelpers from ghpythonlib
do you know how i can solve this problem?
Yesterday I adapted my array display to show all of your results, which was quite easy (white group), and then got bogged down and failed to group them by the number of edges. I succeeded at that today (cyan group), though used my ‘Tree/List Viewer’ tool to show them instead of creating multiple grids.
The text panel shows the number of edges in each branch: 4, 8, 10, 6, 12, 14 or 16. Use the ‘path idx’ slider to choose a branch of the tree, then the ‘list idx’ slider to examine all the shapes in that branch. All displayed in yellow with blue background at the top right of the array.