algorithmic modeling for Rhino
Hello All:
Trying to put together some code that would place a sphere at each vertex of a brep and do a difference. That alone is not difficult, but I don't want the spherical surfaces included in the resulting brep.
Attaching my code - will entertain any solutions you may have!
Cheers
Neil
Tags:
Hi Neil,
unfortunately it's very difficult. The [Trim Solid] component is supposed to do this, but it isn't working correctly. It seems that Rhino5 actually does provide tools for this, so I can fix the component, in the meantime I wrote a VB script that does this (attached), I hope it works (and I hope you can open it).
Just in case you can't open it, here's the code:
Private Sub RunScript(ByVal S As Brep, ByVal T As List(Of Brep), ByRef A As Object)
For i As Int32 = 0 To T.Count -1
Dim rc As Brep() = S.Split(T(i), doc.ModelAbsoluteTolerance)
If (rc Is Nothing) Then Continue For
If (rc.Length < 2) Then Continue For
'We need to figure out which part of rc is the original.
'I'm going to boldly assume in this case that it's the one with the
'largest bounding box
Dim maxI As Int32 = 0
Dim maxD As Double = rc(0).GetBoundingBox(True).Diagonal.Length
For k As Int32 = 1 To rc.Length - 1
Dim localD As Double = rc(k).GetBoundingBox(True).Diagonal.Length
If (localD > maxD) Then
maxD = localD
maxI = k
End If
Next
S = rc(maxI)
Next
A = S
End Sub
--
David Rutten
david@mcneel.com
Poprad, Slovakia
I just added the new logic to Trim Solid, so come the next version this will be easy, but until then you'll need the VB component.
--
David Rutten
david@mcneel.com
Poprad, Slovakia
Many thanks David! I appreciate the reply!
Neil
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
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by