I wanted to write a script that will create a surface from the edges of a surface. If there are only 2 edge curves then I need a loft, if between 2 and 4 edge surface command and if more than 4 a network surface command should run. Here is the code:
import rhinoscriptsyntax as rs
import Rhino as rh
print crvs
print type(crvs[1])
#print len(crvs)
#crvs = [rs.coercecurve(crv) for crv in crvs]
#print type(crvs[1])
if len(crvs) <= 2:
dir_check = rs.CurveDirectionsMatch(crvs[0], crvs[1])
if dir_check == False:
crvs[1] = rs.ReverseCurve(crvs[1])
# crvs[1] = rh.Geometry.Curve.Reverse(crvs[1])
srf = rs.AddLoftSrf(crvs)
elif 2 < len(crvs) <= 4:
srf = rs.AddEdgeSrf(crvs)
else:
srf = rs.AddNetworkSrf(crvs, cont, edge_tol, int_tol, angle_tol)
When I run this code I get this error on rs.ReverseCurve function:
Runtime error (TypeErrorException): Parameter must be a Guid or string representing a Guid
Traceback:
line 890, in coerceguid, "C:\Users\Erdem\AppData\Roaming\McNeel\Rhinoceros\6.0\Plug-ins\IronPython (814d908a-e25c-493d-97e9-ee3861957f49)\settings\lib\rhinoscript\utility.py"
line 995, in coercecurve, "C:\Users\Erdem\AppData\Roaming\McNeel\Rhinoceros\6.0\Plug-ins\IronPython (814d908a-e25c-493d-97e9-ee3861957f49)\settings\lib\rhinoscript\utility.py"
line 490, in AddLoftSrf, "C:\Users\Erdem\AppData\Roaming\McNeel\Rhinoceros\6.0\Plug-ins\IronPython (814d908a-e25c-493d-97e9-ee3861957f49)\settings\lib\rhinoscript\surface.py"
line 28, in script
I’m pretty sure that the types of the items of crvs list are Guid. So I don’t understand why it asks for a Guid type object when I already pass Guid type objects?
By the way, rs.AddEdgeSrf function works with this same input but rs.AddLoftSrf and rs.AddNetworkSrf don’t work. What’s the logic?