Batch operations on objects

Issue #206 new
Marius Stanciu created an issue

Add a feature so you can do an operation on multiple objects at once.

Example: if we have 3 objects selected: a GERBER file, a EXCELLON file and a bounding box geometry then if we change the OFFSET field (shouldn't matter on which of the selected objects) then the OFFSET operation will apply to all at once.

In a way, the operations (scale, offset and future ones) should be aware of how many objects are selected and then apply that action over all selected files (objects).

Comments (2)

  1. Juan Pablo Caram repo owner

    Also: Toggling visibility with the space bar on multiple selections only acts on one of them.

  2. Mike Evans

    Or you could copy the last edited offset into the other objects.

    On a "it works for me" note, I modified tclCommands/TclCommandOffset.py to allow me to offset all the loaded gerbers and excellons using the command shell. Here's the diff:

    diff --git tclCommands/TclCommandOffset.py tclCommands/TclCommandOffset.py
    index 17ffdaa..50acb80 100644
    --- tclCommands/TclCommandOffset.py
    +++ tclCommands/TclCommandOffset.py
    @@ -49,5 +49,13 @@ class TclCommandOffset(TclCommand.TclCommand):
    
             name = args['name']
             x, y = args['x'], args['y']
    +        name = args['name']
    +        if name == 'all':
    +           names = self.app.collection.get_names()
    +           for name in names:
    +                object = self.app.collection.get_by_name(name)
    +                if object.kind == 'gerber' or object.kind == "excellon":
    +                    object.offset((x, y))   
    +        else:
    +            self.app.collection.get_by_name(name).offset((x, y))
    
    -        self.app.collection.get_by_name(name).offset(x, y)
    

    Then in the command line do:

    offset all x y
    plot
    

    The plot just redraws the display.

    I've not done a PR for this as this was a quick and dirty hack to get the job done. I don't think this is suitable for official inclusion.

  3. Log in to comment