DesignScript Coordinate Translation #5, Code to Node

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.

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.

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

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.

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.

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.

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.

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.

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.