- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
How to set by iLogic or VB : "allow custom values" for all user multivalue parameters? (when creating them or later)
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello Marcin,
The parameter has an attribute
UserParameters.item(1).attributeSets.item("com.autodesk.inventor.parameterAttributes").item("AllowCustomValue").value = 0/1
this should help you, I hope
Kudo's are also appreciated
Succes on your project, and have a nice day
Herm Jan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello
Thank's but it seems that it works, but only if i first manually set "allow custom value",
without setting at beginning i got failure (i quess that item AllowCustomValue not exist !)
then by this code i can only change seeting from 0 or 1
UserParameters.item(1).attributeSets.item("com.autodesk.inventor.parameterAttributes").item("AllowCustomValue").value = 0/1
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
as soon as you make a multi value parameter, the attribute will also be created for that parameter.
value = 0 : check is off
value = 1 : check is on
when a parameter is not a multi value parameter the attribute does not exist
Kudo's are also appreciated
Succes on your project, and have a nice day
Herm Jan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
could You please look my file? inv. 2020.2
i disagree with You, attribute is not created, but true is that it should be created ![]()
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello Marcin,
apperently the attribute is not created if you make the multyvalue by code....
so I altered your iLogic code a little so that the attribute is created.
the condition still is there that it should be a multi value!
try it, and let me know
Kudo's are also appreciated
Succes on your project, and have a nice day
Herm Jan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
One line must be added, if not, it worked only after manualy open list of parameters
pcd.Parameters.UserParameters.Item("param_N").AttributeSets.Add("com.autodesk.inventor.ParameterAttributes")
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Dear Marcin,
exactly the functionality described here would help me a lot. Unfortunately, I am not getting the rule to run smoothly. I guess it has to do with the fact that I am creating the MultiValueList Parameters with an ilogic rule and therefore the AttributeSet does not seem to be created with it. Is it possible to post the complete rule text here again. That would be great. Thanks a los.
Best regards Ben
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Sub Main Add_Parameters End Sub Sub Add_Parameters Dim doc As PartDocument doc = ThisDoc.Document Dim pcd As PartComponentDefinition pcd = doc.ComponentDefinition If ThisApplication.ActiveDocumentType = kPartDocumentObject Then MultiValue.UpdateAfterChange = True MultiValue.SetValueOptions(True) 'example to only setmulivalue j = 10 For i = 1 To j : Try : If Parameter("k_flange_N" & i) <> -100 Then : End If : Catch : doc.ComponentDefinition.Parameters.UserParameters.AddByExpression("k_flange_N" & i, 1, "mm") : End Try : Next For i = 1 To j : MultiValue.SetList("k_flange_N" & i, -1, 0, 1) : Next 'example to setmulivalue and allow custom value j = 20 index_no = 2 For i = 1 To j : Try : If Parameter("set_N" & i) <> -100 Then : End If : Catch : doc.ComponentDefinition.Parameters.UserParameters.AddByExpression("set_N" & i, 0, "mm") : End Try : Next For i = 1 To j MultiValue.SetList("set_N" & i, -2, -1, 0, 1) Set_Attributes_To_Mulitivalue("set_N" & i) 'set default index value Dim oParam1 As UserParameter oParam1 = ThisDoc.Document.componentdefinition.parameters.item("set_N" & i) oParam1.ExpressionList.SetExpressionList(oParam1.ExpressionList.GetExpressionList(), True, index_no) Next RuleParametersOutput() InventorVb.DocumentUpdate() End If End Sub Function Set_Attributes_To_Mulitivalue(PARAM_NAME As String) Dim doc As PartDocument doc = ThisDoc.Document Dim pcd As PartComponentDefinition pcd = doc.ComponentDefinition Try Dim paramAttribSet As AttributeSet pcd.Parameters.UserParameters.Item(PARAM_NAME).AttributeSets.Add("com.autodesk.inventor.ParameterAttributes") paramAttribSet = pcd.Parameters.UserParameters.Item(PARAM_NAME).AttributeSets.Item("com.autodesk.inventor.ParameterAttributes") Try paramAttribSet.Add("AllowCustomValue", ValueTypeEnum.kIntegerType, 0) Catch ex As Exception End Try paramAttribSet.Item("AllowCustomValue").Value = 1 Catch End Try End Function
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report