So you want too select modules with the script and edit them with the UI Interface? Or am I on the wrong track.
Had a look in the source code (especially at block_module_editor.cpp). I’m not so familiar with C++, but I think they work with List, we don’t have access to from Python.
Why not use the script to modify the modules?
@pwuertz I like the idea of creating your own selection commands. I don’t like the popup listing the different filters. Like you, I also think the filters are not sufficient. I’ll poke around and see if I can find an appropriate python command(s)
@upanie I’ll see if I can find a command to rezoom programatically. I’ve already been looking for the command to redraw (simpler than zoom). Assuming I find it, I imagine zoom will not be far away.
@DougE Yes, I would like to select modules by script and then move/manipulate the block using the UI (i.e. I still want to use the UI for working on the layout).
Often I find myself in a situation where I’d like to move around a group of objects coherently, but the need to select every object single handedly whenever I loose the selection really bothers me. PcbNew does not have a “group” feature, so I figured defining groups via script and recall them would be the easiest approach (much like CTRL+Number lets you define/recall groups of units in mainstream strategy games).
The point is, nothing I do from the scripting interface seems to have a direct effect on the UI. If you change the position of an object for example you need to click around a bit until the UI actually picks up the change and draws the new position.
@mmccoo You mentioned a redraw or update command for the UI? Maybe a module.SetSelected() followed by ui.redraw/update() will do the trick?
I checked, @davidsrsb took care of that and as far as I can see he didn’t agree with the @system flagging him for spamming.
The system is just a little bit more careful with new users as @mmccoo joined on 17.2.2017, so he fell into the raster as basic user it seems… don’t know when he’ll get member status, there are a couple of tiny hurdles to jump over for:
@mmccoo Unfortunately the Refresh command doesn’t do the trick for me. There is probably another mechanism involved in the selection handling of objects in pcbnew.
I did check out the Zoom function just for fun. It only works for the classic view though, not with the OpenGL canvas enabled. I liked your post on adding such functionality yourself and found your git commit. It’s a nice entry point for someone without knowledge of the code! What I get from this is that PCB_EDIT_FRAME seems to handle two different canvas objects (GetCanvas, GetGalCanvas, IsGalCanvasActive). This is probably why there is kind of a break in functionality between the different views in pcbview.
It’s been a while since I’ve posted to this thread. I’ve added a new blog post, this time about applying the placement from the schematic to the layout. This helps get an initial placement that isn’t random.
One question for everyone: when posting about new blog posts, should I continue this thread or start a new one?
Personally, even though I go for long periods without working on this stuff, I like coming back to one place to see if anyone has asked a question. Better late than never? There aren’t a lot of people out there that are comfortable with the kicad code base.
I’ve added this thread to the FAQ. Please consider editing the original post from time to time if you feel that something could be added that would keep someone from having to read the entire thread.