#DesignScript LM – Chapter 20 Translation – Modifier Stack and Blocks

Hi Everyone:

This translation is from the twentieth chapter of the DesignScript Language Manual and can be found at DSLM  (pages 60-61) and is entitled; Chapter 20: Modifier Stack and Blocks.

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 20, Modifier Stacks & Blocks.  (Note that it can be not longer be found on the Autodesk Labs Website, as previously linked.)

Continuing on, open the DS Editor and create a new file, lets copy and paste the code from Chapter 20 (pages60 & 61) into the editor. Separate the code by commenting out the “import” statements at each pasted section of code. Run the code in Debug mode (step-in and step-out) in order to generate the graphic windows results in each subsequent page of code. Each graphic result has been pasted along side of the script for reference.

Chapter 20_Modifier Stack and Blocks-ds

Chapter 20_Modifier Stack and Blocks-ds

Note that the DS Editor ran code from both pages of the DSL Manual. Moving on, paste the same script into a blank canvas on DesignScript Studio.

Chapter 20_Modifier Stack and Blocks#a1

Chapter 20_Modifier Stack and Blocks#a1

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

Chapter 20_Modifier Stack and Blocks#a1-edited

Chapter 20_Modifier Stack and Blocks#a1-edited

After commenting out the import statement and the code-block is activated we see that Modifier Blocks are not supported currently ,” so “this example was altered to include the steps without the associative updating to the elements as evident when run in the DesignScript Editor.” (from previous forum posting on the DesignScript.org site)

Chapter 20_Modifier Stack and Blocks#1

Chapter 20_Modifier Stack and Blocks#1

The first translation (page 60) shows the script “stacking transformations” yet keeping the elements initial relationship intact for use in forthcoming operations.

Chapter 20_Modifier Stack and Blocks#2

Chapter 20_Modifier Stack and Blocks#2

The second translation (top page 61) illustrates the use of the cube as a temporary variable to modify itself sequentially.

Chapter 20_Modifier Stack and Blocks#3

Chapter 20_Modifier Stack and Blocks#3

The third translation as illustrated above attempts to emulate the use of Modifier Blocks (which are not supported).  The intent is to eliminate the redundancy of naming the cube repeatedly, while allowing further object description. Continuing on with the more detailed and defined translations with the naming of the variables, identifying them and referencing them into their corresponding nodes. This is shown sequentially for each of the above corresponding (1,2,3) graph node canvases.

Chapter 20_Modifier Stack and Blocks#1a

Chapter 20_Modifier Stack and Blocks#1a

The first again utilizes “Stacking Transformations.”

Chapter 20_Modifier Stack and Blocks#2a

Chapter 20_Modifier Stack and Blocks#2a

The second example utilizes the cube as a “Temporary Variable.”

Chapter 20_Modifier Stack and Blocks#3a

Chapter 20_Modifier Stack and Blocks#3a

And the third attempts to show the intent of the “Modifier Block.”

With the naming and identifying complete for each of the translations,  the “Node to Code” operation can take place. Here they are once again sequentially.

Chapter 20_Modifier Stack and Blocks#1b

Chapter 20_Modifier Stack and Blocks#1b

We see that a little editing is in order for the first translation as highlighted above.

Chapter 20_Modifier Stack and Blocks#1b-edited

Chapter 20_Modifier Stack and Blocks#1b-edited

The second Node to Code is shown below.

Chapter 20_Modifier Stack and Blocks#2b

Chapter 20_Modifier Stack and Blocks#2b

And see the third Node to Code below.

Chapter 20_Modifier Stack and Blocks#3b

Chapter 20_Modifier Stack and Blocks#3b

The Window Graphics that is generated from the files is shown below.

#1

Chapter 20_Modifier Stack and Blocks#1a-Graphic Window

Chapter 20_Modifier Stack and Blocks#1a-Graphic Window

#2

Chapter 20_Modifier Stack and Blocks#2a-Graphic Window

Chapter 20_Modifier Stack and Blocks#2a-Graphic Window

#3

Chapter 20_Modifier Stack and Blocks-#3Graphic Window

Chapter 20_Modifier Stack and Blocks-#3Graphic 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.

2014_02_25-chapter-20-Modifier Stack&Blocks#a1

2014_02_21-chapter-20-Modifier Stack&Blocks-pt#1

2014_02_21-chapter-20-Modifier Stack&Blocks-pt#1a

2015_02_26-chapter-20-Modifier Stack&Blocks-pt#1b

2014_02_21-chapter-20-Modifier Stack&Blocks-pt#2

2014_02_21-chapter-20-Modifier Stack&Blocks-pt#2a

2014_02_21-chapter-20-Modifier Stack&Blocks-pt#2b

2014_02_21-chapter-20-Modifier Stack&Blocks-pt#3

2014_02_21-chapter-20-Modifier Stack&Blocks-pt#3a

2014_02_21-chapter-20-Modifier Stack&Blocks-pt#3b

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