Message 1 of 5
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
I want to export coordinates of a point (more points in the future) to a csv-file.
I am not an experienced coder, but even with help of google and some friends I couldn't figure it out.
I tried the in python included csv module, csv.DictWriter etc. but i always get the same error.
OSError: [Errno 30] Read-only file system: 'coordinates.csv'
I tried moving the directory of the .py file to different paths, where I know i have write rights but still the error persists.
#Author-
#Description-
import adsk.core, adsk.fusion, adsk.cam, traceback, csv
app = adsk.core.Application.get()
ui = app.userInterface
pntEntity = ui.selectEntity('Select a sketch point', 'SketchPoints')
pnt = adsk.fusion.SketchPoint.cast(pntEntity.entity)
fields=['X-Coord','Y-Coord','Z-Coord']
with open(r'coordinates.csv', 'a') as coord_csv:
writer = csv.writer(coord_csv)
writer.writerow(fields)
writer.writerow('{0}'.format(pnt.geometry.x))
Solved! Go to Solution.