How to create a selection filter to do this ? Seems impossible ! - Page 1
Forum section: electronics / general

author: snoopy
author_rank: Frequent Contributor
timestamp: November 04, 2018, 01:26:28 pm
content: I'm starting to think the filtering capability is very limited and the query builder is useless too.For example I want to highlight all component comments which are at 90 degrees to the component orientation so I can re-orientate them so they fit nicely within the component ? Seems you can only focus on one parameter at a time like the component angle or the text angle but not both !Anyone have any clues because this aspect has had me puzzled for quite a while.cheers

author: voltsandjolts
author_rank: Unknown
timestamp: November 04, 2018, 04:11:45 pm
content: Sounds like you need to run a script. I always struggle with API changes when trying run random scripts from the web but YMMV:http://www.tdpcb.com/RotateDesignators.htmlhttps://altiumpcbdesigner.blogspot.com/p/re.htmlhttp://altiumdesignerblog.blogspot.com/2011/06/new-script-for-rotating-and-adjusting.html

author: snoopy
author_rank: Frequent Contributor
timestamp: November 05, 2018, 01:16:52 am
content: Thanks, I have used scripts before but never wrote my own. Looks like a nightmare if you don't know what you are doing. I guess it would be easier for me just to go through the PCB and change the rotation of the comments manually. But I did notice that when you rotate a component the orientation of the comment always stays the same. Wonder if there is any way of turning this off so the comment rotates with the component ?EDIT: Actually if you switch 'Auto Position' to Manual then the comment orientation is locked to the component orientation.cheers

author: T3sl4co1l
author_rank: Super Contributor
timestamp: November 05, 2018, 02:35:43 am
content: Correct, you cannot make relational queries.You can try a two-step query instead (query the components, change selection to the comments, query "IsSelected AND ...").Or you can use a spreadsheet-augmented method. Query Components, go to List, select and copy the columns including designator, position, rotation, etc. Paste into a spreadsheet. Query Comments, do the same. Cross-reference the two lists (they should sort to the same length and positions, but use e.g. Excel's INDEX(MATCH(...)) combo if not), and finally prepare a query string of exactly the Comments you need to adjust.Note that, in the Inspector, you can enter "Rotation+90" in the Rotation field to rotate counter-clockwise, rather than setting all of the selection to a constant. Or you can make the change in the spreadsheet, and copy it back into the List Panel.I don't think I do this much myself, but I have used similar approaches to set component placement, say when multi-channel doesn't quite work in the design, or when copying placement between files. Or when placing, say, labels and graphics over test points, to make a drawing of them. And similarly in schematics, or with the spreadsheet view (T, R).So far, this has covered enough cases for me, and I haven't had any jobs so massive or strapped for time, that I had to do a more involved (scripting based) method. But if you're interested in scripting in Altium, that's absolutely an option!Tim

author: ajb
author_rank: Super Contributor
timestamp: November 05, 2018, 09:22:32 pm
content: Quote from: voltsandjolts on November 04, 2018, 04:11:45 pmThat first one is what I use for this purpose, but extended to set comments and designators to the appropriate styles and layers as well. Works fine in AD18, although sometimes I have to run it twice, but I haven't had the inclination to spend enough time in the AD scripting environment to figure out why.