By Adam Nagy
If the name of one of the parameters in a document contains a Ctrl+Underscore / Ctrl+Shift+- / character 0x1f, then you won't be able to edit any of the rules inside the document, because of the following error:
You would need to find the problematic parameter and then remove the bad character from its name. Once that's done, all should be fine again.
A colleague provided the following iLogic Rule that can be used to find the bad parameter name. We could do the same in VBA or a .NET AddIn as well. I modified it to show how you could also fix the parameter name if that's what you wanted: Download FindParametersWithCtrlUnderscore
Imports System.Text Sub Main Dim sb As New StringBuilder() Dim paramsX As Parameters = GetDocParams(ThisDoc.Document) Dim ctrlUnderscore As Char = Chr(&H1F) For Each param As Parameter in paramsX If (param.Name.IndexOf(ctrlUnderscore) >= 0) Then ' If you also want to fix the name then ' uncomment the below line 'param.Name = param.Name.Replace(Chr(&H1F), "") sb.AppendLine(param.Name) End If Next Dim outputList As String = sb.ToString() If (outputList.Length = 0) Then MessageBox.Show( "No parameter with Ctrl+Underscore in its name was found.", "Parameters") Else MessageBox.Show( "Parameters with Ctrl+Underscore in the name:" & vbNewLine & vbNewLine & outputList) End If End Sub Function GetDocParams(ByVal doc As Inventor.Document) _ As Inventor.Parameters Dim oParams As Inventor.Parameters = Nothing If (doc.DocumentType = Inventor.DocumentTypeEnum.kPartDocumentObject) Then Dim oPartDoc As Inventor.PartDocument = DirectCast(doc, PartDocument) oParams = oPartDoc.ComponentDefinition.Parameters ElseIf (doc.DocumentType = Inventor.DocumentTypeEnum.kAssemblyDocumentObject) Then Dim oAssemDoc As AssemblyDocument = DirectCast(doc, AssemblyDocument) oParams = oAssemDoc.ComponentDefinition.Parameters ElseIf (doc.DocumentType = Inventor.DocumentTypeEnum.kDrawingDocumentObject) Then Dim oDrawDoc as DrawingDocument = DirectCast(doc, DrawingDocument) oParams = oDrawDoc.Parameters End If Return oParams End Function