Forgot password?

Create an account!

Forum

« back

RhinoScript – Beginner Problem

Messages

Please log in to write a message.

  • 5. Michi.Rauch (Aug 06, 2010 10.34):

    I have found an solution!

  • 4. Michi.Rauch (Aug 06, 2010 09.46):

    HI,
    Thank's for your help.

    Perhaps somebody has an Idea,
    if I use the LineMinDistanceTo function I get the problem,
    Mismatch of Type in Parameter. Float necessary.
    The second Problem is to create a Line between two
    lines with the minimal Distance. I can create this line with
    a line perpendicualar to two lines, but I haven't found a function in
    Rhino Script.

    kind regards

    Michael

  • 3. Johannes (Aug 05, 2010 21.55):

    hi, there are two problems in your script.

    you wrote in line 20 'axis = i+1' but i think you ment 'axisNumber = i+1'.
    you don't need to rename the lines... every line has its own identifier (name) and you have a clear asignement with the array (axis(0), axis(1), axis(2),...).

    take a look into the rhinoscript help for the LineMinDistanceTo function.
    you don't need an identifier for that function. you need two 3d points (start and end point) of two lines as input parameters.
    you can get them with the functions rhino.curvestartpoint() and rhino.curveendpoint().

    kind regards
    johannes

  • 2. Michi.Rauch (Aug 05, 2010 20.43):

    Further Information:

    I tried to change the name of the lines. But it's not possible
    to get one line by using "axis(i)"
    Also I can't save the lines in an Array.
    I don't know why!

  • 1. Michi.Rauch (Aug 05, 2010 20.39):

    I want to write a small script to draw the axis of bars which were
    drawn as "volumes" and connect the axis with a line.
    The calculations works, but I have a problem to save the created lines in
    an array.

    Option Explicit

    Call connect_centre_lines()



    Sub connect_centre_lines()

    Rhino.AddLayer "connecting_bars" ,RGB(0,0,255)

    Rhino.CurrentLayer ("connecting_bars")

    Dim bar, bars,axis
    axis = Rhino.GetObjects ("Select axis",,,True)
    If IsNull (axis) Then Exit Sub
    If IsArray (axis) Then
    Dim i
    For i=0 To UBound(axis)
    Dim axisNumber
    axis = i+1
    Call Rhino.ObjectName(axis(i),"axis_" & axisNumber)
    Rhino.Print "Object identifier: axis_" & axisNumber
    Next

    End If


    '------------ Stäbe Verbinden-------------------------
    Dim current_axis
    Dim connecting_bar
    Dim connecting_bars
    i=0
    For i=0 To UBound(axis)-1
    current_axis = (axis(i))
    connecting_bar = Rhino.LineMinDistanceTo (current_axis, axis(i+1))
    connecting_bars(i) = connecting_bar
    Next



    End Sub

Recommend

Why are these buttons gray?