Grasshopper

algorithmic modeling for Rhino

 

 

With VB.Net in RhinoCommon, what is the syntax for changing multiple properties of the Transform class?  (and I'm sure there are other classes that have this issue).  With the old vb.net you could say:

 

dim MyXform as New OnXform

 

Then you could effect any property by calling it:

 

MyXform.Rotation(...)

 

or

 

MyXform.Translation(...)

 

 

 

But now, with the Rhino.Geometry.Transform Class, the only way I can figure out to set properties is :

 

Dim MyTransform as New Rhino.Geometry.Transform

MyTransform = Rhino.Geometry.Transform.Translation(........)

 

 

 

And the only way to also do rotation or scale is to make an entirely new transform object and call another property  like    .Scale(...)

This seems inefficient. 

 

What am I missing?

Thanks.

 

daniel

 

Views: 2668

Replies to This Discussion

Hi Daniel,

you don't actually have to construct the transforms. You can say something like this:

Dim xform As Transform
xform = Transform.Translation(...)
geo.Transform(xform)
xform = Transform.Scale(...)
geo.Transform(xform)


Or, better yet:

geo.Transform(Transform.Translation(...))
geo.Transform(Transform.Scale(...))


Creating a Transformation matrix is hardly an intensive operation, don't worry about it being inefficient, it's not. Also, the new Transform is no longer a class, it's a value type.

--
David Rutten
david@mcneel.com
Poprad, Slovakia
Thanks David, much appreciated.
I got it, never mind! Thanks!


David- Am I missing something? With the code below, I got a boolean value at A.



Private Sub RunScript(ByVal x As Brep, ByRef A As Object, ByRef B As Object)

Dim xform As Transform = Transform.Translation(0, 0, 1)

A = x.Transform(xform)

End Sub



Thanks!

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service