Hello all
I have been developing DC's for my cabinet software over the past several months and it has been a struggle trying to get them to work in any kind of consistent manner. It wasn't uncommon for some of my attributes to share the definitions values with other instances, yet another attribute in the same DC wouldn't! To say the least it has been very frustrating.
About the only way that I could ever get consistency was to make every DC and every child DC unique, which makes any complex component to burdensome to use and kind of defeats the purpose of having a definition. Well.... after getting intimately acquainted with the dynamic_attributes dictionary, by watching how it changes as you develop and then use a DC, I've discovered a couple of things that have not only fixed my problems, but has restored my faith in DC's
I started developing my DC's under SU7, and I believe that most of my problems were from that time period... so this thread may be irrelevant if you've only been using SU8.
There are two things that I found that have fixed so many of my issues.
- From what I can tell, there should always be a 1:1 mapping of the attributes between the component instance and definition dictionaries... but this is not always the case. When I say attributes, I am meaning the attributes that you create in the components attribute dialog... there are all kinds of other ancillary information stored in the definition that aren't shared with the instance. There were situations where my instance dictionary did not have all of the attributes declared... and when this happens, the instance picks up the value from the definition. This means that that particular attribute will be subject to the value of whatever the definition holds at any point in time (and it doesn't matter if the parent DC is made unique or not). When the attribute is present in the instance dictionary, it holds it's value private and respects any "uniqueness" invoked.
As an example; If you have a cabinet with several child DC's, it is the child DC's that experience the problem that I'm describing. Should you access the value from another DC or from ruby, you will get whatever the definitions value is at that point in time... which may not be what you were expecting. The cabinet, being the top level DC, will not share it's values regardless of missing instance attributes in the dictionary.
- If you have an attribute whose value is empty, then it too will act as if it is undeclared, and pick up the value from the definition as well.
I have written a ruby script that will list the instance/definition dictionary key/value pairs for the selected DC and list it's missing information as well. There is also an option to recursively fix what ever you have selected, or the entire model if nothing is selected. The results are displayed on the ruby console, so you will need to open that first before running them. You can access the scripts though the plugin or context menus. Please take the necessary precautions in case you need to restore your models.
These fixes have made a huge difference for me and I hope they can help others who may be experiencing the same kind of issues.
Paul
csValidateDC.rb