Course info
Dec 7, 2017
2h 13m

Through an in-depth look at DesignScript, you will be able to understand how this underlying framework drives the geometry and core engines of Dynamo and how designers can use this design focused scripting language to explore and utilize parametric processes. In this course, Code Blocks, DesignScript and Custom Functions in Dynamo, you'll learn about Code Blocks and how to access data types within them. Next, you'll explore the building-blocks of DesignScript: what it is, how it relates to Nodes, what the core components of DesignScript are, how to call and nest functions, and how to leverage the power of replication guides and more. You'll finish with an in-depth look at how to create and call Custom Functions, running through the difference between Associative and Imperative graph executions, if and else statements and for and while loops, inclusive of nested loops, in order to tap into the true power of DesignScript. By the end of this course, you'll have a much greater understanding of the DesignScript framework. Software required: Dynamo.

About the author
About the author

Sol Amour is a Project BIM Manager at in London, United Kingdom. He has a broad background in Architecture, Construction, Industrial Design, and Landscaping. In London, he provides Dynamo and Revit training, bespoke content, on-site project work, and custom workflows all while striving to push the boundaries of the AEC industry.

More from the author
Exploring Dynamo Geometry
1h 54m
Nov 1, 2016
Section Introduction Transcripts
Section Introduction Transcripts

Course Overview
Hello everyone. My name is Sol Amour, and welcome to my course, Working with Code Blocks, DesignScript, and Custom Functions. I am a Project BIM Manager and Computational Designer at DesignTech in London in the United Kingdom. DesignScript, one of the underlying foundations of Dynamo, is a clear and concise scripting language built from the ground up for designers, engineers, and the AEC industry. The focus of this course will be to understand how this underlying framework drives the geometry and co-engines of Dynamo, and how we as designers can use this design-focused scripting language to explore and utilize parametric processes. Some of the major topics that we'll cover include code blocks, what they are and how to use them; core features such as data types and syntax; advanced features, such as nesting, sorting, filtration, and list manipulation, before tackling custom definition creation inclusive of looping. By the end of this course, you'll understand the core building blocks, features, and syntax of DesignScript. We will have covered the UI and guide features, explored a brief history of DesignScript, as well as learn how to create custom definitions in order to leverage the true power of Dynamo. Before beginning this course, it would be useful, but not necessary, to know Dynamo in the node-based format. I hope you will join me on this journey to learn DesignScript, with the Working with Code Blocks, DesignScript, and Custom Functions course, here at Pluralsight.

DesignScript Fundamentals
This module looks at a brief history of DesignScript, covering how it came into being and what need it was deigned to fit, as well as how DesignScript interfaces with core Dynamo. We will then look at code blocks and how to access data types within them, before exploring the fundamentals of DesignScript, what the building blocks are, how to achieve a greater degree of legibility within our code, and what data rank means and how to access particular pieces of information.

Core Components and Features
In this second module, we will cover Core Components and Features. This module specifically will cover the DesignScript UI, how it's been developed to aid in its use, the difference between a creator, an action, and a query, what the dot notation is, and how IntelliSense works. We will then explore how Node2Code converts a nodal workflow into a DesignScript one, and discuss its limitations before touching base on how it applies a default conversion and why some nodes will not convert. Finally, we will discuss operators, the bread and butter of DesignScript, and consider a few use cases and how they can interact with each other.

Leveraging Power Through Advanced Features
In this third module, we'll explore how we can leverage the power of DesignScript through advanced features. This module specifically will cover collectors, how to collect data from the Revit environment; nesting, how to write code in a more efficient manner and cut down on visual clutter; sorting and grouping to better manage the data we have; filtering to pull only relevant pieces of data out; dictionaries to understand the key value pairing relationship; before finally looking at dynamic indexing where we can both insert and get items at a particular index in a dynamic way.

Custom Callable Functions
In this fourth module, we will explore how to create custom callable functions. DesignScript, like many programming languages, gives designers the ability to create their own functions. Functions take blocks of code with clear input and returns a result. The processing that happens inside the custom functions can be either simple or complex, and simply uses the inputs to derive and return a valid ouput. Custom functions give greater legibility to end users by allowing complex calculations to happen under the hood by allowing the processing of large amounts data and by the their neatly wrapping up what could be a rather daunting expanse of code into a clean DesignScript interface. Functions are created using the def keyword. This tells DesignScript that a custom function is being created. The def keyword is followed by the chosen function name of which we will use to call the function at a later date, and the series of function inputs wrapped up inside parentheses. The code itself, which does all the heavy lifting, resides within the curly braces, and the final output is derived by assigning a value to a special keyword variable called return. Functions can only return a single value, and if we wish for multiple outputs, we must return a list of objects instead, and break them down outside the function itself.