#DesignScript LM – Chapter 24 -Part I: Intersection, Trim, and Select Trim

Hi Everyone:

Having looked at the precursor to this chapter (part 1a), in the previous post and the very long translation, its time for a bit of code, to create a efficient compact DSS translation. But first a little introductory housekeeping.

This translation is from the twenty-fourth chapter of the DesignScript Language Manual and can be found at DSLM  (pages 70-73) and is entitled;  Intersection, Trim, and Select Trim. There is a companion video tutorial on Trim & Intersection(#17) which can be found on the DS website’s tutorials.

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 24: Intersection, Trim, and Select Trim, Part #1(Note that it can be not longer be found on the Autodesk Labs Website, as linked)

Copy and paste the script from (page 71) the Design Script Language Manual into the DesignScript Editor.  Below shows the script in the  DS  Editor with the results of the code being run, and the window graphics inserted alongside for reference.

Chp_24 Intersection, Trim, and Select Trim_ds#1

Chp_24 Intersection, Trim, and Select Trim_ds#1

Now open DesignScript Studio and paste this same script into the canvas.

Chp_24 Intersection, Trim, and Select Trim#1.a1

Chp_24 Intersection, Trim, and Select Trim#1.a1

Note script is inactive as it has been commented out.

Chp_24 Intersection, Trim, and Select Trim#1.a1-edited

Chp_24 Intersection, Trim, and Select Trim#1.a1-edited

The script is then run, with the editing as shown above. At this point, as shown in the previous post, when the script is further translated into nodes, an error is drawn and the file fails. So, what must be done is to create a custom node which will satisfy the translating requirements.

The translate graph node is substituted by the newly created DS file.

def PointTransporter : Point[][](points : Point[][])
{

points[1][1] = points[1][1].Translate(0, 0, 2);
points[
8][1] = points[8][1].Translate(0, 0, 2);
points[
2][6] = points[2][6].Translate(0, 0, 2);
return = points;

}

Enter & Save the above code in the Design Script Editor, which was named “PointTransporter” and added to the DSS library.

PointTransporter

PointTransporter

This results in the number of graph nodes being reduced significantly to generate a very complex surface with “bumps” and is quite responsive to the BSplineBySurface node command.

Chp_24 Intersection, Trim, and Select Trim#1a

Chp_24 Intersection, Trim, and Select Trim#1a

The initial DSS translation is shown below.

Chp_24 Intersection, Trim, and Select Trim#1

Chp_24 Intersection, Trim, and Select Trim#1

Continuing on with the more detailed and defined translation with the renaming of the variables, identifying and referencing them with their corresponding nodes.

Chp_24 Intersection, Trim, and Select Trim#1a

Chp_24 Intersection, Trim, and Select Trim#1a

As a reminder, selecting the graphic window one can get an enlarged view of each snapshot.

Continuing on to the “Node to Code” operation.

Chp_24 Intersection, Trim, and Select Trim#1b

Chp_24 Intersection, Trim, and Select Trim#1b

The Graphic Window(s) that result from the script is shown below.

Chp_24 Intersection, Trim, and Select Trim#1a-Graphic Window

Chp_24 Intersection, Trim, and Select Trim#1a-Graphic Window

Chp_24 Intersection, Trim, and Select Trim#1a-Feature Image

Chp_24 Intersection, Trim, and Select Trim#1a-Feature Image

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.

2015_03_26-Chp_24 Intersection_Trim_SelectTrim#a1

2013_11_25-Chp_24 Intersection_Trim_SelectTrim#1

2014_03_22-Chp_24 Intersection_Trim_SelectTrim#1a

2014_03_22-Chp_24 Intersection_Trim_SelectTrim#1b

2015_03_26-Chp.24-Intersection_Trim&Select_Trim.ds#1

The next post on this chapter will continue with the trimming of the surface.

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