algorithmic modeling for Rhino
Hello everyone,
I'm writing VB script that does the same as "Divide Domain" but in unequal segments, given a list of "weights", so I can meld the outputs _H0 and _H (image).
The problem is I don't know how to output a "Domain". Is it a variable type? Or a collection type?
Here is the code below, where I have to output two sets of values...
Thanks in advance,
Eduardo
partes.Count()
Dim totalDePartes As Integer
totalDePartes = 0
For Each elem As Integer In partes
totalDePartes = totalDePartes + elem
Next
Dim Hparcial As Double
Hparcial = H / totalDePartes
Dim Hs As List(Of Double)
Hs = New List(Of Double)()
Dim H0s As List(Of Double)
H0s = New List(Of Double)()
Dim H0parcial As Double
H0parcial = H0
For i As Integer = 0 To (iList - 1)
Hs.Add(partes(i) * Hparcial)
If i <> 0 Then H0parcial = H0parcial + (partes(i - 1) * Hparcial) H0s.Add(H0parcial)
Next
_H = Hs
_H0 = H0s
Tags:
I found something in Grasshopper SDK: GH_Interval1D Structure
It seems what I need, but how can I use it in VBScripting?
In short the answer to your question is yes you can divide a surface into unequal segments. They will still be grids but they can have whatever spacing you choose.
A domain in VB is an interval so you would do the following:
dim int1 as new inteval(0,1)
I suggest that you "reparameterize" your surface in code which happens like this:
(assuming that "sur" is a surface you've brought in or already dim'ed)
sur.setdomain(0, int1)
sur.setdomain(1,int1)
then if you want to cut the surface up into whatever pieces you can use the domains like percentages so 0 to .2 would be from the start to 20% and .2 to .3 would be 20% to 30% and so on.
I am not quite sure what you want with the chopped up domain unless you are trying to split the surface in which case please see the ghx I attached.
you could run that trim in a for loop to get a bunch of parts and add those surfaces to a list. Let me know if this is not what you needed and I'll see what I can do to help.
Hi Andy!
Thanks for your reply. That's exactly what I was looking for, interval-wise. Thanks!
However, the intervals are not to generate trimmed surfaces, but rather to convey abstract data about (also) abstract objects. This is because I'm dealing with a complex program and i have to cut down on the geometry :p Basically I'll be using GH to generate the geometry at the very end, and meanwhile taking advantage of the dataflow capabilities...
Thanks again!
Eduardo
Welcome to
Grasshopper
© 2025 Created by Scott Davidson.
Powered by