Error when adding custom feature

Error when adding custom feature

crazybrain13
Contributor Contributor
435 Views
4 Replies
Message 1 of 5

Error when adding custom feature

crazybrain13
Contributor
Contributor

I am working on an addin that will add a custom feature to make parametric helical patterns of objects. So far i have the core functionality of the execute command working as intended.

Helix Pattern Test v15.png

However, I get a runtime error when I try to add the customFeatureInput.

 

Failed:

Traceback (most recent call last):

File "C:/Users/shopuser/AppData/Roaming/Autodesk/Autodesk Fusion 360/API/AddIns/HelicalPattern/HelicalPattern.py", line 186, in notify

features.customFeatures.add(customFeatInput)

File "C:\Users/shopuser/AppData/Local/Autodesk/webdeploy/production/7627f627889be835182cfc345110c3c9f5bc9cc3/Api/Python/packages\adsk\fusion.py", line 22142, in add

return _fusion.CustomFeatures_add(self, input)

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

RuntimeError: 3 : make params invalid

 

I have tried many different combinations of things to try to make this work to no avail. Does anyone know what this means or how to fix it?

 

I have attached what I have for my addin so far as a .txt

0 Likes
Accepted solutions (1)
436 Views
4 Replies
Replies (4)
Message 2 of 5

Jorge_Jaramillo
Collaborator
Collaborator

Hi,

 

I have the following remarks about your AddIn:

- Did you tried creating the CustomFeature without any of the 3 parameters? Just to check the parameters are not an issue.

- Did you checked the result value from each of the customFeatInput.addCustomParameter() method call?  It returns a boolean, which indicates the parameter is well defined for the feature.

- Or maybe, try creating the CustomFeature with a single parameter at a time, so you can check which parameter is making it to fail.

- This is not the cause of your problem, but it could be an issue later: the global variables design, root and defaultLengthUnits depends on the document over the AddIn will work on; so, you should set them in the CommandCreateHandler with the active design.  The way you have them set, they reference the active at the moment the AddIn is being activated.

 

I hope this can help out.

 

Regards,

Jorge Jaramillo

 

0 Likes
Message 3 of 5

crazybrain13
Contributor
Contributor

Thanks for the input!

 

Yes, I did try creating the customFeature without any of the parameters, and the issue still happens. I also checked the return values for customFeatureInput.addCustomParameter() method call, and they all returned true. I even tried singling out each parameter, still the same error.

 

Thanks for the heads up about my global variables. I moved the assignment for those variables into the CommandCreatedHandler.

 

This really has me stumped. From everything I can see, I have set this up exactly like the documentation says and It's just not working. I just keep assuming I must have done something wrong somewhere because I can't find any information about this error and no one else in the forums has posted anything about it.

0 Likes
Message 4 of 5

scm
Explorer
Explorer
Accepted solution

One reason to get this error is if the Add-In's manifest file doesn't have an id field defined.

 

This can easily happen for two reasons:

 

Fusion has to be restarted for a change to the manifest file to take effect. Just starting/stopping the add-in is not sufficient.

 

Example manifest with an id (a randomly generated UUID works fine):

 

{
	"autodeskProduct":	"Fusion",
	"type":	"addin",
	"id": "8ddf023b-89bd-4313-84ea-1d94c4dba3bd",
	"author":	"...",
	"description":	{
		"":	""
	},
	"version":	"",
	"runOnStartup":	false,
	"supportedOS":	"windows|mac",
	"editEnabled":	true,
	"iconFilename":	"AddInIcon.svg"
}

 

It took me days to figure this out. I hope this helps someone. Autodesk, a more descriptive error message would be much appreciated.

 

Message 5 of 5

crazybrain13
Contributor
Contributor

Thank you so much, I had given up on this thinking there would need to be an update or something to make this work correctly. Added an id, restarted fusion, and it worked like it was supposed to. Thank You!

0 Likes