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: 

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

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
sgraffe
133 Views, 2 Replies

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

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.

Labels (1)
2 REPLIES 2
Message 2 of 3
kandennti
in reply to: sgraffe

Hi @sgraffe .

 

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

1.png

Message 3 of 3
sgraffe
in reply to: kandennti

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

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