Allow custom values setting of a parameter

<?xml encoding=”UTF-8″>By Adam Nagy

In the user interface this is where you can set the Allow custom values option for a parameter:

AllowCustomValuesSetting

In case of the API, you’ll find it in a custom Attribute:

AllowCustomValue

Here is a VBA sample that toggles this value for the first user parameter if possible:

Sub Toggle_AllowCustomValue()
Dim doc As PartDocument
Set doc = ThisApplication.ActiveDocument
Dim pcd As PartComponentDefinition
Set pcd = doc.ComponentDefinition
Dim p As UserParameter
Set p = pcd.Parameters.UserParameters(1)
On Error Resume Next
Dim att As Inventor.Attribute
Set att = p.AttributeSets _
("com.autodesk.inventor.ParameterAttributes") _
("AllowCustomValue")
If Not att Is Nothing Then
att.Value = Not att.Value
End If
On Error GoTo 0
End Sub

Comments

Leave a Reply

Discover more from Autodesk Developer Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading