Monthly Archives: January 2014

DesignScript Coordinate Translation #7, Code to Node

Hi Everyone:

Here is the seventh translation of the DesignScript Editor (DSE) file “CoordinateSystem.ByOriginVectors.IsSheared.”

DesignScript Editor Lite

DesignScript Editor Lite

After loading it, running it in the editor, copy it to the clipboard and open DesignScript Studio (DSS) and paste it on the blank canvas as a large Code Block. (double click on the canvas to access a code block)

DesignScript Studio

DesignScript Studio

To the right on the canvas is the pasted code from the DSE file (it’s a *.ds file). To the left is a translation of the top part of the code. As previously mentioned, working with the graph nodes and with the original code is desirable for access in ones translation however it can lead to a crash, at least on a system running windows on a mac. When working out the whole file regardless of what method that is used. Save the file frequently.

DesignScript Studio Translation

DesignScript Studio Translation

After running this it was noticed that a few improvement could be made, slight as they may be.

Capture#1

What’s missing is a description of the value 1.  Another item that is still under debate,  is whether or not further definition of true and false is desirable.

Boolean condition

Boolean condition

The updated DesignScript Studio graph is updated below.

Screenshot 2014-01-27 11.38.37

DesignScript Studio Translation updated

The original Node to Code translation is below.

Screenshot 2014-01-20 13.51.29

Now lets do the Node to Code Translation and take a look at the changes to see whether they represent an improvement.

 Partial original Node to Code view

Partial original Node to Code view

New Node to Code view

New Node to Code view

One can simply substitute a Variable number, in this case it was 40 and changed to the number 1.

Here is the whole file updated.

Node to Code DSS translation

Node to Code DSS translation

Only one Variable that is named a number. Obviously excessive at this point.

Wonder how this issue will play out with some complex files. We will see.

And below we has the Coordinate Graphic that is generated.

DesignScript Graphic Window. Standalone version.

DesignScript Graphic Window.
Standalone version.

Here are the files available for download.

CoordinateSystem.ByOriginVectors.IsSheared#7

CoordinateSystem.ByOriginVectors.IsSheared#7a

CoordinateSystem.ByOriginVectors.IsSheared#7b

Thanks for looking

T!M

 

Advertisements

DesignScript Coordinate Translation #6, Code to Node

Hi Everyone:

The next DSS example from the DSE  is “CoordinateSystem.ByOriginVectors.IsNormalized” and is the sixth file on the list.

Capture#1

After loading it into the DSE, copying and pasting it into DSS canvas we get another short and simple code to translate.

Capture#1a

After using the Library to place the nodes in the canvas (BTW if one doesn’t want to use the double-click, a right click will work as well), and entering the variables values for the coordinates in block nodes (just double-click on the canvas) one should have something similar as in the image below.

Screenshot 2014-01-20 13.38.20

To complete and refine the translation edit the variable code blocks and add a variable name. Use the Driver Block from the Library as before to do this.

Screenshot 2014-01-24 18.28.09

 
Coordinate System By Origin Vectors Is Normal #6

One must be pretty careful to make sure that the variables are named with an appropriate designation.

Node to Code Translation

Node to Code Translation

Here is an error that was caught before making a node to code translation.

Capture#2

One can see the results that were on the DSS Graph nodes, but was missed.

Capture#4

Trying to make as descriptive improvement on Var 43=False is illustrated below.

As it appears in the translation from node.

Capture#8

As it appears on the DSS Graph Node Canvas.

Capture#5

And the edited versions, first the Graph Node Window.

Capture#7

Then the results in the Node to Code Translation below.

Capture#9

This isn’t really much of a improvement but it does illustrate how to clarify the translation and the naming process.

Screenshot 2014-01-25 20.34.27

Screenshot 2014-01-15 18.26.41

Here are  the files available for download.

CoordinateSystem.ByOriginVectors.IsNormalized#6

CoordinateSystem.ByOriginVectors.IsNormalized#6a

CoordinateSystem.ByOriginVectors.IsNormalized#6b

Thanks for looking.

T!M

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

 

 

DesignScript Coordinate Translation #4, Code to Node

Hi Everyone:

On to the fourth file, find it in the DesignScript Editors (DSE) opening program window, Coordinate System. By Cylindrical Coordinates.

CoordinateFile#4

Just click on it and it will load the file in the Editor. After it’s loaded the file look like this.

(partial screen view below)

CoordinateFile#4a

It might be best to first run the file and see the resulting Graphic window. (Note that this is being done without AutoCAD, it is being used in it’s standalone capacity.) Also, one might want to see if the file has any anomalies or errors which will show up, so run the program in debug mode.

After running it, copy it and run the DesignScript Studio(DSS) program and open a new blank canvas. Double click on the canvas and paste the code text on the resulting Block node.

On the left one sees the subject code. It’s been commented out  (/* code */ ) so that it doesn’t actualize and run. Also note that the “ import (“ProtoGeometry.dll“);”  at the top of the text must be deleted if one wants to run the code in DSS.

 

Screenshot 2014-01-20 11.41.05

As seen here, only the top part of the code is translated into DSS graph node form on the canvas. The” Guaranteed properties for Coordinate System” were not translated here due to a possible OS instability.   Not sure what others are experiencing running these files because this was done running a Mac with Windows 7  (64 bit) running VMware fusion and it was necessary to create a new file to complete the translation.

Screenshot 2014-01-20 11.36.09

The file then was selected by a bounding box on the DSS canvas and translated back again to Code. (Node to Code)

Screenshot 2014-01-20 11.35.10

Note the absence  of unnamed variables, thus making the code more legible.

Screenshot 2014-01-15 16.52.36

And there we have it  CoordinateSystem.ByCylindricalCoordinates.

CoordinateSystem.ByCylindrical.Coordinates#4a

CoordinateSystem.ByCylindrical.Coordinates#4b

CoordinateSystem.ByCylindrical.Coordinates#4

Thanks for looking,

T!M

DesignScript Coordinate Translation #3, Code To Node

Hi Everyone:

Once again,  here is the next  DesignScript Translation which can be found from the DS Editor program opening window when the program is run. DesignScript, a Autodesk standalone free program (or can be run as  plugin for AutoCAD), can be downloaded from  DesignScripts new home.

After posting these past two example translations and further climbing into the nuances of the example files,  one begins to see the intent which wasn’t quite previously understood.

CoordinateSystem.AtParameter.UpVector#3

To the left on the image of the Graph Node window one can see inserted code notation (commented out) from the DesignScript Editor (DSE). It’s commented out because if it executes it will execute and the Graph Node version will run as well…this inevitably will cause a unstable environment and consequential crashes.

Capture2

Notice the variable names; startPoint, pointOnCurve, endpoint, if one doesn’t have some sort of identifiable name then one will get names like Var10 or Var21 etc. It then will become difficult to identify what one is doing code wise. Looking at the original DS Editor file one notices this naming convention (see below)

Screenshot 2014-01-23 14.07.36

This is what it looks like after copying and pasting it into the DS Studio Graph Window. (below)

Capture1

So this is what the “myCSOrigin”…”myCSx”…”myCS”…y etc. is about, without it one tends to get lost in identifying and associating the bits of code (and node).

So consequently, this is what the DSS file  “CoordinateSystem.AtParameter.UpVector.bin looks like when played out in a faithful translation (see below).

Screenshot 2014-01-22 15.46.19

Here is the file in yet another form…the infamous (just joking) “Node to Code” form (see below).

Screenshot 2014-01-22 15.44.43

Finally here is the image from the Graphic Window. (Note  please that this is generated from the standalone version) (see below)

Screenshot 2014-01-14 17.49.12

Here are the links to the files for download.

CoordinateSystem.AtParameter.UpVector#3, 3a & 3b.

https://www.dropbox.com/s/1ly6ob0k3cztp8f/2013_12_16-CoordinateSystem.AtParameter.UpVector%233.bin

https://www.dropbox.com/s/5i6strw2rsu5ckq/2014_01_13-CoordinateSystem.AtParameter.UpVector%233b.bin

https://www.dropbox.com/s/vfln2zhqhc5zptp/2014_01_13-CoordinateSystem.AtParameter.UpVector%233a.bin

More later,

Thanks for Looking

T!M

DSS Coordinate Translation #2

Here is the next  DesignScript Translation which can be found from the DS Editor program opening page. If you haven’t started to run DesignScript and wish to follow along you will have to go and get it from  DesignScripts new home , then open DS Editor and find the “Coordinate .At Parameter.Surface” file on the opening page (2nd file in the Sample section) of the Editor and run it.

The translation that was done to the DS Editor (*.ds) file to the DS Studio (*.bin) file can be found below, it’s located in a dropbox folder (so you know when you click on it you will open a new page).

(BTW both DS programs are in the in the same package that one downloads)

This is same file that was used in the DesignScript Language Manual for a couple of the tutorials. http://designscript.org/manual.pdf  Some deviations were used to get the desired results.

Thanks for looking

T!M

-CoordinateSystem.AtParameter.Surface#2a

 

Screen Shot 2014-01-12 at 5.22.20 PM

Screen Shot 2014-01-12 at 5.23.16 PM

2014 – first post and not from the garage #1

Hi Everyone:

After spending a good deal of time over at the Autodesk Labs DesignScript forum (http://forums.autodesk.com/t5/DesignScript/bd-p/DesignScript), slowly learning the program and posting translations of the DesignScript Language manual (http://designscript.org/manual.pdf ),  I thought I’d start a blog about it and other subjects as I continue architecting away.

For one thing I thought that I could post some of the files and make them available to download. Admittedly learning visual programming can be somewhat tedious and some of the tutorials deserve more or less attention.

When one loads the Free DesignScript Program on their Windows  (64 bit) operation system and runs the DesignScript Editor (Lite in my case) , additional “Sample” files for learning are visibly accessible.

DesignScript Editor Lite

DesignScript Editor Lite

C:\ProgramData\Autodesk\ApplicationPlugins\DesignScript.bundle\Contents\Resources\Samples\Geometry\CoordinateSystem\CoordinateSystem.AtParameter.ds

From there these files can be run in the DS Editor. In this Blog those files will be translated into the Visual DesignScript Studio Program and will go from “Code to Node”, similar to the translation that was done with the DesignScript Language manual.

Screen Shot 2014-01-11 at 10.09.33 PM

Screen Shot 2014-01-11 at 10.12.46 PM

2014_01_09-CoordinateSystem.AtParameter#1a

Here is the first file translation from above DesignScript Editor type file (*.ds) to DesignScript

Studio type file(*.bin)  Down load it from the link below and run it in DesignScript Studio to get the node-graph  translation. Let me know if you have any further modifications…that would be great.

Coordinate System at Parameter

Lets see how this works for starters.

Just to let everyone know…normally I spend half my time in the garage and the other half in the office.  I’d spend the morning at the office desk doing the conventional and in the afternoon I’d work (tinker) in the garage. I’ve been spending a bunch of time in the office learning DesignScript. I’ve been neglecting the garage…so more later.

Thanks for looking

T!M