#DesignScript LM – Chapter 12 Translation – Math

Translating maths to DesignScript Graph-Node

Hi Everyone:

This translation is from the twelfth chapter of the DesignScript Language Manual and can be found at DSLM  (pages 38-39) and is entitled; Math. There also is a companion video tutorial on Functions  (#9), which can be found in the DS website’s tutorials.

The initial translation was made on the Autodesk DesignScript Community Forum and DesignScript.org. Now it can be found at can be found at Chapter 12 Math, Translating maths to DesignScript Graph-Node. (Note that it can be not longer be found on the Autodesk Labs Website, as linked.)

Open the DS Editor and create a new file and copy and paste the code from Chapter 12 (pages 38-39) into the Editor. Run it, and observe that their aren’t any errors generated, as illustrated and highlighted below. The same can be pasted into a blank canvas of DesignScript Studio.

chapter12_Math_a-ide

chapter12_Math_a-ide

Below is what the DS Studio canvas looked like in that initial posting.

chapter12_Math

chapter12_Math

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

chapter12_Math-edited

chapter12_Math-edited

As it is developed on the DS Studio canvas the nodes take the place of the script. As noted previously there are a number of functions in the Math Library, such as Floor Ceiling Round as well as standard trigonometric functions i.e.; Sin, Cos etc. to help in manipulating data and to produce algorithms.

chapter12_Math_x

chapter12_Math_x

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

chapter12_Math_xa

chapter12_Math_xa

Also it might be noted that variations of the circle example were produced through adding additional  coordinates and accordingly were not part of the original tutorial, more of that is shown below.

chapter12_Math_xa-alt

chapter12_Math_xa-alt

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

chapter12_Math_xb

chapter12_Math_xb

The Windows Graphic that is generated from the files.

chapter12_Math_a-Graphic Window

chapter12_Math_a-Graphic Window

The alternate maths DS Studio canvas produces the Graphic Window as shown below. Color was added to highlight the various graphical reiterations.

chapter12_Math_a-Graphic Window#2

chapter12_Math_a-Graphic Window#2

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.

Chapter12_Math_ax

Chapter12_Math_x

Chapter12_Math_xa

Chapter12_Math_xa-alt

Chapter12_Math_xb

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