Unspecified error working with oUserParams.AddByValue:

Unspecified error working with oUserParams.AddByValue:

agsiviglia
Explorer Explorer
279 Views
2 Replies
Message 1 of 3

Unspecified error working with oUserParams.AddByValue:

agsiviglia
Explorer
Explorer

Hi,

 

I am trying to add a user parameter to my assembly.

(totalArea is a variable that is calculated in another part of the code)

 

When I run this code, an unspecified error occurs on this line:

Dim Area As UserParameter = oUserParams.AddByValue("Surface Area for Buttering",totalArea,"in , in")

 

Any tips for dealing with this? I can't understand what I'm doing wrong since the error is unspecified Any help is appreciated.

 

   oUserParams  = ThisAssembly.Document.ComponentDefinition.Parameters.UserParameters
	
    ' Try to find the existing parameter
    Try
        ' Attempt to retrieve the parameter by name
        Dim r As UserParameter = oUserParams.Item("Surface Area for Buttering")
    Catch
        ' If the parameter doesn't exist, add it
        Dim Area As UserParameter = oUserParams.AddByValue("Surface Area for Buttering",totalArea,"in , in")
    End Try

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

Curtis_Waguespack
Consultant
Consultant
Accepted solution

Hi @agsiviglia 

 

just at a glance I think the issue is the spaces in the parameter name. If you try to create that parameter manually I think you will be greeted by an error message about invalid characters.

 

also, it looks like the units specifier is included 2x which will likely cause an error too

Curtis_Waguespack_0-1722546869887.png

 

EESignature

Message 3 of 3

agsiviglia
Explorer
Explorer

Thank you!