Community
Fusion API and Scripts
Got a new add-in to share? Need something specialized to be scripted? Ask questions or share what you’ve discovered with the community.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Coordinate algebraic sign (-) in point geometry print command

4 REPLIES 4
Reply
Message 1 of 5
_fabschke_
299 Views, 4 Replies

Coordinate algebraic sign (-) in point geometry print command

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

4 REPLIES 4
Message 2 of 5
JeromeBriot
in reply to: _fabschke_

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

 

Message 3 of 5
_fabschke_
in reply to: JeromeBriot

The world space I think.

What excactely is the difference?

Message 4 of 5
JeromeBriot
in reply to: _fabschke_

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.

Message 5 of 5
_fabschke_
in reply to: JeromeBriot

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.

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report