Quantcast
Viewing all articles
Browse latest Browse all 5791

Script to rotate objects around one of his axis

@Tofuw wrote:

I just started Rhinoscript development, and I'm still not used with the 3D management. So I would like some explaination for the RotateObject Rhino3D method.

I have an object, and I would like to do a rotation of it, around the Y axis, in particular, around the orange arete.

Image may be NSFW.
Clik here to view.

To do so, I followed this example :

Option Explicit

Call Main()
Sub Main()
    'Create second glass
    Dim sObj, aBox, aMin, aMax, aCen
    sObj = Rhino.GetObject("Select object to rotate 1 degree", 0, True)
    If Not IsNull(sObj) Then
        aBox = Rhino.BoundingBox(sObj)
        If IsArray(aBox) Then
            aMin = aBox(0)
            aMax = aBox(6)
            aCen = Array( _
                0.5 * (aMax(0) + aMin(0)), _
                0.5 * (aMax(1) + aMin(1)), _
                0.5 * (aMax(2) + aMin(2))_
                )
	yAxis = Array( _
		0.5 * (aMax(0) + aMin(0)), _
		0.5 * (aMax(1) + aMin(1)), _
		0.5 * (aMax(2) + aMin(2))_
		)
            Rhino.RotateObject sObj, aCen, 10.0, yAxis, True
        End If
    End If 
End Sub

But I don't understand how it works.

  • What is aBox(6), does it represent the 6th corner of the box ?
  • Can you explain me aMin and aMax ?
  • Can you explain me the aCen variable ? What are the different points of this array, and also, why are they all multiply by 0.5 ?

  • The syntax of RotateObject is as following

    • Rhino.RotateObject(strObject, arrPoint, dblAngle, arrAxis, blnCopy)
    • I would like to define the arrAxis to rotate around my orange axis. How can I declare this arrAxis (yAxis in the script) ?
      Thank you in advance for your help.

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 5791

Trending Articles