090731- SHOW ME THE CODE!!!-(RVB) – automatic unroll

julio 31, 2009

unroll

This is another fabrication tool that i wrote almost two years ago for my thesis. So… let´s show the code!!!!

This tool was developed for the automated process of unrolling planar surfaces for fabrication via laser cut or cnc cut. It allows the user to select the surfaces of the model (or polysrf) and make an array of contours with an ID, in the model and the array (for further assembly help). I wrote it for the ribber tool, and added to the MAB FPS and exatect structure scripts.

It´s a very simple, but powerfull tool ,i hope you use it , and again , do whatever the f#$#cK u want. but remember to name the real author of the script.

Video showing the script running, (in spanish).

stay tuned for more SHOW ME THE CODE!!! in escripto…

Option Explicit
‘script name <unroll automatic>
‘Script written by <Diego Pinochet Puentes>
‘Script copyrighted by <escripto.wordpress.com>
‘Script version lunes, 14 de abril de 2007 09:44:02 a.m.
‘este codigo esta generado y protegido por creative commons. cualquier alteracion
‘del mismo o adjudicacion de autoria por parte de cualquier persona es un delito intelectual.
‘si lo ocupas debes indicar la version y autor de la herramienta.
‘generated under creative commons license, u must name the author of the code in ur work if u use it or modify it.
Call Main()
Sub Main()
Dim arrobjects,arrpanel, arrEdge,i,grilla(),pt,arredge2
Dim texto1,texto
Dim textdim:textdim= rhino.getreal(“enter the size of the text (it depends of your model scale)”,1)
Dim punto,newarrPoint,newarrpoint2
Dim n:n= 0
Dim newDomainU, newDomainV
Dim newarrParameterU, newarrParameterV
Dim strpoligon,strpoligonoff,crvamidpt(),crvbmidpt(),aux(),auxmidpt()
Dim espaciado:espaciado=rhino.getreal (“enter distance of unfolded patterns”)
Dim trgroup2
Dim letra:letra= rhino.getstring (“enter a prefix for the id”)
arrObjects = Rhino.GetObjects(“select the surfaces, or polysurfaces to to unroll”,8+16)
For i =0 To (ubound(arrobjects))
ReDim Preserve grilla(i)
grilla(i)= array(i*espaciado+50,0,0)
Next
‘——————————————————————
If IsNull(arrObjects) Then Exit Sub
ReDim arrpanel(UBOUND(arrObjects))
For i = 0 To UBOUND(arrObjects)
Call Rhino.EnableRedraw(True)
Call Rhino.UnselectAllObjects
Call Rhino.SelectObject(arrObjects(i))
newarrpoint= Rhino.SurfaceAreaCentroid (arrObjects(i))
texto1= rhino.addtext (“<“&letra & i + 1 &””&”>”  ,newarrpoint(0),textdim)
rhino.ObjectColor texto1,RGB(255,0,255)
‘————————————————
Rhino.Command “_unrollsrf explode=no enter enter”
Call Rhino.UnselectAllObjects
arrpanel(i) = Rhino.FirstObject
Call Rhino.MoveObject(arrpanel(i),array(0,0,0), grilla(i))
newarrPoint2 = Rhino.SurfaceAreaCentroid (arrpanel(i))
texto= rhino.addtext (“<“&letra & i + 1 &””&”>”  ,newarrpoint2(0),textdim)
rhino.ObjectColor texto,RGB(255,0,255)
‘————————————————
arrEdge = Rhino.Duplicatesurfaceborder(arrpanel(i))
arrEdge2 = Rhino.Duplicateedgecurves(arrpanel(i))
strpoligon= Rhino.JoinCurves(arrEdge,True)
rhino.ObjectColor strpoligon,RGB(178,248,58)
Call Rhino.DeleteObject(arrpanel(i))
trgroup2= rhino.addgroup
rhino.addobjectstogroup array(strpoligon(0),texto),trgroup2
Next
End Sub






Option Explicit
'script name <unroll automatic>
'Script written by <Diego Pinochet Puentes>
'Script copyrighted by <escripto.wordpress.com>
'Script version lunes, 14 de abril de 2007 09:44:02 a.m.
'este codigo esta generado y protegido por creative commons. cualquier alteracion 
'del mismo o adjudicacion de autoria por parte de cualquier persona es un delito intelectual. 
'si lo ocupas debes indicar la version y autor de la herramienta. 

'generated under creative commons license, u must name the author of the code in ur work if u use it or modify it.

Call unroll-escripto()
Sub unroll-escripto()
	Dim arrobjects,arrpanel, arrEdge,i,grilla(),pt,arredge2
	Dim texto1,texto
	Dim textdim:textdim= rhino.getreal("enter the size of the text (it depends of your model scale)",1)
	Dim punto,newarrPoint,newarrpoint2
	Dim n:n= 0
	Dim newDomainU, newDomainV
	Dim newarrParameterU, newarrParameterV
	Dim strpoligon,strpoligonoff,crvamidpt(),crvbmidpt(),aux(),auxmidpt()
	Dim espaciado:espaciado=rhino.getreal ("enter distance of unfolded patterns")
	Dim trgroup2
	Dim letra:letra= rhino.getstring ("enter a prefix for the id")
	
	arrObjects = Rhino.GetObjects("select the surfaces, or polysurfaces to to unroll",8+16)	
	
	For i =0 To (ubound(arrobjects))
		ReDim Preserve grilla(i)
		grilla(i)= array(i*espaciado+50,0,0)
	Next
		'------------------------------------------------------------------		
	If IsNull(arrObjects) Then Exit Sub	
	ReDim arrpanel(UBOUND(arrObjects))
	For i = 0 To UBOUND(arrObjects)		
		Call Rhino.EnableRedraw(True)		
	Call Rhino.UnselectAllObjects	
		Call Rhino.SelectObject(arrObjects(i))		
	
		newarrpoint= Rhino.SurfaceAreaCentroid (arrObjects(i))	
		texto1= rhino.addtext ("<"&letra & i + 1 &""&">"  ,newarrpoint(0),textdim)
		rhino.ObjectColor texto1,RGB(255,0,255)
		
		'------------------------------------------------				
		Rhino.Command "_unrollsrf explode=no enter enter"		
	Call Rhino.UnselectAllObjects		
		arrpanel(i) = Rhino.FirstObject
		Call Rhino.MoveObject(arrpanel(i),array(0,0,0), grilla(i))
			
		newarrPoint2 = Rhino.SurfaceAreaCentroid (arrpanel(i))	
	
		texto= rhino.addtext ("<"&letra & i + 1 &""&">"  ,newarrpoint2(0),textdim)
		rhino.ObjectColor texto,RGB(255,0,255)
		'------------------------------------------------
		arrEdge = Rhino.Duplicatesurfaceborder(arrpanel(i))
		arrEdge2 = Rhino.Duplicateedgecurves(arrpanel(i))
		strpoligon= Rhino.JoinCurves(arrEdge,True)
		rhino.ObjectColor strpoligon,RGB(178,248,58)
		Call Rhino.DeleteObject(arrpanel(i))

		trgroup2= rhino.addgroup 
		rhino.addobjectstogroup array(strpoligon(0),texto),trgroup2
	Next
End	Sub
Anuncios

4 comentarios to “090731- SHOW ME THE CODE!!!-(RVB) – automatic unroll”

  1. Jose Salazar Says:

    Sirve solo para lasser cut y cnc cut??? Digamos si fuera un caso más rudimentario o menos asistido, podria funcionar digamos, para imprimir y cortar a la antigua?


  2. Hi, good day! Your work is quite inspiring. I never considered that it was probable to carry out something like that until after I checked out your article. You definitely gave an excellent understanding on exactly how this kind of whole process functions. I will make sure to come back for more information. Keep writing!

  3. manuelnomaza Says:

    saludos! donde puedo descargar el codigo en rvb? probe insertando el codigo en el editor rvb, pero no puedo hacerlo correr, tampoco encuentro el pdf que mencionas, help!!!! PD:por cierto esta muy bueno el script

  4. escripto Says:

    manuel , el codigo es llegar y pegar, te deberia funcionar.

    por otro lado … pdf?


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: