0

I have a question about a rather general table. I have spent some time with VBA and Excel now I am trying to create something in Fusion using python. And after previous experience with excel I am unpleasantly surprised from the API that fusion provides for any table in a drawing environment.

I found that you can use the script below to insert an empty Custom Table on a drawing. Also .execute property has a NamedValues parameter which could maybe be used for this? I have not been able to track down the information in the API documentation.

#Author-
#Description-

import adsk.core, adsk.fusion, adsk.cam, traceback

def run(context):

    app=adsk.core.Application.get()
    ui=app.userInterface
    D_doc=app.activeDocument
    cmd_pick=ui.commandDefinitions.itemById('FusionDrawingEmptyTableCommand')
    val_list_create=adsk.core.NamedValues.create()
    VL1=adsk.core.ValueInput.createByString('Ahoja')
    val_list_create.add('A:2',VL1)
    hoax=cmd_pick.execute(val_list_create) #U get same result just with .execute()

    #//Warning Using this script outside of the Drawing environment will cause crash of Fusion 360//

The problem is that either I have missed something basic or this table cannot be populated using the API. After a couple of hours of bumping my face on Visual Studio, I'm leaning towards the second option.

I tried playing with the names in the name value pair in the NamedValues object. Names like "A1", "A:1", "A_1", "A 1" did not make any progress. After a few hours of googling, I think I'll have to create my own commandDefinition class similar to the 'FusionDrawingEmptyTableCommand' class.

So the question is does anyone have any idea how to get a table similar to Custom Table created with 'FusionDrawingEmptyTableCommand' but so that it can be populated with data into Fusion?

0 Answers0