editCommandId is invalid for custom feature, but error doesn't tell me why

sgraffe
Explorer Explorer
376 Views
2 Replies
Message 1 of 3

editCommandId is invalid for custom feature, but error doesn't tell me why

sgraffe
Explorer
Explorer

I'm getting an error when I try to add a custom feature definition during the run() function like this:

global _waterlineCustomFeatureDef
_waterlineCustomFeatureDef = adsk.fusion.CustomFeatureDefinition.create('sgraffeWaterline', 
                                                                'Water Line', 
                                                                'Resources/CustomPocket')
_waterlineCustomFeatureDef.editCommandId = 'sgraffeWaterlineEdit'

# Connect to the compute event for the custom feature.
computeCustomFeature = ComputeWaterLineCustomFeature()
_waterlineCustomFeatureDef.customFeatureCompute.add(computeCustomFeature)
_handlers.append(computeCustomFeature)

 

But I get this error about the editCommandId being invalid:

Failed: Traceback (most recent call last):
  File "C:/Users/sgraf/Documents/sources/fusion-360-addins/WaterLine/WaterLine.py", line 143, in run
    _waterlineCustomFeatureDef.editCommandId = 'sgraffeWaterlineEdit'
  File "C:/Users/sgraf/AppData/Local/Autodesk/webdeploy/production/090497a6fd58c652eeadc96ef980caa6ca71c3c6/Api/Python/packages\adsk\fusion.py", line 13807, in _set_editCommandId
    return _fusion.CustomFeatureDefinition__set_editCommandId(self, value)
RuntimeError: 3 : Invalid command Id

Why? The API docs make it sound like it's an arbitrary string, but it's apparently not. I even tried to substitute the ID from the CustomPocket example into here, but I get the same result.

0 Likes
Accepted solutions (1)
377 Views
2 Replies
Replies (2)
Message 2 of 3

kandennti
Mentor
Mentor
Accepted solution

Hi @sgraffe .

 

It's hard to tell from that, but do the command IDs match?

1.png

0 Likes
Message 3 of 3

sgraffe
Explorer
Explorer
That was it. I didn't think about getting those to match. Thank you!
0 Likes