Forgot password?

Create an account!

Forum

« back

RhinoScript – listing differences in Z values for curve points

Messages

Please log in to write a message.

  • 7. dingle (Nov 28, 2008 13.12):

    worked perfectly. shouldn't have missed that one. thank you again!

  • 6. Hanno (Nov 27, 2008 12.34):

    Hi,

    rhino.angle returns an array with more information than just the angle, so your dblLineAngle is in fact an array with the angle at position 0. Try:

    Call Rhino.RotateObject (strTextMarker, arrCrvEnd, dblLineAngle(0))

    ...and to avoid confusion you should in this case name your variable arrLineAngle

    Hanno

  • 5. dingle (Nov 26, 2008 20.08):

    (sorry for the double post last time.)

    all right, let me reiterate that i'm new to this, and i feel like i'm asking something embarrassingly easy, but i can't seem to figure out what i'm doing wrong. i have an idea but i'm not sure.
    trying to get that text object to rotate to align with the line it just evaluated. having trouble with the Rhino.RotateObject line. am i sending the function the wrong parameter somehow?

    Call Main
    Sub Main

            Dim arrObjects, strTopLine
            arrObjects = Rhino.GetObjects("Pick curves", 4)

            If Not IsNull (arrObjects) Or Rhino.IsCurveClosed Then
                   
                    For Each strTopLine In arrObjects
                           
                            Dim arrCrvStart, arrCrvEnd, dblDistance
                            arrCrvStart = Rhino.CurveStartPoint(strTopLine)
                            arrCrvEnd = Rhino.CurveEndPoint (strTopLine)
                            dblDistance = arrCrvStart(2) - arrCrvEnd(2)
                           
                            If Not IsNull(dblDistance) Then
                                   
                                    Dim strTextMarker
                                    strTextMarker = Rhino.AddText (CStr(dblDistance), arrCrvEnd, 150)
                                   
                                    If Not IsNull(strTextMarker) Then

                                            Dim dblLineAngle       
                                            dblLineAngle = Rhino.Angle (arrCrvStart, arrCrvEnd)
                                                     
                                            Call Rhino.RotateObject (strTextMarker, arrCrvEnd, dblLineAngle)
                                           
                                    End If
                                   
                            End If
           
                    Next
           
            End If
                   
    End Sub
  • 4. dingle (Nov 25, 2008 18.59):

    hanno,
    perfection. that's the more sensible solution i knew must exist somehow. i just didn't know you could find the attribute of the point with just the parentheses. now i do. excellent, thank you very much!

  • 3. dingle (Nov 25, 2008 18.09):

    hanno,
    perfection. that's the more sensible solution i knew must exist somehow. i just didn't know you could find the attribute of the point with just the parentheses. now i do. excellent, thank you very much!

  • 2. Hanno (Nov 25, 2008 16.29):

    Hi dingle,

    the easiest way to get the z difference is looking directly at the z values of the points. So instead of calling rhino.distance try the following:

    dblDistance = arrCrvEnd(2) - arrCrvStart(2)

    If you want x or y values you simply have to use (0) or (1) as array key.

    If you do not want to have negative values you can use the abs() function:

    dblDistance = abs(arrCrvEnd(2) - arrCrvStart(2))

    Hope that helps!

    Hanno

  • 1. dingle (Nov 23, 2008 23.00):

    hey there,
    very new to rhinoscript, read the primer and studied a bunch of examples, and this is my first crack at it. i'm trying to list the difference in height of the endpoints of a bunch of curves by placing a text object at the end. i can't seem to figure out a way to extract only the distance in that one dimension. here's what i have so far.

    Option Explicit
    'Script version Sunday, November 23, 2008 8:06:27 PM

    Call Main
    Sub Main

            Dim arrObjects, strTopLine
            arrObjects = Rhino.GetObjects("Pick curves", 4)

            If Not IsNull (arrObjects) Or Rhino.IsCurveClosed Then
                   
                    For Each strTopLine In arrObjects
                           
                            Dim arrCrvStart, arrCrvEnd, dblDistance
                            arrCrvStart = Rhino.CurveStartPoint(strTopLine)
                            arrCrvEnd = Rhino.CurveEndPoint (strTopLine)
                            dblDistance = Rhino.Distance(arrCrvStart, arrCrvEnd)
                           
                            If Not IsNull(dblDistance) Then
                                   
                                    Rhino.AddText CStr(dblDistance), arrCrvEnd, 200
                           
                            End If
           
                    Next
           
            End If
    End Sub

    thanks for looking!

Recommend

Why are these buttons gray?