algorithmic modeling for Rhino
Hi all,
I am doing a project which involves generating a large group of surfaces (often more than 800 units). It has become very memory consuming. I am wondering between brep and mesh, which one would be better in terms of memory efficiency?
Another question is, does anyone know what's the right way to convert a brep into a mesh in VB.net?
Thanks guys!
Tags:
Btw, this is what I have tried:
Private Sub RunScript(ByVal outerhex As List(Of Curve), ByVal innerhex As List(Of Curve), ByRef units As Object)
'your code goes here…
Dim num As int32 = outerhex.Count()
Dim i As int32
Dim surface_list As New List(Of mesh)
For i = 0 To num - 1
Dim outercurve As Curve = outerhex(i)
Dim innercurve As Curve = innerhex(i)
Dim curves As New list(Of Curve)
curves.add(outercurve)
curves.add(innercurve)
Dim startpt As point3d = outercurve.PointAtEnd
Dim endpt As point3d = innercurve.PointAtEnd
Dim surface_array() As brep = rhino.Geometry.Brep.CreateFromLoft(curves, startpt, endpt, LoftType.Straight, False)
Dim newbrep As brep = surface_array(0).DuplicateBrep
Dim newmesh As mesh
newmesh = mesh.CreateFromBrep(newbrep)
surface_list.Add(newmesh)
Next
units = surface_list
End Sub
The error message is:
Error: Value of type '1-dimensional array of Rhino.Geometry.Mesh' cannot be converted to 'Rhino.Geometry.Mesh'
When you mesh a Brep, you actually get an array of meshes. So this:
newmesh = mesh.CreateFromBrep(newbrep)
is illegal. You cannot assign an array of Meshes to a single Mesh. Try the following:
Private Sub RunScript(ByVal outerhex As List(Of Curve), _
ByVal innerhex As List(Of Curve), _
ByRef units As Object)
Dim meshes As New List(Of Mesh)
For i As Int32 = 0 To outerhex.Count - 1
Dim curves As New List(Of Curve)
curves.Add(outerhex(i))
curves.Add(innerhex(i))
Dim loft() As Brep = Brep.CreateFromLoft(curves, Point3d.Unset, Point3d.Unset, LoftType.Straight, False)
If (loft Is Nothing) Then Continue For
If (loft.Length = 0) Then Continue For
Dim loftMeshes As Mesh() = Mesh.CreateFromBrep(loft(0))
If (loftMeshes Is Nothing) Then Continue For
If (loftMeshes.Length = 0) Then Continue For
'Now merge all partial meshes into a single mesh
Dim loftMesh As New Mesh
For Each partialMesh As Mesh in loftMeshes
loftMesh.Append(partialMesh)
Next
meshes.Add(loftMesh)
Next
units = meshes
End Sub
--
David Rutten
david@mcneel.com
Poprad, Slovakia
Typically meshes take less memory than breps, especially since breps use a secondary mesh to draw themselves in shaded modes. Though if you switch to wireframe preview this won't happen.
If memory is really a problem, and if you have a 64-bit OS, you can try Rhino5 64-bit. It can handle enormous files.
--
David Rutten
david@mcneel.com
Poprad, Slovakia
WOW, it is hundreds of times faster now! Thanks so much David, You are amazing!!!
For the same project, I have another question. Right now the loft gives me a surface without thickness. If I want to make it into hexes with thickness, would I need to extrude each of the six surface, trim them and join? Or is there any better way to do this?
Thanks again for your help!
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by