DesignScript Coordinate Translation #5, Code to Node

Hi Everyone:

If these posts seem redundant then you know your learning… LOL.  The next DSS example from the DSE  is “CoordinateSystem.ByOriginVectors”, the fifth file on the list.

Capture#5d

DesignScript Coordinate Translation #5, Code to Node

After opening the file,  copy it, then open DSS to a blank canvas and paste the code into a code block on the canvas.

Again note, if one wants to run the file in DSS then after pasting it into the canvas be sure to delete “import(“ProtoGeometry.dll”) from the canvas. As mentioned previously, commenting out either the whole code with” /* “at the beginning of code & at the end of the code ” */ ” to render it invisible to the program. Another method is to use “//” at the front end of each line of code.

Capture#5e

Screenshot 2014-01-20 12.24.37

This portion of the script can be quickly translated using the Library on the DSS canvas. It’s pretty short and straightforward. (see below)

Capture#5f

What one can do accomplishing this portion of the translation is save the file and then do a “saveas”…in this case CoordinateSystem.ByOriginVectors#5a. Then generate the additional code various properties.

Screenshot 2014-01-22 16.10.58

Now lets take a look at some of the changes that can be made to make the script more legible both in graph node form and especially in code form.

Capture#5c

Access the Library and search for driver node. Double click on it and place it in the canvas. In this case we have Var41… (variable 41) with a value of 0. Edit it to look something like below.

Capture#5b

The reason for doing this is to eliminate the Var41 name to something more informative. Note also that the WCS coordinate system identity was added to the opening node. This was done for the same reason.

Capture#5a

This may seem pretty tedious, which it is at the moment but it might very well be worthwhile in a large and more complex file.

Screenshot 2014-01-22 16.10.23

Notice above how the Graph node file reads now when translated back into Code form. See “Node to Code” in the  DesignScript Language Manual . (page 83) Much more informative than a bunch of Var41..38..01..etc. Still one can edit a Var41 to another identity as long as there is consistency in the code.

Screen Shot 2014-01-15 at 5.48.00 PM

CoordinateSystem.ByOriginVectors#5b

CoordinateSystem.ByOriginVectors#5a

CoordinateSystem.ByOriginVectors

Not much of a Graphic…but the question is about learning something.

Hopefully.

Thanks for looking

T!M

 

 

Advertisements

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 )

Google+ photo

You are commenting using your Google+ 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 )

w

Connecting to %s