I am a fabricator. We build our models in Rhino, several years ago someone on this forum gave me an amazing script and I lost it. Basically I am modeling parts that are extrusions, and I need to generate a CSV file that has the part name and a length, that is it. The script I found on this forum worked by first having all my parts be blocks, with the block name being the part number, inside the block was the extrusion, and a dimension string which specified the desired length. Additionally, in the properties of the dimension string, it has a “name” which was “dim”. When I built my model, I made all the parts blocks, then I ran the script and it produced a CVS file with all the part numbers and lengths. It worked great! Then I lost it in a hard drive failure. Could anyone help me find it again or point me in the right direction?
Thank you for responding, but I think that was a false flag, it doesn’t work because it requires first to make a part as a seperate rhino file. I was initially excited because I thought it was what I was looking for .
thank you for your help, so I really dont know where I originally found this script, but i accidently re- named it the same name is this other script which is there all this confusion came from.
Hi Gregoryhitchcoc,
Can you guide me how do i execute this script in windows? If you have any document then that would be great. Which python version i have to install and how rhinoscriptsyntax need to import. Looking forward to here from you.
import rhinoscriptsyntax as rs
def BOMCSV():
DocPath=rs.DocumentPath()
fileObject=open(DocPath+'BOM.txt','w')
BlockNameList= []
fileObject.write('BlockName'+'\t'+'PartLength'+'\t'+'QTY'+'\n')
BlockTestList=rs.BlockNames(True)
for i in BlockTestList:
if rs.IsBlockInUse(i,0):
BlockNameList.append(i)
for d in BlockNameList:
PartLen ='-'
BlockObListD=rs.BlockObjects(d)
for i in BlockObListD:
if rs.IsDimension(i):
obname = rs.ObjectName(i,);
if obname == 'length':
PartLen=rs.DimensionText(i)
Qty = rs.BlockInstanceCount(d)
fileObject.write(d+'\t'+PartLen+'\t'+str(Qty)+'\n')
fileObject.close()
print ("CSV Exported")
BOMCSV()