Arch324

Experiments in Scripting and Generative Architecture

RhinoScript Boolean

The following code appears to run but nothing happens and it gives no error message (or any message). Any thoughts on it?

Option Explicit

Call Main()
Sub Main()

Dim arrInput0, arrInput1

arrInput0 = Rhino.GetLayer(“Select Layer to Subtract from”)
arrInput1 = Rhino.GetLayer(“Select Layer to Subtract out”)

If IsArray(arrInput1) Then
  Rhino.BooleanDifference arrInput0, arrInput1
 
End If
 
End Sub
Main

Maya Loops

Tyler and Me our having trouble creating a loop that will make fifty cones and then connecting that loop to another loop that at each key frame it will move the cones randomly around the page. any help would be great Thanks

$i=0

 

{

cone -name cone(++$i) -radius .5;

for( $i=0; $i<96; ++$i )

{

 

setKeyframe -time (++$i) -value (rand(5,10)) cone(++$i).translateX;

setKeyframe -time (++$i) -value (rand(5,10)) cone(++$i).translateY;

setKeyframe -time (++$i) -value (rand(5,10)) cone(++$i).translateZ;

 

}

}

Array (Josh)

Josh,

This should clean up the mistakes… the quotation marks were throwing it off. It seems that you had copied and pasted the script and sometimes that changes the font of the quotes which causes an error.  Also you had an extra “(” in your copy command.  This is still not working because you need to look at your Copy command, you don’t have the correct number of arguments. 

Sky

Option Explicit

Call Main()
Sub Main ()

 Dim i
 Dim strObject, arrstart
 Dim arrcpy
 strObject = Rhino.GetObject(“Select objects to copy”, 16 )
 arrstart = Rhino.SurfaceAreaCentroid (strobject)

 For i = 0 To 60
 
  arrcpy = Rhino.CopyObject(strObject, Array(arrstart(0)), Array(arrstart(0)(0) + i*36, 0), Array(arrstart(0)(1), arrstart(0)(2))
 
 Next
End Sub

Interpolated Spiral

Matt,

This should work.  Basically you needed to create a dynamic array which updates after each loop and will contain all of your points.  Previously you were renaming the point each time so that when you called the interpolated points function it only had one point and couldn’t create a curve (this would have been the last point that was created).  Hope that helps.

-Sky

Option Explicit
Sub Main()
 Dim arrPoints(), strPoints()
 Dim k : k = 0
 Dim t, a, b, totLength, pi
 pi = Rhino.Pi
 totLength = 100

 For t = -((totLength/2)-5) To ((totLength/2)-5) Step .075

  If t = (totLength/4) Then
   a=(totLength-(2*t)) : b=(totLength-(2*t))
  Else a=Abs(t)+24 : b=Abs(t)+24
  End If

  ReDim Preserve arrPoints(k) : arrPoints(k) = Array(8*t, Cos(50*t)*b, Sin(50*t)*a)
  ’ReDim Preserve arrPoints(t)(0) : arrPoints(t)(1) = Cos(50*t)*b
  ’ReDim Preserve arrPoints(t)(0) : arrPoints(t)(2) = Sin(50*t)*a

  ’Call Rhino.Pt2Str(arrPoints, 3)
  Call Rhino.AddPoint(arrPoints(k))
  k = k + 1
 Next

 Rhino.AddInterpCurve(arrPoints)

End Sub
Main

MEL script_Random float with specific range???

>>>Skylar,

I am having trouble creating a variable that can be a random number within a specified range<<<

float $a=(rand(-40 40));
float $b=(rand(26 30));

>>>so that i may then assign them to the x and z coordinates of an object’s position,

this gives me an error msg…

!!! okay… i just SORT OF figured it out. Instead of creating the float $a and making it equal a specific random range of coordinates, I simply need to create<<<

float $a=rand(80);

>>>this works. However, If I call on $a later in an object’s animation loop as the first distance that the object will move to relative to it’s current position. The problem is that then on the second or third iteration, this object could move out of the designated area. The idea is to keep that object bounded to a certain field<<<

Thank you

tyjs

RhinoScript array

Does anyone know why this script won’t work? I just want to simply array an object right now.

Option Explicit

Call Main()
Sub Main ()

 Dim i
 Dim strObject, arrstart
 Dim arrcpy
 strObject = Rhino.GetObject(“Select objects to copy”, 16 )
 arrstart = Rhino.SurfaceAreaCentroid (strobject)

 For i = 0 To 60
  
  arrcpy = Rhino.CopyObject(strObject, Array(arrstart(0)), Array(arrstart(0)(0) + i*36), arrstart(0)(1), arrstart(0)(2)))
  
 Next
End Sub

Rhino array

How do I write an array to be based off the last object that was arrayed in a chain?

The first object arrayed was based off an object picked, then the next array is based off the last one, etc. etc. so instead of just adding a number each time, how can I make it continuous from each object as it continues?

Set Driven Keys : MEL

I found a link that should explain how to set driven keys in MEL.

Also, you could have posted this on the tech support pages.. but no worries.

http://www.purplestatic.com/courses/maya/MEL/PDF/MEL_12.pdf

Maya people

Hey guys I found this cool code on Maya if you type in the script window help sphere; then it will show you all the parameters of sphere you can control.. such as radius and where its located on the page. If anyone know the code for how to make like ten shapes the same size and everything but different locations and rotations with out typing each individual one in that would be great. Thanks!!

Maya- Driven Keys

anyone who is working in Maya I was wondering if they figured out how to create driven keys because everytime I try to work with it nothing is happening. Any code that you found that would work in Maya would be great to have. Thanks

Older entries »