Week 4

Week 4 (11/15): ASSEMBLY / AUTOMATION

  • Class: 7-9 | Tutorial: 9-10
  • Due: Full-scale physical prototype
  • Due: An updated drawing or sketch
  • Due: Scripting concept
  • Lecture: Assembly/Automation
  • Lecture: Rhino.Script
  • Desk crit sign up

http://www.contemporist.com/2010/10/30/lasercut-lampshades-by-stellavie/#more-22143

Option Explicit
‘Script written by mark.bearak
‘Script copyrighted by parametric.realizations
‘Script version Monday, November 15, 2010 6:50:51 PM

Call Main()
Sub Main()
 ‘declare all variables
 Dim i, j, dblRndX, intXMax, dblRndY, intYMax, dblRad, intRadMax, intRadMin, intNewY
 Dim dblOff : dblOff = 0.5
 intXMax = 75
 intYMax = 12
 intRadMax = 3
 intRadMin = 0.5

 ‘run 20 iterations
 For j = 0 To 20
  intNewY = intYMax*j*2
  ‘make a rectangle that signifies sheet boundaries
  Call Rhino.AddPolyline (array(array(0,intNewY,0),array(intXMax,intNewY,0),array(intXMax,intYMax+intNewY,0),array(0,intYMax+intNewY,0),array(0,intNewY,0)))
  For i = 0 To 20
   ‘determine a random value
   dblRndX = rnd*intXMax
   dblRndY = rnd*intYMax+intNewY
   dblRad = rnd*(intRadMax-intRadMin)+intRadMin
   ‘check random value
   ‘Call Rhino.AddPoint (array(dblRndX,dblRndY,0))
   ‘Print Radius
   Call rhino.Print (dblRad)
   If (dblRndY+dblRad < intYMax-dblOff+intNewY ) And (dblRndY-dblRad > intNewY+dblOff) And (dblRndX+dblRad < intXMax-dblOff) And (dblRndX-dblRad > dblOff) Then
    ‘add circle based on center points
    Call Rhino.AddCircle3Pt (array(dblRndX+dblRad,dblRndY,0), array(dblRndX,dblRndY+dblRad,0), array(dblRndX-dblRad,dblRndY,0))
   End If
  Next
 Next
End Sub

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 )

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