Grasshopper

algorithmic modeling for Rhino

Hi all,

I have a rhinoscript that I'd like to convert to GH def... Is there any way to easily convert it using C# or VB?

Thank you!

here below the code:

_______________________________________________

Option Explicit
Rhino.EnableRedraw False
Call Main()
Sub Main()

Dim strMsg, arrCurves, strCmd, blnResult
Dim strObj, arrObjs, b, arrTmp, arrBorders()

strMsg = "Select lines or curves"
arrCurves = Rhino.GetObjects(strMsg, 4, False, True, True)
If IsNull(arrCurves) Then Exit Sub

strCmd = "_TestGetPlanarRegions"
blnResult = Rhino.Command(strCmd, False)

If blnResult = True Then
arrObjs = Rhino.LastCreatedObjects(False)
If Not IsArray(arrObjs) Then Exit Sub

b = 0
For Each strObj In arrObjs
arrTmp = Rhino.DuplicateEdgeCurves(strObj, False)
If IsArray(arrTmp) Then
ReDim Preserve arrBorders(b)
arrBorders(b) = Rhino.JoinCurves(arrTmp, True)(0)
b = b + 1
End If 
Next

Rhino.DeleteObjects arrObjs
Rhino.SelectObjects arrBorders

End If
End Sub
Rhino.EnableRedraw True

________________________________________

Views: 295

Replies to This Discussion

See Attached!

Attachments:

thank you for your reply, but it seems it doesn't work (probably there is something I'm doing wrong). If I press the button nothing happens and than the button is locked avoiding any action.


In any case, how to collect crvs as INPUT and how to have OUTPUT in order to have final crvs directly in GH?

Thank you again

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service