Grasshopper

algorithmic modeling for Rhino

It has been several days I have been trying to understand the ways of VB.Net coming from Bentley GC and Csharp. But still I seem to be crawling...

Can someone point out whats wrong with this code?


Private Sub RunScript(ByVal point As On3dPoint, ByRef A As Object, ByRef B As Object)

Dim yArray As New ArrayList

Dim count As Double : count = 10
Dim i As Int16

For i = 1 To count Step 1
Dim xArray As New List (Of On3dPoint)
Dim j As Int16

For j = 1 To count Step 1
Dim nPoint As New On3dPoint
nPoint.x = i
nPoint.y = j
nPoint.z = 0
xArray.Add(nPoint)

Next

yArray.Add(xArray)

Next

A = yArray


As a side point i reckon grasshopper is fantastic, not having to promote and export in and out from rhino saves hours each day! But would benefit from a more useful debugger also even simple definitions run quite slowly, is there plans of allowing people to compile definitions into rhino native plugins? That would be great!

Views: 710

Replies to This Discussion

I profiled a simple grasshopper network. About a dozen components, a QuickGraph, two sliders and a TextPanel. Ellipse, Curve Divide, Polyline, Curve Length, so none of the operations require BReps or Meshes.

This is the performance graph for a simple network like this:


~10% is spend actually calculating stuff, ~30% is spend redrawing the canvas and a shocking ~60% is spend redrawing Rhino viewports.

If you would not run this network in Grasshopper, but as a customized plugin instead, you could get rid of the 30% canvas redraw, so there would be a definite speed increase. But of course you'd lose all the visual feedback (text panels and quickgraphs).

You might also be able to shave a few percent off the solution time, as dedicated code can make more assumptions and has to perform fewer fail-safe checks. However, there's no way you'd be able to improve on the viewport redraw time.

--
David Rutten
david@mcneel.com
Poprad, Slovakia
This graph is extremely useful. I had always felt that keeping most objects on preview off does significantly affect performance, and your graph just reinforced that belief.

I think coded versions of things in GH can help somewhat due to:
- Fewer components on canvas to redraw
- Fewer fail-safe checks
- A lot fewer objects to preview, since most of them are calculated and processed internally.

This gives rise to another question I had been wanting to ask. I have seen some people use the *.Dispose function in scripted components. Does that have a significant contribution or is it all cleared by garbage collection anyway once its compiled?
Is there some documentation on the methods and classes specific to Grasshopper? This seems to be important in order to interface with Grasshopper, for example with the datatree class, but I can not find any documentation or help on it.

BEst,

Ben
Thanks David too for the DataTree explanation.

I would encourage anyone who is able to write some documentation please do so. I understand that things are developing and changing very fast these days. But please consider doing it as soon as it is appropiate. It would be a great help to many.

Consider the exhausting shift list, cull and list item operation which could potentially be much easier with some basic scripting.

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