Here is my python code (which runs in python fine);
import math as ma import csv brand ='phillips' filename = 'C:\Users\gornall72\Desktop\import.csv' with open(filename,'r') as file: reader = csv.DictReader(file) for row in reader: if(brand in row['Brand Name']): I = (float(row['dB'])) D= 3/ma.sqrt(30/I) D2= D+3 print D2
When I try to bring it into Rhino I am getting a message saying “No module named csv”. The half of my Rhino code is:
import rhinoscriptsyntax as rs
import scriptcontext as sc
import math as ma
response=rs.MessageBox( "Evaluate Classroom?", 4) if response !=7: layer = rs.GetLayer("Please select a layer") if layer: obj = rs.ObjectsByLayer(layer) rs.SelectObjects(obj) ObjId=rs.SelectedObjects(include_lights=False, include_grips=False) for obj in ObjId: cent=rs.SurfaceAreaCentroid(obj) print cent rs.AddPoint(cent) Radius = 5 rs.AddSphere(cent,Radius) else: rs.MessageBox("Evaluation Aborted")
Right now where radius is equal to 5 ( in the rhino python script) I am trying to get that equal to the value D2 found in my python formula(the first script) using the csv file. long term id like to automatically apply the information to the layers by a naming convention, maybe by making the brand = to the layer name, but solving this step first would help.