I’m trying to make a script that lofts 2 closed curves. One in an “irregular circle” (it’s a circle when looking from the top plane, but the 3d geometry is irregular) and the other one is just a bigger concentric circle.
I’m trying to do it with just rhinoscriptsyntax.
The loft works great when done manually but when I try doing with a script I end up with the monstrosity below:
What I’ve already tried:
- Using points to guide the loft
- Changing the curve directions to match
- Using the sweep2 instead of a loft (couldn’t even get that to work)
None of the above worked for me.
Here’s the code:
tryingToLoft.py (721 Bytes)
import rhinoscriptsyntax as rs
baseCurves = rs.SelectedObjects()
for curve in baseCurves:
if rs.IsCircle(curve):
smoothCircle = curve
else:
perimeter = curve
sameDirection = rs.CurveDirectionsMatch(perimeter, smoothCircle)
if not sameDirection:
smoothCircle = rs.ReverseCurve(smoothCircle)
closestPoints = rs.CurveClosestObject(perimeter, smoothCircle)
sweepLine = rs.AddLine(closestPoints[1], closestPoints[2])
rs.AddLoftSrf([perimeter, smoothCircle], closestPoints[1], closestPoints[2], 3, 1, 100)
#rs.AddLoftSrf([perimeter, smoothCircle]), None, None, 3, 1, 100)
#rs.AddSweep2([perimeter, smoothCircle], sweepLine, True)
I’m also attaching the file with the 2 curves if anyone wants to give it a try. You need to select the curves first before running the script.
2 closed curves.3dm (94.9 KB)
Any help is appreciated