Coordinate algebraic sign (-) in point geometry print command

Coordinate algebraic sign (-) in point geometry print command

_fabschke_
Participant Participant
717 Views
4 Replies
Message 1 of 5

Coordinate algebraic sign (-) in point geometry print command

_fabschke_
Participant
Participant

Hello,

 

I am trying to print (and later export to a csv file) the pnt coordinates of 2+ sketch or construction points.

But the issue I am having currently is, that some coordinates should have a "-" before the value.

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
print(coord)

#2

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)

The output should be:

[('0.0', '0.3000234521308176', '-2.3838218031176135'), ('0.0', '3.0992720830223104', '-5.589760148808029')]

 

but it is:

 

[('0.0', '0.3000234521308176', '2.3838218031176135'), ('0.0', '3.0992720830223104', '5.589760148808029')]

so basicely without the "-".

 

In Fusion i get the - shown if i select the point

 

Bildschirmfoto 2019-09-12 um 09.25.35.png

Bildschirmfoto 2019-09-12 um 09.26.18.png

 

Thank you guys in advance

0 Likes
718 Views
4 Replies
Replies (4)
Message 2 of 5

JeromeBriot
Mentor
Mentor

Hello,

 

Do you want to export the coordinates in the sketch space or in the world space?

SketchPoints have two different properties : geometry and worldGeometry

 

0 Likes
Message 3 of 5

_fabschke_
Participant
Participant

The world space I think.

What excactely is the difference?

0 Likes
Message 4 of 5

JeromeBriot
Mentor
Mentor

The sketch space is the 2D space where you draw the sketch (i.e. the z coordinate is always 0.0)

 

The world space is the 3D space of Fusion 360 represented by the viewcube at the top-right corner of the UI.

0 Likes
Message 5 of 5

_fabschke_
Participant
Participant

Ok, got it.

It would be good to get the World geometry.

I am currently no sure I nedd the Z_coordinate, but in case i do not need the z-coordinate i can always set it to zero afterwards.

 

0 Likes