Open navigation menu
Close suggestions
Search
Search
en
Change Language
Upload
Sign in
Sign in
Download free for days
0 ratings
0% found this document useful (0 votes)
262 views
476 pages
DynamoPrimer Print
dynamo for revit handout
Uploaded by
ريهام أحمد عبد الوهاب
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF or read online on Scribd
Download now
Download
Save DynamoPrimer Print For Later
Download
Save
Save DynamoPrimer Print For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
0 ratings
0% found this document useful (0 votes)
262 views
476 pages
DynamoPrimer Print
dynamo for revit handout
Uploaded by
ريهام أحمد عبد الوهاب
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF or read online on Scribd
Download now
Download
Save DynamoPrimer Print For Later
Carousel Previous
Carousel Next
Download
Save
Save DynamoPrimer Print For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
Download now
Download
You are on page 1
/ 476
Search
Fullscreen
Table of Contents 1, About 0 2, lnodustiog 1 1. What is Visual Progamming? 1 2, What is Dynamo? 12 3. Dynamo Action 13 3, Hela Dynamo! 2 1, Installing and Launching Dynamo 2.1 2. Tho User imerlace 22 3, The Workspace 23, 4, Getting Sted 2.4 4, The Anatomy ofa Visual Progam 3 1. ads 3.1 Wins 32 Livan 33 Managing Your Progam 3.4 Managing Vour Data with Presets 35 5, The Building looks of Promams 4 1 Dal 2, Math 42 3. Losic 43 Sinn 44 Cola 6.5 6, Goometry for Computational Design § 1, Goometny Overview 5.1 Mestos $2 Points 53 Inponting Geometry 58 Desining with Lists 6 1, Whats a List 6.1 2, Working with Lists 622 3, Lintoftists 63, 44, neDimensionl Lists 64 8, Cou locks and DesonSsrint 7 1, What's @ Code Bloc 7.1 2, DesigSsript Syatas 7.2 3, Stowhand 7.3 4 Eunotions 74 9. Dynamo for Revit # ‘The Revit Connection 8.1 “Sclsting 82 iting 83 Creating 4 Customizing 85 6, Documening 86 oon Nas 9 1, Custom Node Inzoduction 9.1 ‘Ceatinga Custom Node 92 Publishing Your Library 9.3 thon Nodes 9.4 Python and Rei 9.5 1. Packages 10 1, Package Intodtion 101 2, Pashage Case Study = Mesh Toolkit 1024. Developing Packas 103 44. Publishing «Package 10.4 , Zom-Louch imposing 10.5 12, Web Experience IY 1, Sond to Web 1.1 2. Castomizer View 11.2 13, Beat Practices 12 1, Graph Stes 12.1 2. Scripting Sustesies 122 3: Soripking Reference 123 14, Appendis 13, 1, Resoutes 13. 2. Index of Nodes 132 3 Usa Pasko 13.3 4, Buample Fes 13.4About The Dynamo Primer For Dynamo v1.3 B Dynamo Dynamo isan open source visual programming platform for designers ‘Welcome ‘You hve just opeacd the Dynamo Prine, a comprehensive guide to visul progamming in Autodesk Dynamo Studio. This primer is an on-going project to share the fndamentals of programming Topics include working with computational wrometry, best practies for rules-based desi, cross.seplinary programming pplication, and more wih the Dynamo Patform, ‘The power of Dynan canbe found isa wide variety of design tlated activities, Dynamo enable an expanding it of ray accessible ways for yout gst started: ‘Explore visual progamming or the fs ine ‘© Connect workllows in varios software 1 Engage an active commanity of users, contributors, and develops ‘Develop an open-source platform fr continued improvement In the midst of this activity an exiting opportunity for working with Dynamo, we need a document ofthe same caliber, the Dynamo Prime “This Primer include chapters developed with Mode Lab. These chapters focas on the ettentias you will eed to pet up and runing developing your own visual programs with Dynamo and key insights on how to take Dynamo further, Hens what you. ‘ean expect lear fom the primer: Context - What actly is "Visual Programming and what ar the concepts eed to understand to div in to Dynamo? Getting Started - How do I yt Dynamo and este my Test prowan? What's in a Program - What ar che functional parts of Dynamo and how douse them? Building Blocks - Whit is “Data” and what are tome fundamental types Ica start usingin my programs? Geometry for Design - How do I work with pometie laments in Dyna? ists, Lists, Lists - How to do I manage and cordate my data structures? Code in Nodes - How can I start extending Dynamo with my own eods? Computational BIM - How can I use Dysamo with a Revit model? (Custom Nodes - How can I esate my wn nodes? Packages - How can I share my tols withthe community’? ‘This isan exiting time to be lering bout, working with and developing fr Dynamo. Let's pt stare! Open Souree ‘The Dynamo Primer project is opensource! Wete dedicated to providing quality content and appreciate any feedback you may ‘hve, Ifyou would ket report an asus on anything all, plate post them on our it hub se page: pegthub convD yasmaD)SDynamaPrimeriseues you would lice to contribute new section, edits or anything ese to this projet checkout the github repo to gt starenepsithab comDynamoSDyramaPrimer. ‘The Dynamo Primer Project ‘The Dynamo Primer isan open souee projet, jntated by Matt Jezyk and the Dynamo Development tam at Autodesk, ‘Mode Lab was commsionod to write the Fist Fiton of the prime. The team continues to wok with Autodesk to provide ‘updates inpaalel with Dysamo's development. © MODELAB Acknowledgments, A special thanks to Ian Keough fo inating and piding the Dynamo projet. ‘Thank you to Matt Jezyk, lan Keough Zach Kron, nd Colin MeCone for enthusiast olaboraton and the opportunity to participate ona wide aay of Dynan projects Software and Resources Dynamo The current stable relese of Dynamo is Version 1.3 DbynamoBIM The best source for alton information, lamin content, and forums isthe DynamoBIM website putty ambi ng Dynamo GleHub Dynamo isan open-source development project on Github. To contribute, chek out By names. nspssthu conDynamoDSDynaime ‘Contact Let us know about any issues with tis document Dynamofautodesk com License Copyright 2017 Autodesk ‘Licensed under the Apache License, Version 2.0 (the "License"; you may’ not use tht file excapt in compliance with the Ticese ‘Youmay obtain copy of the License at pwn. ap ache opgicensesiLICENSE-2.0 ‘Unles required by applicable law or agree to in writing software distributed under the License is distributed on an "ASS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express ot implied. See the Liens forthe speci lnguagegoveming permissions and limitations under the LicenseIntroduction INTRODUCTIO: rom ts origins as an a-on for Building Information Moding in Revit, Dynamo has matured to become many things. Above all ‘eset a platform, enabling designers to explore vtul programming, solve problems, nd make thei wn tol, Let's tet our journey with Dynamo by setting some context - what st and how do T approach sing?What is Visual Programming? ‘What is Visual Programming? Designing teguenty involves establishing visual, system, or grometic relationships between the pats ofa desig More ines ‘than no, these relationships are developed by workflows that gets ws from conept to result by way of rules. Peeps without knowingit, we are working algorithmically - defining a step-by-step set of actions tha follow abasic loge of input, processing and output Programming allows us to conti to work this way but by formalzing our algorithms. Algorithms in Hand ‘While offering some power apporuniies, the term Algorithm ca carry some misconceptions witht. Alriths can generate ‘unexpected, wild, oF cool things, but they ate not mug. In ft, they ate petty plan, in and of themselves. Lets use a tangle ‘rample ke an origami crane. Westar with a square pice of paper (input, follow a seis of folding steps (processing actions), snd result in aera Coutpt). So whereis the Algorithm? tis the abstract set of steps, which we can represent ina couple of ways ~ ier teatualy oF aphically ‘Textual Instructions 1. Start with square piece of paper, coloured side up. Fold in half nd open. Tea olin half the other way. 2. Tum the pape aver tothe whit sid, Fold the paper in al, crease well and open, an then fod again nthe ote dacston. Using the creases you have mae, Bringthe top 3 comers ofthe model down tothe bottom comer Flatten model Fold top triangulr flaps int the enter and unfold, Fold top of model downwards, ccase well and unfold Open the uppermost flap ofthe model. bringing upwards and pressing theses ofthe model inwards at the same tine Flatten dows, ceasing wall, 7. Tum mods over and epeat Steps 46 onthe oer side 8. Fold top Naps into the center 9. Repeat on ater side 10. Fold both "legs" of model up, cease very well then unfold 1 Inside Reverse Fold the “legs longthe reses you just made, 12 Inside Reverse Fold one sdeto make ahead, then fold dove the wines 13. Younow havea crane Graphical InstructionProgramming Defined Using ether ofthese sets of instructions should result in a zane, andi you flowed along yourself, you've applied an lth. “The only diference ie the way in which we rtd the formalization ofthat ec of instractions and that eas us to Programming. Programming quently shortened from Computer Programming, isthe act of foalizingthe processing oF series of actions ingoan exceutable progam. If we tumed the dove instructions fora creating crane nt a fnmat our compuce an ead and ‘rose, we are Programming, ‘The key to and fst hurdle we wil ind in Progamming i that we have to ely on some form of abstraction to communicate effectively with our computer That takes the form of ny number of Programming Languages, such as Javasript, Python, ot . IF "we ean write out arepeatzble set of instructions, Ike forthe organi cans, we oly need o translate it forte computer. We are on ‘our way to having the computer be abe to make a crane or even a multitude of differnt cranes where cach one vais sigly. This isthe power of Programing the computer will patel ewsute whatever atk, set of tasks, we asp tot, without dey and without human ero, Visual Programming Defined Download the example fle that accompanies this exercise (Right click and "Save Link As..") Visual Progamming - Circle “Lhroush Poin dy, A fl st of eample files ean be found in the Append you wer tasked with writinginstractions for folding an organ crane, how woul you gy about? Would you make them with tpaphics, tex, or some combination ofthe wo? your answer contained graphics, then Visual Programming is deftly for you. The process i essentially the same fr both Programmingand Visual Progamming They vtize the same framework of formalization; however, we define the instructions and relatioaships of our program through a praphical (or "Visual user interface Instead of typingxt bound by sy, we connect pre-packaged nodes together. Here's a comparison of te same arithm - “daw acl through a point - programmed with nodes eu ode Visual Program:“Textual Program: nyPoint = Point ByCoordsnates (0.0,0.0,0.007 x= 5.8 you. Attractoreoine ~ Point ByCoordinates (x,y, 0.017 dist myPoint Digsancers (ateractorPaint} 7 nyCirele ~ Circle. ByCenterPointRadiue (nyPoint, dist) ; ‘The results of our algorithm: ‘The visual characteristic to programming in such away lowers the barrier to entry and fequetly speaks to designers. Dynamo {als nthe Visual Progamming paradign, but as we willse ltr, we can sill use txtvalprograramingin the apphction as wellWhat is Dynamo? ‘What is Dynamo? Dynamo i, quite tery, what you make it. Woking with Dynamo may inelude using the application, ithe in connection with “other Autodesk software o ot, engaging Visual Progamming proces, or participating in broad community of wers and ‘contributors ‘The Application Dynamo, the sppisation, i software that can be downloaded and run in iter stand-alone “Sandbox mode ora «plugin for other software lke Revit of Maya. It is described a: A visual progmming oo! that aims tobe acessibeto both non-progammers and programmers alike I ives users the shility to visually script behavior, define ustom pieces of lg, nd expt using various textual programming ngs. B Dynamo eg Opon source graphical programming for design 1, See Dynamo in aeton with Revit 2, Download tho installer ‘The Process ‘Once we've install the application, Byramo wil enable ws to work within a Vial Progamming process whervin we connect
Dynamo > Dynamo. This will open the stand-alone version and present Dyna’ Sart Page Oa this page, we se he standard menu and toolbar a well a a collection of shorteuts tht allow usto acess file functionality or access additional esouess. Files - Start new fle or pen an existing one ‘Recent -Seoll trough your recent les Samples - Check ou the examples that come with te installation ‘Ask - Get direct sees to the User Forum or Dynamo Website Reference - Go futher with addtional Iering resources6. Coe - Participate inthe open-source development project, ‘Open the ist sample fie o open your fist workspace and conim Dynamo is working correct. Click Samples > Bases > Basics_ Basic ayn, 1, Confirm thatthe Execution Ba says “Automatic” or lick Run 2, Follow th instructions and connect the Number Node tothe + Node 3. Confer that this Watch Node shows a result his file succesflly loads, you shold be able to execute your First visual program with Dynamo,he User Interface The Dynamo User Interface The User ntrface (UN for Dynamo is onized int five main regions, the lest of which is the workspace where we compose ‘our visual progam ip - 2 3 4 t Mens Toober 1 2 3. Library 4 Workepace 5. Execution Bar La’ dive deeper int the UL and explore the functionality ofeach region. Menus The Dropdown Menus sara place to find some ofthe basi finetonaty of the Dynamo application Like most Windows software, actions relited to managing ils and operations for selection ani content eting are found in the fst two menus. The remaining mens ae more specif to Dynamo,1 2 s 6 ‘Toolbar File it View Pockages Setings Hep Dynamos Toolbar contains a series of buttons for quick acess to working with files as wellas Undo (Ctel~ 2] and Redo (Cel + ‘Y| commands. On the fr ight another button that will export astapsbot of the workspace, which is exremelyusefl for documentation and sharing 1 1. Now=Cresteanew yn file ‘Open - Open an existing. dyn (workspace) or dy (eustom node) ileSuve'Swe As - Save your active dyn or dy fle Undo - Undo your lst action Redo - Redo the next action 6. Export Workspace as Image - Expo the visible workspace as PNG le ‘Te Library contains al of the loaded Nodes, insluing she default Nodes thet come with the installation as wellas any akonally loaded Custom Nodes or Packages. The Nodes inte Ltray ae organized hierarchically within rai, eaegoie, and, where appropriate, sub~atoories based on whether the Nodes Create daa, exceute a Action, or Query dats, By deta, the Library will contain ight capris of Nodes. Core and Geometry are great menus to ben exploring they ‘contain the ares quantity of Nodes, Browsing though these eateries the fistest way to understand the bierrchy of what we «an add to our Workspace andthe best way fo discover new Nodes you have used before. ‘We wil focus on the default collection of Nodes now, but note that we willexend this Libary with Custom Nodes, tional bras, ad the Package Manager ter, Analyze Built-in Functions Core 1 4. Geometry 5. Migation 6. Offs 7. Operators Browse the Library by icing through the menus, Click the Geometry > Cirle, Note the new portion of the men tha srvenod and specially the Create and Query Labels1. Liary 2. Category 3, Shearer: CretelActionsiQuery 4. Node 5. Node Description and propertics - this appears when hovering over the node ion From the sume Cirle men, hover your mouse over ByCenterPoint Radius, The window reveals more detailed information sbout ‘the Node beyond its name and con. Thi offers usa quick way to understand what the Node docs, what it wil equi for ips, and what it wll gveas an output 1. Description plan language description ofthe Node 2. Toon = lars version of he con inthe Libriy Mens43, Inputs) - name, datatype, and data structure 4. Output(s)- data rypeand structure you know with relative specifcty which Node yon want to ald to your Workspace, the Seareh Fld is your bestfriend. Whe ‘you arent editing settings or specifying vals in the Workspace, the cursors alway’ prseat inthis Feld. IFyou sar typing, ‘the Dynamo Library wil evel a selected best fit match (with breadcrumbs for where it canbe foun in the Node ctepries) anda Ts of aerate matches to the seach, When you hit Enter, oclck onthe tem nthe tuncaed browse, the highlighted Nodes add tothe center ofthe Workspace, 1, Seach Fit 2. Best Fit Result /Selsted 3, Alternate Matches Settings ‘From gsomstrs to user settings, thee options canbe found inthe Settings menu Here you can opt in o ut for sharing your use dala improve Dynamo a well as dain he application's dein point precision snd womzy reader gut, Note: Remamber that Dyna units se geri‘Enabling Reporting - Options for sharing user data to improve Dynamo, [Number Format Options - Chang: the document settings for dei Render Precision - Raise or lower the document render quality, ‘StowiHide Geometry Eéges~ Toggle 3D geomeity eis. ‘Stowide Preview Bubbles ~ Tog data previw bubbles below nodes, Manige Node and Package Paths - Manage fle paths to make nodes and packages show up in the Libary. Enabling Experimental Features -Use beta features new in Dynamo, Help youte stuck, check ou the Help Men Here you ean find the sample file that come with your installation ss wells access ‘one ofthe Dynamo erence websites though your internet browscr Ifyou need t, check the version of Dynamo installed and ‘whether it sup to dat trough the About option,1 2 3 4 S 6 7 Gein Stated - A brie introduction to using Dyna, ‘Samples - Reference example fils, Report A Bug Open an Issue on GitHub Go To Project Website - View the Dynsmno Projet on Gite Go To Project Wiki - Visit the wiki for learing about development using the Dynamo API, supporting ibrarics and tools Display Start Page - Return othe Dynamo start page when within a document About - Dynamo Vssion dataThe Workspace The Workspace The Dynamo Workspace i where we develop our visual programs, but i’ lo where we preview any resulting geometry. Whether we are working in a Home Workspace or Custom Node, we can navigate with our mouse or the buttons at top right “Togling between modes at bottom ight switches which preview we navigate Note: Nodes and prometry ave a daw order so you may have objects rendered ontop of each other This canbe confusing hen adding multiple nodes in sequence as they may be rendered inthe sme positon in the Workspace. Proview Mode 1 2. ZoonwPan Buttons 44 Double Cckingon the Workspace Tabs ‘The active Workspace ta allows you to navige and eit your progam, When you open a new fil, by default you are opening ‘new Home Workspace You may alo open «new Custom Node Workspace fom the File Menor by the New Node by Selection Fh eek option whes Nodes are suected (mote con this funtionaiy ater)Note: You may have only one Home Workspace open ttn; however, you may have miple Custom Node Workspaces open in additional tabs Graph versus 3D Preview Navigation lm Dyname, the Graph and the 3D results ofthe Graph (if we ae creating geometry) ae both rendered inthe Workspace. By default he Graph is the active preview, so using the Navigation buttons or middle ous button to pan and zoom will move us trough the Graph, Topaing between active previews can be achieve thee ways 1, Preview Toggle Buttons inthe Workspace 2. Right clicking in the Workspace and sletng Switch. Yew 3. Keyboard shortcut (Ctel+B)‘The 3D Preview Navigation mode also gives us the ability for Dreet Manipulation of poiss, cempifed in Getting State, ‘Zoom to Recenter We cn emily pan, zoom and rolaefresy sound models in 3D Preview Navigation mode, However, to zoom specie onan object erated bya gometry node, we can use the Zoom All icon wih single nade slete, Soa 1, Selst the node corresponding the geometry that will center the view 2, Switch tothe 3D Preview Navigation 1, Cleon the Zoom Allison inthe top right 2. The selected geometry wil be centered inside the view,Hello Mouse! Based on which Preview modes ative, your mouse buttons will ct iffrenty. In sea, the lf mouse lick tele and specifies inputs, the right mouse cick gives acess to options, andthe mle mouse cick allows you to navigate the Workspace ‘The ight mouse cick wll present us with options based on the context of where we are clicking 1. Right Click onthe Workspace 2. Right Click on a Node, 3. Right Click on a Note Heres a table of mouse interactions per Preview Mouse Action Graph Preview Left Click Select Nin Righ Click Conte Mens Zoom Options Middle Click Pan Pan Scroll ZoominOut Zoom iniout Double Cisk Create Cade Block NIA In-Canvas Search Using the "n-Canvas Search" willadd some serious speed to your Dynamo work-flow by providing you acess to node {descriptions and tooltips without taking you away from your place onthe yap By just ighticking, you ean asus all che the "Library Search” fom wherever you happea to be working on the canvas. ‘sof fctionalty1. Right lk anywhere onthe canvas co ring up the serch fete. While the ssarch bars empty, the drop-down will beapreview men 2, Asyoutypeiint the search br the drop-down menu willontinuously update to show the most relevant search results. 3. Hover over the search results 1o bring up their corresponding scriptions and tooltips. Clean Up Node Layout Keeping your Dynamo canvas oraized becomes increasingly importa! as your les buildin comp ey. Although we ave the ‘Align Selection too to work wit small amounts of seseted Nodes, yam also Features the Cleanup Node Layout tol to help with oveal ile leanup. Before Node Cleanup 1, Selet the Nodes tobe automatically orpnized, or lave all unselected to cleanup all nodes inthe fle 2 Tho Clamp Node Layout featur is located under the Fait ta. After Node Cleanup,sligning them with neighboring node.Getting Started GETTING STARTED Now tat we have fined ourselves withthe ints ly ot and navigating the Workspace, our next sep ito understand the typical workfow for developing a gaph in Dynamo. La’ gst started by ratinga dynamically sized cite and then create an aay of eles with varying rads, Defining Objectives and Relationships Before we add anythingto the Dynamo Workspace itis key tht we havea solid understanding of what we ating to achieve and what the siguifcat relationships will be. Remember tat anytime we are connstiag two Nodes, we re creating an explicit Tink between them- we may chang the flow of da ltr, bul once eonected weve commited to that relationship. In this exercise ‘we want to create a cle (Objective) where the ads inputs defined by a distance toa neat point (Relationship PS, ‘oO. Pt Length (0) ¢ Radius (7) A point that defines a distance-based relationship ie commonly refed to as an “Attractor” Here the distance o our Atractor Point willbe use fo specify how big our etl shoud be Adding Nodes to the Workspace [Now that we have our Objectives and Relationships sketched we can begin creating our gaph, Wenneed the Nodes that wil represent the sequence of actions Dynamo will exovute, Since we know we are tryigto create # Gc, ls stat by lating "Node tat does so. Using the Search field or browsing through he Library, we wil ind that there more than one way to eee cael1, Browse to Gcomtry > Circle > Clrele.ByPolntRadius 2. Search» "Cale by Point Lt’ add the Circle ByPointRadius Node to the Workspace by clcking‘on i inthe Library - tis shoul add the Node to the ‘enter ofthe Workspace, Gia Cena 1. The Cte ByPointandRadius Node inthe Libary 2. Clicking the Node inthe Library ads ir the Workspace‘We also wil nod Point ByCoordinates, Number Input, and Number Slider Nodes, 1, Geometry > Point > Point.yCoordinates 2. Geometry > Geometry > 5. Core Input Number 44 Core> Input > Number Slider istance'To Connecting Nodes with Wi Now that weave few Nodes, we need to connect the Ports ofthe Nodes with Wires, Thee connections will define the Now of ae,[Number to Point.yCoordinates [Number Sliders to Point.llyCoordinates Point.ByCoordinates (2) to Distance Polat ByCoordinates and DistanceTo to Circle.ByCenterPolntRadlus Executing the Program ‘With our Program Flow defined all we need to dois tell Dynamo to execute it, Once our program is exeate (ther Automatically ‘or when we cick Ru in Manual Mos, data wll passthrough she Wites, and we should se the rsults in tho 8d Preview. 1, (Click Rus - ithe Execution Baris in Manual Mode, we neato Click Ru to exzete the graph 2. Node Preview - Hovering your mouseover the box onthe lower right corner of « Node wll give you a pop-up ofthe resus 43, 3D Preview - [fay of our Nodes eretepeometey, we wil ee it inthe 3D Proview, ‘Adding Detail our program is working we should oe a cic the 3D Preview that i passing through ur Attracoe Point. This sect, but we may want to add more detail or more contol, Lat’ adjust the input the ele Node o that we ean ealibrat the fftenee on ‘thovadius, Add another Number Slider to the Workspace, then double lick ona blank atea ofthe Workspace to adda Code Block Node. Et the i inthe Code Bloc, specifying.1. Code Boeke 2, DistanceTo and Number Slider to Code Block 4. Code Block to Cirele.ByCenterPointRadius ‘Adding complexity Sting simple and building complet isan effetve way to incrementally develop our progam. Once itis working for one ‘eel, e's apply the power of the progam to moe than one cl. Instead of one centerpoint, if we used of points and azcommmodate the chang inthe resulting data structure, ou progam will now
Cross Reference 2, Adda Fiatton Node after Point. By Coordinates 53. The 3D Preview willupdate with gd of ccos Adjusting with Direct Manipulation Sometimes numerical manipulation isnt the right approach. Now you can manvaly push and pll Point geometry wisn avigting inthe background 3D preview, We ean alo control other gsometry tat was constructed by post. For earple, Sphere.ByCenterPointRadius is capable of Dict Manipulation as wel, We ea contol the location of pit fom au 1X, Yand Z values with Point ByCoordinates. Wit the Dect Manipulation approach, however, you are able o update the ‘values ofthe sides by manvally moving the point inthe 3D Preview Navigation mode, Tie offers a moe intuitive spprosch to controling set of dierete values that Wen a point’ Wcstion, = =a =m te =m] S\ = = ; 1, To use Direot Manipolation, sec the panel of the point to be moved — eros will appesr over the point selsted 2, Switch to 3D Presiew Navigation made,1. Hover overthe point and the X,Y, and Z 28 will appear ick and dagthe colored arrow to move the corespording axis, andthe Number Slider values will update Live swith the manually moved point. 1. Note tht before Direct Manipulation only one slider was pha into the Point ByCoordinates component ‘When we manually move the pat ia the X-diestion, Dynamo will axtomaticlly verte anew Number Slider fr the X inpThe Anatomy of a Visual Program ANATOMY OF A VISUAL PROGRAM Dynamo enables ws to create Val Programs in a Workspace by connesting Nodes with Wires to spesily the logical flow ofthe ‘resulting Visual Progam, This chapter iniodess the elements of Visual Programs, the organization of the Nodes availble in Dyas Libraries, the parts and stats of Nodes, and best practices for your Workspaces,Nodes Nodes In Dynamo, Nodes ae the objets you connect to form a Visual Progam. Bach Node performs an operation = sometimes that may ‘be as simpleas stringa number ort may bea more complex action suchas creating or querying geometry. Anatomy of a Node Most Nodes in Dynamo are composed of five pars, While there are exceptions, such a Inpt Nod, the anatomy ofeach Nee ‘an be dseribed a follows 4 Point.ByCoordinates Use Default Value AW ‘Name The Name of the Node with a Category Name naming convention “Main - The main body ofthe Node-Righ-lckinghere presents options at the level ofthe whole Node 3, Ports (In and Out) ~The ecetors far Wires that supply the input data to che Node as wellas the ess ofthe Node’ action 4, Lacingfoon- Indicates the Lacing option specified fr matching it inputs (more on that ate) 5, Default Vlue~ Rightoisk onan input Port - some Nodes have default values that can be used or not used Ports ‘The Inputs and Outputs for Noes ar cil Ports and ata the receptors for Wires, Data comes nto the Node through Ponts om the left and flows out ofthe Node after it has execte ts option onthe ight. Port empct to recive daa ofa crtain type. For instance, connectinga umber suchas 2.750 the Ports ona Point By Coordinates Node will successfully resut in creating Point; however, if we supply "Red to the same Por it wil result in an err Tip: Hover over Port to see tooktp coataningthe datatype expectedPoint.ByCoordinates 1. Poet Label 2. ToolTip 3. Data Type 4. Defat Vlue States Dynamo gives an indication ofthe state ofthe excction of your Visual Progam by rendering Nodes with diferent color schemes ‘based on each Nodes status, Furthermore, hovering or ight-cicking over the Name or Ports presents atonal information and ‘options 1. Active - Nodes with a Dak Grey Name backyzound are well-connected and havea of thet inputs suecessfully connected 2, Inactive - Grey Nodes ar native and need to be connested with Wires to be pat ofthe Program Flow in the active Workspace not State- Red indicates that the Node is nan Fro State Freeze A Transparent node as Frezs turned on, suspending the execution ofthe node Selected -Curently selected Nodes have and Aqua highlight on thei border ‘Warning Yelow Nodes ain an Waring state, meaning they may have incorect datatypes7. Background Preview -Dark Grey indictes thatthe gometry preview is ted off ‘your Visual Progam contsins waming or errs, Dynamo will provide tional information about the problem, Any Node that is Yllow will aso have tooltip above the Name, Hover your mouseover the tooltip to expand ‘Tip: With this took information in hand, canine the upstream Nodes to sei the datatype or dt iactre required is in 1. Waning Tootp - Null” o no data cannot be understood asa Double ie a mumber 2, Usethe Watch Node o exmine the ip data 4, Upstream the Number Node i storing "Red nota numberWires Wires Wires connect between Nodes to crete relationships and establish the Flow of ou Visual Program, We ean think of them iterally social wires that cary pulses of data from one object tothe neat. Program Flow Wires connes the output Port from one Node tothe input Por of another Node This detionality establishes the low of Data in the Visual Progam. Although we en antange our Nodes however we dese in the Workspace, because the output Pots ae located onthe sight side of Nodes andthe input Ports are on the lef side, we can generally say thatthe Program Flow moves from Tet to ret Creating Wires We erate a Wie hy lel clicking our mouse on Port andthe let clicking on the port of another Nod to crete a connection Wile we arin the process of making aconactio, the Wite wil appear dashed and will nap to become sold ines when suocesflly connected, The data wll vay low through this Wie from output to input; however, we may erate the wie in ‘ther direction in terms ofthe sequence of eicking on the connected Ports. Tip: Before completingthe eomnetion with your second click, allow the Wire snap ta Por and hover your mouse thereto sc the Prt toot.1. Click onthe se output Por of the Number Sequence Node 2. As you ae moving your mouse towards another Port the Wires dashed 3, Click on they inpt Port ofthe Point By Coordiantes to complete the connetion Editing Wires roquntly we will want oadst the Program Flow in or Vewl Program by eding the connections represented by the Wise. To eit a Wr, et click on the ip Port ofthe Node thai heady connected, You now have two options 1, sisting Wire 2. To change the conection oan input Post, left click on anther input Port 3. Toremove the Wir, pullthe Wire away and lft tick onthe Workspace Wire PreviewsBy deta, our Wies willbe previewed with a gay stoke. When a Nodes slote, it will render any connecting Wire with the sume agua highlight asthe Node 1, Defaut Wire 2. Highlighted Wie Byaam alo allows us to customize how our Wis lookin the Workspace through the View > Connectors Menu, Here we ean toggle between Curve or Poly ine Wires of tum thes ofall oper. [aap > pasar Ca1, Connestor Type: Curves 2. Connector Type: PolylinsLibrary Dynamo Library The Dynane Library contains the Nodes we add to the Workspace to deine ual Programs fr exeeution, Inthe Library, we en scatch fr or browse to Nodes. The Nodes contained her the basic Nodes installed, Custom Nodss we define, and Nodes fom ‘the Pakage Manage that we add to Dynamo - ae onganizoed hirachialy by category. Let's review this organization and explore the key Nodes we will ute frequent Library of Libraries ‘The Dynamo Library that we interface with in the application is actually a cllsction of fnctonal ibrar, ach contining Nodst ‘rouped by Catepry, While this may seam obtseat fist, a eb rsmework for organizing Nodes that come wih the
Create Note 2, Usethe keyboard shorteut Cut+W ‘Once the Notes aed tothe Workspece ate: field will pop up sllowingus to et the tex inthe Note, After they are tate, ween eit the Note by double-ticking or right-clicking the Note Node ~ a Grouping, ‘When our Visual Program gs big its helpful to identify the arr steps tat will be executed. We can highlight args coletons| ‘of Nodes with & Group to label them wit colored rectangle the background and a ite. Therese three ways to make a Group with more than one Node selected1, Browse tothe menu File> Create Group 2. Usethe keyboard shorteut Cui+G 3, Right-lck on the Workspace ad select "Create Group" ‘Once a Group is rated we can eit is seftings, such tthe tite ad color, Tip: Using both Notes and Groups isan effective way to amstate your file and increase readability Here’ our progam from Section 2.4 with Notes and Groups add:Note: "Gig Poins" Group: "Create Grd of Points" Group: "Create an Attractor Point” Note "Caltbvate Distance Velus” Note: Neible Grid of Clas" 1 2 3 4 s. 6Managing Your Data with Presets Managing Your Data with Presets In the previous section we looked at managing proyrams by slgning grouping and annotating nods to oryaize the Workspace ‘These best practices help to reduce some of the visual complexity of your gph. Now let's dive deeper and organize the
Presets mana, Preses an be ued to create and compare design seratons, Pretls ae saved with the ‘le, making them a useful too! fr sharing or requesting Feeback. They ak allow anther user to iterae: with the raph without Ihavingto search forthe relevant inputs, or tne a et of valu that work well togsther fom a desi peepectvs, 1, Preset 2. Preset? Creating Presets Download the example le that accompanies this eecse (Right cick and "Save Link AS.) Puestsdy, A fl ist of ample files canbe found inthe Appendix. “Tocreate a preset, slect one or more input nodes. Right-click the canvas and lest "Crete Prost fm Sletion" or press (Control Lets take a ook at an example Below is a simple raph tha crates a surface by lofing through a sves of cls.1. The inputs ofthe wap area series of sliders controlling the eight and rai Sole the input sliders and type ContrTtera mame and description forthe saved statin the dialog Create several states with different input values, Restoring Presets ‘Torestore saved preset, navigate to Eai>Presets>Restore Preset. This will st ll the nodes in that tte to the saved values, Ifa ‘ode inthe statis no longer present in the graph jit has bees deleted), al ther nodes in the state wil beset. Deleting Presets To delet a preset, nivigte 1 Fat>Prevets>Delet Preset, Thi will remove stat from the ist of saved sates—— He a7 —e aeThe Building Blocks of Programs THE BUILDING BLOCKS OF PROGRAMS ‘Once we are ready to dive deper into developing Visual Progams, we willed a deeper understanding of the building blocks we ‘will se. This chapter intodes Fundamental concep round data the stfT Ut travel rough the Wins of our Dynamo="Data Data Data's the stutf of our programs, It travels though Wires, supplviginputs for Nodes wher it es processed into anew form of ‘output data Let's evow the definition of data, how it’ structured, and begin using it in Dynamo, ‘What is Data? Data is se of values of qualitative or quantitative variables The simplest form of datas numbers such 80, 3-14, oF 27. But ara can als be ofa numberof different types: variable representing changing numbers (heh); characters (nya); ‘omer (Cixo12);ora list of data items (1, 2, 3,5, 8,13 --.). Weneed data to ad to the input Ports of Dyname's Nodes - ‘we can have data without actions but we need dat to procs the actions that our Nodes represent. When we've added a Node to the Workspace, ft doesn't have any inputs supplicd the result will bea function, not she result ofthe ation isl 1, Simple Ds 2, Daaand Acton (A Node) successflly ccutes 3. Action (A Node) without Data Inputs returns apneic function Beware of Nulls ‘The ‘nu! * type epresents the absence of dat. While his isan abstract concept, you wil ksly come aross this while working ‘with Visual Progamming If ation does creat vabd reel, the Node will tur aml, Testing for nulls and removing lls ftom data structure is crucial par to eatingrobus programs, Icon Name/Syntax Inputs Outputs @ Object.Nall 0b} boo! Data Structures When we are Visual Progamming we can very quickly generate ot of data and require means of managing its hierarchy. This is the ole of Data Sistas, the ornizationl schemes in which we store data, The speifis of Daa Srvetures and how to se‘them vary from programming language to programing language. In Dynamo, we ad hierarchy to our data through Lists. We wil ‘explore this in depth in later chapters, but le’ start simply Ait represents a colton of items place ito one structure of dat: ‘+ Uhave five fingers (ems) oa my hand (i). ‘© Thore ate ton houses (tems) on my set (li AHEEECONG ANAT i * 1, ANumber Sequence node defines sist of numbers by using start, amount, ti step input, With these nades, weve created to separate lists often numbers, one which rang rom 100-109 and another which anges from 0-9. 2 The List.GetltemAttndex node selects an item ina ist ata specific index When choosing, weg the fs iter in he st (200 in this ease). '. Applvingthe same process tothe second ist, we ge a value of 0, the fst tem inthe st 44. Now wemeng the two lst nto one by using the ListCreate nods. Notie tit the node crests it fs, This ‘anges the structure ofthe data, 5. When using ist. GetltemAtindex agin, with index set 0, weg the fst list in the ist of lists. This i what means to tet ais as a item, whichis somewhat diferent from other scripting langiags. We will pt more ‘vanced with it manipulation and data structure in ater chapters ‘The key concept to understand abou data hierarchy in Dynamo: with respect to data structure, lists are regarded a8 items. In ‘other words, Dynamo functions witha top-down process for understanding data structures. What does ths mean? Let's walk through it with an empl Using Data to Make a Chain of Cylinders Download the example Sle that accompanies this exercise (Right click and "Save Link As.."): Bulding Blocks of Progans ‘Datadys. A full list of example files can be found in the Appendix In this frat example, ve assemble shee eyliner which walks through the gometry hirarchy’ discussed in this section1, Polnt.ByCoordinates- aftr adding the node to canvas, we sea point atthe origin ofthe Dynamo preview gid The default values of they, and inputs are 0, giving usa pein at this location, 1, Plane.ByOriginNormal - The net scp inthe goomeiry hierarchy isa ple. Tete ae several ways to construct a plane, and we sre usngan org and norma forthe input The orga the point node created in the previous step. 2, VeetorZAsle this is a nitized vector inthe z diction. Notice there re nat inputs, only a vstr of [0,0] va ‘Weuse this asthe normal input forthe Plane ByOriginNormal node. This gives us a ectangular plane inthe Dysamo preview:1. ClreleByPlaneRas - Stepping up the hierarchy, we now crate a euve fom the plane is ou previous ep After phuggnginto the nods, we gta cceat the erga. The default radus on the node is vale of J 1. Curve.Extrude - Now we make his thing pop by giving some depth and gongin the thd dimension. This node creates a surfice om a curve by exuding. The def distance onthe nodes, and we should see a cyliner in the viewport1. Surface-Thicken ~ This node gives us a closed soli by ofeting the surface a given distance and closing the form. The default thickness value is and we soe shelled cylinder inthe viewpor inline wit These values. eer 1, Namber Slider - Rather than using the defasht vas frail these inp, ls al some parametric control to the model 2. Domain Wait after adding the number slider tothe canvas, lick the caret inthe tp let to reveal the domain options 3, Min/Max tep- change the min, max, and step vals to 02, and 01 respectively, We are doing histo control the sizeof the overall gomety1. Number Sliders nal ofthe def inputs, let's copy and pase tis number sider (eet the der, hitCrk+C, then Cis}-V) several times, until ofthe inputs with defelts havea sider instead. Some ofthe slider values will have tobe ler than zero tog the definition to work Ge: you need an exrsion depth inorder to havea surface to thicken). ‘Weve now created a parametric she cylinder with these sides. Ty to flex some ofthese parameters and se the oometry update dyzamically in the Dynamo viewport. 1, Number Siders -takngthis step further, we've adda tof sider othe canvas, and nod to clean up the ted, Right click on one sider, select "Revame.," and change each slide tothe sppropriate name for its parame. You cn erence the image above for nas. ierface ofthe tool we ustAt tis point, weve created an awesome thickening cylinder thing This i one object rently, lt’ look at how to erate an aay ‘of cylinders that remains dynamically inked. To do this, were going to creat alist of eylndrs, rather than working with single 1. Addition (#)- Our goat ad row ofeyinders next 10 the ey inde we've erate, If we want to ad one eine sjcent tothe curtent one, we need to conser both radius of the cylinder and the thickness ofits shel We gst this umber by adngthe two values ofthe sides. This step is more invoved so e's walk throught slowly: the end gol to create ast of mumbers which define the locations ofeach einer in row 1, Multiplication - First, we want to multiply the value fom the previous step by 2, The vate fom the previous stoprepresents radius, and we want to move the elindr the ull ameter 2, Number Sequence - we crete an aray of numbers with thie node, The Fist ip the multiplication node fom the prevaus step into the step vale. The start vale can be st to 2.0 using a mumber node 3, Integer Slider -For the amount vals, we comet an intepe side. This wil define how many cylinders ar crate, 4. Output This ist shows us the distance moved foreach eylinder inthe aay and is parametrally driven by the ign slides 1. This step is simple enough -phugthe sequence defined in the previous step int the input ofthe orginal Point ByCoordinates. This wll replace the sider poln which we can delete, We now see an ary of eyindes inthe viewport (make sue the integer slider is ager than ‘The cain of elinders is still dynamically linked to al of the sider. Flex each sider to watch the def ston update!he simplest form of data is numbers, the easiest way to relate those numbers s through Mathematics. From simple operators lke divide to crigonometie functions, to more complex formulas, Math sa great way to start exploring numeric relationships and patter, Arithmetic Operators ‘Operators area set of components tha use alisha functions with wo numeri input vale, which result in one output vale {eddition, subtraction, multiplication, division, et). These canbe found under Operators>Actios. eon Name Syntax Inputs Outputs Ags + val) v(t) var Subtrost var}, vat] var. Maniply * var] val] val Divide / var). varf(] var). beoe Parametric Formula Download the cumple fle that accompanies this excise (Right click and "Seve Link As..") Bulding Bloks of Programs ‘Mathaivn. fl ist of eample files can be found in the Appendix. From Operators, the next logical step i 1o eombine operators and vcabes vo frm a more complex ratonship trough Formulas, Let's make a Formula that canbe controled by input parmetes, leslie,1. Number Sequence: define anumber sequenes based on tice inputs: sar, amount and step. This sequence "presents the in the parametric equation, so We want to use alist tha’ large enough to define @ pial The step above as erated ast of numbers to define the parametric domain, The olden spilt defined a the equation: rroos 0 = acos Ge ana y-rsinO= asin De®. The group of Nodes below represent this uation in vtual programming form ‘When steppingthrough the roup of Nodes, try to pay attention to the paral bewoen the visual progam and written squation 1, Namber Slider: Ad two number stiders to the canvas, These lies wil represen the and the b vals of the parametric equation. These represen a constant which i flexble ot parameters which we can adjust towards &Assit outcome, 2. *: Themukiplcation Node is represented by an asterisk. Wel use tis repeatedly to connect mokiplying variables 43, Math.RadiansToDegrees: The vales need tobe translated to dees fr thei evaluation inthe trigonometric functions, Remember, Dynan defaats to dees for evaluating there functions 44, Math.Pow: as function ofthe and the number this rete the Fibonacci suns 5, Math.Cos and Math.Sin: These to trignnmetricfnetons wil dilfrentat the x-nordnate an the y-coordinae, respectively, af each parame point. 6. Waten: Wenow se that our ouput is two lists, thes willbe the randy coonlingtes ofthe points used to generate he spiral From Formula to Geometry "Now, the bulk of Nodes ffom the previous step will work fin, bu it is lot of Work. To erate amore ecient workiow, havea look at Code Block (section 3.3.2.3 o define a string of Dynamo expressions into one nod. In this net series of steps, wel Took et using the parantrc equation to draw th Fbonace pial 1. Polat ByCoorainates: Connect the upper multiplication node into the input andthe lower ato the Yip. We now See a parametric spiral of points onthe sren.1, Polycurve.ByPolats: Connect Pointy Coordinates fom the previous step int points, We can Ive connecthastToFirst withoat an input because we arent making closed curve, This crete spital which passes ‘vou each pot defined in the previous step ‘Weve now completed the Fibonact Spi! Let's take sis further into two separate excises from hee, which wel ll the [Nauti and the Sunflower. These ae abstractions of natural systems, but thetwo different applications ofthe Fbonacs spiral will be well epreseated From Spiral to 1. As jumping of point, let's start with the same step fom the previous excise: creating spite aray of pots ‘with the Point ByCoordinates Node,Polycurve.RyPointe: Agi, this isthe Nods from the pervious exercise, which WeTl se Circte.ByCenterPointRadius: Well use a cle Node herewith the sre inputs as the previous step. The adios ‘vale defalsto 70,30 we see a mediate output of cites. I beomes immediately Ibe how the points diverge futher from the orig 1. ClreleByCenterPointRadius: To ecate amore dynamic aay of les, we plug the orginal number sequence (tbe * sequence) ito the rds vale 2, Number Sequence: This is the orignal ara of By phgngtis into the radius vale, the ele enters asi diverging further from the origin, but the radius of the cil i incresing, creating a funky Fibonacci raph, Bonus points ifyou make it 3D! From Nautilus to Phyllotaxis Pattern[Now that we've made a cicular Nats shel lets amp into paranctie pds. Wee ping to use a base rotate on the Fibonacci Spiral to create Fibonacci gid, and the result modeled after the gwuth of sunflower sis, 1. Agin, 2s a jumping-off point, k's start withthe same step from the previous exis: creating spiral aray of points with the Paimt.ByCoordinates Node 1, Geometry Rota ‘Thar re several Gometty Rotate options; be xan youve chosen the Node with _geometty basePlane, apd degrees as its inputs. Connect Point ByCoordinates ito the geometry inpu Plane.X¥: Consett the basePlane put, We will tte around the orig, which the same location a the ase of ‘he spiel [Number Range: For our degre input, we want to teste mule otation. We en do this quickly with a Number Range component. Connes this into the degres input4, Number: And to define the range of numbers, add three number nodes tothe canvas in vertical ord. From tp to bottom, assign values of 0,560.0, and 120.0 respectively. These ae driving the rotation ofthe spiral Notice the ‘output resus from the Number Range ode aftr connectingthe three number node to the Nod ‘Our output it beginning to resemble a whitpool Let's adjust some ofthe Number Range psraneters and sec how the sus change 1, Chang the step sizeof the Number Range nods fom 120.00 360. Notie that this creating more ottions and is therefore giving us a denser gid 1. Change the step size ofthe Number Range node ftom 36.9 to 3.6. This now gives us @ much dense rd, and the lrwtionalay ofthe spirals unclear Ladies and gentlemen, weve ceatd asuniowerLogic Logic slows us to specify an ation o tof actions bated on test. Afr evaluating or more specially, Conditional thetest, we will havea Bookan value eepresen cing "rue of Fave that we can use to contrl the Program Fo Booleans [Namercvarisles an store whale rane of eiffrent numbers. Boolean variables ean only store two vals refered to a8 True or Fake, Yes or No, I or 0. Werately use boolean to perform calculations because of thr ited range Conditional Statements The "statement is. akey concept in programming "Ishii tue, thea tht happens, otherwise something lsc happens. The resuingaetion ofthe statement is driven by a boolean vale, There ae multiple ways to define an "IP statement in Dy name Icon Name Syntax Inputs Outputs i ] Code Block (X'y2) xyz result Let's over brie exmpleon each ofthese three nodes ination using te conditional I sateencoy22); In this image, the boolean is set to ue, which means thatthe result isa string reading "his ithe sul fue". Te tree Nodes eeatngthe sttement are working identically hee to yy Ain, the Nodes are working dntcaly If the Booleans change to fie, our results the number Pas defined in the vigil statement Filtering a List Download the example Se that accompanies his eacse (Right eck and "Save Link As,.") Bulding Blocks of Progam Logic.dvn. A fullist of example fies canbe found inthe Appendix. Let's use loge to separate ast of numbers into alist of even numbers and alist of edd numbersen 1. Number Range - i a number range to the canvas 2. Numbers ald three number nodes tothe eavas, The value foreach number node shoud be: 00 fo start, 10.0 foe end, and 1.0 for tp. 3. Output our output is ast of 11 numbers ranging from 0-10, 4, Modato (%)- Number Range into xan 2.0 nt This clculaes the remains For each number inthe Hist divided by 2. The ouput from this it gives ws list of values aerating between O and I. 5. Equality Test (=) -add an cqulty test tothe canvas. Plug modulo ouput into the input and 0.0 into they input 6, Wateh - The ouput ofthe exuity testi ist of vals lerating between rc an false. These ar the valves used to separate the items in the Ist. 0 (or ue) represents even numbers and (J, ofl) represents odd numbers 17, List.FlterByBoolMask - this Node wil iter the values ito two diferent lists based onthe input boolean. Plgthe ‘orignal number range into the ist input and the equality test** ouput int the mask input The in ouspu represents true values while de out” output rapresents fae vals 8, Wateh~asaresul, wenow havea list of even numbers and separate ists iato patterst is of odd numbers, We've used logical operators to From Logic to Geometry Building off ofthe logic established in the Fost exercise, a's apply this setup into a modeting operation|. Wel junp off fom the previous exercise withthe same Nodes. The only exceptions 2, Weve changed the forma 5. The‘ values have changed 4. Weve unplugged thei it input into List FiterdyBootMask. Wel put these Nodes aside for now, but they come in handy later the exreise. Let's begin by comnectingthe Nodes together as shown inthe image above. Ths roup of Nodes represents a parame uation to define ine curve. A few notes 1. The fest slider should have amin of 1,2 ax of, anda step of 0.0 2. Thesecond slider should havea min oF 0,amaxo I, and astep of 0.0. 3. PolyCurve-ByPoints- ifthe above Node diazams copied, the resus a sine curve inthe Dynamo Previewviewport. ‘The method here forthe inputs: use mumer nodes for more state propetis and number sides onthe more lebe ones. We ‘want to keep the orginal number rang that wee defining the beginning ofthis step. However, the sine curve that we ereate here should have some flexbity, We cn move these sliders to watch the curve update its frequency and amplitude. ‘ere gingto jump around abit in the defiition, sole’ look a the end result 0 that we can reference what we'e ting The fst two steps are made separately, we now wan! to connec the two. Well us the base sine curve to dive the locaton ofthe ipper components and well use the trelase loi to lem betwee itl boss sd ag bos 1, Math.RemapRange - Using the amir sequence esate in step OF, le’ create anew series of numbers byremappiing:be range. The orignal mbes from step 01 rage fom 0-100. These numbers range from 0 to I by the newhtin and newMax inputs respectively 1, Carve.PointAtParameter - Plug Pobcurve ByPoins (Sr step 2) nto curve and Math RemapRange ito param: This step erates points along the curve, We remapped the numbers to 010 1 beease the input of param i looking for values in his ange. A val of 0 represents the star pint, value of 7 represents she end pois. All numbers in between evaliot within the (0.1) rage 1, ListilterBiyoolMask - Plog Curve PoithtParameter from the previons step into the fs inp 2, Wateh - a watch node ford and a watch node for out shows that we have two lists repeseating even indies and odd Indices. These points are ordered in the same way onthe curve, which we demonstrate in the nex step1. Cubold.ByLengths - reteate the connection sea inthe image above to gst a 2ipper alongthe sine curve cuboid {jst a box ere, and were defining its size bated onthe curve pont i the center of hte box The loge ofthe eveniodd divide should now be clea ithe model 1. Number Slider stepping back othe besaning ofthe definition, wean flex the number sider and watch the Zipper update. The top row of images represents a ange values fr the top number slide. This isthe equency of the wave 2, Number Slider he bottom row of images represents a rang of vals forthe otto sider. This isthe amplitude ofthe wave,Strings Strings Formally, a String i a sequence of characters representing itera eostant o some typeof variable, Informally, string is programing lingo for tat. Weve worked with numbers, bath aces and decal numbers, to dive parameters and we can do the same with et Creating Strings Stings can be used for a wide range of applications, inching defining custom parameters, annotating documentation Sts, nd parsing through text-based dat ses. The string Nodes located in the CoreIaput Categsy. The quick brown fox jumped > over the lazy dog KE 5 > SO js ‘The sample Nodes above re strings. A mumber canbe represented a string sean ee, ram ene aay of te. Querying Strings Download the example le that accompanies this excise (Right elick and "Save Link As.."): Buling Blocks of Programs ‘Sinus. A falls of example fies canbe found inthe Appendix. You can parse through lng amounts of data quickly by querying strings. Well talk about some base operations which an speed ‘up a workfiow and help for sofware interoperability ‘The nage below consider striag of data coming rom an external spreadsheut, The string represents the vertices oF acectange in ‘the XV-Plane, Le’ break down some stringspit operation in minature exci:ao Watch separate 1. The" separator splits each vertex of the rectangle. This crests ist with 4 items for each vertex. separate separatert wana 02 1. By Nisin the "+ nthe mide ofthe Node, we ccate new separator 2. Adda” stringto the canvas and plugin tothe new separator input 3. Our rest is now a st often items, The Node fist spits based on separator then base on separator Wii the ist of items above may lok Hke numbers, they’ re stil rede individual strings in Dynamo, In onder to create points, ther datatype needs to be converted fim a string toa Number. This is dane withthe Sri ToNumber NodeSead om separate separatert 1. ‘This Nodes straightforward. Pg the String Split results into the input The output doesnt ook diferent, but the datatypes now a mamber instead of using, = A 1, With some basi addtional operations, we now havea rectangle drawn atthe rg based on the orginal string input Manipulating Strings Since a strings ager teu object, they host a wide range of applications. Lets take a look at some ofthe major ations inthe (Core>String Catesnry in Dynamo: ‘hiss a method of merging wo strings togsther in onde, This takes cach ral string in lit and creates one merged stringea ing] ‘ring! The quick brown Foxjumped over the Lazy ce ring? jumped over the lazy do > = The image shove represents the conatenation ofthe strings: 1. ‘Ad or subtract strings tothe concatenation by clicking the ~/-buttons inthe center of the Node 2. The output gves one concatenated string with spaces and punctuation includes, "The join method is very similar to concateats, except it hs an aed aye of punctuation, you've worked in Excel, you may have come asoss CSV file This stands for comma-separated values, One ould use» comma 2 in tis case, Wo dashes) as the separator with the join Node onder to create sina data strutue: ‘tring oin Em stringO The quick brovn fox--Junped over the 1229 foo [The quick bronn fox > string fd The image above represents the joining of two stings: 1. The separator input allows one to crete a string which divides the joined strings‘Working with Strings In this exercise, were pingto use methods of querying and manipulating strings to deconstruct the final stanza of Robert Frost's Stopping By Woodson a Soowy Evening Not the most practical application, butt wil help us to gasp conceptual stig setians ‘5 we apply them to legble ines of rhythm and rhyme Lets begin with abate steing spit ofthe stanza, We ist notice thatthe writings formated based on commas. Wel use this format to separate each lin into individual tems 1 Thebase stings pasted into a string node 2. Another stringnodeis used to denote the separator. In this case, we're using comma, 53. A Swing Split Node is added to the eavas and connate to the two stags. 4 The output shows tht weve now separated the lines ino individual elementsNow ets gt to the god part ofthe poem the lst twa ines. The orignal stanza was one tem of dats, We separated this daca into individual tems inthe frst step. Now we need to doa search forthe text wes looking for. And while we can do ‘his by selecingthe lst two items ofthe it, if this were sn entre Book, we wouldnt want to read through everythingand ‘manually isolate the elements 1. Instead of manually seaching, we use a String Contsias Node to perform seach fora st of characters. This isthe similirgo doing the “Find” command in a word processor. In tht cas, we gta return of "ue" oF "alse that substring i found within the iter, 2. Inthe "searchFor” input, we define a substring that were looking for within the stanza Lat's use string node with the tea “And mies 3, The output gives us ais offlses and trues, Well use tis boolen loge lo fter te elements in the nent step,1, List FikerBy BoolMas isthe Node we want to set cl ut the fles and truss. The output return the statements with a "mask" input of rue, while the “ou output return those wich are “alse 2, Our output from the in” a expected, ings the final two Hines ofthe tan [Now we want to ive home the repetition ofthe stanza by merging theo lines together When viewing the output ofthe previous step, we notice tha here are wo items in thei: 1, Usingtwo List. Geitema nex Nodes, we can toate the tems using the values of and! as the indsxnput. 2, The output for ea Node gves us, in ode, the final two ines To mee thete wo ites into on, we use the Siring Jon Node 1, Aer ang the String Join Node, we notice thal we nes a seperation2, Ta cea the separator, we add rng node to the canvas and type in comma. 13. The final output has merged the lst a items ito one, ‘This may seem like ot of work to sot he fas wo Tne; ad's tr, string operations often reste some up fant work, But ‘they ace salable, and they canbe spp id to lie datasets with relative ease. you are working parameteiclly with sprealsbeats and interoperability, be sure to kep string operations in mind,Color Color (Colors a reat datatype for creating compeling visuals as wells for endring ference in the output from your Visual Program. ‘When working with abstract data and varying numbers, sometimes t's difficul to sce wha’ changing and to what ogee. This is @ eat application for coors. Creating Colors (Colors in Dynamo are erated using ARGB inputs. Ths corresponds to the Alpha, Red, Gren, and Ble channels. The alpha represents the ransparocyof the ol, while the olher thee are uted a pray coors to generate the whole spectrum of color Icon Name Syntax Inputs Outputs ARGB Color ColorByARGB A.R.G.B color Querying Color Values ‘The colors in the table below query the properties used to define the color: Alpha, Red, Gree, and Blue. Note that the (Color Components Node gives us al four as different outputs, which makes this Node referable for querying the propetes ofa “ Icon ‘Name Syntax Inputs Outputs[Components ColarComponcats color AR.G.B ‘The cols in the table below correspond tothe HSB color space. Dividing the colo into hus, Saturation, and brightness is rgably more inutve for bow we interpret color: What color should it be? How colorful should it be? And how light or dark ‘should th color be? This isthe breakdown of hus, saturation, and brightness respectively Query Name Syntax Inputs Outputs Hue ColotHue color Hue Suturation ColorSaturation color Saturation BrighnessColosBrighness color Brighiness Color Range ‘The color age is sina tothe Remap Range Node ftom section 42:itremaps alist of numbers ato another domain. But instead of mapping @ number domain it maps to acolo gradient based on input numbers ranging fom Oo I. "Te eurent Node works well, but it canbe a litle awkward tog everything working he fist ime around, The best way to ‘become fair withthe colo gradient io tet tout interactively. La’ do aquck execs to review how to setup gradient ‘with ousput colors corresponding to numbers1, Define three colors: Using code black node, define md, green, and hlue by phuggng inthe appropriate combinations of and 255 2. Creat list: Merge the tre colors into one it. 3. Define Indice: Cresta list to define the ip positions of cach color (ranging from Oto 1), Notice the vale of 0.75, for ren. This pose the green color 3 ofthe way acros the horizntal gradient in the coor range sider. 4, Code Block Inpt values (between 0 snd 1) o transite to coon Color Preview ‘The Display ByGeometry Node gives us the ability to color gometry inthe Dynamo viewport. This is helpful fr separating diferent types of poometry, demonstrating parametric concept, or defining analyst legend for simulation, The inputs re simple: geomatry nd color To create again lke the image above, the color input i connected to the colar range NodeColor Exercise Download the example fle that accompanies this exercise (Right cick and "Sve Lik As..") ullding Blacks of Progamns< Color, A fll it of example fies eas be found ia the Appendix ‘This exercise focuses on contollng color parametialy in parallel with geometry. The geometry’ isa asic helt, which we define ‘below using the Code Block (3.2.3). This ia quick and easy way fo create a parametric function; an since our fous is on cole ‘ater than geomstry), we use the codeblock o efficiently crete the helix without lutring the canvas. We will se the code ‘block more fequetly asthe primer moves to more advanced material, 1, Code Block: Define the two code blacks wit the formulas sbove This i quick parametric method for eating spiral. 2, Point-ByCoordinates:Plug the tree outputs fam the codeblock int the coordinates forthe Node Wenow seean amy of points cretinga helix The ne step isto crete acuve through the poats so that we can visualize the helia ooo : 1, PolyCurve.ByPoints: 2, Curve-PointAtParameter: Connect the PobkCurve ByPoints ouput nt the curve np. The purpose ofthis step {sto crate parametric attractor poitt which sides along the curve. Since the cuve is evaluating a pois at parameter, well nee to input a param value berween 0 and 4, Number Slider: After adding to the canvas, change the min vale to (0, the max veo /.0, and the ssp va to (OF. Phgthe slider output int the param input for Carve PoincltParanter. We now ase apoin along the length of the heli represented by a parcsntage ofthe slider (Oat the start point, 1a the ead point). onncst the Point Coordinates out int the points input forthe Node. We gta helical With the reference point created, we now compare the distance from the reference point to the orignal points defining the heli. This distance value will dive poetry os well at coor,|. Geometry DistanceTo: Connect Curve PointdtParametr ouput ito the input, Connect Point ByCoordinates into the tromesry input 2, Watch: The eulant output shows a list of distances from each hell point to the reference point along the curve ‘Our net step is to drive parameters withthe lit of distances from the helical points to the reference point, We ue these distance ‘values to define the radio series of spheres alongthe curve. In order to keep the spheres suitable size, we need to remap the values for distance, 1. Math. RemapRange: Conncst Geomery.DistanceTo output int the number input 2. Code Bock: connet code block with value of 0.0 into the newiin mp and code block with a vale of J nto {he new Mar input 3. Wateh: comet the Math RemapRange output into one Node and the Geometry DistanceTo output into ante Compare the rests. “This step bas remapped te list of distance to be a smaller range. We can eit the newMin and newMax values however we se fit ‘The vals wil ema and will have the same dition rao aos the dorsi1. Sphere.ByCenterPointhadlus: connect the Math Remap Range output into the radu input and th Point ByCocndinats output into the center Poin inp vignl 1, Number Slide: change the value ofthe number slider and watch the size ofthe spheres update, We now ha. parametric ie The size ofthe spheres demonstrates the paramere ray defined by a reference point along the curve, Lets use the sme concept {or the sphere radius to drive ther colo.Color Range: Add op the canvas. When hovering over the value input, we notice thatthe numbers equssted are between and, We ned to remap the numbers from the Geometry.DistanceTo output 0 that they ae compatible wth this domi, Sphere.ByCenterPolntRadlus: Forth ime being, ls disable the preview on this Node (Right Click > Preview) ‘Math.RemapRange: This process should look fii, Connost the Geometry DistanceTo output ito the munbers input. (Code Bock: Siilr to an ever step, rete a value of forthe newMfin input and a value of J forthe mewMae Input Notice that we are abe to define two outputs fom one code Bock in this ease Color Range: Connect the Math RemapRange output into the value inputCColorByARGB: This is what well do to create two colors. While this process may lok awkward, it's the same as RGA colors in another software, wee jus using visual programming te do 2. Code Block: create wo values of and 253, Plagthe two ups into the two Color ByARGB int in agreement with the image above (or rate your favorite two colt) Color Range: The colors input requests alist of clos. Wenoe to create this ist fom the two coors create in the previous step 4. ListCreate: merge the tocol into one lit. Pugehe output into he colors input for Color Range 1. Display.ByGeometryColor: Const Sphere ByCenterPointadis into the geomet input snd the Color Range Into the color input. We now have a smooth gradient aross the domain ofthe curve.we change the value ofthe number slider fom eatin the defaiton, the colors en sizes update, Colors and tau size ae ret related inthis case: we now have a visual ink berwosa two params! Color On Surfaces ‘The Display BySurfaceColors node gies us the ability to map data across a surface using olor! This Fetinaity introduces some exiting possibtes fr visualizing data obtained through discrete analysis like solar, enerey, and proximity. Applying color 1o 8 surfie in Dynamo is sini to applying tenure 1 a materia in ather CAD environments. La’ demonstrate how owe this ‘oo in the brief exeeise below. Color on Surfaces Exercise Download the example fle that accompanies this exercise (Right click and "Swe Link As.."): Buling Blocks of Progumns ColoOnSurface.ip. A ful it of example files ean be found in the Appendix—— — Fs, we nae to eae (or refizence) a surface to use a an input forthe Di ‘weatelofting between a sine and cosine curve play BySurfaceColors node, For this carpe 1. This Group of nodes is cresting points along the Z-aithen displacing them based on sine nd cosine functions, The ‘seo point ists are then used to generate NURBS curves, 2, Surface.ByLoft:encrate an iatep lated surfice between the list of NURBS curves 1, File Path: slat an image file to sample fr piel daa downstream 2. use File-FromPath to convert the fie path oa file then pas into Image ReadFromFile to output an imag for sampling Image Pixels: it an image and provide a sample valu to use along the xand y dimensions ofthe image4. Slide: provide sample values for Image Pixels 5. Display.BySurfaceColors: mop ary of coor values ecoss surface slong X and Y respectively Close-up preview of the output surface with rexolution of 400x300 samplesGeometry for Computational Design GEOMETRY FOR COMPUTATIONAL DESIGN As s Visual Progamming eavironment, Dynamo enables you to craft the way that data x processed, Data number sos Geometry, As understood by the Compute, Geometry -or somtimes called Computational Geometry ~is the data we can use to create beautiful intricate, or performance-driven models. To do 0, we need to understand the ins and ous ofthe various types of Geometry we can useSete LOS BOraeoSeae FOOL ORCOES SPAS SSOBOAGSOE eeeeeecescs SLES NP OBOOS IOUVOVOCHOSGeometry Overview Geometry Overview ‘Geometry i the lng for design, When programing language or envionment has a eometry Kernel at core, we eat _unlook the possiblities for designing precise and robust model, automating desig routines, and generating desig iterations with igor. ‘The Basics Gometey, traditionally defined, isthe study of shane, size, relative position of figs, andthe propertis of space. This fed has rich history goingback thousands of years. Wi the advent and popularization ofthe compute, we pind a poxerfl tol in
Coondinates node with Icing ss to "Cross Product” This costes 8 id of points, and also returns alist of Hist a8 an oul 3. Notice thatthe Watch node gives 3 iss with items in each ist 4. When using List Gediemtnder, with an index of 0, Dynamo slets the fst ist and all ofits contents. Other programs may selec the fis item of every ist nthe dua structure, bul Dynamo employ’ top-down hicreehy when dealing with dite Flatten and List.Flatten Flaten removes al is of data om a data structure. Tiss hepfl when the data hierarchies ae not necessary for your ‘petition, but it canbe risky becuse t removes information, The eample below shows the ul of fattening ast of data, Uxercise - Flaten Download the example le that accompanies this excise (Right click and "Save Link As.."): Eaten dun. fl ist of inthe Appendix. ‘ample les can be fo— 1. Tasrt one ine of code to define a range in code ioe" 250,180.24," 2, Phaggingthe codebook into the x andy input ofa Poin ByCoordinates node, we sat the lacing to "Cross Producto a mid of points 3. The Watch node shows that we have sist ofits 4. A PolsCurve Points nade will ference cach ist and crate a oepestivepolycure, Notice inthe Dynamo preview {hat we hve four poly eave representing each row in the rd 1. By inserting flat before the polyeuve node, weve created one sng Ist for all ofthe points. The polyeurve node vefrenes list 1 create one curve, and since al ofthe points are on one Uist, we gst one 24-zagpolycuve ‘whic runs throughout the enti list of points "here are also option for Matening isolated ties of dat. Usingthe List Flaten node, you can define a set numberof dts tiesto‘atten from the top ofthe hirarehy. This sa sell helpful too if youte struggling with complex data structures which ae not ‘necessarily relevant to your worktow. And another option isto use the faten node sa function in List Map. Well discuss ListMan more below, Chop ‘When parametric modeling there ae also times where youll want to add more data structure to an esting list. There are many ‘nodes available fr tis aswel, and hop i the most basic version, With chop, we ean partition ist into sublists with set numberof tens. Exercise -List.Chop Download the cumple fle that accompanies this exercise (Right click and "Save Link As.."): Chop.dvn, A fll is of emmple files an be found in the Append. (oo) real hol bal Ro pa feo} Bal @ oO e (0) tt) (2 (a A LiseChop witha _subLength of2 cates 4Usts wit 2 tems each ‘The chop command divides sts based on a given st length Tn some ways, chop isthe opposite of atten: rather than removing ata structure, it ads new iets ot. This is a helpful tal fr geometric operations like the eumple below. List. Map and List.Combine ALst Mep/Combine applies st function on input ist, but one step down in the hzearchy. Combinations ae the sae as “Maps, exept combinations can have multiple inputs eomespondigto the input ofa ven function, Exercise “List. Map Note: This exorcce was cated witha previous version of Dynamo, Much of he List Map inciomality hac Boo resolved withthe addin of the
[email protected]
feature. For mone information, se ist. L.eel below: ve Link As.) Map. dvs. A full ist of sample Download the example le that ascompanis this excise (Right elisk and{les can be found in the Appendix. ‘As a quick introduction, les review the List Count node fom a previous section ~ ‘The ListCount node counts allo the tems in ais, Wel use this to demonstrate how List. Map works, 1, Inset ta ines of code into the code Blok: ‘Aflertypingin this code, the code block wll create wo inputs for Nxand Ny. ‘With two intge sliders, define the Nand Ny values by coectng them to the code Block CConncet each ie ofthe code Block ito the respective Xand Yinputs ofa Poin. 8yCoondinates nade, Right lick the node, selest "Lacing", and choose "Crass Product". This creates a grid of points. Because we defined the range fom 501050, we are spanningthe dealt Dyas 4. A Match node eveals the points ceated, Notice the data structure, Weve row of points of the wid ested ist of ts Each ist represents a=~ 4 i 1. Attach a Lis Count node to the output ofthe watch node from the previous step. 2. Connect a Watch node to the List.Count output Notice that the List Count node gives a value ofS. This is equal the "Nx" variable as defined in the code block. Why is this? ‘+ Fist, the Point ByCoordintes node uses the" input asthe primary input for creating lists. When Nxis Sand Ny is 3 we ait list ofS ists, each with 3 tens. ‘+ Since Dynamo treats iss as objects in and of themselves, a List Count nodes applied tothe mai ist in the hierarchy. ‘The rel i vale of 5, of, the ember of ists nthe mist 1. By using Lit Map node, we ake a step down in the hirrchy and perform ction thi ove 2. Note chat the Lise Cow node has no input. tis being used as aFunetion, so the Lit Cow node willbe applied tovery individual ist one step down in the hiraehy. The Bank input of List Coun earesponds to the Hist input of| Listap. 13, Therestls of List Count now gives alist of Sites, each with value of 3, This represents the lng of each subi. Exercise - List Combine (Note: This exreive was created with a previous version of Dynamo. Muck ofthe List Combine factional hasbeen solved wih the addition ofthe ListLevl feature. For more information, sce ListLevel below Dowload the cumple fle that accompanies this exercise (Right click and "Save Link As..") Combine. dyn. A full ist of ‘example les canbe found inthe Append In this exercise, well use sil logicto List. Map, but with mile elements In this case, we want to divide ist of eurves by unique number of points 1. Using he code ioe, define a range using the sy tae 20.8 2. Connect the cde hook to two Pointy Coordinates nodes 3. Creates Line ByStartPoinndPoin fom the Pont ByCoordinates nodes 44. The Watch node shows four lies. nd & vale 0£20;"™ below tat Tine‘low the raph for line creation, we want to use_codeblock_to crete four distinct range to divide the Hines uniquely. We do this with the following ne of code: Ont caas 2, With a Lise Create node, we mange the fur lines from the ede Book into oe st 3. The Watch node reveals a ist of its, 1, Curve PoinutParameter will ot work by connecting te lines directly into the parameter values. We ned 10 stepone level dawn onthe hierarchy. For this, well se List Combine By using List Combine, we can sucessfully divide cach in by the sven range. This sate ricky, so wel reat down in-depth 1, Fiat add Curve PointéiParameter node tothe cans, Tit willbe the “incon” _or Ycombintor that we app to _ListCombine node, Mone on thin second, 2, Adda List Combine node to the canvas ithe "+" or "=" to add or subtract inputs, In this case, wel se the etl wo inputs onthe node. 4. Wewant to plugthe Curve PointAtParumetr nade ince the “comb” input of List Combine, And ane more important node: be sure to right-click the “param input of Curve. PointatParamer and uncheck "ase default vale”, Defult ‘values in Dynamo inputs have to be removed whe runing node a a funtion, In ober words, we should consider oft values as having additional nodes wired to them. Because ofthis, we ned Yo remove the default vals i this 4, We know wehive to ius, thelne and the parameters to erste points. But how do we connes ther othe ListCombine inputs and ia what order? 5. The empty inputs of Curve PointstParameter, from top-to-bottom need tobe filed in the combinatorin the same onde So, the lines are phd ito list of List Combine. 6, Following suit, she paramstrvalucs ae plugged into te ls input of List Combine 7. The Waich node and the Dynamo preview shows us that we have lines, each divided based on the codeblock ranges List@Level ‘An altemative to List Map, the List @Level feature allows you to dzectlyselest which level flit you want to work with right at ‘the input port of the node. This feature canbe applied to any incoming input of anode and will allow you access the levels of your lists quicker and easier than other methods, Just tel the nde what evel ofthe Tit you watt to use the input and et the de do theres. List@Level Baercise In this exercise, we will use the Lit@Leve feature to isolate a spi evel of dt, Dowload the example fle that accompanies this exercise (Right lick nd "Sve Link A." Litovel. fl it of| ‘example les canbe found inthe Appendix.iti ih iii fi 4 ‘We willstart with a simple 3D grid of pots. 2, Since the gid is constructed wih a Range for X, Yand Z, we know thatthe data is structured with 3 irs an X List, Ybist and Z List. [3, Those tit eit at lifrent Levels, The Levels a indicated at the bottom ofthe Preview Bubble. The ist Levee columns corespond tothe ist data above to help identify whic level to work within 4, TheList Levels ae oxpnized in reverse order so thatthe lowest level datas always in “LI”. This wil help ensure ‘hat your gaps will Work as planned, even f anything's changed upstream. aE} GRRE in 1, To use the List @Levelfuetion, click Inside this mens, you will see wo checkbows 2. Use Levels - This enables the Lst@Level fanctionlty, Afar licking on this option, you willbe aloo click through and select the input list levels you want the node tous. With his men, you can quickly try out diferentlevel options by clicking up or down 3. Keeplis structure ~ If ensbled, you wil have the option to keep that inputs lve structure. Somctimes, you may have purposely organized your data into sublists. By cheekingthis option, you ean Keep Your ist organization Jitat and not lose any information, ‘With our simple 3D gi, we can access and visualize the ist structure by tong trough the List Levels, Fach List Level and index combination will tur a diferet set of points fom our orignal 3D se. 1 (@L2" ia Designrpt allows us to sce only the List at Lvel2 ‘The List at Level 2 with the index inches only the fist set of Y pints, returning only the XZ gid 5. Ifwe change the Level fiterto“L1", we will be able to se everthing the fst List Lave. The List t Level | with the index incuds all of our 3D points in ft ist. 4 Ifwe ty the same for” we wil se only the third List Love points, The List at Level 3 with the index includes ‘only the fist se of Z points, returning only an XY gi 5, Ifwetry the same for “LA” we will se only the third List Love points, The Lista Level 4 with the index includes only the fist set ofX points retuming only an YZ gi Alvnough this particular example can also be create with List. Map, List@Level ety simplifies the interaction, makingit easy twacess the node data, Take look below at comparison betwen List Map nd List@Level methods1. Although both methods will ive us acess tothe same pots, the List@Level method allows us to easily toggle between layer of data within single node. 2, To acess a point gid with List Map, we will uced a List GetltmAtIndox node alongside the List Map. For every lst evel tat we re stepping dowa, we wll need to use an additonal List Map node. Depending om the complexty ‘otyour lists, tis could equi you oa sigaifiantanount of List. Map Nove to your waph to access the right evel of information 3. Inthis oample a List GettemAtIndex node with a List Map node reurs the same st of points wit the same list structure a the List GetltemA nex with '@L3 selected, ‘Transpose ‘Tanspose sa fundamental function when dealing with list of ists Just sin spreadshest programs, transpose fips the ‘columns and rows ofa daa strate, Wel demonstrate this with «basic matrix below, and inthe following teton, well demonstrate how «transpose ean be use to cea omic teltionships, ot ees Banana SinnlanS ga gus Oe Onn aa ed ee ae sis dna due Sus bua Sus Download the example fle that accompanies this exercise (Right click and "Save Lik As." Teansposs dyn, A fl ist of ‘ample files can be found inthe Appendix.Let’ delete the List Count nodes from the previous exercise and move onto some geometry’ to see how the data structured, 1. Connsst a Fob\Curve ByPoins tothe output ofthe watch node from Point Coordinates 2, The output shows S polycurves, nd we can se the curves in our Dynamo preview. The Dynamo node i looking for list of points (or it of Fists of points in this ease) and erating singe polyurve fom them, Essential, each ist has convertod toa curve inthe data structure 1. If we want isolate one row of curves, weuse the List Gedtem Ander nods 2, Usinga code book value of 2, query the 3 element in the mai is. 3. The PobCurve ByPoins gives us oe curve, since only ne lit i eonected to the nods1, A.LiscTranpose node will swith al ofthe tems with ll ofthe Tit in ist of ts, This sounds complicated, but {t's the same leas transpose in Microsoft Exel switching columns with rows ins data structure 2. Notice the abstract esl: the transpose changed thelist structure oma lists with’ items each to 3 Hist wih $ items ech 43, Notice the prometric rel: using PolyCurve. By Points, we st 3 poly curves inthe perpendicular dietion to the orga cures Code Block Creation (Code block shorthand uses "{)" to define alist This i mh fster and more Pid way to creates than the List Ceate node ‘Code los i discussed in more detail m Chapter 7. Reference the image below to note how a ist with matiple expressions can be defined with ede block 0, 24Math. PL, (0..1..#2)}; | > [ene : I wa 6) fo) 6Code Block Query ‘Code block shorthand s uses") quick and casy way to teletspeife items tht you want from. complex data srt, ‘Code blocks ae discussed in mace detail in Chapter 7, Reference the image below to note haw alist with multiple datatypes can ‘be queried with code block. Exercise - Querying and Inserting Data Download the cumple fle that accompanies this exercise (Right click and "Save Lik As..") Repucltems dyn, A fll ist of sracnple Ges canbe found inthe Append. This exercte uses some ofthe logic established io the previous one to edi surice, Our goal eri intuitive, but the dita structure navigation will be more involve, We want to articulate surface by moving a contol pin.y om eo = 1. Boga with the string nodes shove, Wesre ceatings hase surface which span the defalk Dynamo gi 2. Using cade book inser these two lines of code and connect to the w and» inputs of Surface. PoinedeParamcter, respectively 3. Be suet set the Lacing of Surface PointAiParameter "Cross Product 4. The Watch node show that we have list of 3 Iss, each with Stems. =e) ay = vt In this step, we want to query the central point inthe gid we've erate, To do this wel select the mide point in the middle list, Makes sense, ht?1, To confirm that this is the comet pont, we can alo click through the watch node ems to confi that were tangstng the correct one. 2, Using codeblock, well write abasic ine of code for queryinga list ofits points(1) (217 3. Using Geometr Translate, well move the selected point up inthe Z scion by 20 units 1, Lats ao slot the mide row of points with a Lit Geto Atindes nods: Note: Similar oa previous step, we can slko query thelist with codeblock, using in of poi ee \ ee eee So far weve sucesfilly queried the center pont and moved it upward, Now we want need to insert this moved point back Into the original dara structure1. Fiat, we want to replace the item ofthe list we isolated in previous step. 2, Using List ReplaceltomAtindes, well replace the middle tem by using and index of "2", withthe replacement item connected to the moved point (Geometry Translate) ‘The output shows that weve put the moved point nt the middle Rem of thelist. i 22) \ om —* fea Now that weve modified the Ist, we nood to inset this st back into the orginal data structure: he list of it. Following the same loi, use List Replaceltem Ander to replace the mide list with the our modi bist. Notice that the code blocks defining the index for these two nodes re I and 2, which matches the original query fom the codeblock pains 1/12), By selectingbe lista nde 1, we soe the data structure highlighted in the Dynamo preview. We succesfully merged the moved point into the orga data struc,‘There are many ways to make surface fom this st of points. In this case, we'e going eeatea surface by long curves tothe. 1. Createa NarbsCurve ByPoins node and connect the new data structure to erate ree nubs curves 1. Comet a Surface ByLofo the output from NurbsCurve ByPoints, We now have s modified surface, We can change the original Z valve of Geometry. Translate and watch the geometry updaten-Dimensional Lists n-Dimensional Lists Further doen the abbit-hole, let's ad even moe testo hierrehy Data structure can expand far beyond a two-dimensional st of lists, Since its ar stems in and of emcee in Dynamo, we can crest data with as many dimensions as possible ‘The analogy well work wit hee are Russian Nesting Doll. Each list canbe regarded as one container holding ml ach list has its own properties ands also reed sis own objec. ile items.PC Peceseces Aset of Russian Nesting Dolls (Photo by Zs) i an analogy forn- Dimensional iss. Fach layer represents ist, and each lst contains itoms within ts Dynamos ease, ech container eas have multiple containers aside (epeesenting the toms of sch st), Dimensional are dificult to emplain visually, but weve Set up afew exercises in this chapter which focus on working with lst which venture beyond two dimensions Mapping and Combinations ‘Mappings argusbly the most complex part of data management in Dynamo, ands especialy relevant when working with complex hirarchies of sts. With the series of eurcses blow, wel demonstrate wher o use mappingand combinations as data ‘becomes ulsdimensionl Prolninary introductions to List Map and List.Combine ca be found in the previous sexton, In te last exercise below, well se ‘these nodes on a complex data structure. Exercise - 2D Lists - Basic Download the example les tht accompanies this exerese (Right cick and "Save Link As." flit of example files ean ‘be found in the Appendic 1n-DimensionlLists dvs 2.n-Dimensional-Lists sat ‘This exercises the isin a series of thre which focuses on aticalting imported geometry. Hach pat inthis sves of excises ill inctease in the compleity of data structure,1. Lets begin with thet file inthe excise fle folder. We can grab this ile using the Fle Pah nod. 2. With Geometn:mportfiomSAT he geomcry is mportd into our Dynamo preview as two surfaces For this exes, we want to keep it simple and work with one ofthe surfaces. 1. Let's slect the index of # toga the upper surface, We do this with List Gettemtinde node.Thonex step ito divide the surface into aid of points 1, Using codeblock, insert these two tins of code: 2.0; 2, With the Surface PointstParameter, connect the two cade block valves tow and, Changs the lacing ofthis node to “Cross Produc” 4. The output reveals the data structure, which is also visible inthe Dye preview 1, Tout lok at how the daa structures organized, t's connect Surface PoinatParamcter.2. Notie we have ten curves runing vertically along the surface 1 Abasie Lis Transpose wil ip the columas and ows of ast of lit 2, Connecting the output of List Franspore to NurhsCurve yPoins, we now ge five curves runing horizontally seross the sufce, Exercise - 2D Lists - Advanced Lat’ inerease the completiy, Suppose we wanted to perform an operation onthe curves created rom the previous execs. relate these curves to another surface and lot between them, This requires more altotion 1o data struture, Dut the underlying ages the same1. Bega with step fom the previous excise isolating the upper sur List Geom ther node, ofthe imported geometry with the 1, Using Surface Ofer, ot the surface by a value of 10. 1. In the same manner a the previous excise, define code block with these two lines of ede 0.14105 2, Coneet thee aus toto Surface PointftParameter nodes, each with lacing se 9 "Cross Product” One of ‘hese nods is connected tothe original surface, while the others connected tothe office surace1. By using Lise Transpase temembe, we ate ippingall ofthe coluras and ows. This node will transfer two lists of ten curves into tn iets of tvo curves. We now have each murbs curve rated tothe neighboring curve onthe other surface 2, Using Surface Loft, we aie at a ibbed structure 7 ee eee_// = Va we —_ =< a / 1. Am aleratve to List hanspose uses List Combine, This will operate a “combinator* on cach sul. 2. Inthis case, were sing List Crete a the “combinator” which wil feat a ist of cach te inthe sublists 2. Using the Surface ByLof node, we pt te sme surfces a inthe previous sep, Tranapose is easier o use in this ease, but when the daa structure bosoms even more complex, List Combines mot lishow steps, if we want to switch the ovenaton ofthe curves in the ribbed strustre, We want to use 1. Steppinghack af ‘ List-Transpote before connet to Nurhs Curve AyPoints, Tis wil ip the columns and rows, gvingus 5 horizontal ribs, Exercise - 3D Lists Now, were gingto go oven one stp furthe In this excise, wel work with both mportod surfices, coating complex ata hierarchy. Sill, ur sim eo complet the same operation withthe sme underlying loge 1, Bega with the imported fle fom previous exis,1. As inthe previous ext, use the Surfice Ofer node to offset by avalue of 10 2. Notice fom the output, that we've created two surfaces with he offset node 1. Inthe same manner a the previous exercise, define a code block with these two line of ede: 2, Connes these ouipul 1 two Sure PoineiParamter node, cach with cing el to “Cros Produc". One of| ‘these nodes is conned tothe orignal surfaces, while the others connected tothe ot suri1. As inthe previous extes, connect the outputs to 10 NurlsCurve ByPoin nods. 2. Lookingat the output of the NarbsCurve.ByPoins, noice that this sa ist of two lists, which is more complex than the previous execte, Theda is eateporized by the underlying surface, so we've added another tie to the dal structured. 3. Notice that things become mare complex the Surface PoinutiParamcter node. I this ase we have alist of ts of lists 1, Usingthe List Create node, we merge the murs curves into one dat structure, creating sist of ists of sts, 2. Ry connecting a Surfce ByLoft nade, we get aversion ofthe original surfaces, as they cach remain in their wa ist «seated ffom the orignal data structure1. Inthe previous exes, we were bleto use List Tanspose to crete a ied structure. This wort work here. A. transpose shouldbe used ona two-dimensional ist, nd since we havea threediensionl stan opention of "Tipping columns and rows" won't work ss asily. Remember, its are biets, x0 List Transpose wl lip our lis with ot sublists, but won' lip the nurbs curves one list futher down ia the hierarchy. 1. List Combine will work better for us here. We want to se List Map and List Combine nodes when we gst to more complex data structure. 2. Using List Crate asthe “combinaor”, we eeate a daa stractre tha wll work better for us,1. The data structue stil neds toe transposed at one step down on the hierarchy. To do this well use Lise Map. This Js working ike ListCombine, uept with on inputs, rather thun two oF more The function well apply to Lit Map is List Transpo, which wil ip the columns and rows ofthe sublists within cour mai it 1. Finally, we cat lof the nurs curves tagther wit «proper dats hirarchy, giving us aibbed struct.1. Wl be nie toa surface hacking two this structure, so wel use Lise fom the lofted surface fom tbe previous steps xt selec the back surieeThe first version ofthe rocking cai was sleek, so our Second mode! oes an ora, sporty version of recumbency.Code Blocks and DesignScript Code Blocks and DesignScript ‘he code block i unique feature in Dynamo tha dynamically inks a visual programming environment with atextased one, The «de-bock has acces toll ofthe Dynamo node and ean define an entire graph in one node Rea this chapter closely, the code ‘lok fundamental building block of Dynamo,What's a Code Block ‘What's a Code Block? ‘Code blocks area window des into DesipSerp, the proyamming language atthe heart of Dynamo, Built fom serteh to suppor exploratory design workflows, DesgnScit ise eadableand concise language that offers both immediate feedback to ml bis of code and alo caer to large and complexnteractions, DesgnScrit alo forms the backbone ofthe engine that drives ‘most atpeats of Dynamo “under the hood”, Because ney all of the functionality found in Dynamo node ad interaction havea ‘one-to-one relationship wit the seiping language, there are unique opportunities to move between node based interactions and sriptingin a Maid way Code Block "I am the Walrus. I am the Walrus. For beginners, nodes ean be automatically convested to text syntax to sid in etrning Desierto simply to reduce the size of lage sections of guphs. This is done using a process cad "Node to Code”, which i eutlned in more dealin the DesissSeint ‘Suntncssstias, More experienced urers can ue Code Blocks to crest cstomized mashups of existing fnetionality and user ‘authored relationships using many standard coding paraigns. In Between the bupnner and advanced se, there te a huge number ‘of shortcuts and code snippets that will aclerate your designs While the term 'cods block’ may be itl intimidating to none rogammers is both esy to use and robust. A beginner can use te code block efficiently with minimal coding and an advanced. ‘user can define scripted definitions to be realed elsewhere in a Dynamo definition, Code Block: A brief overview In short, code bocks ara tet-scipting interface within a visulsritingcavironmnt They can be used as aumbes, strings, formals, and other data ype The codeblock it designed for Dynamo, so one can define whitrary variable nthe codeblock, snd ‘those varisbles are automatically added to the inputs ofthe node: ‘With code blocks, «usr bas the Meibility to desidehow to specify inputs. Her are several different ways to make a besie pont with coordinates (10,5 0:ho > olntox = 19.008, v= £990, = = 0,00) aa : ia 1 |Pointaycoordinatestiyzt > eure = 16,805 Y= 10.08 Point syCcoordinates(1000): > = z [As you eum more ofthe avalible functions in the loary, you might even find that typing™“Point By Coordinates” is faster han ‘scrching nthe ibary and findingthe proper node. When you type in "Poin." for exsmpls, Dynamo wil display « it of posible functions to apply toa Point. This makes the scripting more intuitive and will hep with earning how to apply functions in Dynamo (Creating Code Block Nodes “The cade block canbe found in Core>Iput>Actions>Code Blak. But even faster, just double cle on the canvas and the code block appesrs, This node is used so often ts ge fill doublestick priilessuthored Numbers, strings, and formulas (Code blocks ae sso flexible towards ta types. The ser can quickly define numbers, stings, and formulss andthe codeblock ‘will iver the desired output In the mage below, you ca se the “old school” way of doing things i litle long-winded: the user searches for the intended node in the interface, ads the node tothe canvas, and then puts the data, With codeblock, the user ean doublecck on the eanvas to pullup the node, and type'in the cozet dat type with basic syntax2.000 > ‘0d Schoo tess 13 sore oul Blocks tess 4s more Watch Bes [> 5 "The number sting, and formula nods are tree examples of Dynamo nodes which ar arguably obsolete in comprson to the code block.DesignScript Syntax DesignScript Syntax ‘You may have noticed common theme inthe names of nodes jn Dynamo: each node wses a" syntax witout spaces, This is ‘because the ex atthe top of each node espresats the actual syntax for Sripting andthe” (or dot notation) separates an ‘erent from the possible methods we an call This creates an easy translation fom visual Serpting to text-based serping ‘As a general analogy forthe dot notation, how can we dea with parametric applein Dyname? Below area few methods well un fn te apple before decidngto eat it. (Note these are not aetual Dynamo methods) Humanly Readible Dot Notation Output ‘What colors the apple? Applesolor ted Is the apple ripe? AppleisRipe tue How much does the apple weigh? Applecigit Gor Wher did the applecome fiom? Applepareat, wee What does the apple crete? Applehileen seeds Is this aplelocally grown? Apple stanceFomOrehard 60 mi 1 dont know about you, but judging by the outputs in the able above, this looks like one tasty apple. think I Apple eat it Dot Notation in Code Block Wit the apple analogy in mind e's oak st Point Coordinates and show how we can create point usngthe code Block: cy The code lock syntax Point .ByCoordinaves (0, 10): gives the same rest a a Point ByCoordinates node in Dynamo,cept were ale to eeatea point using one node. This is more efficient than the connecting a separate node into “X" and ™ 1. By using Poin ByCoordinates nthe code block, we are specifying the inputs inthe same order as the out-of-the-box node (KD, Calling Nodes ‘You can cll any gular node in the Hay trough a Code Block a longs the node int special “UI” node: those witha spesa se interface feature. For instance, you ca all Cin ByConterPointRadis, ba it woulda’ make much sense to cll Watch 3D node Regular nodes (most of your library), generally come a thee types: 1 Create Creat (or construct) something ‘+ Action - Perform an action on something + Query - Get aproperty of somethingtbat already exists ‘You'l find that the Horicy is orsnized with these categories in mind. Methods, or nodes ofthese thre types are treated
<2>,<3>, ete 1. Inthis example, we use a shorthand to define two ranges (more on shorthand inthe following ssction ofthis chapter In shor, 0.1; is equivalent to (0,1) and ~3. .~Tis equivalent to (~3,—4)~5,~5,77). Theresut gives us lists of2xvalues and y-vaues. If we don't use replication pide with thete mismatched ists, we gta ist of to Pols, which is the lng ofthe shortest lit. Using plication gids, we can find al ofthe possible combinations of Zand S coordinates (t, a Cross Product) 2, Using the syntax Point SyCoordinatos (x valsel>,y_valle<2>) 1 we pet two ists with five items in echts. 5, Using the ryntax Point ,ByCoorelinates (x_valls<2>,y_vale<1>) ; we pe five lists with two tems in each ist, ‘With this notation, we ean aso spesity which ist willbe dominant: 2 its ofS things or $ ist of 2 things Tn the example hanging the onder ofthe replication guides makes the el alist of sows of points or ist of cokimus of points a i, Node to Code Wii the code black mathods above may take some ting wed to, here i feature in Dynamo elle "Nod to Code” which will make the process easier. To use this feature, select an aray of nodes in yout Dynamo gap, right-click onthe canvas an sleet ‘Node to Code". Dynamo condenses these nodes into a codeblock, with all ofthe inputs and outputs! Not ony is this a eat took for laringcode bck, bat i aso allows you to work with a more fficent snd parametric Dynamo graph, Well conclude the ‘exccise below by using "Node to Code", 0 dot miss it Exercise Download the example fle that accompanies this exercise (Right click and "Save Link As..") fl st of eample files can be found inthe Appendix Dunsmo. Syn Aurion To show the power of ede block, we re ging translate an existing atrctr fed definition into cade block form, Working with an existing definition damonstrats how codeblock rats to visual scripting and is helpful fr kearing DesgnSerip syntoxBegin by recreating she dfnition inthe image above (orby apeningte sample ile) 1. Notie thatthe lacing on Poin 8yCoordnates has ben et to Chass Product 2. Bech point ina gis moved up in the Z direction based on its distance to the reference point 3. A surface i erated and thickened, creating bulge in the geometry relative to the distance the reference point. 1, Siting from the begining, k's define the reference paint fs: Posne BC srdinaves (x0) 7. Weuse the same Point B)Coordinates syntax ais specified onthe top ofthe reference paiat node 2, Thovariales xan y ac inserted into the codeblock so that we may update these dynamically with sider. 3. Adil some sliders 10 the codeblock inputs which rng from 00 50 This way, we can span across the defDynamo gid on {olsun 1. Inthe seond ine ofthe cade oe, we define a shorthand to replace the number sequence node: coordsx = #11) 4 . Well disuss this more inthe nest section, For now, notice that this shorthand is equivalent to the Number Sequence node nthe visual script 1, Now, e want to create dof points from the coondeXY sequence, Todo this, we want to use the Point ByCoordinates sya, but algo need to nate a Cross Produc ofthe lit i the same manner tat we di inthe visual script. Todo this, we type the line Point 8yCoordin sdeX¥<1>, coordeX¥<2>, 0) 2, The angled brackets denote the cose prodetreference 2. Notice in the Watch3D node tat we havea gid of points across the Dynamo gid einen igo intern coaraers arertnprisres rele etan site cana e(gntar) 2 ‘ 4 : =o oo cr 1. Now for thesrsky part: We want to move the gid of points up based on their distance tothe reference point. Fest, Je’ cll this now ast of points ransPs, And since a translation ean action onan esting element, rather than using Coonstry. Translate. ., weuse gridPts, Translate 2. Reading fom the actual node on the canvas, we ses that there ae thee inputs. The geometry to tans is aeady Aeslared because we are performing the ation on that cemont (with ridPts Translate). The remaining wo mpte willbe inserted nt the parentheses of the funtion: dreion and distance. 13, Thedltetion is simple enough, we usea Vector. 2ieis (} to move vty 4. The distance berwoen the refeeace point and each gid point still needs o be calculated, so we do his san action to the reference point in the same manner: ro£2t.DsstanceZo (grsdets) '. Tho final line of code gives us the translated points: tranePes = Pts. Translate (Vector. 2Axis(}, refPt.DistanceTo(grid?=s}}11. Wenow havea gid of points with the appropriate dara sruture to crate a Nuts Surface, We constrct the surface wsingszf = Narnss) cers nr 1 Ani finaly, to add some depth tothe surface, we construct a solid usin ‘case we thickened the surfs by Sums in the code, ut we euldabvays dele this as variable alingit thickness for example) and then contol that value with aside. 4 = arf.thicken (5) ; inthis Simplify the Graph with "Node to Code" ‘The "Node to Code” feature automates the entire exerisethat we ust completed withthe click ofa button, Not any is his powerful for eeting custom dfritions and reusable code blocks, but i i soa really helpful tol to ean ho to sept inDynamo: 1, Stat withthe existing visual script ffom step | ofthe exercise Seles all ofthe nodes, ight click on the canvas, and select "Nae to Code". Spe as tht. Point ,8yCoordinates(t2
, 0)5 #4 -Dictanceto(t); ti-Translate(t), 17); nurbeSurface.bycontrolvoints(ts, 3, 3 ‘Dynamo has automated a teat based version ofthe visual raph, lacing nd ell Test his out on your visual scripts and release the powerof the cade block!Shorthand Shorthand ‘Thete area few basi shorthand methods inthe ode block which, simply pu, make data management ao ease, Well break ‘down the basics Below and discuss how this shorthad canbe usod both for ceting nd querying data Data Type Standard Dynamo Nukes = Suing: Lessismore. > SequencesSequences Get tema Index Number Sequence start seq amount step Number Number Range start seq Number end Number List.GetitemAtindex var{]..0 TL te 1,000 >Crate List Concatenate Stings Conditional Siatements dataString > Tt List.Create indexO + - | list index1 Til et tg index2 String Siri SST Reel o14 stringO + | - | string Str string? o1Ranges ‘The method for defningrangss and sequences canbe reduced to basic shorthand. Use the mgs below a guide to the,” syntax for defining ist of rumaical data with codeblock. After getting the hang of this notation rating numerical data i a ally ‘ficient process 1. In this example, «number ranges replaced by basic codeblock syntax defining the bog ning. end. 8¢p~ ‘sSzez. Represented numerically, we ge 0.19. 17 2, Note tit the syntex 0. .10..17 is equivalent 190. 107. Astep-size of |i the def vale forthe shorthand notation So 0.107 will ve a sequence from 0 to 10 witha sep-sze oF 3. The number sequence amples sila, ewspt We use "#” to state that We Want 15 vals i the ist, rater than a lst which goes up to 15.In this case, we are defining: beginning. .YofSteps. .svep-size:. Theactual sytan forthe sequence is 0. #15. 2 4. Usingthe "#” om the previous step, we now plac it in the “stp-size” portion ofthe syntax Now, wehave a unter range spassing from the "beginning tthe “end” andthe "sepsie" notation evenly dstrites a mumber of vales between the lwo: beginning. .end. .#ofsteps Advanced Ranges ‘Creating advanced ranges allows us to work wth Ist ofits in a simple fasion. nthe amples below, wer islainga vaable from the primary range notation, and creating another range ofthat ist1. Creating nested anges, compare the notation with 2 ranges, except it gs alittle more complex. Ween define sub-range a any place within the primary rang and notice that we ean have wo subranges as wel By conllng the “nd” value in a rage, we erate more ranges of ditferng lengths the notation without. The sae lope applies as in base ears (Bend). (203)5 As a loge exreis, compare the two shrthands above an try to parse through how subranges and the the evlant outpet, rotation drive Make lists and get items from a listIn addition to making ists with shorthan, we can also create lists onthe Hy. These st can contain a wide range of element types and can also be queied (remember lists are objects in themselves). To summarize, with code lock you make lists with braces (ka, “curly brackets" and you query stems fom a ist with rackets (ake, “agua brackets"): (San ranceo'iw Yon’-cneapo = ler sp 3 se 1, Creat ists quickly with stings and query them using the tem index 2. Crest iss with variables and query using the range shorthand notation, And manging with nested lists is a similar process. Be awae of the ist order and recall sing multiple sets of square rackts ze > ltcen «aber angioon = sot -boo ecrom= Cee ity thes Ibstroom (tot bah 5 vrehgertor: > lyst (ecber hurenoem,sesreom.batroom) > + ott 1, Define ait of sts 2. Query alist with single bracket notation 5. Query a item with double bracket notation, Exercise Download the example fle that accompanies this exercise (Right cick and "Save Link As." A full ist of example files can be found inthe Appendix OboleteNades Sine Surfieedys In this exercise, we wl ex our new shorthand skills to erate a funky-zool enhel surface defined by sanges and Feralas During this exercise, notice how we use code block and esting Dynamo nodes in tandem: we use the codeblock forthe heavy ata ting whe the Dynamo nodes ae visually lid out for leit’ ofthe definition,Sart by crating surface by connecting the nodes above. Instead of usingamamber node to define width and length, double Click on the canvas and type 1007 ito code block, 1. Define aang: between O and I with SO divisions by typing 0.1. 450 into acode block 2. Conneet the rng into Surface PoinuttParameter, which akesw and v vals between and I aro the suis: ‘Remember to change the Lacing to Cross Produc by ight licking on the Surface PalndtParametr nod.In this step, we employ our fst function to move the grid of points up inthe Z. This gd wll rive a gered surface based on the underying futon. 1. Ad the visual nodes to the canvas a shown nthe image above 2. Rather than using formula node, we use ode Bock withthe ine: (0. (quickly break tis dow, were defining a range with a formula insie of i This formula isthe Sine function. The sine function reeves degree inputs in Dynamo, so inorder to gt afl ine wave, we multiple our x values (this s the range input from Oto 1) by 260. Next we want the sme number of divisions as control yd points for each row, 40 \we define ft subdivisions wih #80. Finally, the moliper o simply increases the amplitude of translation so fen the Dynamo Preview Sin (2360) #50) 57. To that we an se1. While the previous code bio worked ing, it wasnt completely parameti. We want to dynamically dive is peramcers, so well replace then from the previous step with 9. .Matn.Sin (x*360%eycles) ..#List.Count (x)) “amps. This gives us the bility to define thet values based on inputs, 1. By changing he sider (ranging fom 0 to 10}, we et Some interesting ess1 Changingtbe sliders agin let's us calm the waters ofthis algorithm.1. Last, lt’ query isolated parts of the data with the code black. To spunea the surface with a specific ange of pois, ad the codeblock above between the Geometry Translate and Nurbs Surface ByPoins node. This has the tne of te! sinestrips (0..15..17, Ths will sla the frst 16 rows of points (out of 50), Reeratng the surfs, ‘we can soe that weve guneratd an slated portion ofthe gid of points, 1. Inthe fina step, to make this code block mote parametri, we deve the query by usnga slide angng fom O10 ‘edo this with this ine of code: sinestrips [0.. ((list-Count (sineS=rips) 1) *u) };. This may seem confsing but the ine of code ves uta quick way to scale the length ofthe lit into 2 multiplier between 0 snd1. valu of. 53 on the sider creates a surface just past the midpoint ofthe grid 1, And as expected slider of # crests surfice fom the fll pid of pointsLooking tthe resultant visual raph, we cn high the code blocks and see each ofthe 1, The ist code black replies the Number node 2. Thesocond ode block replaces the Number Range node 3. Thethied codeblock eplaces the Formula node (aswell as List Transpase, List Count and Number Range) 44 The fourth code block queries it of fst, replsing the Lit Gtlom tinder nodeFunctions Code Block Functions Functions canbe create in a code block and recalled elsewhere in « Dyname definition, This rates another yer of entrl in & ‘paramcrc ile and canbe viewed as text-based version of a eustom node. In this eas, the "parent code bock i eadly accessible and canbe located anywhere on the graph. No wires needed! Parent ‘The fist ic has the key word “de, then the Fuetion name, the the names of input in patenhesss Braces define the body of ‘the funtion. Retum a value with “retum =". Code Blocks that define function do not have input or output ports besaue they sae called fom other Code Blocks, nes*/ Children Call the ftion with another Code Black in the same ile by givighe name and the sare number of arguments, Ie works jus ike the out-of-the-box nodes ix your lraryet Funetornane ing Aap12) vunctLontane (int, in2) Exercise Download the exmple fle that accompanies this eurcse (Right click and "Save Link As..") A ful st of eample files can be found inthe Appendix Functions Sphareliy7.dye In this excise, we wil make a generic dfnition that wil creat spheres fiom an put ist ae driven by the Z property ofeach point. points. The radius ofthese spheres {Let's begin witha number range often values spanning fom 0 1o 100. Plgthese into a Poin. 8)Coondinates nodes to create a ingonal ine1, Create a cade black and introduce ou definition by using the line of cade def spnereByZ (LnputPt) { ‘The inpuPris the name we've given to represent the pois that will rive the function. As of now, the function it oinganything bu wel build up this function nthe step to come. parr anp ey pti 1. Adingto the code block Faction, we place a comment and a sphereRadus variable which quis the Z position of yraP1.Z does not need parenetheses 8 a method, This isa query ofan existing element's cach point, Remembe, roperts, sono inputs ae nocssaryi {get & Value, use it to drive radius o sphereRadive-inpat Pt.2 sphere ere) 1. Now, a's recall the fnetion we've crete in another code Blok, IP we doubletick on the eanvas to create a new code black, and type in sphere, we nice that Dynamo suggest the sphere B)Z funtion that weve defined, Your function hasbeen addod to the inelsese library Pretty coo Seer rCnpy kc fet 1 Now wecallthe function and create a variable called Pto plugin the points crated inthe eri steps‘We notice from the output chat we have al mull values. Why this? When we defined the Function, we ae calculating the sphereRads variable but we didnot define wha the function should return san np. We can fx this in the eat step ener ene ferns) ine aprcaainy : 1. An important step, we need to define the output ofthe function by addingthe ine veturn ~ sphereRadiues tothe sphereB)z futon 2. Now we se tha the output ofthe code Blok gives ws the Z coordinates ofeach point. [Let's crete atl spheres now by editing he Part ineton‘We fist define a sphere with the line of code: sphere-sphere, 3yCenterPointRadivs (in jereRadius): 2, Nett, we change the retum vale tobe the sphere instead ofthe sphereRadias: roturr: = spheres. This gives us some giant spetes in our Dynamo preview! Perey ast) tpn vt © 1, Totemperthe ofthese spots, lets update the sphere Radia value by aldnga divider sphereRa snputPE. 2/207. Now we can sos the separate spheres and str to make sense ofthe relationship between rede snd Z valve 1. On the Poin ByCoordnaes node, by changing he lacing from Shorest List 19 Cross Product, weereata gid of paints, The sphere function ssl in fl effet, so the poins al create spheres wit radi based on Z vals,or ric 1, Ans to test the waters, we lig the oil tof rmbers into the X int for Point Be Coontinates, We now have cube of epberes 2. Note ifthis takes a longtime to calulteon your computer, try to change #70 to something tke #5. 1, Remember, the spherBhZ function weve created is a generic function, so we can recall the helix from an carer lesson and apply the futon tot(ne final step: e's drve the radi ratio with a user defined parameter. To do this, we need to create anew input forthe fustion and also replace she 20 divider with a paamete Update the sphereBy2 detiton to: i Hget 4 value, woe it to deive radius of sphere sphereRadiverinput Pt.2/radiedatior //Define output for function Updtethe children code blocks by adding rai variable to the input: sphexeByZ (Pe, cato) + Plagastider into the newly created ode block input and vary the sizeof the radi based on the radius ratio,Dynamo for Revit Dynamo for Revit While Dynamo is a exible environment, designed o pot into wide ange of programs it was orginally created for use with Revit, A visual program creates robust options for a Building Information Model (BIM), Dynamo offers «whole suite of nodes spsificaly desig for Revit, t wells thind-party ibrar from a thriving AEC community. This chapter focuses onthe basics of using Dynamo in Reviteevee gy yyy Y eee egy yy yy “afi eek ekekeREBEB “Cif KKK EKEBEEBER “Cite ekekeRg BEE “aie ek ekeekeRBEE fei ete KkekKeBEBER “fit eK eKKeKgBERBEEThe Revit Connection The Revit Connection BR Dynamo for Revit extends building information modeling withthe data and ogc environment ofa waphica algorithm editor Is Aexsilty, coupled with arobust Revit database, offers 8 new perspective for BIM, This chapter foeases onthe Dynamo workflows foe BIM, Sections ate primarily exercie-based, sine jump ngrght nt a project, isthe best way to get Fania With 2 graphical agit editor for BIM. But Fst, les talk about the beginnings ofthe program story of Dynamo ayrboielnoa i into ypesebcr airing ann? ajrrine ayrsbetcnre ‘jinn yrbcelcune . dinkeleeneeFobe aynhomnorcdse airdovtlecrew‘With addicted team of developers and a passionate community, the projet has come slong way fom its humble begining. ‘Dynamo wa orignally crested to streamline AEC workflows in Revit, While Revit creates arobust database for every pros. it
Search fr a Package: 2. Search for “Lunchilox" and download "LunchBox for Dinamo". This is realy help set of tools for geometry ‘operations sucha thi 1, After downloading you now have fll acess to the LnchBox suite Search for "Quad Grid and selet “LanchBor (Quad Grid By Face”. Plugshe paramsvic surface inc te surface input and set the U and V divisions to 15. You should ee a quad-panled surface in your Dynamo previow,you're curious about ts setup, you can double lick onthe Lunch Bor nave and ee ow it's made Back in Revit, le’ take @ quick look atthe adaptive component were wsinghere, No ned 10 follow along but ths the rot ‘panel were goingto instantiate, Is «four-point adeptive component which fa erud representation ofan ETE system, The aperture ofthe centr vod is ona paramter called "AperueRatio".1 Were shout to instantiate tof gzometry in Revit, so make sure totum the Dynamo solver to “Manual 2. Adda Famity Types node othe canvas and select “ROOF-PANEL-4PT" 53. Add an AdaptveComponen ByPoint nod to the canvas, connect Panel Pa from the "LunchBox Quad Grid by Face” output inte the pont input. Cone the Family Types nod tothe fumiSymbo inp 4. Hit Run. Revit will have to okink fora bit while the rometry is being eeated. It takes too long. reduce the code block's 73"toalower number. This wllredve the number of panel onthe 90 Noe: If Dynamo i aking long inet calle nodes, ou may want to use the "freeze nodefanctonaliy in onder o pause the ‘exceution of Revit operations while you develop your graph, For more wfermation on freezing nodes, check out the "Frezing”™ section inthe solids chap.Back in Revit, wehave thearay of panels onthe oot om ran oS ee oomingin, we ea pt a loser lok at thie surface gusts Analysis 1. Continuing from the previous sep, lego further and drive the aperture of each panel based on ite exposure to the sun, Zooming nto Revit and select one panel, we sein the properties bar tha there is a parameter called "Aperture Ratio". The fail is setup so that the aperture anges, roughly, rom 0.05 1 04S.‘Wo can reference this sun location using she SunSenings Current node. Plug the San sttings into Sunseing SunDirvcion vo gst he solar vector rom the Panel Ps used to reste the adaptive components, use lane ByBestPiTroughPonts to approximate plane forth component. (Query the normal ofthis plane Use the dot producto eaeulate solar orientation, The dt product is a formula which determines ow parlor at parallel to vectors may be So we'e taking the plane nomal ofeach adaptive component and comparing it tothe solar vector to roughly simolte sola orientation6, Take the absolute valu ofthe result. This ensures thatthe dot produt i accurate if the plane normal is fcing the reverse destin, Be 1. Lookiagat the do produc, we havea wide ange of numer. We want to use heir lative dstbution, but we mead to condense the numbers into the appropriate range ofthe “Aperture Rao” parameter we pl to di The Mah Remap Range sa eat too fo this takes an inpot list and emp its bounds into two tart values. Define the ar values 8 0.15 and 0.45 in code Block it a.1. Connse the remapped values into a HlementSetParameterByName node. 2. Connect the string "Aperture Ratio" ito the parameterName input 3, Connect the adaptive components nt the element np 4. Hit Ran, ack in Revit, fom a distance we can make out the affect ofthe solar oictation on the aperture ofthe ET FE panel Ss = oomingin, we seth the FTFF pancs are more close asthe face the sun. Our tarpet hare i to reduce overeating fom Solar exposure. IF we wanted 0 lt in more light based on solar exposure, We just have to switch the domain on Math Remap ange.Documenting Documenting ding parameters for documentation follows suit with the lessons leredin prior sections In this seton, well ook at eitng ‘paramctcs which don affist the guomstrc properties of an clement but instead prepare a Revi ile for documentation, Deviation In the exercise below, well use basi devition from plane node to create a Revit sheet for documentation. Each panel on our paramerclly defined root structure has different valve for deviation, and we want to cll ut the range of values using color and by scheduling out the adaptive points to handoff oa facade consultant, cginet, of constr. asi a ‘The deviation from plane node wil cleulate the ditance thatthe et of four points varies fom the best-fit plane between "em, This quick and easy way to study construct Exercise Download the example les tat accompanies this exercise (Right click and "Sve Link As... falls of example files ean ‘be found in the Appendix 1, Documenting 2. ARCH-Dooumenting Hasciigt Start with the Revit ile for this section (or continue from the previous section). Ths filehas an arey of ETE panes on the roo Well reference these panels fr this ens
You might also like
DynamoPrimer Print PDF
PDF
No ratings yet
DynamoPrimer Print PDF
563 pages
Dynamo Primer
PDF
No ratings yet
Dynamo Primer
43 pages
Dynamo Primer Clear Version
PDF
No ratings yet
Dynamo Primer Clear Version
657 pages
Allplan 2022 BasicsTutl
PDF
100% (1)
Allplan 2022 BasicsTutl
273 pages
Allplan 2024 NewFeatures
PDF
100% (1)
Allplan 2024 NewFeatures
99 pages
TGMAN300A
PDF
No ratings yet
TGMAN300A
496 pages
DynamoPrimer Print
PDF
No ratings yet
DynamoPrimer Print
477 pages
Bogibeel Rail-cum-Road Bridge
PDF
No ratings yet
Bogibeel Rail-cum-Road Bridge
14 pages
Manual de Programación Staad Pro 2004 PDF
PDF
No ratings yet
Manual de Programación Staad Pro 2004 PDF
553 pages
Dinamo Primer
PDF
No ratings yet
Dinamo Primer
530 pages
DynamoPrimer Print
PDF
No ratings yet
DynamoPrimer Print
569 pages
Dynamo Visual Programming For Desing
PDF
No ratings yet
Dynamo Visual Programming For Desing
57 pages
Bridge Analysis, Design and Assessment Software
PDF
0% (1)
Bridge Analysis, Design and Assessment Software
16 pages
Irc SP 65 2018
PDF
No ratings yet
Irc SP 65 2018
28 pages
AllplanBridgeGettingStarted EN
PDF
No ratings yet
AllplanBridgeGettingStarted EN
172 pages
Dynamo For Revit Design
PDF
No ratings yet
Dynamo For Revit Design
56 pages
Midas CIM: Parametric Modeling Experience
PDF
No ratings yet
Midas CIM: Parametric Modeling Experience
8 pages
Seismic Vulnerability Evaluation of Axially Loaded Steel Built-Up Laced Members
PDF
No ratings yet
Seismic Vulnerability Evaluation of Axially Loaded Steel Built-Up Laced Members
327 pages
PDF Etabs Oapi - Compress
PDF
No ratings yet
PDF Etabs Oapi - Compress
6 pages
Leap Bridge Overview
PDF
No ratings yet
Leap Bridge Overview
32 pages
Padgett Jamie e 200705 PHD PDF
PDF
No ratings yet
Padgett Jamie e 200705 PHD PDF
270 pages
Roadmap On Adoption of BUILDING INFORMATION MODELLING For Building Plan Preparation and Submission
PDF
No ratings yet
Roadmap On Adoption of BUILDING INFORMATION MODELLING For Building Plan Preparation and Submission
36 pages
1973 - Postrcracking Stiffness of Reinforced Concrete Beams in Torsion and Bending
PDF
No ratings yet
1973 - Postrcracking Stiffness of Reinforced Concrete Beams in Torsion and Bending
49 pages
Plane Stress Analysis by FEM
PDF
No ratings yet
Plane Stress Analysis by FEM
30 pages
Dynamo-Programming For Non-Programmers
PDF
100% (2)
Dynamo-Programming For Non-Programmers
44 pages
Mastering Autocad Vba: Part 1 " Vba Macros and The Visual Basic Editor
PDF
No ratings yet
Mastering Autocad Vba: Part 1 " Vba Macros and The Visual Basic Editor
1 page
Torsion of Prismatic Bars
PDF
No ratings yet
Torsion of Prismatic Bars
7 pages
Class Presentation BIM128342 Computational BIM Workshop-Advanced
PDF
No ratings yet
Class Presentation BIM128342 Computational BIM Workshop-Advanced
43 pages
Irc SP 115 2018
PDF
No ratings yet
Irc SP 115 2018
40 pages
01 Introduction of KMG
PDF
No ratings yet
01 Introduction of KMG
24 pages
Revit Structure 2013
PDF
No ratings yet
Revit Structure 2013
351 pages
Koushik - 2024 Jan - Railway CV
PDF
No ratings yet
Koushik - 2024 Jan - Railway CV
5 pages
Bridge Detailing 2.0: Computational Modelling Methods Using Civil 3D, Revit & Dynamo
PDF
100% (1)
Bridge Detailing 2.0: Computational Modelling Methods Using Civil 3D, Revit & Dynamo
18 pages
As Starting Guide 2014 en Metric 140407
PDF
No ratings yet
As Starting Guide 2014 en Metric 140407
73 pages
Lateral Pile Paper - Rev01
PDF
No ratings yet
Lateral Pile Paper - Rev01
6 pages
Direct Strut and Tie Model For Single Span and Continuous Deep Beam
PDF
No ratings yet
Direct Strut and Tie Model For Single Span and Continuous Deep Beam
15 pages
Cad 20 (S3) 2023 148-164
PDF
No ratings yet
Cad 20 (S3) 2023 148-164
17 pages
Whats New in 2025
PDF
No ratings yet
Whats New in 2025
11 pages
Transverse Load Distribution of Skew Cast-In-Place Concrete Multicell Box - Girder Bridges Subjected To Traffic Condition
PDF
No ratings yet
Transverse Load Distribution of Skew Cast-In-Place Concrete Multicell Box - Girder Bridges Subjected To Traffic Condition
13 pages
Report On Pre-Engineered Buildings
PDF
No ratings yet
Report On Pre-Engineered Buildings
22 pages
2 BNZSEE1591 Piras+et+al Modeling+of+rocking+bridge+piers
PDF
No ratings yet
2 BNZSEE1591 Piras+et+al Modeling+of+rocking+bridge+piers
17 pages
Revit Structure Package
PDF
No ratings yet
Revit Structure Package
10 pages
Bridge Engineering Major Bridges
PDF
No ratings yet
Bridge Engineering Major Bridges
56 pages
A Study On The Seismic Behaviour of A 15 Storey RCC Building Considering Base Isolator
PDF
No ratings yet
A Study On The Seismic Behaviour of A 15 Storey RCC Building Considering Base Isolator
35 pages
Behavior and Analysis of Inverted T-Shaped RC Beams Under Shear and Torsion PDF
PDF
100% (1)
Behavior and Analysis of Inverted T-Shaped RC Beams Under Shear and Torsion PDF
14 pages
04 - Structural Modelling in SAP 2000
PDF
No ratings yet
04 - Structural Modelling in SAP 2000
12 pages
Steel Box Girder Bridges-Design Guides & Methods: in Memoriam
PDF
No ratings yet
Steel Box Girder Bridges-Design Guides & Methods: in Memoriam
22 pages
Integrating Structural Design and Analysis: The Basics of A Revit-Robot Structural Analysis Workflow
PDF
No ratings yet
Integrating Structural Design and Analysis: The Basics of A Revit-Robot Structural Analysis Workflow
18 pages
Analysis of Composite Bridge Superstructures Using Modified Grillage Method
PDF
No ratings yet
Analysis of Composite Bridge Superstructures Using Modified Grillage Method
12 pages
8 Years' Worth of Dynamo and Revit Classes From 1 Speaker in 60 Minutes
PDF
No ratings yet
8 Years' Worth of Dynamo and Revit Classes From 1 Speaker in 60 Minutes
33 pages
Steel Bridge - Parametric Alignment
PDF
No ratings yet
Steel Bridge - Parametric Alignment
7 pages
Computational Logic in Structural Design2
PDF
No ratings yet
Computational Logic in Structural Design2
44 pages
Structural Drafting Model
PDF
No ratings yet
Structural Drafting Model
10 pages
Revit - Autodesk Revit Architecture 2012
PDF
No ratings yet
Revit - Autodesk Revit Architecture 2012
19 pages
PSBeam 4
PDF
No ratings yet
PSBeam 4
2 pages
Armacad Exercises
PDF
No ratings yet
Armacad Exercises
5 pages
Ref Exact Stiffness Matrix For Beams On Elastic Foundation
PDF
No ratings yet
Ref Exact Stiffness Matrix For Beams On Elastic Foundation
5 pages
Report Culvert
PDF
No ratings yet
Report Culvert
2 pages
V, Saouma FEM I PDF
PDF
No ratings yet
V, Saouma FEM I PDF
0 pages