Forgot password?

Create an account!

Forum

« back

RhinoScript – Exploding closed curve & Trimming the corners

Messages

Please log in to write a message.

  • 5. pulgarata (May 25, 2016 18.31):

    In that case the best choice is to include that order in the same script, because of this way you don't have to select the lines again, just have to use the name recently saved:

    Option Explicit

    Call Main()
    Sub Main()
            Dim Curva
            Curva = Rhino.GetCurveObject("Select closed curve")
           
            If Not Rhino.IsCurveClosed(Curva(0)) Then
                    Rhino.MessageBox "It is not a closed curve"
                    Exit Sub
            End If
           
            Dim Segmentos
            Segmentos = Rhino.ExplodeCurves(Curva(0), True)
           
            Dim Segm
            For Each Segm In Segmentos
                    Rhino.ExtendCurveLength Segm, 0, 2, -2
            Next
           
            Dim x
            ReDim corners(Ubound(Segmentos))
           
            For x = 0 To Ubound(Segmentos)
                    If Not x = Ubound(Segmentos) Then
                            corners(x) = Rhino.AddLine(Rhino.CurveEndPoint(Segmentos(x)), Rhino.CurveStartPoint(Segmentos(x + 1)))
                    Else
                            corners(x) = Rhino.AddLine(Rhino.CurveEndPoint(Segmentos(x)), Rhino.CurveStartPoint(Segmentos(0)))
                    End If
                   
            Next
           
            Dim Alllines:   Alllines = Rhino.JoinArrays(corners, Segmentos)
            Rhino.JoinCurves Alllines, True
           
    End Sub

    Regards

  • 4. rishabhkhurana (May 25, 2016 17.54):

    Hey pulgarata,

    Works Perfectly..Thanks..!
    But what i'm trying to understand is how to i select objects in the script to perform operations.
    For Example, lets say, after running your code, I get Trimmed curves. How can I call the start and end points of those curves if I want to join them as straight lines or generate some other lines from them..?

  • 3. pulgarata (May 25, 2016 17.44):

    Hi Rishabhkhurana,
    Try with this:

    Option Explicit

    Call Main()
    Sub Main()
            Dim Curva
            Curva = Rhino.GetCurveObject("Select closed curve")
           
            If Not Rhino.IsCurveClosed(Curva(0)) Then
                    Rhino.MessageBox "It is not a closed curve"
                    Exit Sub
            End If
           
            Dim Segmentos
            Segmentos = Rhino.ExplodeCurves(Curva(0), True)
           
            Dim Segm
            For Each Segm In Segmentos
                    Rhino.ExtendCurveLength Segm, 0, 2, -2
            Next
           
    End Sub

    Regards,

  • 2. rishabhkhurana (May 25, 2016 16.45):

    Here's a jpg of what I want to achieve

  • 1. rishabhkhurana (May 25, 2016 16.44):

    Hey Guys,
    I'm trying to explode a closed curve and then select the exploded curves in the script to get their start points and crate a circle and trim the lines intersecting with the cirle.. Can anyone help?

Recommend

Why are these buttons gray?