@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 have added another post to my blog. This time it’s about how to add your own command on the top, left, or right toolbars.
kicad.mmccoo.com (I’m not posting a direct link for fear that I’ll get flagged again for spamming. If you feel this thread is spam, please give a comment on why)
To summarize the important bits:
import wx
import wx.aui # this is the key one
wx.App()
These exports also cause pcbnew to give you the correct wxApp and wxAuiControl pointers (otherwise, you’d get a parent class pointer missing the interesting APIs.)
I appreciate the topic ideas I’ve gotten on this thread:
zoom
redraw (though I guess that’s my own)
autoload python
special selections (this one could be hugely useful, I think. I’m thinking I could use this with sheet based schematics.)
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:
I oked @mmccoo posts and unblocked them. To get promoted @mmccoo needs to read some other threads and post in a few. Reading the forum rules gets you a badge too
Thank you @dBman, @Joan_Sparky and @davidsrsb for the support and info on how the system works. I’d assumed it was just generic infrastructure + overzealous flag police. Guess I shoulda rtm
Unfortunately not that easy… this info is pretty well hidden, gotta go to your Preferences and there to Badges and then hopefully there is a link somewhere…
@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.
What did you use to draw that UML diagram? I’ve been looking for something that would draw UML diagrams that look as neat as that but have been disappointed by everything. I would love to know.
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.
Thanks.
@MitjaN yes,the replicate script does work with hierarchical schematics. The trick is whether to look for replication on the lower levels of hierarchy or the upper ones. I wish pcbnew supported properties. After I did my placement by sch script, I think I might be able to fake the properties thing by just parsing the schematics. Among other things, that would be a good place to store the desired spacings from one copy to the next. It would further make things clearer because it would also say which level is replicated. Send me a link to a testcase and I can take a look if it’s still relevant.
@hermit It appears I can’t edit my earlier posts. I don’t see the pencil icon on posts older than 40 days.
New post on zones with holes from svg
In other news, I have a new blog post. It’s about a script (and the hows behind it) that takes an svg file (only inkscape tested) and converts it to zones like this: