Fusion 360 API - mesh object properties return unexpected values

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
I tried accesing the data of user-selected mesh using the API. According to the API specification, nodeIndices can be used to look up nodeCoordinates of each triangle. Does this mean that the length of nodeIndices and nodeCoordinates should be equal? However, this does not happen in my script. I use the following code to access the data of the mesh body selected by user - I included just the handler for the execute event:
# Event handler for the execute event.
class SampleCommandExecuteHandler(adsk.core.CommandEventHandler):
def __init__(self):
super().__init__()
def notify(self, args):
eventArgs = adsk.core.CommandEventArgs.cast(args)
# Code to react to the event.
app = adsk.core.Application.get()
ui = app.userInterface
product = app.activeProduct
design = adsk.fusion.Design.cast(product)
# Get the root component of the active design.
rootComp = design.rootComponent
# Get the values from the command inputs.
inputs = eventArgs.command.commandInputs
# Assign the selected body to mb variable
mb :adsk.fusion.MeshBody = inputs.itemById('msh').selection(0).entity
msh = mb.displayMesh.nodeCoordinates
dbl = mb.displayMesh.nodeCoordinatesAsDouble
flt = mb.displayMesh.nodeCoordinatesAsFloat
ind = mb.displayMesh.nodeIndices
print("ind length: " + str(len(ind)) + "msh length: " + str(len(msh)) + " no of nodes: " + str(noNodes))
print("flt length: " + str(len(flt)) + "dbl length: " + str(len(dbl)))
The output of this code is:
ind length: 29094
msh length: 4896
no of nodes: 29094
flt length: 14688
dbl length: 14688
I would appreciate any support to identify why the ind and msh arrays are not the same length - whether I do not understand these properties correctly or are they implemented incorrectly. Thank you in advance for any help.