Message 1 of 12
Dynamic Control of Parameters

Not applicable
04-09-2007
06:05 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
I have created an Add-In (VB.NET using Visual Studio 2005) which accesses an Inventor assembly. I have been able to read in parameter values and display them for the user. I am trying to provide a "slider" which allows the user to change values dynamically while viewing the results in real-tiime.
For example I have a box on top of a cylinder with a parameter defining an angular constraint value.
I have placed a TrackBar on a VB Form and set the min value to 0 and the max value to 6.2 (approx 360 degrees in radians knowing that parameter values will be in radians). I then created a ValueChanged event procedure for the trackBar object and added the following code:
oDoc = oApp.ActiveDocument
oCompDef = oDoc.ComponentDefinition
'I used a listBox to define variable "SelectedManip"
oCompOcc = oCompDef.Occurrences.ItemByName(SelectedManip)
oSubDef = oCompOcc.Definition
oSubParams = oSubDef.Parameters
oModelParams = oSubParams.ModelParameters
oModelParams.Item("Manip01_Angle").Value = TrackBar1.Value
'I created a text box on the form to provide angular feedback to the user.
TextBoxAngle.Text = TrackBar1.Value
oDoc.Update()
I find that it woks but only triggers once, moving the Inventor assembly and then stopping untill I try and drag the TrackBar again. I want to use this technique to allow users to interactively adjust parameters.
I would be grateful if someone could explain how to enable smooth control of the values.
Thank you.
Chris
I have created an Add-In (VB.NET using Visual Studio 2005) which accesses an Inventor assembly. I have been able to read in parameter values and display them for the user. I am trying to provide a "slider" which allows the user to change values dynamically while viewing the results in real-tiime.
For example I have a box on top of a cylinder with a parameter defining an angular constraint value.
I have placed a TrackBar on a VB Form and set the min value to 0 and the max value to 6.2 (approx 360 degrees in radians knowing that parameter values will be in radians). I then created a ValueChanged event procedure for the trackBar object and added the following code:
oDoc = oApp.ActiveDocument
oCompDef = oDoc.ComponentDefinition
'I used a listBox to define variable "SelectedManip"
oCompOcc = oCompDef.Occurrences.ItemByName(SelectedManip)
oSubDef = oCompOcc.Definition
oSubParams = oSubDef.Parameters
oModelParams = oSubParams.ModelParameters
oModelParams.Item("Manip01_Angle").Value = TrackBar1.Value
'I created a text box on the form to provide angular feedback to the user.
TextBoxAngle.Text = TrackBar1.Value
oDoc.Update()
I find that it woks but only triggers once, moving the Inventor assembly and then stopping untill I try and drag the TrackBar again. I want to use this technique to allow users to interactively adjust parameters.
I would be grateful if someone could explain how to enable smooth control of the values.
Thank you.
Chris