UserParameter - Set Value
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hey
i am trying to update a parameter value. This appeared to work for a long time but now no longer works (Unless it never it worked and i only assumed it did!)
Anyway.
_BMDef is the Document ComponentDefinition
My function
Friend Sub SetParams(ByVal ParamName As String, ByVal ParamValue As String)
Dim Params As UserParameters = CType(_BMDef.Parameters.UserParameters, UserParameters)
Dim P As UserParameter = Params.Item(ParamName)
P.Expression = ParamValue
End Sub
I pass in the parameter name & value to update
The error is on this line
Dim P As UserParameter = Params.Item(ParamName)
I am getting a System.ArgumentException
{"The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARGS))"}
The error would indicate the parameter probably doesnt exist but it does. Its the correct document with a valid existing parameter.
Is my code correct to access & update a user parameter?
Nacho
Automation & Design Engineer
Inventor automation Programmer (C#, VB.Net / iLogic)
Furniture, Sheet Metal, Structural, Metal fab, Tradeshow, Fabrication, CNC
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.