Title: Triangle can't be solved with two angles and one distance constraint · Issue #4 · KmolYuan/python-solvespace · GitHub
Open Graph Title: Triangle can't be solved with two angles and one distance constraint · Issue #4 · KmolYuan/python-solvespace
X Title: Triangle can't be solved with two angles and one distance constraint · Issue #4 · KmolYuan/python-solvespace
Description: Hi, I'm playing around with python-solvespace and it's great so far - thanks! One problem I found though is that it can't seem to solve the following file: # adapted from https://github.com/KmolYuan/python-solvespace/blob/master/example/...
Open Graph Description: Hi, I'm playing around with python-solvespace and it's great so far - thanks! One problem I found though is that it can't seem to solve the following file: # adapted from https://github.com/KmolYua...
X Description: Hi, I'm playing around with python-solvespace and it's great so far - thanks! One problem I found though is that it can't seem to solve the following file: # adapted from https://github...
Opengraph URL: https://github.com/KmolYuan/python-solvespace/issues/4
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Triangle can't be solved with two angles and one distance constraint","articleBody":"Hi, I'm playing around with `python-solvespace` and it's great so far - thanks! One problem I found though is that it can't seem to solve the following file:\r\n\r\n```python\r\n# adapted from https://github.com/KmolYuan/python-solvespace/blob/master/example/PyDemo.py\r\n\r\nfrom slvs import *\r\n\r\nsys = System()\r\n\r\n# origin Point zero\r\np0 = sys.add_param(0.0)\r\np1 = sys.add_param(0.0)\r\np2 = sys.add_param(0.0)\r\nPoint0 = Point3d(p0, p1, p2)\r\n\r\n# create normal vector\r\n# quaternion represents a plane through the origin\r\nqw, qx, qy, qz = Slvs_MakeQuaternion(1, 0, 0, 0, 1, 0)\r\np3 = sys.add_param(qw)\r\np4 = sys.add_param(qx)\r\np5 = sys.add_param(qy)\r\np6 = sys.add_param(qz)\r\nNormal1 = Normal3d(p3, p4, p5, p6)\r\n\r\n# create workplane (a plane to draw 2D points on), defined by\r\n# the origin point and the normal vector\r\nWorkplane1 = Workplane(Point0, Normal1)\r\n\r\n\r\n###\r\n# triangle\r\n\r\np7 = sys.add_param(-22.92)\r\np8 = sys.add_param(-6.77)\r\nPoint1 = Point2d(Workplane1, p7, p8)\r\n\r\np9 = sys.add_param(25.55)\r\np10 = sys.add_param(-19.02)\r\nPoint2 = Point2d(Workplane1, p9, p10)\r\n\r\np11 = sys.add_param(25.55)\r\np12 = sys.add_param(-19.02)\r\nPoint3 = Point2d(Workplane1, p11, p12)\r\n\r\np13 = sys.add_param(11.92)\r\np14 = sys.add_param(29.07)\r\nPoint4 = Point2d(Workplane1, p13, p14)\r\n\r\np15 = sys.add_param(11.92)\r\np16 = sys.add_param(29.07)\r\nPoint5 = Point2d(Workplane1, p15, p16)\r\n\r\np17 = sys.add_param(-22.92)\r\np18 = sys.add_param(-6.77)\r\nPoint6 = Point2d(Workplane1, p17, p18)\r\n\r\nLine1 = LineSegment2d(Workplane1, Point1, Point2)\r\nLine2 = LineSegment2d(Workplane1, Point3, Point4)\r\nLine3 = LineSegment2d(Workplane1, Point5, Point6)\r\n\r\n# constrain edges of lines at each vertex to be coincident\r\nConstraint.on(Workplane1, Point1, Point6)\r\nConstraint.on(Workplane1, Point2, Point3)\r\nConstraint.on(Workplane1, Point4, Point5)\r\n\r\n# set one side length and two angles\r\nConstraint.distance(50, Workplane1, Point1, Point2)\r\nConstraint.angle(Workplane1, 60, Line1, Line2)\r\nConstraint.angle(Workplane1, 60, Line2, Line3)\r\n\r\n# alternatively, set two distances and one angle\r\n#Constraint.distance(50, Workplane1, Point1, Point2)\r\n#Constraint.distance(50, Workplane1, Point3, Point4)\r\n#Constraint.angle(Workplane1, 60, Line2, Line3)\r\n\r\nsys.calculateFaileds = 1\r\nsys.solve()\r\nresult = sys.result\r\n\r\nif result == SLVS_RESULT_OKAY:\r\n print(\"OK\")\r\nelif result == SLVS_RESULT_INCONSISTENT:\r\n print(\"solve failed\")\r\n print(\"SLVS_RESULT_INCONSISTENT\")\r\nelif result == SLVS_RESULT_DIDNT_CONVERGE:\r\n print(\"solve failed\")\r\n print(\"SLVS_RESULT_DIDNT_CONVERGE\")\r\nelif result == SLVS_RESULT_TOO_MANY_UNKNOWNS:\r\n print(\"solve failed\")\r\n print(\"SLVS_RESULT_TOO_MANY_UNKNOWNS\")\r\n\r\nprint(\"{} DOF\".format(sys.dof))\r\n```\r\n\r\nThis is a triangle with two constrained angles and one constrained length, and should therefore be fully constrained. Instead, I get the error \"SLVS_RESULT_DIDNT_CONVERGE\". In the SolveSpace GUI it is able to solve this as \"OK\".\r\n\r\nInterestingly, setting two distance constraints and one angle constraint seems to work ok.\r\n\r\nDo you have any idea what is wrong?","author":{"url":"https://github.com/SeanDS","@type":"Person","name":"SeanDS"},"datePublished":"2018-09-12T09:24:53.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":5},"url":"https://github.com/4/python-solvespace/issues/4"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:fd89aacc-d00b-08e7-abcc-28e6b20e32ca |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | ADC2:31CE76:1AA50AE:24D900E:698CCAFF |
| html-safe-nonce | 0363d103bd8ca67daae40d3ff871e50bdb469e768ff58f5bf9910eab0585febe |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBREMyOjMxQ0U3NjoxQUE1MEFFOjI0RDkwMEU6Njk4Q0NBRkYiLCJ2aXNpdG9yX2lkIjoiNDk2ODA0ODQ4NDc2ODU5ODc4MyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | d65c25896cf54dd8e8401eba8332055cd418527279f139a105c85c6091fb8cc9 |
| hovercard-subject-tag | issue:359390476 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/KmolYuan/python-solvespace/4/issue_layout |
| twitter:image | https://opengraph.githubassets.com/679893fad15d5ac821ffda56aae485046e045b884e620f7f7eaf72770d98f8d2/KmolYuan/python-solvespace/issues/4 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/679893fad15d5ac821ffda56aae485046e045b884e620f7f7eaf72770d98f8d2/KmolYuan/python-solvespace/issues/4 |
| og:image:alt | Hi, I'm playing around with python-solvespace and it's great so far - thanks! One problem I found though is that it can't seem to solve the following file: # adapted from https://github.com/KmolYua... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | SeanDS |
| hostname | github.com |
| expected-hostname | github.com |
| None | 640eeb7b6ff4d8d106235d228c0c286e82592d4d2403227b5b2b4fc5832297a4 |
| turbo-cache-control | no-preview |
| go-import | github.com/KmolYuan/python-solvespace git https://github.com/KmolYuan/python-solvespace.git |
| octolytics-dimension-user_id | 10264720 |
| octolytics-dimension-user_login | KmolYuan |
| octolytics-dimension-repository_id | 63935880 |
| octolytics-dimension-repository_nwo | KmolYuan/python-solvespace |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 63935880 |
| octolytics-dimension-repository_network_root_nwo | KmolYuan/python-solvespace |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 3d444f0a47beeeac94cddbb51c91ab408befe8d4 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width