#DesignScript LM – Chapter 16 Translation – Imperative and Associative Blocks – Part I

Hi Everyone:

This translation is from the sixteenth chapter of the DesignScript Language Manual and can be found at DSLM  (pages 50-51) and is entitled; Imperative and Associative Blocks. There also is a companion video tutorial on – Imperative Code(#12), 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 Chapter 16 Translation – Imperative and Associative Blocks – Part I  (Note that it can be not longer be found on the Autodesk Labs Website, as linked.)

Since defining language blocks are not supported in DesignScript Studio, workarounds are going to be used to illustrate the intent of this chapter, which is allowing DS associative language to also be able to employ an Imperative one as discussed in the DSLM.

Open the DS Editor and create a new file, lets copy and paste the first page of code from Chapter 16 (pages50) into the Editor.  Run it, and observe that their aren’t any errors generated, as illustrated and highlighted below.

2015_02_08_Chp_16_Imperative&associative_blocks.ds#1

2015_02_08_Chp_16_Imperative&associative_blocks.ds#1

The same can be pasted into a blank canvas of DesignScript Studio.

2015_02_08_Chp_16_Imperative&associative_blocks#a1

2015_02_08_Chp_16_Imperative&associative_blocks#a1

Edited out the commenting out so the script will be activated, but first make sure that the imported statements are commented out.

2015_02_08_Chp_16_Imperative&associative_blocks#a1-edited

2015_02_08_Chp_16_Imperative&associative_blocks#a1-edited

Its here that we see that the DS canvas even in Block form that “Defining Language Blocks are not yet supported.” As it is developed on the DS Studio canvas the nodes take the place of the script.  Below is what the DS Studio canvas looked like in the initial translation.

Chp16_Imperative&associative_blocks_a_pg50#1

Chp16_Imperative&associative_blocks_a_pg50#1

A more detailed and defined translation was done and involved naming the variables to identify and reference into them to their corresponding nodes.

Chp16_Imperative&associative_blocks_a_pg50#1a

Chp16_Imperative&associative_blocks_a_pg50#1a

Then with the naming and identifying complete,  the “Node to Code” operation can take place.

Chp16_Imperative&associative_blocks_a_pg50#1b

Chp16_Imperative&associative_blocks_a_pg50#1b

The Windows Graphic that is generated from the files.

Chp16_Imperative&associative_blocks_a_pg50#1a-Graphic Window

Chp16_Imperative&associative_blocks_a_pg50#1a-Graphic Window

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.

2015_02_09_Chp16_Imperative&associative_blocks_a_pg50#a1

2013_10_04_Chp16_Imperative&associative_blocks_a_pg50#1

2015_02_08_Chp16_Imperative&associative_blocks_a_pg50#1a

2015_02_09_Chp16_Imperative&associative_blocks_a_pg50#1b

The second part of Chapter 16 will be in the next post.

Thanks for looking.

T!M

 

 

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s