Hi all of you genious out there .
I’ve this script that I need to improve a bit.
! _-RunPythonScript (
import rhinoscriptsyntax as rs
curve = rs.GetObject(“Select a curve”)
if rs.IsCurve(curve):
print "Curve dimension =", rs.CurveLength(curve)
l = rs.CurveLength (curve )
start = ( 0, 0, 0 )
end = ( l, 0, 0 )
base= rs.AddLine(start, end)
turns =rs.GetReal(“n of turns”)
point0 = (0,0,0)
point1 = (l,0,0)
pitch = l/turns
radius0 =rs.GetReal(“spiral radius”)
spiral01= rs.AddSpiral(point0, point1,pitch, turns, radius0, )
spiral02 = rs.RotateObject((spiral01), (0,0,0), 180, (1,0,0), copy=True)
cmd1 = ( 'Scorri ( copy = False) Selid ’ + str( spiral01 )+
’ Invio Selid ’ + str( base ) + ’ Selid ’ + str( curve ) )
rs.Command( cmd1 )
cmd2 = ( 'Scorri ( copy = False) Selid ’ + str( spiral02 )+
’ Invio Selid ’ + str( base ) + ’ Selid ’ + str( curve ) )
rs.Command( cmd2 )
cmd3 = ( 'Selid ’ +str(spiral01))
rs.Command(cmd3)
cmd4 = ( 'Selid ’ +str(spiral02))
rs.Command(cmd4)
cmd5 = ( 'Selid ’ +str(base))
rs.Command(cmd5)
rs.Command(’_delete’)
cmd6 = ( ‘Selid ’ +str(curve))
rs.Command(cmd6)
rs.Command(’_hide’)
crv1 = rs.GetObject(“sel crv1”)
crv2 = rs.GetObject(“sel crv2”)
radiusp= rs.GetReal( “raggio pipe” )
rs.AddPipe(crv1,0,radiusp)
rs.AddPipe(crv2,0,radiusp)
)
So basically what it does is to create a rope kind once a curve is selected .
You pick the curve it will make a line of the same lenght and wrap it with a spiral. Then flow the spiral using the line as base crv and the input curve as target crv.
last it will prompt to select the two new spiral that are been created around the original curve and ask for a radius to pipe them.
My question is how do I get the ID of those two new spiral so that it’s no more necessary to select them manually ? … I’ve tryied many ways with no result .
Any idea ?
Any help?
thanks a lot,
alberto