This is possible. The key element is placing the power/ground symbols on the schematic sheet. Here is an example script:
Dim view As ViewDraw.View
Dim blok As ViewDraw.Block
Dim comp As ViewDraw.Component
Dim partition, symbol As String
Dim x, y As Double
view = app.ActiveView
blok = view.Block
partition = "Pwr_Misc"
symbol = "AGND"
x = 100
y = 100
comp = blok.AddSymbolInstance(partition, symbol, x, y)
The script assumes that you already have a reference to an open DxDesigner session with the global app variable.
To make this into a useful application, there are a number of things to consider. Here are some that come to mind:
- Will the application run blind or with an interface?
- Will the user select a component and then run the tool, or else how will the application know what part to work on?
- How will the tool know how to identify the power and ground pins on the component? Pin names? User selection in an interactive mode?
- What kind of paradigm will you use to place the symbols? Gang many pins together and connect to a single power symbol, or place one power symbol per pin?
The two major areas of concern for such an application are:
1. How will you know what power/ground symbol a pin will be connected to?
2. How will you know how/where to place the wires and symbols on your schematic sheet?
I'm not really asking you to answer these questions. Only suggesting that in your application you will need to consider how to handle them in a large number of possible use cases. It's not an insurmountable problem but one that will take some care and forethought to implement effectively.