We have several global symbols with Global Signal Names like USER_GND, USER_V, and so on. I would like to place them programmatically and then change the value to the name of a power net, such as +5V, PWR_RTN, or whatever.
Even though there is already a "Global Signal Name" property on the symbol, using GetBatchAttributes doesn't show it. Looking through the documentation I find the concept of Promotion of symbol attributes/properties to the schematic level. Of course there is no PromoteAttribute command, so I guessed and attempted to add the attribute even though it's already there. This method has worked for other properties on normal component symbols. So I have come up with this:
Dim comp As ViewDraw.Component
Dim attr As ViewDraw.Attribute
comp = app.ActiveView.Block.AddComponent("globals:user_gnd.1", x + 200, y)
attr = comp.AddAttribute("Global Signal Name", x + 210, y - 10, 3)
attr.Value = net_name
After doing this, selecting the symbol and displaying properties shows that "Global Signal Name" now has the correct value. No errors result from adding the attribute. Everything looks good. BUT, the netlist doesn't come out right. So now I'm scratching my head.
Since some of the documentation describes globals as a 'special pin, I have also experimented with getting the connections of the symbol, setting to component pin, and trying to use GetBatchAttributes for the pin object. No attributes are acquired using this method.
I've also tried going the route of getting the symbol block, using FindAttribute, and changing the value that way, but if you do that it changes all of them at once and all power nets are shorted as one.
If anyone has any ideas on this, please share.