Grasshopper

algorithmic modeling for Rhino

Hi,all

 I use GH0.70014 , Who can help me to write a vb.net component that would retrieve a set of text object and output as a set of strings. GH doesn’t have String reference component .I think that if
you get the strings of text object must be through command line operation ,I
try to use Rhino.Input.Custom
class but no reaction to my Script .


Any suggestion will be appreciated!

Views: 5069

Replies to This Discussion

Hi Wangbin

Do you need to input strings from Rhino command line? Why?

You can always type a list of strings in a "Panel" component as in the attached image:


-Rajaa Issa
Hi,Rajaa

thank you for your help,I actually want to grab the thousands of datas from the Rhino drawing. for example , In the attached image , every line has a name corresponding to the closest sting, retreive the string to GH VBScript then I can do the next step .
Attachments:
Hi Wangbin,

I see what you mean now.
Attached is a file with two components. One for selecting text objects and the other for selecting dots.

-Rajaa Issa
Attachments:
Thanks a lot.It's what I want.
Hi Rajaa,

Thanks a lot for the script.
Would you know how I could dispatch doubles from string (in this case get rid of the ST2H) ?
Is it possible afterwards to bake them back in position ?

greetings,

Arthur


Hello again :)
Here is the solution, thanks to Mitch/EPFL on the RHINO newsgroup:


Call AddPtfromTextHeight()
Sub AddPtfromTextHeight()
' Instruction:
' 1. Pre-select all text-objects containing valid height(z) values
' ex. selText
' 2. Run Script
' * Maybe a good idea to set a different layer as current to keep the new points

Dim strTxtObj,arrTxtObj
Dim pt3D, height,strTxt

'get array containing pre-selected text objects
arrTxtObj=rhino.SelectedObjects

If IsArray(arrTxtObj) Then
'loop through individual text objects
For Each strTxtObj In arrTxtObj
If rhino.IsText(strTxtObj) Then
'1. get text object location
pt3D=rhino.TextObjectPoint(strTxtObj)
'2.get the text from the text object
strTxt=(rhino.TextObjectText(strTxtObj))
'3.check to see if the text can be interpreted as a number
If IsNumeric(strTxt) Then
'4. convert z-value of point location to the text object value
pt3D(2)=Cdbl(strTxt)
'5. add point
rhino.AddPoint pt3D
End If
End If
Next
End If
End Sub

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