Grasshopper

algorithmic modeling for Rhino


Hello All!

I wonder if someone could help me with this question:

There is an option in _Loft to //Adjust Curve Seams// and if you loft with GH Loft component - it has the same option to Adjust Curve Seams.
However I've been having difficulties to achieve that with LoftSDK (in VB). Say I want to loft curves within the VB script, but //MArgsRhinoLoft// doesn't have the option to Adjust Curve Seams - so the loft comes out all twisted.
Please, let me know if there is such functionality built in the SDK or I'd have to workaround.

Thanks!
Dima

Views: 1570

Replies to This Discussion

This is the code I use in the Loft component to Adjust the seams:

If (bOptions.AdjustSeams) Then
Dim iBasePt As On3dPoint = nSections(0).m_curve.PointAtStart
Dim iBaseDir As On3dVector = nSections(0).m_curve.TangentAt(nSections(0).m_curve.Domain.Min)

For i As Int32 = 1 To nSections.Count - 1
Dim Curve As OnCurve = nSections(i).m_curve
If (Curve.IsClosed()) Then
Dim t As Double
Curve.GetClosestPoint(iBasePt, t)

'Flip the curve if the direction is reversed
Dim pA As On3dPoint = iBaseDir
Dim pB As On3dPoint = Curve.TangentAt(t)
If (pA.DistanceTo(pB) > Math.Sqrt(2)) Then Curve.Reverse()

'Only change if sufficiently far away
Dim adjDistance As Double = Curve.PointAtStart.DistanceTo(Curve.PointAt(t))
Dim crvLength As Double : Curve.GetLength(crvLength)

If (adjDistance > (0.01 * crvLength)) Then
Curve.ChangeClosedCurveSeam(t)
End If

iBasePt = Curve.PointAtStart
iBaseDir = Curve.TangentAt(Curve.Domain.Min())
Else
iBasePt = Curve.PointAtStart
iBaseDir = Curve.TangentAt(Curve.Domain.Min())
End If
Next
End If

--
David Rutten
david@mcneel.com
Poprad, Slovakia
Many thanks!
Hey, could you tell me please how do you insert the code in the Loft component to Adjust the seams. I have the same problem, but as I´m a new user on this all new world it sounds a bit tricky for me.
Thanks in advance,
Igo
Igo,

I wrote the Loft component from scratch, so no code "insertion" was required. Dima is trying to Loft in a custom Script component, and he was having problems with the Rhino SDK Loft function.

--
David Rutten
david@mcneel.com
Poprad, Slovakia
Thanks for your reply David. It's a bit clearer than before.
Cheers,
Igo

And for adjustin the beams in the default grasshopper loft? I've been toching the loft options but i cannot solve it... (the problem is between hexagons and circles). 

Any clever ideas?

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service