Here is an example of how you can set-up the iLogic rule that creates the user parameter and exposes it as a custom iProperty. When set-up this way, the custom iProperty will be updated every time the user parameter's active value changes, but changing the custom iProperty's value manually won't change or update the active value of the user parameter.
Dim oDocType As DocumentTypeEnum = ThisApplication.ActiveDocumentType
Dim oUParams As UserParameters
If oDocType = DocumentTypeEnum.kPartDocumentObject Or _
oDocType = DocumentTypeEnum.kAssemblyDocumentObject Then
oUParams = ThisApplication.ActiveDocument.ComponentDefinition.Parameters.UserParameters
ElseIf oDocType = DocumentTypeEnum.kDrawingDocumentObject Then
oUParams = ThisDrawing.Document.Parameters.UserParameters
End If
Dim oUParam As UserParameter
Dim oName As String = "FINISH"
Dim oValues As New List(Of String)
oValues.Add("MILL")
oValues.Add("PAINTED")
oValues.Add("GALVANIZED")
oValues.Add("ANNODIZED")
'or
'oValues.AddRange({"MILL","PAINTED","GALVANIZED","ANNODIZED"})
Dim oExists As Boolean ' False by default
For Each oUParam In oUParams
If oUParam.Name = oName Then
oUParam.ExpressionList.SetExpressionList(oValues.ToArray)
oExists = True
End If
Next
If oExists = False Then
oUParam = oUParams.AddByValue(oName, oValues.Item(1), UnitsTypeEnum.kTextUnits)
oUParam.ExpressionList.SetExpressionList(oValues.ToArray)
'oUParam.Comment = "SELECT FROM LIST"
oUParam.IsKey = True
Try
'try to expose this parameter as a custom iProperty
oUParam.ExposedAsProperty = True
oCPF = oUParam.CustomPropertyFormat
oCPF.PropertyType = CustomPropertyTypeEnum.kTextPropertyType
oCPF.Units = ThisApplication.UnitsOfMeasure.GetStringFromType(UnitsTypeEnum.kTextUnits)
Catch
MsgBox("Couldn't expose this parameter as a 'custom' iProperty.",,"")
End Try
End If
'Output Parameters values from this rule to the Model. (Use this before Document Update)
RuleParametersOutput()
'Immediately update the current document.
iLogicVb.DocumentUpdate()
When dealing with text inside a title block sketch of a drawing template file, the options for linking to other stuff is more limited than usual. In this situation it seems you can't link to any Parameters, and only certain Properties. The Property options are "Properties - Model", "Properties - Drawing", "Custom Properties - Drawing", "Drawing Properties", "Sheet Properties", "Prompted Entry", "_Piping Style", "Physical Properties - Model", & "Sheet Metal Properties". The list doesn't include the one we need ("Custom Properties - Model"). That option usually only becomes available in situations like a leader note attached to a model edge in a drawings model view, where it has a clear reference to a model. So, in light of this situation, I believe the best option left is to use something like the above rule to copy the custom iProperty from the model document to the drawing document, then have your title block text linked to the "Custom Properties - Drawing", and that custom property within the drawing. This still isn't ideal, because the value of that custom iProperty within the drawing will need to be kept up-to-date somehow. To keep this value up to date, I'm thinking the best option may be to have an iLogic rule that will copy the model's custom iProperty value to the drawing. Then put that rule into your Event Triggers dialog (Manage tab > iLogic panel), under the "iProperty Change" event within the model document. Then every time the iProperties change in the model document, it will trigger the rule to run, which will push the value to the drawing. (Make sure the rule checks if the drawing document exists before it attempts to push the values to it, to avoid potential errors.) That rule, or another one like it, could also just be ran manually from the drawing, when you want to be sure it is up-to-date. I could also help you create that rule too if needed, but it would likely be pretty similar to the one I provided a link to in the earlier post.
If this solved your problem, or answered your question, please click ACCEPT SOLUTION.
Or, if this helped you, please click (LIKE or KUDOS) 👍.
If you want and have time, I would appreciate your Vote(s) for My IDEAS 💡or you can Explore My CONTRIBUTIONS
Wesley Crihfield

(Not an Autodesk Employee)