Edit: KiCommand is now released on github
There is still a lot of work to do. Be careful docking the window, and ALWAYS save before executing a command. Crashing and creating bizarre objects are to be expected.
I’m asking everyone so I can understand if there is any interest in a dialog box that accepts easy to construct commands in pcbnew.
I don’t yet know how many types of commands I can implement, but here is what I have so far. Right now it’s just retrieving items (PADS, MODULES, TRACKS) either all or only the selected items or unselected items. Then selecting or unselecting them. Once I add commands such as ‘RELATIVEMOVE’ or ‘MOVE’, and the ability to select on a few more parameters, then things will get more interesting.
# This allows simple command strings to be executed within pcbnew # The command string is in postfix format, and the current commands are: # Arguments, if any, are taken from the top of the stack. # and results, if any, are placed back on the stack. # COPY - Copy the top of the stack. # MODULES - Put all modules on the stack. # PADS - Put all pads on the stack. # TRACKS - Put all tracks on the stack. # SELECTED - Filter top of the stack for selected items. # NOTSELECTED - Filter top of the stack for unselected items. # SETSELECT - Set items on the top of the stack to selected. # CLEARSELECT - Set items on the top of the stack to unselected. # MATCHREFERENCE - Filter list of modules for matching a reference. # GETPADS - Get all pads on the list of modules. # command_stack.runcommand(command_string) # # Sample command_string: # # 'MODULES' - return the list of modules # 'MODULES SELECTED' - return the list of selected modules # 'MODULES SELECTED CLEARSELECT' - unselect all selected modules # 'MODULES SETSELECT' - select all modules (this seems to have no visual effect) # 'PADS SETSELECT' - select all pads # 'PADS CLEARSELECT' - unselect all pads # 'MODULES GETPADS SETSELECT' - select all pads of all modules # 'MODULES GETPADS CLEARSELECT' - unselect all pads of all modules # 'MODULES U1 MATCHREFERENCE GETPADS SETSELECT' - select the pads of the module with reference 'U1'