Advertisement

Tuesday, April 17, 2018

Dynamo v2.0

From the Dynamo website:

By Racel Williams
April 16, 2018

Today is the day! After a long wait, the much anticipated Dynamo 2.0 is finally here.

Dynamo 2.0 is a special and significant release for our team as it is a “major” release, but more importantly because it contains features and changes that will make desktop to web workflows possible in the future.

What’s so special about a “major” release?

As mentioned above and in previous blog posts, Dynamo 2.0 is a “major” release and this means several things:
  • Files (dyn and dyf) will be saved in a format that is not compatible with earlier versions of Dynamo. Dynamo 2.0 graphs and custom nodes can not be opened in 1.x.
  • Dynamo 2.0 can be installed side-by-side with an existing 1.x version allowing you to have control over which major version your project uses. In Dynamo for Revit, you will be prompted to choose which version you wish to run on first launch of Dynamo. This setting is cached per-session of Revit. A restart of Revit will enable you to change to a different version of Dynamo.


  • Since Dynamo 1.0, we have followed semantic versioning rules which means breaking API changes have been made in this release which may affect your existing packages and graphs that were compatible for 1.x. Take a look at our wiki for more info on Dynamo versioning.

Is Dynamo 2.0 shipping with other Autodesk software yet?

Dynamo 2.0 is currently not shipping with Revit or Advance Steel as our release schedules do not align yet. However, we will be offering the direct installer of Dynamo 2.0 on dynamobim.org/download and  dynamobuilds.com. For Revit installations, 2.0 is compatible with 2017, 2018, and 2019.

Fun fact, if you are a user of Alias 2019, you already have Dynamo 2.0! Welcome to the Dynamo family Alias users!

Will my 1.x package run on 2.0?

While most 1.x packages will work just fine on 2.0, due to the breaking API changes that have been made in this release, it is possible that you may run into some issues. We suggest that you test out your workflows and packages to ensure compatibility.  As we have said in the past, package developers should consider posting the version information of their packages to reflect the Dynamo builds they were made against. (Check out Mesh Toolkit for a clear version history matched to Dynamo builds). A few notes for package developers:
  • In general, existing zero-touch node implementations should be unaffected. But, if your zero-touch nodes reference Dynamo Core libraries which have changed, you may need to update your references and recompile.
  • NodeModel UI nodes will require additional JSON constructors.
  • The introduction of the new dictionary and list syntax may cause issues with ZeroTouch inputs, specifically for default arguments. When opening graphs, migration of 1.x lists to the new 2.0 syntax will be done for all cases except for default argument attributes in ZeroTouch nodes.
  • Custom nodes created in 1.x in the XML format should continue to work in 2.0. However, it is recommended that you test out these nodes to maintain functionality and migrate them to JSON when possible for compatibility with future versions of dynamo.

For more info, check out the list of API changes in Dynamo 2.0.

Are desktop to web workflows already possible?

Not yet, but we are working on it. The Dynamo Team has been working hard behind-the-scenes on new technologies that support distributed cloud computing and interconnected workflows between applications. These new technologies that we are working on could transform your user experience by allowing for potentially more performant and efficient computing of graphs, more flexibility in how you can share and manage scripts across your teams through real-time collaboration, and the ability to access an online repository of services/scripts/workflows. So, while we have not publicly released these technologies, Dynamo 2.0 does contain several features that will make it possible in the future for you to easily work back and forth between the existing desktop environments and these new web-based resources. To allow for compatibility with the web in the future, the following  web-compatible changes are featured in Dynamo 2.0:
  • FILE FORMAT: Dynamo 2.0 has changed from an XML based file format to JSON to facilitate future use and reuse of Dynamo graphs in non-Windows, web-friendly environments. One particular feature of this change is the separation of user interface descriptions (where is the node, what does it look like) from the business logic of the graph (what does the script do).  In the future, this will allow for cleaner reuse of Dynamo graphs in headless or other non-node editing contexts like batch processors or Dynamo Player-like interfaces. See below for more details.
  • NODE LIBRARY: The library is now a web component that we plan on utilizing in both the desktop and web environments. See below for more.
  • DESIGNSCRIPT LANGUAGE CHANGES: Several DesignScript changes have been made to simplify the language for easier maintenance and increasing legibility across both local compute and in distributed cloud compute system. Some of the changes are explained below. See the wiki for a list of changes.

What’s new with Dynamo 2.0?

FILE FORMAT: As mentioned above, the file format has changed from being XML-based to JSON. This was done to align the desktop file format with the new schema we are using in our cloud compute environments. With the exception of some deprecated functionality, all information in 1.x files will be preserved and migrated to the new 2.0 format on load. To prevent data loss, a copy of the 1.x file will be saved in your specified backup location as [original_Name]_xml.dyn.


NODE LIBRARY: You may have noticed that the library looks different than previous versions. Aside from the library being web-compatible, several significant updates have happened with the user interface and with how nodes are organized to make it easier for both new and existing users to browse for the nodes:
  • All non-out-of-the-box nodes (custom nodes, packages, dlls) will appear in a separate section called Add-ons.
  • You can now resize and collapse the library by dragging the right edge of the library panel. You can completely collapse the library by dragging the right edge all the way to to left side of the Dynamo window.
  • There has been significant reorganization of the library. We have removed confusing categories like “Core” and “BuiltIn”, and organized sub-categories and classes to reflect dependencies or make it easier to browse groupings of nodes.


AUTO LACING: Dynamo 2.0 introduces the “Auto” lacing option. Shortest lacing now more strictly stops lacing with single items matched with lists for more precise control of data structures and clearer alignment with DesignScript replication syntax. The new default “Auto” lacing will match single items with lists as the “Shortest” behavior did in previous releases.  Existing 1.x “Shortest” lacing settings will be mapped to “Auto” when the graph is loaded in Dynamo 2.0.  The image below shows the difference between “Auto” and “Shortest” lacing.


PYTHON UPDATES: As many of you know, Python scripts can play a significant role in a Dynamo workflow allowing for a way to easily and quickly extend Dynamo beyond its core functionality.  Dynamo 2.0 introduces some new interactions that will make it easier for you to work with Python:
  • Multiple Python editor windows can now be opened at once to make it easier for you to work with multiple Python scripts at the same time.
  • A “Run” button has been added to the Python editor window to allow for re-execution of the python node and any nodes downstream of it without having to exit the Python window.
  • The Python editor window title and the Python node’s title will now match.
  • Python templates are now supported that can be used to populate any Python script nodes that are added to the workspace. Dynamo will check in the user location root %appdata%/Dynamo/Core/{version}/  for a file called “PythonTemplate.py” to see if it can populate the Python nodes. Thanks Radu Gidei for the contribution.

DESIGNSCRIPT LANGUAGE CHANGES: The following items have been changed to make Designscript more legible, more predictable, and easier to maintain:
  • Unify List@Level syntax to more closely match the UI found in nodes, preview bubbles, and watch nodes. For example, @-2 will now be @L2.
  • To reduce ambiguity about what function is being called, you will need to be more precise about the data you pass into a node. Before functions that share the same method like Geometry.Translate and  FamilyInstance.Translate would look at the first item of the list being passed into the function and try to look for the correct method call.  It then would replicate over that method for the rest of the items in the list. This would lead to problems in lists with heterogeneous data. For instance, prior to this change, FamilyInstance.Translate would take in any geometry and translate. Now, you must be precise about what type of data you use as your input for these type of nodes.
  • Nodes that have the same name as another method but only differed in parameter rank have been cleaned up. For instance, if there were two nodes that were both named “foo”, but one of them took in a list and the other took in a single item, the node that only took in a single item would be deprecated. This is to reduce the redundancy in the node library and make it easier to support in the future.
  • “=” is no longer required in for return statements in function definitions or imperative code. This should make it easier for you to write DesignsScript in code blocks without needing to remember if this syntax is required. For example, you can write simply return x; rather than return = x;
  • Variables are immutable in code blocks. If you use a variable like “x” in a code block, you cannot redefine “x” again in the same code block.
  • Variables defined in imperative blocks will be local to imperative block scope. Cross-talk between variables defined inside and outside of Imperative blocks will no longer be allowed, because this previously led to unpredictable behavior and instability.
  • Single items are no longer promoted to lists automatically. This is to prevent the creation of unnecessary, extraneous list structures. For instance, if you have a list of numbers and a single number in a cross lacing situation, you will now have a flat list rather than a nested list.


DICTIONARIES: Dynamo 2.0 introduces the concept of separating the dictionary data type from the list data type. This change can pose some significant changes to how you create and work with data in your workflows. Prior to 2.0, dictionaries and lists were combined as a data type. In short, lists were actually dictionaries with integer keys.
  • What is a dictionary?  A dictionary is a data type composed of a collection of key-value pairs where each key is unique in each collection. A dictionary has no order and basically you can “look things up” using a key instead of an index value like in a list. In Dynamo 2.0, keys can only be strings.
  • What is a list? A list is a data type composed of a collection of ordered values. In Dynamo, lists use integers as index values.
  • Why was this change made and why should I care? The separation of dictionaries from lists introduces dictionaries as a first-class citizen that you can use to quickly and easily store and lookup values without needing to remember an index value or maintain a strict list structure throughout your workflow. During user testing, we saw a significant reduction in graph size when dictionaries were utilized instead of several “GetItemAtIndex” nodes.
  • What are the changes?
    • Syntax changes have occurred that change how you will initialize and work with dictionaries and lists in code blocks.
      • Dictionaries use the following syntax {key:value}
      • Lists use the following syntax [value,value,value]
    • New nodes have been introduced to the library to help you create, modify, and query dictionaries.
    • Lists created in 1.x code blocks will automatically migrated on load of the script to the new list syntax that uses square brackets [ ] instead of curly brackets { }

Be on the lookout for more documentation on dictionaries soon!


NEW NODES AND NODE UPDATES: Thanks in large part to our community contributors, we even have some new nodes and added functionality in Dynamo 2.0 including:
  • Color Picker node (Thanks Adam Sheather)
  • File.AppendText (Thanks again, Radu Gidei)
  • GetDirectory Contents with recursive access to subfolders (Thanks again and again, Radu Gidei)
  • Updated ImportExcel node to suppress launching of Excel window (Thanks Dimitar Venkov)
  • Modulo operator (%) now follows the standard behavior of Python, Excel, and Google calculator, returning a modulo which follows the sign of the divisor.


THE RETURN OF THE SANDBOX: For those of you who have missed Dynamo Sandbox, it is now delivered with the 2.0 installer in “Program Files\Dynamo\Dynamo Core\2”.

So, what’s missing in Dynamo 2.0?

Unfortunately, every release comes with its share of functionality that needs to be cut for the sake of clarity, maintainability, and ease-of-use of the system. The following while great in their heyday, will sadly be missed in Dynamo 2.0. Let’s have a moment of silence for the following features:
  • Presets (Fear not, we are working on more optioneering features in our new technologies)
  • Preview Upstream (We don’t know what this did either….just kidding…but really just kidding)
  • Saved pin state: The Preview Bubble pin state is not persisted in 2.0 graphs. Graphs saved in 2.0 will always open with preview bubbles closed.
  • NewtonRootFind1DNoDeriv and NewtonRootFind1DWithDeriv are removed from Dynamo core libraries.
  • Drag and drop of nodes from the library to specific locations in the canvas is no longer supported.
  • Redundant nodes have been consolidated. For example, instead of List.Flatten and Flatten, or List.Count and Count, there is simply List.Flatten and List.Count.
  • Custom nodes cannot be located among out-of-the-box nodes and categories.
  • Revit Model Curves, Detail curves, Tags, and Text notes that are selected are no longer automatically rendered in geometry previews. This is by design to make them consistent with other Revit elements and prevent certain crashes. Users can still use Element.Geometry and Element.Curve to visualize the curves. Tags and Text notes do not have real geometry to visualize as they are View specific elements.

Are you ready?

So, I’m out of breath. That’s Dynamo 2.0 in a nutshell. Obviously, I had to skip a few things. For more info on other minor features, bug fixes, known issues, and bugs that you will encounter with Dynamo 2.0, check out our Release Notes.

Additionally, look out for more documentation to come out soon related to the new features and how to develop in Dynamo 2.0.

Thanks again to everyone who contributed to the release and to the entire Dynamo community for continuing to support our work. We hope you get a chance to try out Dynamo 2.0. And as always, please let us know if you have any feedback or suggestions!



Dynamo is brought to you by Autodesk. It's free.

There's more information available on the Dynamo website.


No comments: