Created
April 19, 2017 21:30
-
-
Save Alliages/230f3bf873c014720355dfc4eb0504b6 to your computer and use it in GitHub Desktop.
Rhinoscript Planarization of surfaces
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Option Explicit | |
'Script written by Guillaume Meunier | |
'Script copyrighted by Guillaume Meunier | |
'Script version Wednesday, April 12, 2017 1:14:09 PM | |
'try to Planarize objects | |
Call Main() | |
Sub Main() | |
Dim nSurf, arr, strSurf, count, arrObjects, strCurve, num_Type, res | |
arrObjects = Rhino.SelectedObjects | |
If IsArray(arrObjects) Then | |
arr = arrObjects | |
Rhino.UnselectObjects arrObjects | |
Else | |
arr = Rhino.ObjectsByType(8 + 16) | |
End If | |
count = 0 | |
For Each strSurf In arr | |
num_Type = Rhino.ObjectType(strSurf) | |
'Rhino.Print num_Type | |
Do While True | |
If num_Type <> 8 And num_Type <> 16 Then Exit Do | |
strCurve = Rhino.DuplicateEdgeCurves(strSurf) | |
res = Rhino.AddPlanarSrf(strCurve) | |
If IsNull(res) Then | |
Print "Null" | |
Else | |
'Rhino.Print CStr(res) | |
count = count + 1 | |
End If | |
'Rhino.DeleteObjects(strCurve) | |
Exit Do | |
Loop | |
Next | |
Call Rhino.SelectObjects(arr) | |
Rhino.Print "DONE " & CStr(count) & " times" | |
End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment