Created
October 14, 2025 10:35
-
-
Save stephensmitchell/61960d82bcae879208647acb80d90f31 to your computer and use it in GitHub Desktop.
Triangle
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #https://help.alibre.com/articles/#!alibre-help-v28/triangle | |
| # Create triangle with angles 90, 15, 75 | |
| import math | |
| # set up parameters | |
| Theta = 15.0 | |
| Adjacent = 100.0 | |
| # calculate side | |
| Opposite = Adjacent * math.tan(math.radians(Theta)) | |
| # generate three vertices of triangle | |
| P1_X = 0 | |
| P1_Y = 0 | |
| P2_X = Adjacent | |
| P2_Y = 0 | |
| P3_X = Adjacent | |
| P3_Y = Opposite | |
| # create part and sketch | |
| P = Part('Foo') | |
| S = P.AddSketch('Shape', P.GetPlane('XY-Plane')) | |
| # draw it | |
| S.AddLine(P1_X, P1_Y, P2_X, P2_Y, False) | |
| S.AddLine(P2_X, P2_Y, P3_X, P3_Y, False) | |
| S.AddLine(P3_X, P3_Y, P1_X, P1_Y, False) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment