Grasshopper

algorithmic modeling for Rhino

Is this the easiest way to output brep wireframe as bunch of polylines ?

(x = input brep)

Dim ptree As New DataTree(Of Curve)


For i As Integer = 0 To x.Faces.Count - 1 Step 1
Dim actpath As New GH_Path(i)
Dim actf As brepface
actf = x.Faces(i)
Dim intlist As New list(Of Integer)(actf.AdjacentEdges)


For j As Integer = 0 To intlist.count - 1 Step 1
Dim tempedg As BrepEdge = (x.Edges(intlist(j)))
Dim tempcrv As curve
tempcrv = tempedg.Duplicate
ptree.Add(tempcrv, actpath)

Next

Next

 

Dim outputCrvs As New list(Of Curve)
For i As Integer = 0 To ptree.BranchCount - 1 Step 1
outputcrvs.addrange(rhino.Geometry.Curve.JoinCurves(ptree.Branch(i)))
Next

a = outputcrvs

Views: 778

Replies to This Discussion

You probably want to use the GetWireframe method on Brep.

I see your code doesn't actually produce polylines but curves. So I suppose the easiest way to write this would be:

a = x.GetWireframe(-1)

--

David Rutten

david@mcneel.com

Poprad, Slovakia

Sorry for being ambiguous. getWireframe gives i.e. for cube 12 disconnected lines. I would like to obtain 6 polylines, 4 segments each, so each polyline is continuous set of trimming curves per face.

Then you'll indeed need to iterate over the faces and get all boundary loops.

--

David Rutten

david@mcneel.com

Poprad, Slovakia

You could explode the brep into individual breps:


Dim crvlist As New list(Of curve)
For Each bf As brepface In x.faces
crvlist.addrange(curve.JoinCurves(bf.tobrep.GetWireframe(-1)))
Next
a = crvlist

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service