Ilogic Parameter Passing

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
I am trying to get a code that will allow the user to pass through variables from an assembly into all the referenced parts. I seem to have this mostly working but i'm running into a weird error that i can't figure out what the cause would be.
A little information on the code itself, the code first loops through all parameters in the assembly finding unique names, i.e. not d#, then using whether the parameter is key to decide if it should be passed or not. code includes methods to add or remove variables. the code then loops through all referenced documents, make a few checks, such as is modifiable or has a skip requirement. I then loop through all parameters in the referenced document and change its value if it is the correct name.
The code runs perfectly when i first open a document, but as soon as i hit save i start getting errors. i know for a fact that the error is occurring when doing the following, oDoc.ComponentDefinition.Parameters.Count. I have attached the code if you would like to take a look.
I'm mostly wondering is there a better way to get the number of parameters or a better way to loop through them. i know i could just use Parameter(oDoc, "Variable Name") = vVal, and either contain this in a try catch block or turn errors to quiet, but i would like to know if there is an error passing a variable so that i can inform the user, so i at least need to differentiate parameter doesn't exist, from other errors, as i know there will be a lot of doesn't exist errors.
Thanks in advance,
Logan