How to subdivide a surface to polysurface in 0.7.0


#1

kilian3_forforumquestion

I am trying to compare different Visual Dataflow Modelling tools and for that purpose I am building a Kilian roof in each of these tools. In Dynamo, I would like to subdivide the surface into a list of polysurfaces over which I would perform other functions like create diagonal cross lines etc. Im stuck at subdividing the surface and cant find an effective node to do the same. Am I missing something? Can anyone help me with it? File is attached. Thanks!!


#2

I understand that you are trying to follow this workflow from Axel Kilian

http://generativecomponents.wikispaces.com/roof

After generating the surface you can directly make the networks of points with just PointAtParameter

01

You will find different custom nodes for takings group of 4 points, the quads (some of them will make it directly in the surface without having to use PointAtParameter before)

02

With the quads is up to you to make the diagonals with revit adaptive components or with the solid tools of 0.7 (a DS function will be quite handy in this last case)

 


#3

Side note to the last post:

I have taken a look to the existing custom nodes for quads (how they work internally). They were done in the previous versions. They are quite smart, but maybe a little bit too complicated compared with the way you will do it today using the new engine.

Getting the quads with designscript is very easy and straightforward.

Having the net of points (list of points with dimension 2), you can get the quad of a point with its indices

def QuadAtPointIndices(NetPts: var[][],N1,N2)
{
Pt1=NetPts[N1][N2];
Pt2=NetPts[N1][N2+1];
Pt3=NetPts[N1+1][N2];
Pt4=NetPts[N1+1][N2+1];

return={Pt1,Pt2,Pt3,Pt4};
}

Now you can nest it in other function for getting all the quads from a net of points

def QuadsFromNet(Pts:var[][])
{
U1=Count(Pts)-2;
U2=Count(Pts[0])-2;

return=QuadAtPointIndices(Pts,(0…U1)<1>,(0…U2)<2>);
}

03

Or even more simple if you are making the net of points only for obtaining the quads

def QuadsAtSurface(Surf, U1,U2)
{
Pts=Surf.PointAtParameter((0…1…#U1)<1>,(0…1…#U2)<2>);
return=QuadAtPointIndices(Pts,(0…(U1-2))<1>,(0…(U2-2))<2>);
}

04

 


#4

Thank you so much, Eduardo. I have actually been trying to script as less as possible and use as many built in nodes. Nevertheless I have tried out the method outlined above and it works well. However, I am stuck at the next point. I have created a custom recursive node that would add diagonal lines for each quad of points. But the node doesnt seem finish execution at all. I have kinda made sure it doesnt get into infinite looping, but still no luck. Even the downloaded recursive nodes do not seem to work in 0.7.0. Is it a version issue? Any idea? I have attached the files for reference. kilian_coding2 quads_diagonal


#5

Vignesh, Recursion currently doesn’t work in 0.7.0, but I hear it will be back eventually.


#6

You are welcome.

First, nothing stops you to put the DS functions inside of a custom node

02

01

(By the way, this custom node is already uploaded in the package manager)

About the recursive node, I am sorry but I haven’t used them so I can not help you on that. But maybe someone else here can.

In any case, you have done pretty much what is needed, because you have defined how to get the diagonals with a list of four points.

03

The only problem now is how to evaluate one by one the sublist of 4 points. But you don’t need any special list management workflow for that. In fact, you are almost there…

If this is working for a list of four points …

Line1=Line.ByStartPointEndPoint(Points[0], Points[3]);
Line2=Line.ByStartPointEndPoint(Points[1], Points[2]);

…this will work for any list of four point and Dynamo will take care of any needed list management.

def MakeDiagonals(Points:var[])
{
Line1=Line.ByStartPointEndPoint(Points[0], Points[3]);
Line2=Line.ByStartPointEndPoint(Points[1], Points[2]);

return={Line1,Line2};
}

When you define the argument Points as “Points:var[]”, instead of only “Points”, you are telling that the function expect a list of dimension 1. Points:var[][] mean that the function expect a list of dimension 2 and so on.

04

The DS function can take directly the global lists of quads. You don’t need even to flatten it one level before.

And as I said, you can put the function in a custom node. Even integrate it with the one that make the quads for having an “all in one” node that makes all the step of your workflow


#7

I didnt know Dynamo could manage lists this way. That was very useful. Thanks a lot, Eduardo.


#8

But, I am trying to create a model with as little multi-line scripting as possible since I am comparing dynamo with other VDM systems like Grasshopper, GC etc. I would like to know if the recursive function I created would be the best bet to achieve the diagonals from the list of quads using nodes (if at all it works in 0.7.0). Any chance I can reduce the overall number of nodes?


#9

The DS Function is the more robust, efficient and concise way. But If you prefer not to use it, you can manage this via transposing the list of quads06

As always, you can integrate this very easily in a custom node.