I have over 600 pieces coming and I need to write number for every piece after machining… It would be quicker just to print the picture automatically. So is there a some way to automatically show layer names on Rhino’s drawing and printing the drawing?
Tried to use this as a Rhino Python and I get following message. I get to choose the layers and after that it gives following error. Any ideas (some error on my part?)
Message: ‘NoneType’ object is not subscriptable
Traceback:
line 5, in , “C:\Users\Mika\AppData\Local\Temp\TempScript.py”
It will depend on what your curves are like - the script above does not have any error checking and will fail if you pick open or non-planar curves - because it will not find the centroid in those cases - so it returns None.
You can try the following modification which should work for open and non planar curves and see if it works:
import rhinoscriptsyntax as rs
curves = rs.GetObjects("Select curves", 4, preselect=True)
for curve in curves:
layer = rs.ObjectLayer(curve)
bb=rs.BoundingBox(curve)
center=(bb[0]+bb[6])/2
rs.AddText(layer, center, justification = 131074)