Grasshopper

algorithmic modeling for Rhino

Hallo zusammen,

ich versuche kongruente Linien aus einer Linienliste nach der Sortierung zu eleminieren. Hierzu vergleiche ich die Sortierten Linien mit deren Nachfolger.
Beim Versuch die Linie in die Liste im VB Script zu adden (OutList) . Kommt der Fehler: "1. Die angegebene Umwandlung ist ungültig. (line: 92)"
Das Script läuft bei einer test explodeten Polylinie mit mehrfacher Nachzeichnung um Doppelte zu erhalten ohne Probleme. Die Umwandlung der Polyline Curve über den Line Befehl schlägt scheinbar fehl, obwohl die Sortierung funktioniert.
Versucht man die Curves zu sortieren und als CurveListe zu adden kommt der Fehler: 1. Das Objekt des Typs "System.Double" kann nicht in Typ "Rhino.Geometry.Curve" umgewandelt werden. (line: 92)

Entweder muss ich die Exploded Curves in 'richtige' Lines umwandeln.
Oder eine Möglichkeit der Liste in VB zum speichern der Curves finden.

Vielen Dank für eure Hilfe!

LG, Bergit

Views: 545

Replies to This Discussion

Hi Bergit,

x appears to be a List(Of Double) while OutList is defined as a List(Of Line). Doubles are not lines and you cannot automatically convert from one to the other.

What are you trying to accomplish with this script?

--

David Rutten

david@mcneel.com

I now use the A of Sort directly from the Explode to get the Values. So now we have Line like Curves in that list.

Then we changed the Line to Object list:

    Dim i As Integer
    Dim maxi As Integer

    Dim OutList As New List(Of Object)

    maxi = x.Count - 1

    For i = 0 To maxi

      OutList.Add(x(i)
 
      If i = maxi Then
        Exit For
      End If
      If  ... Then
        ...
        i = i + 1
      End If
    Next
    A = OutList

now we can use the line like curves to attach in the object list.

Goal is to eleminate the doubellines, look at the Panel below sort. But these are too different. so we eleminate now eqal 10 positions of the length.

      Lx = (x(i).getlength())
      Ly = y(i + 1).getlength()

Lx.ToString("N10") = Ly.ToString("N10")

we hope to solve the problem now

Thanks for ur help

When you use the Sort component your lines are converted to numbers. The [K] input is a Number parameter, meaning the lines are converted to numbers by Grasshopper.

If you want to filter duplicate lines from a list of lines there are better ways to do this. The brute force way is to compare every line to every other line. You can speed this up by using a dictionary/hashtable/sortedlist, but that makes it harder to incorporate a tolerance.

I attached a Brute Force method for removing duplicates with a tolerance setting.

--

David Rutten

david@mcneel.com

Attachments:

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2025   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service