Loop/While, Recursive Function, Place Views on Sheet


#1

Hi All,

I’m trying to make a script that places views on sheet based on their viewport size. It is about interior elevations.
It should start placing the viewports from the botom right corner of the sheet going to the left and when there is not enough space to go on the second row and start again from right to left.
Now I place all the views on the sheet in the right corner of the sheet and then replace them based on coordinates. The problem is I should rerun my definition for every row. I’ve made custom node to do that and I use it for every row.
I assume it can be done with some sort of loop or Recursive Function.
The idea is to start placing the views until there is no more space on the first row and then start on the secont row after the second row is full to start on the third and so on. Everytime it should start from right to left.
You can see the definition of the script and the custom node from the attached files. Also I’m attaching a sample .rvt file with the elevations and sheet.

ViewsOnRow.dyf (22.5 KB)
SampleProject.rvt (1.3 MB)
PlaceViewsOnSheets.dyn (27.4 KB)



#2

you can of course do this with recursion or looping - something like:

http://gamedev.stackexchange.com/questions/2829/texture-packing-algorithm might help, - but I would look for DynamoPack package or github repo, which wraps an open source texture packing library as zero touch nodes.

If you have written your row layout algorithm as a custom node then I think you can try using Loop.While where your custom node will be the loop body, your condition will be some analysis of the space left, and your initial state will be some parameter into your custom node that sets the row,col spot maybe?


#3

Yes, I tried this approaches but I didn’t come up with solution so I cleared everything and posted here. I wasn’t able to create anything that works. I know I’m pretty close. The hard technical work is done it needs only fine tune to exclude the function in the right way without the need to run everything again and again for each row.


#4

Did you ever find a solution for this, as I am currently in the process of having some similar issues…


#5

In fact, I didn’t try anything more because I had another tasks and this script remain the same. I suppose the Loop While node should do the trick since the definition is in custom node and can be used as a function


#6

this could be a really useful dynamo script, I personally would organize the views a bit differently but the concept could save lots of time