erdevelop_ / courses / dynamo Glossary Tools TR
Courses · Dynamo

Dynamo Course

An intensive 7-day programme for façade and architectural designers using Revit. First you get the logic of Dynamo and lists right, then you build graphs that manage the parameters of hundreds of panels with Excel, number panels automatically, place adaptive panels and take data from Grasshopper.

7 days~5 hours a dayEnglishNode names in English

Before you start

Who is it for

Façade and architectural designers who use Revit at a basic level and want to automate repetitive tasks (filling parameters, numbering, placing elements). If you don't know curtain walls, families and shared parameters in Revit, do the first four days of the Revit course on this site first; the examples use that course's files.

What you need

  • Revit (Dynamo comes with Revit: Manage > Dynamo). The trial version is enough.
  • The façade file prepared on days 1-4 of the Revit course, the Panel_Adaptive_4N family and the shared parameters (Panel_ID, Cam_Kodu = glass code).
  • Excel; Rhino 8 and Grasshopper for day 6 (optional).

Programme

DayTopicWhat you learnTime
Day 1Interface, nodes and the first write to RevitLibrary, Run modes, Code Block, Watch, model lines, element binding~5 hours
Day 2Lists, lacing and levelsDesignScript ranges, Shortest/Longest/Cross Product, nested lists, panel corners~5 hours
Day 3Revit parameters and ExcelSelecting by category, reading parameters, writing to Excel, writing back by Element ID~5 hours
Day 4Automatic numbering and PlayerPanel centre, sorting with a combined key, P-001, type and glass code, Dynamo Player~5 hours
Day 5Adaptive panels from a surfaceSelect Face, dividing by uv, AdaptiveComponent.ByPoints, warp and glass code~5 hours
Day 6CSV from Grasshopper and packagesCorner points from GH, reading CSV, coordinate alignment, Clockwork, archi-lab, Rhythm~5 hours
Day 7Python, custom nodes and sharingRevit API, transactions, UnwrapElement, .dyf nodes, team sharing rules~5 hours

There is a checklist at the end of each day. As you tick items, your progress is saved in this browser. If you only study on weekday evenings, the programme takes about two weeks. Node names follow Dynamo 2.x / 3.x (Revit 2023 and later); in older versions some node names and the Python engine differ. Screenshots are from the Revit 2027 English interface. Autodesk screen shots reprinted courtesy of Autodesk, Inc. Autodesk® and Revit® are trademarks of Autodesk, Inc.; this page is not affiliated with Autodesk.

DAY 01

Interface, nodes and the first write to Revit

~5 hours · 0/5 checks

Goal and the logic of Dynamo

By the end of the day you will have built your first slider-driven graph in Dynamo opened from Revit, read its result with a Watch node and written it to Revit as model lines. Time about 5 hours. File: Gun1.dyn.

Dynamo is a visual programming environment running inside Revit. It is similar to Grasshopper, but its real strength is access to Revit data: selecting elements, reading and writing parameters, creating elements. In façade work it is used most to fill the parameters of hundreds of panels automatically instead of typing them by hand.

Revit modelelements · parametersDynamo graph.dynDynamo Playerrun with one buttonreadwrite / createinputsDynamo runs inside Revit while Revit is open
Dynamo reads Revit data, processes it and writes it back to the model. Ready graphs can be run with Dynamo Player without opening them.
Grasshopper Dynamo
Component Node
Canvas Workspace
Panel Watch node
Data tree List of lists and list levels (@L1, @L2)
Bake Nodes that create Revit elements (write straight to the model)
Python / C# Script Python Script node, Code Block (DesignScript)

1. Interface (45 min)

Dynamo start screen: 1: Open / New, 2: sample graphs, 3: Workspace tab.
Dynamo start screen: 1: Open / New, 2: sample graphs, 3: Workspace tab.
Empty workspace: 1: Library, 2: Run mode (Automatic / Manual), 3: switch between graph and 3D preview (Ctrl + B).
Empty workspace: 1: Library, 2: Run mode (Automatic / Manual), 3: switch between graph and 3D preview (Ctrl + B).
  1. Open a project in Revit (the file from day 1 of the Revit course or an empty project). Manage > Dynamo.
  2. Start a new graph with New. Get to know the screen:
    • Library (left): nodes by category. The search box at the top is the fastest way.
    • Workspace (centre): where nodes are connected. A 3D preview is behind it.
    • Run (bottom left): Automatic runs on every change, Manual only when you press Run. Use Manual for graphs that write to Revit.
  3. Switch between preview and graph: buttons at the top right or Ctrl + B.
  4. Double-click an empty area: a Code Block opens. This is Dynamo's most used node.

Shortcuts

Shortcut Function
Double-click (empty area) Code Block
Right-click (empty area) Node search
Ctrl + G Group selected nodes
Ctrl + W Add a note
Ctrl + L Align nodes automatically (Cleanup)
Ctrl + Shift + drag Move wires to another port

2. First graph: points and lines (1.5 hours)

The Code Block (1) generates five point pairs and five lines; Watch (2) shows the list; the lines appear in the background preview (3).
The Code Block (1) generates five point pairs and five lines; Watch (2) shows the list; the lines appear in the background preview (3).
Number Slider2500Point.ByCoordinatesxyzPointLine.ByStartPoint…startPointendPointLineWatchLine(StartPoint = …)Code Blockx = 0..6000..1500;
Node: inputs on the left, outputs on the right. A Code Block does the work of several nodes in one line; Watch lets you read the result.
  1. Number Slider (0-5000): X. Another one: Y.
  2. Point.ByCoordinates: x = X, y = Y. A point appears in the preview.
  3. Place a second Point.ByCoordinates (0, 0, 0): the start point.
  4. Line.ByStartPointEndPoint: a line from two points.
  5. Connect a Watch node to the line output: the line's information is shown. Read its length with Curve.Length.
  6. Move the slider: in Automatic mode the line changes instantly.

The same with a Code Block

Type this in a Code Block:

x = 0..6000..1500;
p = Point.ByCoordinates(x, 0, 0);

The expression 0..6000..1500 generates the list 0, 1500, 3000, 4500, 6000. Five points in one line.

3. Writing to Revit (1 hour)

  1. Set the Run mode to Manual.
  2. With a Code Block generate vertical lines every 1500 mm, 4000 mm high:
x = 0..6000..1500;
bottom = Point.ByCoordinates(x, 0, 0);
top = Point.ByCoordinates(x, 0, 4000);
cizgi = Line.ByStartPointEndPoint(bottom, top);
  1. Connect the cizgi (line) output to a ModelCurve.ByCurve node and press Run. 5 model lines are created in Revit.
  2. Change a value and Run again: Dynamo deletes the old lines and places new ones (same graph, same session). This is called element binding.
  3. When you close and reopen Dynamo, the binding is usually kept thanks to information saved in the file; but if you run the graph in a different project it creates new elements.

4. Layout and saving (30 min)

  1. Select nodes, group them with Ctrl + G and name the group: Inputs, Geometry, Write to Revit.
  2. Right-click the input nodes (sliders) > Rename: give meaningful names.
  3. Add a note at the start of the graph with Ctrl + W: describe what it does in two sentences.
  4. Save: Gun1.dyn.

End-of-day check (15 min)

If you can tick them all, move on to day 2.

Bonus: Combine the same lines with horizontal floor lines into a grid: define a second range for y and set the lacing of Point.ByCoordinates to Cross Product (the subject of day 2).

DAY 02

Lists, lacing and levels

~5 hours · 0/5 checks

Goal

By the end of the day you will have built a façade grid using lists, nested lists and matching (lacing) rules and collected the corner points of each panel. Time about 5 hours. File: Gun2_Liste.dyn.

1. Lists and DesignScript (1.5 hours)

A Code Block uses the DesignScript language. It is short and readable:

Syntax Meaning
0..10 0 to 10, step 1
0..6000..1500 0 to 6000, step 1500
0..6000..#5 5 equally spaced numbers between 0 and 6000
1..#10..2 10 items starting from 1, step 2
[1, 2, 3] List
a[0] First item (indices start at 0)
a[-1] Last item
x > 3 ? "A" : "B" Condition

Basic list nodes

Node Function
List.Count Number of items
List.GetItemAtIndex Item at a given index
List.FirstItem / List.LastItem First / last item
List.Reverse Reverse
List.SortByKey Sort by a key list
List.FilterByBoolMask Split by a True/False list (in / out)
List.Chop Split a list into groups of N
List.Flatten Flatten a nested list
List.Transpose Turn rows into columns

2. Lacing: how lists are matched (1 hour)

Replication guide (1): x<1>, z<2> matches each x with each z (Cross Product). 2: nested list, 5 sub-lists × 3 points; 3: list levels @3 @2 @1 and total {15}.
Replication guide (1): x<1>, z<2> matches each x with each z (Cross Product). 2: nested list, 5 sub-lists × 3 points; 3: list levels @3 @2 @1 and total {15}.

When you give two lists to a node, the node's lacing setting decides how items are matched (right-click the node > Lacing).

Shortest3 pointsLongest5 pointsCross Product15 points
The same two lists (5 x, 3 z) with three lacings: as many as the short list, as many as the long list (last item repeated), or each x with each z.
  1. Define x = 0..6000..1500; (5 items) and z = 0..8000..4000; (3 items).
  2. Try with Point.ByCoordinates (x, 0, z):
    • Shortest: 3 points (as many as the short list).
    • Longest: 5 points (the end of the short list is repeated).
    • Cross Product: 15 points, each x with each z. This is the grid.
  3. Inside a Code Block, a replication guide is used for the same result: Point.ByCoordinates(x<1>, 0, z<2>);

3. Nested lists and levels (1.5 hours)

The Cross Product result is not a flat list but a list of lists: 5 sub-lists with 3 points each (each column a sub-list).

Cross Product result (@L2)List.Transpose[0]0,00,10,2[1]1,01,11,2[2]2,02,12,2[3]3,03,13,2[4]4,04,14,2[0]0,01,02,03,04,0[1]0,11,12,13,14,1[2]0,21,22,23,24,25 column lists × 3 points3 floor lists × 5 points
Nested list: the outer list is columns, inner lists are points. Transpose swaps rows and columns; @L2 runs a node on the inner lists.
  1. Inspect the structure with Watch: List > 0 > List > 0, 1, 2.
  2. List.Transpose: 3 sub-lists with 5 points each (each floor a sub-list).
  3. Connect a List.Count node: it gives 5 (outer list). For the count of each inner list, click the arrow next to the input wire and choose @L2: [3, 3, 3, 3, 3].
  4. List levels are Dynamo's equivalent of tree branches in Grasshopper. You choose the level a node runs on with this arrow.

Exercise: panel corners

  1. Grid points: 5 columns × 3 floors. The 4 corners of each panel come from neighbouring items of the x and z lists.
  2. With a Code Block:
x = 0..6000..1500;
z = 0..8000..4000;
n = List.Count(x) - 1;   // number of column bays: 4
m = List.Count(z) - 1;   // number of floor bays: 2
k1 = Point.ByCoordinates(x[0..n-1]<1>, 0, z[0..m-1]<2>);
k2 = Point.ByCoordinates(x[1..n]<1>,   0, z[0..m-1]<2>);
k3 = Point.ByCoordinates(x[1..n]<1>,   0, z[1..m]<2>);
k4 = Point.ByCoordinates(x[0..n-1]<1>, 0, z[1..m]<2>);
kose = List.Transpose([List.Flatten(k1), List.Flatten(k2), List.Flatten(k3), List.Flatten(k4)]);
panel = Polygon.ByPoints(kose);
  1. x[0..n-1] takes a slice of the list; with <1> and <2> the column and floor slices are cross-matched.
  2. kose (corner) becomes a list of 4 points per panel: bottom left, bottom right, top right, top left.
  3. Check the panel count: 4 column bays × 2 floor bays = 8 panels.

End-of-day check (15 min)

If you can tick them all, move on to day 3.

Bonus: Separate every second floor as spandrel: turn the list of floor indices into a True/False mask with j % 2 == 0 and split the panels in two with List.FilterByBoolMask.

DAY 03

Revit parameters and Excel

~5 hours · 0/5 checks

Goal

By the end of the day you will have read the curtain panels of the Revit model with Dynamo, exported their dimensions and parameters to Excel, and written the values you edited in Excel back to the model. Time about 5 hours. File: Gun3_Excel.dyn.

This is the use of Dynamo with the fastest payback in façade work: editing hundreds of panels in a table instead of clicking them one by one.

1. Selecting Revit elements (1 hour)

Method Node When
Single element Select Model Element Trying out, testing on one panel
Several elements Select Model Elements A group on screen
Category Categories + All Elements of Category All curtain panels in the project
Type Family Types + All Elements of Family Type All of one panel type
In the view All Elements In Active View (with packages) Only elements in the active view
  1. Open the façade you made on days 1-4 of the Revit course (curtain walls and panels).
  2. Categories: Curtain Panels. All Elements of Category: all panels.
  3. Read the panel count with List.Count. Compare with the panel schedule in Revit.
  4. Select a panel with Select Model Element and see its Revit element identity (Element ID) in Watch.

2. Reading parameters (1 hour)

Reading from Revit: 1: Categories = Curtain Panels, 2: All Elements of Category (152 panels), 3: Element.GetParameterValueByName (Mark and Width), 4: panel numbers P-01-001… in Watch (in a Code Block it is written with the full name Revit.Elements.Element).
Reading from Revit: 1: Categories = Curtain Panels, 2: All Elements of Category (152 panels), 3: Element.GetParameterValueByName (Mark and Width), 4: panel numbers P-01-001… in Watch (in a Code Block it is written with the full name Revit.Elements.Element).
  1. Element.GetParameterValueByName: element = panels, parameterName = "Width". The widths of all panels arrive.
  2. Do the same for "Height", "Area", "Panel_ID", "Cam_Kodu". The parameter name must be written exactly as it appears in Revit, including case.
  3. If a parameter is not found the node warns and returns null. See in Watch which elements came back empty.
  4. List all parameter names of an element with Element.Parameters; copy the correct name from there.
  5. Units: although Revit's internal unit is feet, Dynamo returns values in project units. Check in Watch that you get mm.

3. Writing to Excel (1 hour)

Curtain PanelsAll ElementsGetParameterWidth · Cam_KoduExcelpanel listEdit in ExcelG01 → G02match byElement.IdSetParameterCam_Koduread → ExcelExcel → write
Excel loop: panels are read and written to a table, edited there and written back to the model matched by Element ID.
  1. Set up one row per panel: Element ID, Panel_ID, Width, Height, Area, Cam_Kodu.
  2. Combine the lists with a Code Block: [id, pid, w, h, a, ck]; then make them row by row with List.Transpose.
  3. Add the header row: with List.AddItemToFront ["ElementId", "Panel_ID", "Genislik", "Yukseklik", "Alan", "Cam_Kodu"] (width, height, area).
  4. Data.OpenXMLExportExcel (works even without Excel installed) or Data.ExportExcel: file path, sheet name Paneller, start row and column 0, data.
  5. Run. Open the Excel file and check.

4. Writing back from Excel (1.5 hours)

Goal: edit the Cam_Kodu column in Excel and write it back to the panels in the model.

  1. Change the Cam_Kodu of a few panels in Excel (G01 → G02), save and close.
  2. In Dynamo use Data.OpenXMLImportExcel: same file, same sheet. See the rows arrive in Watch.
  3. Drop the header row with List.RestOfItems. Turn into columns with List.Transpose.
  4. Get the panels from the model again (All Elements of Category) and list their IDs with Element.Id. Convert the ID column from Excel to numbers with String.ToNumber (it may arrive as text).
  5. Find the model counterpart of each Excel row: List.IndexOf (list = model IDs, item = Excel IDs), then order the panels in Excel order with List.GetItemAtIndex.
  6. Element.SetParameterByName: element = the panels in this order, parameterName = "Cam_Kodu", value = the Cam_Kodu column from Excel.
  7. Run mode Manual. Run. Select a panel in Revit and check that Cam_Kodu has changed.

Caution

  • Writing back can be undone (Ctrl+Z in Revit), but save the file before running a graph that changes hundreds of elements.
  • Don't rely on row order; always match by Element ID. If the Excel sheet is sorted the order breaks, the ID does not.

End-of-day check (15 min)

If you can tick them all, move on to day 4.

Bonus: When writing to Excel, also create a Summary sheet: count and total area grouped by Cam_Kodu. Group with List.GroupByKey, sum with Math.Sum.

DAY 04

Automatic numbering and Player

~5 hours · 0/5 checks

Goal

By the end of the day you will have a graph that sorts façade panels by position, numbers them automatically and assigns type and glass codes by dimensions. The graph will be prepared for Dynamo Player so that a colleague who doesn't know Revit can use it. Time about 5 hours. File: Gun4_Numara.dyn.

1. Panel positions (1 hour)

Curtain panels don't have a single "location point". We derive the position from the geometry.

  1. All Elements of Category: Curtain Panels.
  2. Get each panel's bounding box with Element.BoundingBox.
  3. The midpoint of BoundingBox.MinPoint and BoundingBox.MaxPoint is the panel centre. Code Block: m = Point.ByCoordinates((a.X + b.X) / 2, (a.Y + b.Y) / 2, (a.Z + b.Z) / 2); (a = MinPoint, b = MaxPoint).
  4. Get the Point.Z and Point.X values of the centres.
  5. On a curved or faceted façade you need the distance along the façade instead of X: take the façade line (a Model Curve or the curtain wall's location line) and find each centre's position on it with Curve.ParameterAtPoint.

2. Sorting and numbering (1.5 hours)

Check after numbering: Mark values are read in Dynamo (4); the order is compared with the tags in Revit.
Check after numbering: Mark values are read in Dynamo (4); the order is compared with the tags in Revit.
P-001P-002P-003P-004P-005P-006P-007P-008P-009P-010P-011P-012P-013P-014P-0151. bottom to top2. left to right (X or along the façade line)key = floor × 1 000 000 + x → List.SortByKey
Numbering order: panel centres are sorted first by floor, then by horizontal position. A combined key packs the two criteria into a single number.

Required order: first floor (bottom to top), then left to right.

  1. Round the floor value: kat = Math.Round(z / 100) * 100; Panels on the same floor fall on the same value even if their Z differs by a few mm.
  2. Sort key: anahtar = kat * 1000000 + x; (floor first, then X within the floor).
  3. List.SortByKey: panels, keys. Sorted panels.
  4. Numbers: n = 1..List.Count(siraliPaneller);
  5. Text: "P-" + String.PadLeft(String.FromObject(n), 3, "0"); → P-001, P-002…
  6. Element.SetParameterByName: sorted panels, "Panel_ID", numbers. Run.
  7. In Revit place panel tags in an elevation with Tag by Category and check that the order is correct.

3. Type and glass code (1 hour)

  1. Read width and height (day 3). Round to 10 mm.
  2. Type key: Genislik + "x" + Yukseklik → 1500x4000.
  3. Find unique types with List.UniqueItems, each panel's type index with List.IndexOf, and make the type code with "T" + (i + 1).
  4. Glass code rule: spandrel panels S01, others by size: w > 1400 ? "G01" : "G02". To identify spandrels, read the panel type's name (Element.ElementType + Element.Name).
  5. Write two parameters at once: give Element.SetParameterByName the parameter names as a list (["Panel_Tip", "Cam_Kodu"]) and the values as matching lists; watch the lacing.

4. Dynamo Player (1 hour)

Dynamo Player runs a graph with one button without opening it. Your colleagues can use it without seeing inside the graph.

graph (.dyn)Prefix [Is Input]Start [Is Input]…nodes…Count [Is Output]Dynamo PlayerPrefix: P-Start: 1Count: 24▶ Play
Nodes marked Is Input and Is Output appear as form fields in Dynamo Player; the user changes values and runs the graph without opening it.
  1. Decide which nodes the user should be able to change: start number, prefix (P-), floor rounding step.
  2. Right-click these nodes > tick Is Input and give meaningful names: Start number, Prefix.
  3. Right-click a Watch node whose result you want to show > Is Output: Number of panels numbered.
  4. Save the graph to a folder. In Revit open Manage > Dynamo Player and choose the folder.
  5. See the graph's inputs in Player, change the values, Play.

End-of-day check (15 min)

If you can tick them all, move on to day 5.

Bonus: Split numbering by façade face: north façade K-001, south façade G-001. Read the panel normal (or the curtain wall orientation), group by direction and restart numbering in each group.

DAY 05

Adaptive panels from a surface

~5 hours · 0/5 checks

Goal

By the end of the day you will have divided a curved mass face in Revit in Dynamo, placed a 4-point adaptive panel in each cell, calculated the panels' deviation from flatness and written it to a parameter. Time about 5 hours. File: Gun5_Adaptive.dyn.

This day uses the Panel_Adaptive_4N family you made on day 4 of the Revit course.

1. Getting the Revit surface (45 min)

  1. Prepare a curved mass in Revit (In-Place Mass) or use the mass imported from Rhino on day 2 of the Revit course.
  2. In Dynamo use Select Face: click the façade face of the mass. The surface appears in the preview.
  3. The face selection is linked to the model: when the mass changes, Dynamo uses the new face when run again.

2. Dividing the surface (1.5 hours)

1234Select FaceSurface.PointAtParameter→ k1, k2, k3, k4AdaptiveComponent.ByPoints
The Revit mass face is divided by its u and v parameters; the four corners of each cell are collected in the adaptive family's 1-2-3-4 order and a panel is placed.
  1. Sliders: U_Adet (U count) = 8, V_Adet (V count) = 3.
  2. Code Block:
u = 0..1..#(U_Adet + 1);
v = 0..1..#(V_Adet + 1);
k1 = Surface.PointAtParameter(yuzey, u[0..U_Adet-1]<1>, v[0..V_Adet-1]<2>);
k2 = Surface.PointAtParameter(yuzey, u[1..U_Adet]<1>,   v[0..V_Adet-1]<2>);
k3 = Surface.PointAtParameter(yuzey, u[1..U_Adet]<1>,   v[1..V_Adet]<2>);
k4 = Surface.PointAtParameter(yuzey, u[0..U_Adet-1]<1>, v[1..V_Adet]<2>);
kose = List.Transpose([List.Flatten(k1), List.Flatten(k2), List.Flatten(k3), List.Flatten(k4)]);
  1. Connect the Select Face output to the yuzey (surface) input and the sliders to the U_Adet and V_Adet inputs.
  2. This is the same as the corner method on day 2; the only difference is that the surface's u and v parameters are used instead of x and z.
  3. kose must be a list of 4 points per panel. In Watch: 24 sub-lists (8 × 3) with 4 points each.
  4. The order matters: 1 bottom left, 2 bottom right, 3 top right, 4 top left. It must match the point numbers in the adaptive family. If the surface's u direction is reversed, the panels are placed back to front; then reverse the u list.

3. Placing adaptive panels (1 hour)

The numbered adaptive points (1–4) of the Panel_Adaptive_4N family. AdaptiveComponent.ByPoints expects the corners in this order.
The numbered adaptive points (1–4) of the Panel_Adaptive_4N family. AdaptiveComponent.ByPoints expects the corners in this order.
  1. Family Types: Panel_Adaptive_4N.
  2. AdaptiveComponent.ByPoints: points = kose, familyType = the selected type.
  3. Run mode Manual, Run. 24 adaptive panels are created in Revit.
  4. First try on 2 panels with U_Adet = 2, V_Adet = 1; if correct, go up to the real numbers.
  5. Change the shape of the mass in Revit and Run again in Dynamo: the panels update to the new surface.

4. Warp calculation and writing (1.5 hours)

1234dPlane.ByThreePoints(k1, k2, k3)d = Geometry.DistanceTo(k4, plane)d < Warp_Tol ? "G01" : "G02"→ Element.SetParameterByName"Cam_Kodu"
Warp: a plane is built through the first three corners and the distance of the fourth corner to the plane is measured. The glass code is set by the threshold and written to the panel.
  1. Plane through the first three points of each panel: Plane.ByThreePoints (k1, k2, k3).
  2. Distance of the fourth point to the plane: Geometry.DistanceTo (k4, plane).
  3. Threshold slider: Warp_Tol = 3 mm.
  4. Glass code rule: ck = d < Warp_Tol ? "G01" : "G02";
  5. Panel number: "P-" + String.PadLeft(String.FromObject(1..List.Count(kose)), 3, "0");
  6. Write Panel_ID and Cam_Kodu to the placed adaptive panels with Element.SetParameterByName.
  7. Check the results in Revit with a Generic Models schedule.

Visual check

Colour the panels in the preview by warp value with Display.ByGeometryColor: set up a green-to-red colour range with a Color Range node, reduce the warp values to 0-1 and take the colour.

End-of-day check (15 min)

If you can tick them all, move on to day 6.

Bonus: To keep the panel width constant, calculate the u parameters not at equal intervals but from the length of the surface's bottom edge: divide the edge with Curve.PointsAtEqualSegmentLength and find the points' uv on the surface with Surface.UVParameterAtPoint.

DAY 06

CSV from Grasshopper and packages

~5 hours · 0/5 checks

Goal

By the end of the day you will have a graph that transfers panels generated in Rhino/Grasshopper to Revit via a CSV file. You will also learn to install and use Dynamo packages. Time about 5 hours. File: Gun6_Aktarim.dyn.

Panelling is often done in Grasshopper. If Rhino.Inside.Revit cannot be used, the most robust bridge is a plain text file: Grasshopper writes the corner points, Dynamo reads them and builds the panels in Revit.

1. Transfer workflow (30 min)

Grasshopperpanel cornerspaneller.csvrow = panelDynamoImportCSV · PointRevitAdaptive + parameterscoordinates and units must match on both sides (mm, common reference point)
A bridge without Rhino.Inside: Grasshopper writes corner points to CSV, Dynamo reads them and builds adaptive panels in Revit.

CSV file format: each row is a panel.

Panel_ID X1 Y1 Z1 X2 Y2 Z2 X3 Y3 Z3 X4 Y4 Z4 Cam_Kodu
P-001 0 0 0 1500 0 0 1500 0 4000 0 0 4000 G01

2. Grasshopper side (1 hour)

Grasshopper definition: 1: XZ Plane and size sliders (6000 × 4000 mm), 2: Plane Surface, 3: Divide Domain² (U = 4, V = 2), 4: 8 panels with Isotrim, 5: a Python 3 component turning corners into CSV rows, 6: the CSV text in a Panel.
Grasshopper definition: 1: XZ Plane and size sliders (6000 × 4000 mm), 2: Plane Surface, 3: Divide Domain² (U = 4, V = 2), 4: 8 panels with Isotrim, 5: a Python 3 component turning corners into CSV rows, 6: the CSV text in a Panel.
Python 3 component (input x as List Access): 1: converts the Rhino object to a surface, 2: corners in adaptive order (0,0 · 1,0 · 1,1 · 0,1), 3: X;Y;Z joined with semicolons, 4: header and P-001… rows in the Panel.
Python 3 component (input x as List Access): 1: converts the Rhino object to a surface, 2: corners in adaptive order (0,0 · 1,0 · 1,1 · 0,1), 3: X;Y;Z joined with semicolons, 4: header and P-001… rows in the Panel.
Right-click the Panel: 2: choose the file path with Stream Destination (paneller.csv), 1: turn on Stream Contents. The file is rewritten each time the Panel changes.
Right-click the Panel: 2: choose the file path with Stream Destination (paneller.csv), 1: turn on Stream Contents. The file is rewritten each time the Panel changes.
  1. Open the panelling definition from day 4 of the Grasshopper course.
  2. Get the 4 corners of each panel in adaptive order (uv = 0,0 · 1,0 · 1,1 · 0,1).
  3. Split X, Y, Z with Deconstruct Point; build one row per panel with Concatenate or Format, separator semicolon.
  4. Add the header row and save as paneller.csv with Panel > Stream Contents.
  5. Coordinate alignment: 0,0,0 in Rhino and the project base point in Revit must be at the same place. If not, take the same grid intersection as reference in both programs and move the Rhino model there. Units must be mm on both sides.

3. Dynamo side (2 hours)

  1. Choose the CSV with a File Path node. Data.ImportCSV: a list of rows arrives. If the separator is a semicolon, split it yourself with File.ReadText + String.Split:
clean = String.Replace(text, "\r", "");     // remove Windows line endings
lines = String.Split(clean, "\n");
data = List.RestOfItems(lines);           // drop the header
data2 = List.FilterByBoolMask(data, String.Length(data) > 0)["in"];  // drop empty lines
fields = String.Split(data2, ";");
columns = List.Transpose(fields);
  1. Convert numeric columns to numbers with String.ToNumber.
  2. 4 points per panel: Point.ByCoordinates(x1, y1, z1) … Point.ByCoordinates(x4, y4, z4).
  3. kose = List.Transpose([p1, p2, p3, p4]); → a list of 4 points per panel.
  4. Place Panel_Adaptive_4N with AdaptiveComponent.ByPoints.
  5. Write the Panel_ID and Cam_Kodu from the CSV with Element.SetParameterByName.
  6. Try first with the first 2 rows (List.TakeItems), then run them all.
  7. Change the panelling in Grasshopper, rewrite the CSV and Run in Dynamo: thanks to element binding the panels update.

4. Packages (1 hour)

When Dynamo's core nodes are not enough, community packages are used.

  1. Packages > Search for a Package (Package Manager, depending on version).
  2. Commonly used packages:
Package What it does
Clockwork Hundreds of helper nodes: elements, parameters, list operations
archi-lab Revit schedules, views, advanced Excel operations
Rhythm Revit element operations, helpers such as Element.ById
Data-Shapes Pop-up windows and form interfaces for Dynamo Player
  1. When you install a package, anyone you share the graph with must install the same version of the same package. Write the packages and versions you used in the graph's note.
  2. The nodes of an installed package appear under Add-ons in the Library.

End-of-day check (15 min)

If you can tick them all, move on to day 7.

Bonus: Add a Tip (type) column to the CSV and choose a different adaptive family type for each row in Dynamo: find the type names in the Family Types list with List.IndexOf.

DAY 07

Python, custom nodes and sharing

~5 hours · 0/5 checks

Goal

On the last day you learn to go beyond Dynamo's limits: direct access to the Revit API with the Python Script node, turning repeated node groups into custom nodes and sharing graphs safely within a team. Time about 5 hours.

1. Python Script node (2 hours)

Python Script editor: 1: engine PythonNet3 (CPython3), 2: UnwrapElement, 3: EnsureInTransaction, 4: TransactionTaskDone, 5: OUT.
Python Script editor: 1: engine PythonNet3 (CPython3), 2: UnwrapElement, 3: EnsureInTransaction, 4: TransactionTaskDone, 5: OUT.

Some tasks take very long with nodes or cannot be done at all. The Python Script node lets you use the Revit API directly.

IN[0], IN[1]Dynamo inputsUnwrapElementRevit elementTransactionEnsureInTransactionprm.Set(...)OUTresultclosed with TransactionTaskDone
Python Script node: inputs come from the IN list, Revit elements are unwrapped with UnwrapElement, model changes are made inside a transaction and the result is written to OUT.
  1. Add a Python Script node from the Library. Double-click it and the editor opens. In newer versions make sure CPython3 is selected as the engine.
  2. Inputs arrive as IN[0], IN[1] …; the result is written to the OUT variable.
  3. Exercise: a script that reads the Panel_ID parameter of the selected panels, finds the empty ones and writes a temporary value to them:
import clr
clr.AddReference("RevitServices")
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

doc = DocumentManager.Instance.CurrentDBDocument
paneller = UnwrapElement(IN[0])     # convert Dynamo elements to Revit elements
onek = IN[1]                        # e.g. "TMP-"

filled = []
TransactionManager.Instance.EnsureInTransaction(doc)
for i, p in enumerate(paneller):
    prm = p.LookupParameter("Panel_ID")
    if prm and not prm.AsString():
        prm.Set("{}{:03d}".format(onek, i + 1))
        filled.append(p.Id.ToString())
TransactionManager.Instance.TransactionTaskDone()

OUT = filled
  1. Add two inputs to the node (+ sign): IN[0] = All Elements of Category (Curtain Panels), IN[1] = "TMP-".
  2. Run. The output is the IDs of the panels a value was written to.

Important rules

  • Any code that changes something in Revit must be inside a transaction: start with EnsureInTransaction and end with TransactionTaskDone.
  • Convert elements coming from Dynamo with UnwrapElement before using them in the API.
  • Reading by parameter type: text AsString(), number AsDouble() (Revit internal unit is feet!), integer AsInteger().

2. Custom node (1 hour)

SortByKeyCode BlockPadLeftConcatnumbering nodes from day 4Custom NodePanel.Numarala (number panels)paneller (panels)onek (prefix)baslangic (start)numaralar (numbers)In the Cephe (façade) category · .dyf
Custom node: a group of nodes becomes a single node with named inputs and outputs and is used in other graphs from the library.
  1. Select the numbering nodes from day 4 (sort key, sorting, number text).
  2. Right-click > Create Custom Node. Name: Panel.Numarala, category: Cephe.
  3. The custom node opens in a separate .dyf file. Name the Input nodes (paneller, onek, baslangic) and the Output node (numaralar).
  4. Save. Your own node appears in the Cephe category of the Library and can be used in other graphs.
  5. When you change the custom node, all graphs using it are updated.

3. Sharing within the team (1 hour)

Rule Why
Put a note at the start of every graph describing what it does, its inputs and the packages used Whoever opens the graph knows what to do
Inputs on the left, nodes writing to Revit on the right, both separated by groups and colours Debugging becomes easier
Graphs that write to Revit are saved in Manual mode They don't change the model as soon as they are opened
Inputs marked Is Input and results Is Output for Dynamo Player The team uses it without opening the graph
Shared folder: Dynamo\Grafikler, Dynamo\OzelDugumler Everyone uses the same version
Version in the file name: Panel_Numarala_v03.dyn It is clear which version works
  1. Tidy up the two most useful graphs from days 1-6 (Excel export and numbering) according to these rules.
  2. Put them in a shared folder and point Dynamo Player to that folder.
  3. Ask a colleague to run them only through Player; check from their perspective whether the description and input names are sufficient.

End-of-day check (15 min)

After the week

  • Revit API: As you master the Python node, the Revit API documentation (revitapidocs.com) will be the resource you open most.
  • Together with Grasshopper: Managing panelling in Grasshopper and Revit data in Dynamo is a good division of work. For a direct link, day 5 of the Revit course on this site covers Rhino.Inside.Revit; the Grasshopper course covers the panelling side.
  • Automation ideas: A graph each for creating sheets in bulk, fixing view names, a missing parameter report, model checks (empty Panel_ID, duplicate numbers).