Quantcast
Channel: Scripting - McNeel Forum
Viewing all articles
Browse latest Browse all 5938

Issue while writing values from ghpython to csv

$
0
0

Hello!

I am trying to write point coordinates, more specifically the xcoordinate value and the y coordinate value to a CSV file from GHpython.

I am rounding the coordinate values by 2 decimals and then writing them to separate columns, but on opening the file some values have not taken the decimal correction. I do not understand why this happens. my code is attached below and an image of the CSV file output. Any suggestion would be very helpful! thanks in advance

import Rhino as rc
import Rhino.Geometry as rg
import rhinoscriptsyntax as rs


fileName = open(fileAddress, 'w')
for pt in points: 
    
    a = round(pt.X,2)
    b = round(pt.Y,2)

    fileName.write(`a` + ';' + `b`+ '\n')
    
fileName.close()

3 posts - 2 participants

Read full topic


Viewing all articles
Browse latest Browse all 5938

Trending Articles