Forgot password?

Create an account!

Forum

« back

RhinoScript – Creating DAT file coordinates in Rhino

Messages

Please log in to write a message.

  • 3. smrhallaj (Aug 23, 2016 08.53):

    helllo
    i can not speak english
    i am iranian
    smrhallaj@gmail.com
    !-_RunPythonScript (
    import rhinoscriptsyntax as rs
    import os
    def ExportPoints(arrptt,arrnames):


    filter = "Text File (*.dat)|*.dat|All Files (*.*)|*.*||"
    filename = rs.SaveFileName("Save point coordinates as", filter, os.getcwd(),arrnames)
    if( filename==None ): return
    file = open(filename, "w")
    for id in arrptt:
    if( rs.IsPointCloud(id) ):
    points = rs.PointCloudPoints(id)
    for pt in points:
    file.write(str(round(pt,1)))
    file.write ( "\n" )
    elif( rs.IsPoint(id) ):
    point = rs.PointCoordinates(id)
    file.write (str(round(point[0],1)) + " " + str(round(point[1],1)) + " " + str(round(point[2],1)))
    file.write ( "\n" )

    file.close()
    pointsco=rs.SelectedObjects()
    if pointsco:
    object = pointsco
    else:
    object = rs.GetObjects("Select one or several curves")
    print "ali"
    for i in object:
    rs.Command("selnone")
    rs.SelectObject(i)
    rs.Command("ChangeDegree 3 enter")
    arrNames = rs.ObjectName( i, )
    print arrNames
    rs.Command("EditPtOn selnone selpt ")
    pointsco=rs.SelectedObjects()
    rs.Command("ExtractPt Selnone pointsoff selpt")
    objects = rs.SelectedObjects()
    ExportPoints(objects,arrNames)
    rs.Command("Delete")
    )

  • 2. Arrow.111 (Jul 24, 2011 21.55):

    hi, any idea how to write this script?

  • 1. Arrow.111 (Jul 16, 2011 22.46):

    Hi dear people,
    I need help to convert *.3dm Rhono drawing polyline to DAT file X,Y coordinates.
    Is there anybody how can help me with creation of such script. I have dome it in LISP for Autocad but unfortunately I don’t know the VB to create the relevant script.
    Here is the video to show how my script woring in Cad. www.youtube.com/watch?v=7wQG4pi1B9k
    Script iz activating by the word - scan
    1 stage- its asking to enter the path and the file name without extension: Enter
    2. stage - its asking "do you need to set cross points to polyline Y/N? by default N":Enter
    3. stage - its asking "select the Line/Spline/Pline to create dat file":Enter
    4. stage - its asking to enter the number of dots that Line/Spline/Pline must be divided( by default 260)":Enter
    5. stage - its asking "do you prefer to divert the path direction of dots dividing(CW, Anty CW) by default NO":Enter
    6. stage - its asking "Do you prefer to NORMALISE the scale as additional task form 0.0-1.0? by default scale is 1.0":Enter
    7. Press Enter to conform dat file creation or ESC:
    In the result I am getting the coordinates like this:
    1 0
    0.99968708 -0.00977171
    0.99937416 -0.01954343
    0.99906125 -0.02931514
    0.99874833 -0.03908685
    0.99843541 -0.04885857
    0.99812249 -0.05863028
    0.99780957 -0.068402
    0.99749666 -0.07817371
    0.99718374 -0.08794542
    etc
    Sorry for my pure English people, I am trying to do my best:)
    Please contact me by skype (arrow.111) if you have possibility to help me with the relevant script writing but for Rhino. I will share my LISP script to anyone fro you with the grate pleasure.

    Regards & truly,
    Robert,

Recommend

Why are these buttons gray?