Grasshopper

algorithmic modeling for Rhino

I have been looking for a way to use the rhino Rotate3D command inside of a C# box.  I want to use a while loop to run a command a certain number of times based upon an input.  Is there any way to do this?

Views: 1254

Replies to This Discussion

Here is some sample code that shows rotate 3D as done by visual basic.net the difference from c# is small and you can even find a syntax converter if you want:


Dim rotate_xf As New OnXform

' these are defined from inputs into the component with code hints to tell what type they are, you may not need to define them again with new names as I have done here

Dim pointOrigin As On3dPoint = AxisPt
Dim vaxis As On3dVector = poleVec
Dim ptB1 As On3dPoint = point1

'rotate ptB1 180 through axis - use whatever angle you want in the first parameter

rotate_xf.rotation((Math.PI / 180) * 180, vaxis, pointOrigin)
ptB1.Transform(rotate_xf)

Hope this gets you started and Good Luck!

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service