Why is Inventor 2011 Slow to set User Parameter Values

Why is Inventor 2011 Slow to set User Parameter Values

Anonymous
Not applicable
692 Views
4 Replies
Message 1 of 5

Why is Inventor 2011 Slow to set User Parameter Values

Anonymous
Not applicable

I would be interested to have opinions on why the VB. net code extract below is so slow.  I am building a series of assemblies from a standard set of parametric part templates.  Using iMates, the parts are placed in an assembly and then all the user parameters are set one by one.  This is the bit that is really slow.

 

The user parameter names and requried values are held in array vParamValue.

 

Try

   For Each oUserParam In oUserParams

      For i = 1 To iParamCount

         If oUserParam.Name = vParamValue(0, i) Then

                            oUserParam.Value = vParamValue(j, i)

            Exit For

          End If

      Next i

   Next

Catch ex As Exception

   MsgBox("Error setting one ot more part parameters" & vbCrLf & ex.Message)

End Try

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

Anonymous
Not applicable

I noticed you hardcoding 0 for one of your array bound in one case using J in another.  Is this right?

 

Are you running inventor through automation from VB.NET?

If so I can tell you that automation will run inventor at about half speed.

 

How big is iParamCount?

 

I've done this sort of thing before.  I was able to cut down on the number of cycles by keeping track of which variables belonged to which files and then pushing them into their respective userparameter directly inside a try catch structure.

(Basically choose your names and values outside your parameters loop)

 

oUserParams(<Name>).Value = <Value>

 

 

 

0 Likes
Message 3 of 5

Anonymous
Not applicable

One of the array indices is 0 because the data is derived from Excel and the first row gives the parameter names.  Successive rows are the values for each parameter with the row given by j.  iParamCount has a maximum value of 32 and yes I am using vb.net.

 

I maybe possible for me to set the parameter names outside of the for loop and go though it once which will certainly help.  Thanks for your reply.

 

0 Likes
Message 4 of 5

Anonymous
Not applicable
Accepted solution

If you running Inventor through automation

from external VB.NET application then you may try this:

 

 

oApp.UserInterfaceManager.UserInteractionDisabled = True
[ code with parameters ]
oApp.UserInterfaceManager.UserInteractionDisabled = False

 

 

0 Likes
Message 5 of 5

Anonymous
Not applicable
Accepted solution

Your suggestion has made a noticeable improvement.  Thanks for the reply.

0 Likes