I have to print about 200 2d drawings, arranged one next to each other, on the same page format. Is there any way to do this with python?
10x!
I have to print about 200 2d drawings, arranged one next to each other, on the same page format. Is there any way to do this with python?
10x!
Well, a lot will depend on how those 2D drawings are. Are they each a separate file? If so it should be possible to write a script to open/import each successive file in a folder, throw a bounding box around the drawing and center that in a standard rectangle and then add that to a layout - spacing it away from the last one and indexing over and down when the page width limit is reached. but it's a fair amount of work...
--Mitch
Hi Mitch, thanks for the reply. The drawings are in the same file, i just have to move the bounding box in X direction. I know it is a lot of work but i'm wandering what is faster, to print manually 200 drawings or to spend that time with the script.
Hi bgdch
Below is a trace of Python scripting.
You must select the bounding rectangles as in the attached file.
Python Code:
import rhinoscriptsyntax as rsimport Rhinoriquadri=rs.GetObjects("seleziona riquadri disegni")object_list = rs.AllObjects()name="stp"n=1for riquadro in riquadri:rs.UnselectAllObjects()bb=rs.BoundingBox(riquadro)for obj in object_list:if rs.IsObjectInBox(obj, bb, False):rs.SelectObject( obj )lista_di_stampa=rs.SelectedObjects()rs.Sleep(600)obs=rs.InvertSelectedObjects()object_list=obsrs.HideObjects(obs)rs.Command("-print _go")# to be completed with setup optionsRhino.RhinoApp.Wait()#rs.Sleep(600)rs.ShowObjects(obs)
I hope help you
Ciao Vittorio
Last edited by vittorio; 08-19-2012 at 06:31 PM.
This script works OK with my printer:
Ciao VittorioPython Code:
import rhinoscriptsyntax as rsimport Rhinoriquadri=rs.GetObjects("seleziona riquadri disegni")object_list = rs.AllObjects()for riquadro in riquadri:rs.UnselectAllObjects()bb=rs.BoundingBox(riquadro)for obj in object_list:if rs.IsObjectInBox(obj, bb, False):rs.SelectObject( obj )lista_di_stampa=rs.SelectedObjects()rs.Sleep(600)obs=rs.InvertSelectedObjects()object_list=obsrs.HideObjects(obs)rs.Command("-print _S _D _p " + '"Epson ESC/P-R"'+ " _enter _enter _g _enter")# to be completed with setup options#Rhino.RhinoApp.Wait() # aspetta che termini la stampa prima di proseguirers.Sleep(28000) # printing time about expectedrs.ShowObjects(obs)
Last edited by vittorio; 08-19-2012 at 08:52 PM.