Bucles 1.
Posted by admin - 15/08/09 at 07:08:01 amOption Explicit 'Script written by'Script copyrighted by 'Script version jueves, 13 de agosto de 2009 9:05:47 'Cambiar esta llamada para ir cambiando el procedimiento que ejecuta el script. Call Main5() Sub Main() Dim x x = 1 Do While x <= 10 Rhino.AddPoint(Array(x, 5, 0)) x = x + 1 Loop End Sub Sub Main2() Dim x, cuantosLLevo, cuantosQuiero x = 1 cuantosQuiero = Rhino.GetInteger("Cuantos puntos dibujo?") cuantosLLevo = 0 Do While cuantosLLevo < cuantosQuiero Rhino.AddPoint Array(x, 1, 0) x = x + 1 cuantosLlevo = cuantosLLevo + 1 Loop End Sub Sub Main3() Dim x, cuantosLLevo, cuantosQuiero x = 1 cuantosQuiero = Rhino.GetInteger("Cuantos puntos dibujo?") Do While cuantosQuiero <= 0 Rhino.Print("Disculpe. El valor debe ser positivo") cuantosQuiero = Rhino.GetInteger("Cuantos puntos dibujo?") Loop cuantosLLevo = 0 Do While cuantosLLevo < cuantosQuiero Rhino.AddPoint Array(x, 1, 0) x = x + 1 cuantosLlevo = cuantosLLevo + 1 Loop End Sub Sub Main4() Dim x, cuantosLLevo, cuantosQuiero, distancia distancia = Rhino.GetInteger("Distancia entre puntos?") Do While distancia <= 0 Rhino.Print("Disculpe. La distancia debe ser positiva.") distancia = Rhino.GetInteger("Distanca entre puntos?") Loop cuantosQuiero = Rhino.GetInteger("Cuantos puntos dibujo?") Do While cuantosQuiero <= 0 Rhino.Print("Disculpe. El valor debe ser positivo") cuantosQuiero = Rhino.GetInteger("Cuantos puntos dibujo?") Loop cuantosLLevo = 0 x = 1 Do While cuantosLLevo < cuantosQuiero Rhino.AddPoint Array(x, 1, 0) x = x + distancia cuantosLlevo = cuantosLLevo + 1 Loop End Sub Sub Main5() Dim x, y, d, h, numPuntos, totalPuntos d = Rhino.GetInteger("Distancia?") h = Rhino.GetInteger("Altura?") totalPuntos = Rhino.GetInteger("Total de puntos?") x = 1 y = 1 numPuntos = 0 Do While numPuntos <= totalPuntos Rhino.AddPoint Array(x, y, 0) x = x + d If numPuntos Mod 2 = 0 Then y = 1 + h Else y = 1 End If numPuntos = numPuntos + 1 Loop End Sub
Los procedimientos van de menos a mas complejidad. Si quereis probarlos solo
tendreis que cambiar la llamada al procedimiento.
agosto 15, 2009 | In vbscript Rhinoceros 4.0 | No Comments
No Comments yet »
RSS feed para los comentarios de esta entrada. TrackBack URI
Deja un comentario
Powered by WordPress with GimpStyle Theme design by Horacio Bella.
Entries and comments feeds.
Valid XHTML and CSS.