Grasshopper

algorithmic modeling for Rhino

Hi

i am trying to transpose/reverse several trimmed surfaces:

i found this code posted here last year by David

  Private Sub RunScript(ByVal S As Brep, ByVal U As Boolean, ByVal V As Boolean, ByVal F As Boolean, ByRef A As Object)
    If (S Is Nothing) Then Return
    If (S.Faces.Count > 1) Then
      __err.Add("Polysurfaces are not allowed")
      Return
    End If

    Dim face As BrepFace = S.Faces(0)
    Dim srf As Surface = face
    If (U) Then srf = srf.Reverse(0)
    If (V) Then srf = srf.Reverse(1)
    If (F) Then srf = srf.Transpose()

    Dim idx As Int32 = S.AddSurface(srf)
    face.ChangeSurface(idx)
    S.CullUnusedSurfaces()

    A = S
  End Sub

however I don't get i to work, as soon as i toggle any of the boolean switches, the Output A becomes an invalid Brep.(can't bake it)

i am not sure what could be wrong here,has somebody got an idea?

i searched through the forum and i got this working in c#:

  private void RunScript(Surface srf, bool swapU, bool swapV, bool swapUV, ref object A)
  {

    if(swapV)  srf = srf.Reverse(1);
    if(swapU)  srf = srf.Reverse(0);
    if(swapUV) srf = srf.Transpose();


    A = srf;
  }

but i'd need to use Brep input (for the keeping trim) and i don't know enough about syntax to figure out how.

i am a bit stuck here. any input much appreciated!

Views: 319

About

Translate

Search

Photos

  • Add Photos
  • View All

© 2026   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service