Grasshopper

algorithmic modeling for Rhino

I am trying to create sections within a brep(Hull) by intersecting the brep with the XY plane. The idea is that within the loop, the plane moves along the length of the brep. I can't seem to get this operation to work. Ideally it would create however many sections the user wants, input as the NumberOfWaterlines variable. Here is my code:

    Dim i As Integer
    Dim WLintCurves As Curve()
    Dim WLintPoints As point3d()
    Dim Waterplanes As Brep()
    Dim WaterplanesBreps As array
    For i = 0 To NumberOfWaterlines - 1
      XYPlane.OriginZ = i * Depth / NumberOfWaterlines
      Rhino.Geometry.Intersect.intersection.BrepPlane(Hull, XYPlane, 0.0001, WLintCurves, WLintPoints)
      Waterplanes = Rhino.Geometry.Brep.CreatePlanarBreps(WLintCurves)
      WaterplanesBreps(i) = Waterplanes
    Next

 

Any help would be greatly appreciated!

Views: 278

Replies to This Discussion

Hi Dorvieto,

 

don't use arrays like this:

 

Dim WaterplanesBreps As array

 

It's much easier to use Lists instead:

 

Dim WaterplanesBreps As New List(Of Brep)

 

Then you can easily append your Planar Breps like so:

 

WaterplanesBreps.AddRange(Waterplanes)

 

--

David Rutten

david@mcneel.com

Poprad, Slovakia

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service