Grasshopper

algorithmic modeling for Rhino

Working through the panelizing tools primer released yesterday. The grasshopper example on page 28 is not baking for me. I get an m_count not defined but if I simply dim m_count as integer at beginning it still dose not bake.

Sub RunScript(ByVal Points As List(Of Object), ByVal GridName As String, ByVal Bake As Boolean, ByVal Num As Integer)

If( Not Bake ) Then
m_count = 0
Return
End If
'Iterate through points by row
Dim i As Integer
Dim j As Integer
j = 0
For i = 0 To Points.Count() – 1
If( j > Num + 1 ) Then
j = 0
End If
Dim pt As On3dPoint
pt = Points(i)
'Name the point
Dim att As New On3dmObjectAttributes
doc.GetDefaultObjectAttributes(att)
att.m_name = GridName & "(" & m_count & ")(" & j & ")"
print(m_count)
'increment index
j += 1
'Add to document
doc.AddPointObject(pt, att)
Next
m_count += 1
A = m_count
End Sub

Views: 328

Attachments:

Replies to This Discussion

Seemed like there was an invalid character pasted in after Points.Count(). Here's a fixed vers.

Sub RunScript(ByVal Points As List(Of On3dPoint), ByVal GridName As String, ByVal Bake As Boolean, ByVal Num As Integer)
Dim m_count As Int32
If( Not Bake ) Then
m_count = 0
Return
End If
'Iterate through points by row
Dim j As Int32 = 0
For i As Int32 = 0 To Points.Count() - 1
If( j > Num + 1 ) Then
j = 0
End If
Dim pt As On3dPoint
pt = Points(i)
'Name the point
Dim att As New On3dmObjectAttributes
doc.GetDefaultObjectAttributes(att)
att.m_name = GridName & "(" & m_count & ")(" & j & ")"
print(m_count)
'increment index
j += 1
'Add to document
doc.AddPointObject(pt, att)
Next
m_count += 1
A = m_count
End Sub
Thanks Dirk,
I worked off a cut and paste from the manual so the character got in there.

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service