you don’t have the loop while node setup quite right. I would use a custom node for your loopbody - at least for me it is simpler to think about.
init is some value, so that looks fine, your condition looks okay, you’re going to quit when your sum of values != 1 in that list.
then your function adds a random value to that list, but it will always be the same random value as that part of your graph is not inside your function to be executed repeatedly.
thanks for sharing the video, but yours is changing the panel’s type.
what i want to do is to randomize the distance between mullions or the width of the panels.
thank you John, this is a great way to randomize it.
but in my case the manufacturer gave me 4 sizes for panels, 450mm, 850mm, 1250mm and 1650mm, i want dynamo to divide the length of the curtain wall into these measurements and place a vertical grid randomly, the horizontal grid is fixed as we need only 400mm for dust space. something like this that I’ve been doing manually;
do you think if it’s possible?
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
import sys
#The inputs to this node will be stored as a list in the IN variables.
pyt_path = r'C:\Program Files (x86)\IronPython 2.7\Lib'
sys.path.append(pyt_path)
import random
#The inputs to this node will be stored as a list in the IN variables.
vals = IN[0]
length = IN[1]
refresh = IN[2]
def addVals(nums,total):
sum = 0
vals = []
i = 0
while sum<=total:
i = random.choice(nums)
vals.append(i)
sum+=i
return vals
OUT = addVals(vals,length)
EDIT to add, I’d freeze the CurtainGrid.AddGridLineByPoint node and run a few times refreshing, until I see a combination of points I like. And follow this suggestion from the post you linked above:
I added a bit to visualize the panels to better find a preferable confugration before running the graph (with the CurtainGrid.AddGridLineByPoint node unfrozen):
Thanks a lot for your script.
How about controling horizontal grids? I’ve already tried “unconnected height” and tick true for “isUGridline” but it seem not working…
This part is creating points along the location line where grids will be placed. I can’t test at the moment but try modifying that line of the code block to get the start point of the curtain wall location line, and then translating another point in the z direction by the unconnected height parameter value. Then create a line using those two points as the start and end point, and from that line get the grid location points with PointAtParameter(params)
I’ve already tried your code either but it still not working. I always get problems with “Unconnected Height” parameter when I want to get the element’s height. In the code block, I saw “params = spaces/length;”. Does it affect the result also?
Please help me clarify whenever you have time. Thanks a lot for your enthusiastic.
@NguyenTriTrung The params = spaces/length should still work with a height value, but if I am understanding correctly it sounds as though you are having trouble getting the height. Perhaps you should create a new topic and upload images with where it is failing, and the error you are getting.
how do i get this to apply to my revit curtain wall? (delete the curtain grid portions) i am very green to dynamo. i see the preview in dynamo but, nothing gets selected in revit… apologies up front if this is a silly question…
I also have a set pattern for the vertical grids and I’ve been able to get it to work. The cycle just repeats.
For the horizontal grids however, I am tasked with setting them with random sizes. The panel is 1250 mm so the architect decided to divide them into 1/1, 1/2, 1/3, and 2/3 panel sizes. The order is then randomized between each vertical grid.
With list.shuffle and list.cycle I’ve managed to get a long list of all of those panel lengths. But how can I make sure it only gets put up between the right grids to create segments?
(Btw, the removal route seems great, but the problem is that I also have 1/2 size and not just thirds.)
Hey I just looked at the script again and I can’t recreate the error. At least not in a way that isn’t caused by the two parameters you noted.
I got the error because I used List.Cycle with a randomizer. That list exceeded the total length. the node did it’s work up until the nulls caused by the last two points (that exceeded)