Export World geometry of sketch points
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi there,
for my student project I need to export the coordinates of multiple landmarks of a bone.
For this case I put sketch_points on the landmarks on the bone stl and imported that in another fusion file.
Now i build a skript to export those sketch point coordinates into an csv file.
But the problem is that i get the same coordinates every time, unrelated where the bone is in the world.
I guess the false output is the coordinate of the point inside the bone STL but not in the enviroment which the STL are now.
How can I get the "real" world geometry that I also get in the down right corner when I select the sketch point?
Output:
8.88178419700126e-18,-5.813692761401534,-0.4320296700973223
8.88178419700126e-18,-5.813692761401534,-0.4320296700973223
8.88178419700126e-18,-5.813692761401534,-0.4320296700973223
which I clearly do not want it to be.
more like
0.0,7.704120366290506,17.327285482391748
0.0,10.99999975413084,20.069999551400542
0.0,12.089999729767442,21.599999517202377
Thank you guys in dadvance for your help
import adsk.core, adsk.fusion, adsk.cam, traceback, csv app = adsk.core.Application.get() ui = app.userInterface # Initialize variables i = 0 coord = [] templist = () #1 pntEntity = ui.selectEntity('Select a sketch point', 'SketchPoints') pnt = adsk.fusion.SketchPoint.cast(pntEntity.entity) templist = ('{}'.format(pnt.geometry.z), '{}'.format(pnt.geometry.y), '{}'.format(pnt.geometry.x)) coord.append(templist) print(templist) templist = 0 #1,2,3...... depends how many pntEntity = ui.selectEntity('Select a sketch point', 'SketchPoints') pnt = adsk.fusion.SketchPoint.cast(pntEntity.entity) templist = ('{}'.format(pnt.geometry.z), '{}'.format(pnt.geometry.y), '{}'.format(pnt.geometry.x)) coord.append(templist) print(templist) templist = 0 print(coord) Point = ['name_of_bone'] header = ['X-Coordinate', 'Y-Coordinate', 'Z-Coordinate'] coordinates = open('path/coordinates_calc.csv', 'a') with coordinates: writer = csv.writer(coordinates) writer.writerow(Point) writer.writerow(header) for row in coord: writer.writerow(row)
In this example there you can see the 3 linked STLs and their sketch points which I select.
Those are the linked bone STLs in which i created the sketch points