{"action":"created","issue":{"url":"https://api.github.com/repos/dcowden/cadquery/issues/291","repository_url":"https://api.github.com/repos/dcowden/cadquery","labels_url":"https://api.github.com/repos/dcowden/cadquery/issues/291/labels{/name}","comments_url":"https://api.github.com/repos/dcowden/cadquery/issues/291/comments","events_url":"https://api.github.com/repos/dcowden/cadquery/issues/291/events","html_url":"https://github.com/dcowden/cadquery/issues/291","id":352109555,"node_id":"MDU6SXNzdWUzNTIxMDk1NTU=","number":291,"title":"RFC: Polar line and lineTo methods","user":{"login":"johnbeard","id":5386578,"node_id":"MDQ6VXNlcjUzODY1Nzg=","avatar_url":"https://avatars3.githubusercontent.com/u/5386578?v=4","gravatar_id":"","url":"https://api.github.com/users/johnbeard","html_url":"https://github.com/johnbeard","followers_url":"https://api.github.com/users/johnbeard/followers","following_url":"https://api.github.com/users/johnbeard/following{/other_user}","gists_url":"https://api.github.com/users/johnbeard/gists{/gist_id}","starred_url":"https://api.github.com/users/johnbeard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/johnbeard/subscriptions","organizations_url":"https://api.github.com/users/johnbeard/orgs","repos_url":"https://api.github.com/users/johnbeard/repos","events_url":"https://api.github.com/users/johnbeard/events{/privacy}","received_events_url":"https://api.github.com/users/johnbeard/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-08-20T12:16:59Z","updated_at":"2018-08-20T20:46:06Z","closed_at":null,"author_association":"NONE","body":"I use the following methods for defining lines in terms of polar co-ordinates, which I sometimes find helpful (`hLine`/`vLine` are useful, but not all lines are on the axes). I don't know if there is appetite to add this to the base `Workplane` object, but I thought I'd post it just in case!\r\n\r\nI haven't tried yet to set up a CQ development environment, but I'm happy to give that a go and make a PR if helpful.\r\n\r\n```\r\ndef polarLine(self, distance, angle, forConstruction=False):\r\n    \"\"\"\r\n    Make a line of the given length, at the given angle from the current point\r\n    \r\n    :param float diastance: distance of the end of the line from the current point\r\n    :param float angle: angle of the vector to the end of the line with the x-axis\r\n    :return: the Workplane object with the current point at the end of the new line\r\n   \"\"\"\r\n    x = math.cos(math.radians(angle)) * distance \r\n    y = math.sin(math.radians(angle)) * distance\r\n\r\n    return self.line(x, y, forConstruction)\r\n    \r\n\r\ndef polarLineTo(self, distance, angle, forConstruction=False):\r\n    \"\"\"\r\n    Make a line from the current point to the given polar co-ordinates\r\n    \r\n    Useful if it is more convenient to specify the end location rather than\r\n    the distance and angle from the current point\r\n    \r\n    :param float diastance: distance of the end of the line from the origin\r\n    :param float angle: angle of the vector to the end of the line with the x-axis\r\n    :return: the Workplane object with the current point at the end of the new line\r\n    \"\"\"\r\n    x = math.cos(math.radians(angle)) * distance \r\n    y = math.sin(math.radians(angle)) * distance\r\n    \r\n    return self.lineTo(x, y, forConstruction)\r\n\r\n#link the plugin into cadQuery\r\ncq.Workplane.polarLine = polarLine\r\ncq.Workplane.polarLineTo = polarLineTo\r\n```\r\n\r\nThanks for CQ, and thanks for making extensions so easy!"},"comment":{"url":"https://api.github.com/repos/dcowden/cadquery/issues/comments/414457315","html_url":"https://github.com/dcowden/cadquery/issues/291#issuecomment-414457315","issue_url":"https://api.github.com/repos/dcowden/cadquery/issues/291","id":414457315,"node_id":"MDEyOklzc3VlQ29tbWVudDQxNDQ1NzMxNQ==","user":{"login":"jmwright","id":1015439,"node_id":"MDQ6VXNlcjEwMTU0Mzk=","avatar_url":"https://avatars0.githubusercontent.com/u/1015439?v=4","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":"2018-08-20T20:46:06Z","updated_at":"2018-08-20T20:46:06Z","author_association":"COLLABORATOR","body":"@johnbeard The way I do it is to install our FreeCAD module, and then replace the [cadquery lib directory](https://github.com/jmwright/cadquery-freecad-module/tree/master/Libs/cadquery) with a cloned version of my fork. It oftentimes takes a restart of FreeCAD to pick up the changes, but it makes it farily easy to develop. You can write scripts to automate a lot of that too. I've had scripts that replaced the cadquery directory in the module with an externally cloned one, then copied the module into the system's FreeCAD Mod directory, then launched FreeCAD. There's quite a bit of latitude there because the cadquery library is just a directory. Swap it out with your development copy, restart FreeCAD, and you're on your development version of the library.\r\n\r\nOne word of caution though. Sometimes when you clone a git repo into another one directly, the git cache/tree/whatever can do things that are unexpected (at least in my experience). I'm sure whatever git does is perfectly logical, I've just had some counter-intuitive things happen before."}}
{"actor":{"display_login":"jmwright"}}