This translation is from the eighteenth chapter of the DesignScript Language Manual and can be found at DSLM (pages 56-57) and is entitled; Looping. There also is a companion video tutorial entitled, Looping (#14), which can be found in 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 Looping. (Note that it can be not longer be found on the Autodesk Labs Website, as linked)
Continuing, open the DS Editor and create a new file, lets copy and paste the code from Chapter 18 (pages 56) into the editor. Separate the code by commenting out the “import” statements at each pasted section of code in order to generate the graphic windows results in each subsequent page of code.
Note that the DS Editor ran code from both pages of the DSL Manual, the first Loop portion has the resulting Windows Graphic illustrated next to it and the second bit of code while showing the results in the output panel, it really needs to be commented out and run separately in order to get the visual graphic result from the initial (1st) script.
Moving on, paste the same script into a blank canvas on DesignScript Studio.
Edited out the commenting out so the script will be activated, but first make sure that the “import” statements are commented out.
After commenting out the last bit of code then, the code-block is activated, and we are reminded that “Defining Language Blocks are not yet supported” in DesignScript Studio. (“Yet” would be a wonderful thing)
Developing and breaking out the script into code blocks is shown in the DS Studio canvas in it’s initial translation.
The intent of this chapter is for a code block to execute multiple times, all the while at each interval the output is evaluated and continues it’s iteration, until the condition that is expressed is met. In this case through the use of using a Boolean expression, i.e. true or false.
Since defining Language blocks are not supported the first “Loop” translation uses the libraries nodes to obtain the desired result, not really what is demonstrated as seen in the DS Editor.
Continuing the translation’s definition, once again a custom node was produced to aid us in this tutorial.
Using the DS Editor script is wrapped and made a DS file. (see previous post on Chapter 17 for a previous example)
After saving the file in the DS Editor, loaded into the subject DS Studio Looping canvas we get the graph node as shown below.
Not really an elegant solution for a work-around, anyone else want to take a stab?That would be great.
Nonetheless continuing, the more detailed and defined translation was done by naming the variables to identify and reference into them to their corresponding nodes.
Then with the naming and identifying complete, the “Node to Code” operation can take place.
(Asked to convert non-convertible types…..certainly non-elegant)
One must remember to make sure the custom node is still present in the Library, otherwise just reload it and reinitialize the code. We see that a little editing is in order as highlighted above.
The Windows Graphic that is generated from the files is shown below.
Note that colors were added in this translation, to highlight the geometry in the Graphic view window.
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.
Thanks for looking.