- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have a dialog that lets you format a part description for various different object types what we use.
I have about 9 combo boxes listing the available parameters in the dialog, though only 3 or 4 are used in a given part.
I have a single control that passes the info to inventor, creates, formats, exposes/exports and configures the parameter but doesn't show up in the descriptions. Other controls do exactly the same thing and work just fine. I have a feeling i'm missing something but do not see it.
Here's the code
'if angle is chosen
If RadioButton3.Checked Then
If AngBoxL1.Text = "" Or AngBoxL2.Text = "" Or AngBoxThk.Text = "" Or AngBoxLen.Text = "" Then
MsgBox("You must fill in all values.", vbOKOnly)
Else
cnum = InStr(1, AngBoxL1.Text, "||", CompareMethod.Text)
ln = Strings.Right(AngBoxL1.Text, Len(AngBoxL1.Text) - (cnum + 2))
'MsgBox(desc)
SetOther(ln, "LEG1")
cnum = InStr(1, AngBoxL2.Text, "||", CompareMethod.Text)
ln = Strings.Right(AngBoxL2.Text, Len(AngBoxL2.Text) - (cnum + 2))
'MsgBox(desc)
SetOther(ln, "LEG2")
cnum = InStr(1, AngBoxThk.Text, "||", CompareMethod.Text)
ln = Strings.Right(AngBoxThk.Text, Len(AngBoxThk.Text) - (cnum + 2))
'MsgBox(desc)
SetOther(ln, "THK")
cnum = InStr(1, AngBoxLen.Text, "||", CompareMethod.Text)
ln = Strings.Right(AngBoxLen.Text, Len(AngBoxLen.Text) - (cnum + 2))
'MsgBox(desc)
SetLen(ln)
descr = "=ANG, <LEG1> x <LEG2> x <THK>"
End If
DelParam("WIDTH")
DelParam("THK")
End If
Private Sub SetOther(ans As String, pm As String)
Dim oPartDoc As PartDocument
oPartDoc = g_inventorApplication.ActiveDocument
'MsgBox("1")
Dim param As Object
Try
param = oPartDoc.ComponentDefinition.Parameters.UserParameters.Item(pm)
'MsgBox("2")
Catch ex As Exception
'Dim newparam As UserParameter = oPartDoc.ComponentDefinition.Parameters.UserParameters.AddByValue("PL_LENGTH", ans, UnitsTypeEnum.kInchLengthUnits)
Dim newparam As UserParameter = oPartDoc.ComponentDefinition.Parameters.UserParameters.AddByExpression(pm, ans, UnitsTypeEnum.kInchLengthUnits)
'MsgBox("3")
End Try
oPartDoc.ComponentDefinition.Parameters.UserParameters.Item(pm).Expression = ans
oPartDoc.ComponentDefinition.Parameters.UserParameters.Item(pm).ExposedAsProperty = True
'MsgBox("4")
oPartDoc.ComponentDefinition.Parameters.UserParameters.Item(pm).CustomPropertyFormat.Units = UnitsTypeEnum.kInchLengthUnits
oPartDoc.ComponentDefinition.Parameters.UserParameters.Item(pm).CustomPropertyFormat.Precision = CustomPropertyPrecisionEnum.kSixteenthsFractionalLengthPrecision
End Sub
The only parameter not working is THK. Like I said. It pulls the correct value, assigns it to the parameter, the export checkbox is checked, the internal custom formatting is correct. It just doesn't show in the description field. The field is set to =ANG, <LEG1> X <LEG2> X <THK>
Leg1 and 2 work just fine. I get a black for THK even though it's set correctly. If i open it's Custom Property format dialog and just hit OK without touching anything, it pops right into the description.
Any help would be appreciated.
Thanks
Solved! Go to Solution.

