generative modeling for Rhino
Marc Hoppermann's script from the first link seems to quite do the thing by using a VB-Script, which calls the exact same functions that you use from within the GUI. However, it is needed to bake the desired surfaces first. I still hope for being able to skip that step.Using Rhino's .NET Framework functions I think this may be achieved, though I'm not sure exactly how, since I didnt' delve deep enough into it yet.
I'd appreciate any help on this topic. Or is this a hopeless case?
If you've got Rhino 5.0, Steve Baer's Python script here will do the trick. I wrote an approach that does it without scripting available here (http://heumanndesigntech.wordpress.com/2010/04/21/unroll-ruled-surf...), and improved on by Gwyllim Jahn here (http://ledatomica.wordpress.com/2011/06/24/unroll-cells-mesh-polyli...).
Finally, if you want to dig into writing the code yourself in vb.net or C#, the relevant classes can be found in the SDK under "Unroller". In C# would look something like this:
Unroller unroll = new Unroller(srf);
A = unroll.PerformUnroll(out unrollCrvs, out unrollPts, out unrollDots);
Here's the code I use in VB with rhino 5
Private Sub RunScript(ByVal BrepList As Brep, ByVal Tol As Double, ByRef Unrolled As Object)
'your code goes here…
Dim Unroll As Unroller
Unroll = New Unroller(BrepList)
Unroll.ExplodeOutput = False
Unroll.RelativeTolerance = Tol
Unrolled = unroll.PerformUnroll(Nothing, Nothing, Nothing)
Hi Fred, just hoping you may be able to expand on your script and help me here. I'm trying to do the same as above but want to unroll a list of curves that are projected on each surface. Because of this I want to loop through the list of Breps and then out them to a list to output.
Unfortunately I'm getting an error: Value of type '1-dimensional array of Rhino.Geometry.Brep' that cannot be converted to 'Rhino.Geometry.Brep'.
Here's what I've got so far. I haven't even gotten to the point of incorporating the curve unrolling yet!
Private Sub RunScript(ByVal BrepList As DataTree(Of Brep), ByVal CrvList As DataTree(Of Curve), ByVal Tol As Double, ByRef Unrolled As Object)
Dim CurrentList As New List(Of Brep)
Dim outList As New List(Of Brep)
For i As Integer = 0 To BrepList.BranchCount - 1
' Get the Brep from the current branch to unroll
CurrentList = BrepList.Branch(i)
Dim CurrentBrep As Brep = CurrentList(0)
' Unroll the current Brep
Dim Unroll As New Unroller(CurrentBrep)
Unroll.ExplodeOutput = False
Unroll.AbsoluteTolerance = Tol
Dim CurrentUnrolled As Brep() = unroll.PerformUnroll(Nothing, Nothing, Nothing)
'Add unrolled brep to list that is passed out (THIS IS WHAT IS CAUSING THE ERROR)
Unrolled = outList
Any help would be greatly appreciated.
You need to add CurrentUnrolled as list. Add() only adds single items. In C# (and probably in VB too), there's AddRange() to add lists to a list.
Thanks Hannes. All fixed.
Now for the curves...
Thanks to you two!
This seems to do the trick. Unfortunately I didn't have the time to update Rhino yet. So I will post again, after successfully replicating your methods.