Message 1 of 11
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am working on an external rule that is set to run when opening any .ipt or .iam file. This rule checks existence of some properties and creates them if needed. This will be a big time saver for us as we revamp our system. Most of the rule is working as expected.
The issue is that the entire section involving Model Type fails. It will not create the multi-value custom parameter, nor will it create the custom iProperty. Any suggestions on where I went wrong would be super helpful!
doc = ThisDoc.Document customPropertySet = doc.PropertySets.Item("Inventor User Defined Properties") Dim TextValue As String Dim NumValue As Double Dim DateValue As Date Dim YesNoValue As Boolean '[Make sure Finish property exists Try prop = customPropertySet.Item("Finish") Catch 'Assume error means not found customPropertySet.Add(TextValue, "Finish") End Try '] '[Make sure Model Type property exists Try prop = customPropertySet.Item("Model Type") Catch 'Assume error means not found Dim ParamName As String = "ModelType" Dim oComp As PartComponentDefinition = doc.ComponentDefinition Dim oUPs As UserParameters = oComp.Parameters.UserParameters Dim oUP As UserParameters Dim List1 As New ArrayList List1.Add("NORMAL") List1.Add("REFERENCE") List1.Add("FIXTURE") Try Test = oUPs.Item(ParamName).Value Catch oUP = oUPs.AddByExpression(ParamName, List1.Item(0), UnitsTypeEnum.kTextUnits) End Try customPropertySet.Add("", "Model Type") End Try '] '[Make sure Tool MFG property exists Try prop = customPropertySet.Item("Tool MFG") Catch 'Assume error means not found customPropertySet.Add(TextValue, "Tool MFG") End Try '] '[Make sure Tool Model property exists Try prop = customPropertySet.Item("Tool Model") Catch 'Assume error means not found customPropertySet.Add(TextValue, "Tool Model") End Try ']
Solved! Go to Solution.