Challenging :D

I had a spare 30 mins this morning so asked Chat GPT for a little Dynamo challenge and this is what it gave me:

:rocket: Challenge: Parametric Pavilion Generator

The Task:

Design a parametric pavilion composed of vertical columns that support a curved roof surface, using only Dynamo.


:memo: Requirements:

  1. Create a base grid of points for the pavilion columns (start with a rectangular grid, e.g., 6x6 points).
  2. Vary the column heights based on their distance from the center of the grid.
  • Closer to the center = taller.
  • Further away = shorter.
  1. Create vertical columns (cylinders or extrusions) at those points with the calculated heights.
  2. Use the tops of the columns to create a curved surface (like a wavy or undulating roof).
  • Loft the points into a smooth NURBS surface or Mesh.

:gear: Bonus Points if you:

  • Add sliders to control:
    • The grid density (number of columns).
    • The minimum and maximum heights of the columns.
    • The radius of influence on height variation.
  • Color the columns based on their height (using Display.ByGeometryColor).
  • Make the pavilion circular rather than rectangular (use Polar arrays).

:white_check_mark: Skills you’ll use:

  • Lists & mapping (geometry points and heights).
  • Math functions (distance calculations, remapping values).
  • Geometry creation (cylinders, lofts, surfaces).
  • Visualization tools in Dynamo.
  • Sliders & design script (optional for math).

:three_o_clock: Expected Time:

20-30 minutes if you’re comfortable with lists and geometry.

<<

So of course it’s taken me longer…
I did decide to do a curved pavilion instead of a square (much nicer) … However I’ve run into an issue…

What have I done wrong?

3 Likes

Have actually achieved what I want with NurbsSurface.ByPoints…

But would still be interested to see how the node in the first post works. (If it works with lists of circular points)

The indicies input is the wrong data type.

Dynamo meshes require 3 or 4 indicies in an index group, and a flat list of meshes.

So in this case y our PythonScript would need to be adjusted to output a IndexGroup set which has a data preview along the lines of this:

IndexGroup(Count = 3, A = 0, B = 1, C = 2, D = 4294967295),
IndexGroup(Count = 3, A = 3, B = 4, C = 5, D = 4294967295)

2 Likes

There are two very similar Mesh nodes, ByPointsFaceIndices and ByVerticesAndIndices. In my opinion, either the nodes, the inputs, or both should be renamed to be more consistent and clear. If you hover over the inputs they give the required data type but it’s not apparent from the input names.

1 Like

Nodes have different names - are you expecting they vary more than this?

I do agree that the input for Mesh.ByPointsFaceIndices should have indexGroups as the input name. FYI @achintya_bhat @emrullah.yildiz and @solamour.

This and I think it’s confusing that one is called ByVertices and the other ByPoints when they both take points. Seems like the most accurate naming would be:
Mesh.ByPointsAndIndexGroups(points: Point[], indexGroups: IndexGroup[])
Mesh.ByPointsAndIndices(points: Point[], indices: int[])

1 Like

I’ve added a task to our backlog to fix it :slight_smile:

  • Mesh.ByPointsFaceIndices → Mesh.ByPointsIndexGroups (With inputs of: Point[ ], IndexGroups : IndexGroup[ ])
  • Mesh.ByVerticesAndIndices → Mesh.ByPointsIndices (With inputs of: Point[ ], Indices : int[ ])

Removed the “and” in the title as that’s not part of our Node naming patterns.

4 Likes

Not an official challenge so I can enter!

I cheated and spent an extra 41 seconds according to my Spotify playlist though, so feel free to disqualify me.

5 Likes

“Can you repost your screenshot with Export as Image? We can’t see your node titles.” :nerd_face:

6 Likes

I was already over on time and making a directory + saving the file and image would put me way over…

If the graph is still open when I get back to my desk in the AM I’ll post it though. Sadly nothing was saved (note the graph name) and the 20 minute challenge aspect would be lost if I have to rebuild it.

Lol just giving you a hard time. Plus it ruins the fun of a challenge if you get to see how other people did it.

1 Like

I did transpose them into groups of 4. The groups formed a straight line. Would this affect it?

So I tried the wrong node?

Not likely.

Most meshes are built of triangles not quads, though that may be what you need it isn’t likely… I can only guess though without context.

Next you need to build index groups of the points - I am guessing 3 points is needed again so I would use a List.Chop to build another set of sublists, transpose those, and then build the index group from the first, second, and third subgroup.

Glad I nurbed now. :grin:

I hear you - but it’s good to learn. You’re missing one node or you need to use a different node to create the mesh.

Here’s an example of it in use: Dynamo Dictionary

You can also hit F1 on the node or right click and select ‘help’ to pull up the extended node documentation. The sample graph in there can be inserted to your graph if you want to play with it.

This took me back to

Don’t know if its possible to have a few math equations in a Dictionary to choose from (it drives the form)
(Distance from 0,0,0 times a SIN or COS factor that calculates the Z coordinate)


PIN1.rfa (428 KB)
formules.txt (7.2 KB)

2 Likes

Not necessarily, though based on your inputs I’d think the Mesh.ByVerticesAndIndices is more inline with what you were imagining. Both options are likely still one step away from what you had but it’s just a matter of deciding which way you want to go with it.

Mesh

rad1 = 100;
pnt1 = Point.ByCylindricalCoordinates(CoordinateSystem.ByOrigin(0,0,0),(0..360..20)<2>, 0, (0..rad1..20)<1>);
pnt2 = pnt1.Translate(Vector.ZAxis(),rad1/2..List.Count(pnt1)..-7.5);
cyl1 = Cylinder.ByPointsRadius(pnt1,pnt2,1);

// Grouping of three points for Mesh Index Group
pnt3 = List.DropItems(List.Sublists(List.Transpose(pnt2),0..1,1),-1);
pnt4 = List.DropItems(List.Sublists(pnt3<1><2>,0..1,1)<1><2>,-1);
pnt5 = List.Flatten(List.Flatten(List.Transpose(pnt4<1>)<1><2>,-1),1);
pnt6 = List.Flatten(List.DropItems(pnt5<1>,[-1,1]),1);
idx1 = List.Transpose(List.IndexOf(List.Flatten(pnt3,-1),pnt6));
idx2 = IndexGroup.ByIndices(idx1[0],idx1[1],idx1[2]);

//Mesh
msh1 = Mesh.ByPointsFaceIndices(List.Flatten(pnt3,-1),idx2);
5 Likes