Code stopped working 2014 upgrade 2021

Code stopped working 2014 upgrade 2021

Jef_E
Collaborator Collaborator
547 Views
5 Replies
Message 1 of 6

Code stopped working 2014 upgrade 2021

Jef_E
Collaborator
Collaborator

Hi all,

 

We are currently going to migrate to 2021, and I am checking some 'custom' work we have running. Sadly I cannot seem to get it to work to the full extent. Previously I did a check to the 2019 version and did not encounter the same problem

 

I receive following error when editing a parameter  value.

 

The current value = 30

The new value = 35

 

Schermafbeelding 2020-10-30 092124.png

 

I can't seem to figure it out why this is failing.

 

Kind regards,



Please kudo if this post was helpfull
Please accept as solution if your problem was solved

Inventor 2014 SP2
0 Likes
548 Views
5 Replies
Replies (5)
Message 2 of 6

Jef_E
Collaborator
Collaborator

In addition I did another test; I started a new plugin using the guide, with following code, producing the same error when setting the value.

 

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

        Dim oDoc As PartDocument = _invApp.ActiveDocument

        Dim oParameter As Parameter = oDoc.ComponentDefinition.Parameters.Item("Nozzle_length_positioning")
        MsgBox(oParameter.Value)
        oParameter.Value = 35
        MsgBox(oParameter.Value)
    End Sub

 

Kind regards,



Please kudo if this post was helpfull
Please accept as solution if your problem was solved

Inventor 2014 SP2
0 Likes
Message 3 of 6

raith-mb
Advocate
Advocate

Did you try

...Value = (Value / 10)

Regards Roland

0 Likes
Message 4 of 6

Jef_E
Collaborator
Collaborator

@raith-mb wrote:

Did you try

...Value = (Value / 10)

Regards Roland


No I did not, as this is not the problem...



Please kudo if this post was helpfull
Please accept as solution if your problem was solved

Inventor 2014 SP2
0 Likes
Message 5 of 6

JhoelForshav
Mentor
Mentor

Hi @Jef_E 

I've tried to reproduce the error in both inventor 2020 and 2021 with no luck... which Autodesk.Inventor.Interop.dll are you referencing? Could you attach a simple VS project where this error occurs?

Message 6 of 6

DRoam
Mentor
Mentor

On the line that fails, if you hover over the three highlighted terms below, what does Visual Studio say is their type (e.g. hovering over "Value" shows "Property Parameter.Value As Object")?

 

oParameters Item("Nozzle_length_positioning") . Value = value / 10

0 Likes