Hi Everyone:
This translation is from the twenty-first chapter of the DesignScript Language Manual and can be found at DSLM (pages 62-63) and is entitled; Collection Rank and Jagged Collections. There is a previous video tutorial on collections which may help with this chapter and can be found on the DS website’s tutorials.
The initial manual translation was made on the Autodesk DesignScript Community Forum and DesignScript.org. Now it can be found at can be found at Collection Rank and Jagged Collections. (Note that it can be not longer be found on the Autodesk Labs Website, as linked)
Continuing on, open the DS Editor and create a new file, lets copy and paste the code from Chapter 21 (pages 62 &63) into the editor. Run the code in Debug mode and step-in and step-out.
The above illustration is of the DS Editor and shows the results of the code being run, pasted in for reference, with the corresponding scripts being noted as 1,2 &3.
We can see that as intended, that the second script draws an error as adding a collection to an integer fails, appropriately so…although take care to add the highlighted parenthesis as shown below, otherwise the script will not execute properly.
Moving on, paste the same script into a blank canvas on DesignScript Studio.
Edited out the commenting out so the script will be activated.
Again we see that “defining language blocks are not supported” for the imperative portion of the script. (marked #2 in the DS Editor illustration above and on the top of page 62.) A work-around method is used in the DS Studio canvas to get a return on the code.
Developing and breaking out the script into code blocks is shown in the DS Studio canvas in it’s initial translation.
Continuing on with the more detailed and defined translation with the naming of the variables to identify and reference into them to their corresponding nodes.
Since we are dealing with collections it might be noted here that there isn’t a graphic Window counterpart with geometry displayed, but it’s noted that the canvas does return a value.
Then with the naming and identifying complete, the “Node to Code” operation can take place.
We see that editing is in order as highlighted above with the results displayed below.
Reiterating, this was done on the stand-alone version of DesignScript, rather than as a plugin for AutoCAD. The files are available for downloading from the Drop-Box links below.
2014_03_03-Chapter 21 Collection Rank & Jagged Collections#a1
2013_10_29-Chapter 21 Collection Rank & Jagged Collections#1
2014_03_03-Chapter 21 Collection Rank & Jagged Collections#1a
2014_03_03-Chapter 21 Collection Rank & Jagged Collections#1b
Thanks for looking.
T!M