100326_ SHOW ME THE CODE!!A simple rhinopython script- lesson 1

marzo 26, 2010

this is a simple , basic , SOOOOOOOOOOOOOOOOO NOOOOOB example of python script working on rhino 5.

this is the lesson 1 . how to draw and then divide a curve into segments with a circle in every division.

so… SHOW ME THE CODE!!!!

#simple rhyno python script
#author: Diego Pinochet Puentes
#copyrighted by eScript-O (escripto.wordpress.com)
import rhinoscript as rh # im lazy , just as the python sample so , i import rhinoscript

pt= [] #empty array
sect= rh.userinterface.GetInteger ("numero de divisiones") #user input for divisions
pt.append (rh.userinterface.GetPoint("select first point")) #user input for first point
pt.append (rh.userinterface.GetPoint("select second point")) #user input for second point 
pt.append (rh.userinterface.GetPoint("select third point")) #user input for third point

line= rh.curve.AddInterpCurve (pt) #draw an interpolated curve

div=[] #empty array

div.append (rh.curve.DivideCurve (line,sect)) #divide and store the divisions in the array

for i in range(0,sect): #for loop 
    rh.curve.AddCircle ((div[0][i]),0.1+1) #add a circle
    rh.userinterface.MessageBox ("you have a simple Rhinopythonscript working") # an ending message

#really simple, direct and less complicated than other programming languages, in the next sample, well see an Cellular authomata and attractor functions
Anuncios

Una respuesta to “100326_ SHOW ME THE CODE!!A simple rhinopython script- lesson 1”

  1. Alessio Says:

    Man, that was fast!

    I still have to take the time to study a little bit….

    Thanks for sharing!

    Alessio


Responder

Introduce tus datos o haz clic en un icono para iniciar sesión:

Logo de WordPress.com

Estás comentando usando tu cuenta de WordPress.com. Cerrar sesión / Cambiar )

Imagen de Twitter

Estás comentando usando tu cuenta de Twitter. Cerrar sesión / Cambiar )

Foto de Facebook

Estás comentando usando tu cuenta de Facebook. Cerrar sesión / Cambiar )

Google+ photo

Estás comentando usando tu cuenta de Google+. Cerrar sesión / Cambiar )

Conectando a %s

A %d blogueros les gusta esto: