03 February 2019

Migrate Custom Nodes to Zero Touch nodes

Yet another time has a user problems in migrating a graph using Custom Nodes which are deprecated to the comparative Zero Touch node. It seems there still exist users who cling to to my long-gone DanEDU package which was a CN based package because it is a job to migrate it using my new ZT based package (Orchid)

I have tried if there was any possibility to add old CN nodes in my migration, but that is not possible.

However, I did try to solve this issue for the user, and figured that it is doable to do a “manually” migration using a notepad editor, and it was not that difficult...

It is a good idea to make a dummy file with the corresponding nodes you want to use because you need to know where the assemblies are stored and what the names are, the easiest is to create a graph with the nodes you know you need and then open this file in a notepad so you have the strings you need to replace values with!

The below example is from a 1.3.x graph, since the old graph most likely is from the era with the old layout before the 2.0.x versions.

The below is the node "List.Clean|DanEDU"
<Dynamo.Graph.Nodes.CustomNodes.Function guid="e4e4649b-af37-41d3-bde8-29c4e9181d4a" type="Dynamo.Graph.Nodes.CustomNodes.Function" nickname="List.Clean|DanEDU" x="281.221049098559" y="999.174659610855" isVisible="true" isUpstreamVisible="true" lacing="Shortest" isSelectedInput="False" IsFrozen="false" isPinned="false">
  <PortInfo index="0" default="False" />
  <PortInfo index="1" default="True" />
  <ID value="f39ad724-9216-46d6-9cfc-0e9bb8a71360" />
  <Name value="List.Clean|DanEDU" />
  <Description value="Remove empty list, null and blank values
- former named as RemoveNull" />
  <Inputs>
    <Input value="list" />
    <Input value="searchFor" />
  </Inputs>
  <Outputs>
    <Output value="list" />
  </Outputs>
</Dynamo.Graph.Nodes.CustomNodes.Function>

The below is the ZT node “List.Clean” in the Orchid package
<Dynamo.Graph.Nodes.ZeroTouch.DSFunction guid="f166a310-a158-4778-b709-8eb190e878c8" type="Dynamo.Graph.Nodes.ZeroTouch.DSFunction" nickname="List.Clean" x="-0.0783702393594012" y="999.174659610855" isVisible="true" isUpstreamVisible="true" lacing="Shortest" isSelectedInput="False" IsFrozen="false" isPinned="false" assembly="..\..\AppData\Roaming\Dynamo\Dynamo Revit\1.3\packages\Orchid\bin\OrchidGeneric.dll" function="Orchid.Generic.Core.List.Clean@var[]..[],var[]..[]">
  <PortInfo index="0" default="False" />
  <PortInfo index="1" default="True" />
</Dynamo.Graph.Nodes.ZeroTouch.DSFunction>
The most important part to keep is the guid mention in the first line after the function, ex. guid="e4e4649b-af37-41d3-bde8-29c4e9181d4a". The guid is the id used in the graph as the connector!
example where a “codeblock” with the connector guid="f7fc68c8-1239-46d9-848c-ef958450c6de" connects to the “List.Clean|DanEDU” node
<Dynamo.Graph.Connectors.ConnectorModel start="f7fc68c8-1239-46d9-848c-ef958450c6de" start_index="0" end="e4e4649b-af37-41d3-bde8-29c4e9181d4a" end_index="0" portType="0" />

Therefore be exceptional observant towards these guid’s!
Likewise do not change the x, y position for the node ex.
x="281.221049098559" y="999.174659610855"

REPLACE to “List.Clean” node
The first string to replace is Dynamo.Graph.Nodes.CustomNodes.Function with Dynamo.Graph.Nodes.ZeroTouch.DSFunction
-– this will replace all the CN nodes functions!!! -–
Next string to replace is nickname="List.Clean|DanEDU" with nickname="List.Clean"
Then add the assembly in the end of the line with isPinned="false">
extend this to isPinned="false" assembly="..\..\AppData\Roaming\Dynamo\Dynamo Revit\1.3\packages\Orchid\bin\OrchidGeneric.dll" function="Orchid.Generic.Core.List.Clean@var[]..[],var[]..[]">
Move on to the other nodes, replacing only the last two strings per node!
Thats it... all the other strings from the “old” node will be removed when you open the graph, then you are good to go...

Try this out by your self...

danedu nodes.dyn
danedu nodes-migrated.dyn




This post is originally published at dynamobim.org