{"action":"created","issue":{"url":"https://api.github.com/repos/dcowden/cadquery/issues/110","labels_url":"https://api.github.com/repos/dcowden/cadquery/issues/110/labels{/name}","comments_url":"https://api.github.com/repos/dcowden/cadquery/issues/110/comments","events_url":"https://api.github.com/repos/dcowden/cadquery/issues/110/events","html_url":"https://github.com/dcowden/cadquery/pull/110","id":106209370,"number":110,"title":"adding boolean/arithmetic selectors","user":{"login":"hyOzd","id":1479166,"avatar_url":"https://avatars.githubusercontent.com/u/1479166?v=3","gravatar_id":"","url":"https://api.github.com/users/hyOzd","html_url":"https://github.com/hyOzd","followers_url":"https://api.github.com/users/hyOzd/followers","following_url":"https://api.github.com/users/hyOzd/following{/other_user}","gists_url":"https://api.github.com/users/hyOzd/gists{/gist_id}","starred_url":"https://api.github.com/users/hyOzd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hyOzd/subscriptions","organizations_url":"https://api.github.com/users/hyOzd/orgs","repos_url":"https://api.github.com/users/hyOzd/repos","events_url":"https://api.github.com/users/hyOzd/events{/privacy}","received_events_url":"https://api.github.com/users/hyOzd/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2015-09-13T10:38:31Z","updated_at":"2015-09-16T19:37:13Z","closed_at":"2015-09-16T19:29:14Z","pull_request":{"url":"https://api.github.com/repos/dcowden/cadquery/pulls/110","html_url":"https://github.com/dcowden/cadquery/pull/110","diff_url":"https://github.com/dcowden/cadquery/pull/110.diff","patch_url":"https://github.com/dcowden/cadquery/pull/110.patch"},"body":"This change introduces new selectors that allows existing selectors to be combined with arithmetic/boolean operations.\r\n\r\nExample:\r\n```python\r\nimport cadquery\r\nfrom Helpers import show\r\nfrom cadquery import selectors\r\n\r\nbox = cadquery.Workplane(\"XY\").box(10,10,10)\r\n\r\ns = selectors.StringSyntaxSelector\r\n\r\n### select all edges on right and left faces\r\n#box = box.edges((s(\"|Z\") + s(\"|Y\"))).fillet(1)\r\n\r\n### select all edges on top and bottom\r\n#box = box.edges(-s(\"|Z\")).fillet(1)\r\n#box = box.edges(s('|X')+s('Y')).fillet(1)\r\nbox = box.faces(s('>Z')+s('<Z')).fillet(1)\r\n\r\nshow(box)\r\n```\r\n\r\nSlightly more complicated shape:\r\n```python\r\nimport cadquery\r\nfrom Helpers import show\r\nfrom cadquery import selectors\r\n\r\nbox = cadquery.Workplane(\"XY\").box(10,10,10).edges('|Z').\\\r\n      chamfer(2.5)\r\n\r\ns = selectors.StringSyntaxSelector\r\n\r\n# select diagonal edges\r\nbox = box.faces(s('>Z')+s('<Z')).edges(-s('|X')-s('Y')).fillet(1)\r\n\r\nshow(box)\r\n```\r\n\r\nI cannot come up with more examples. This was a bit rushed. Please let me know what you think.\r\n\r\nPS: This is not direclty related to this pull request but... Behaviour of `min/max` selector is flawed. If there are more than 1 suitable candidates, only one of them is returned *randomly*. For example\r\n\r\n     box.edges(\">Z\")\r\n\r\nreturns a random edge from the top face. I understand that nature of the `min/max` requires only 1 entity to be returned but I feel like it's okay to return a list in this case. If next operation, for example `workplane()`, requires only 1 entity to be selected it should throw an error.\r\n\r\nI'm bringing up this here, because I think fixing this behaviour will make these additions much more useful (if accepted of course).\r\n\r\nAlso please don't merge. If these changes accepted, I would like to add tests.\r\n"},"comment":{"url":"https://api.github.com/repos/dcowden/cadquery/issues/comments/140862831","html_url":"https://github.com/dcowden/cadquery/pull/110#issuecomment-140862831","issue_url":"https://api.github.com/repos/dcowden/cadquery/issues/110","id":140862831,"user":{"login":"jmwright","id":1015439,"avatar_url":"https://avatars.githubusercontent.com/u/1015439?v=3","gravatar_id":"","url":"https://api.github.com/users/jmwright","html_url":"https://github.com/jmwright","followers_url":"https://api.github.com/users/jmwright/followers","following_url":"https://api.github.com/users/jmwright/following{/other_user}","gists_url":"https://api.github.com/users/jmwright/gists{/gist_id}","starred_url":"https://api.github.com/users/jmwright/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jmwright/subscriptions","organizations_url":"https://api.github.com/users/jmwright/orgs","repos_url":"https://api.github.com/users/jmwright/repos","events_url":"https://api.github.com/users/jmwright/events{/privacy}","received_events_url":"https://api.github.com/users/jmwright/received_events","type":"User","site_admin":false},"created_at":"2015-09-16T19:37:13Z","updated_at":"2015-09-16T19:37:13Z","body":"@hyOzd This code looks good and has been merged, and deployed to the FreeCAD module as well. Thank you as always for your contributions. Your ideas, feedback and code are greatly valued by @dcowden and myself."}}