Grasshopper

algorithmic modeling for Rhino

I am just starting out with VB scripting for GH. I cannot figure out how exactly to scale objects uniformly from a fixed point.

Referring to the Rhino SDK help file, I realize that I need to use the following method:

OnXform::Scale Method (IOn3dPoint^, double)

But I have no idea how to go about it... I tried cooking up something looking at some other codes and have the following non-working example so far:

---------------------------------------------------------
Private Sub RunScript(ByVal crv As List(Of OnCurve), ByVal pt As On3dPoint, ByVal enable As Boolean, ByRef A As Object)

If (Not Enable) Then Return

Dim scale As New OnXform
scale.Scale(pt, "1000")

For Each curve As OnCurve In crv
curve.Transform(scale)
Next

A = curve
---------------------------------------------------

I will appreciate any help... Thank you!

Views: 227

Replies to This Discussion

You don't need quotations around the scale number. The curve variable is only useful inside the loop, for every iteration it gets replaced. You have to either define a list of curves outside the loop and add a curve for every iteration of the loop, or better yet, just deactivate the list option of the crv input so that the script is executed once for every curve. The code you'll need in this case should be something like:

Dim scale As New OnXform
scale.Scale(pt, 1000)
crv.Transform(scale)
A = crv
Thanks Vicente.

I guess I will realize in due course of time when I should be using the loop and when not. I am sure I will be back with another basic question soon!

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