Implement model-independent iLogic rules for automatic parameter capture
This PR implements a comprehensive solution for capturing all model information (parameters, features, operations) from any Inventor model without requiring knowledge of specific parameter names in advance.
Problem Solved
The original issue requested:
"How can I do with ilogic to create a rule that is model independent? When the model is opened and the rule is executed, it will automatically read the operations and parameters for me and start the rule. The idea I have in mind is that the names are stored in an array 1st column operations 2nd column name of the parameter and 3rd value of the parameter. So going through all the rows of the array I can access each parameter without having to use the name given by the user."
Solution Overview
Core Implementation Files:
-
ModelIndependentCapture.iLogicVb- Main rule implementing the exact array structure requested -
ModelInfoCapture.iLogicVb- Advanced version with filtering, search, and export capabilities -
ModelCaptureExamples.iLogicVb- Examples demonstrating programmatic access patterns -
QuickStartExample.iLogicVb- Direct implementation of the user's specific request -
README_ModelCapture.md- Complete documentation and usage guide
Key Features:
✅ Model Independent: Works with any Part, Assembly, or Drawing without hardcoded parameter names
✅ Exact Array Format: Implements the requested 3-column structure [Operation, Name, Value]
✅ Automatic Capture: Reads all parameters and operations when executed
✅ No Hardcoded Names: Access parameters programmatically without knowing specific names
✅ Error Handling: Graceful handling of read errors and edge cases
✅ Multiple Document Types: Full support for Parts, Assemblies, and Drawings
Usage Example
' Get the model information in the exact format requested
Dim modelArray(,) As String = GetModelInfoArray()
' Loop through all rows to access each parameter without using hardcoded names
For i As Integer = 1 To modelArray.GetLength(0) - 1
Dim operation As String = modelArray(i, 0) ' 1st column: operations
Dim paramName As String = modelArray(i, 1) ' 2nd column: name of parameter
Dim paramValue As String = modelArray(i, 2) ' 3rd column: value of parameter
' Access each parameter without using the name given by the user!
If operation = "Parameter" Then
' Process parameter programmatically
MessageBox.Show($"Found: {paramName} = {paramValue}")
End If
Next
Integration
The solution follows existing code patterns in the repository and integrates seamlessly with the Helper Rules collection. It uses the same VB.NET conventions and error handling approaches as other rules in the codebase.
Fixes #8.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.