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/slice-a-part | |
| # open part, replace with your own path | |
| P = Part(r'C:\Users\Brian\Desktop\ScriptDir', 'New2') | |
| # get bounding box of part - eight points, one for each corner | |
| # of the bounding box | |
| Bounds = P.GetBoundingBox() | |
| # get the plane that the part will be sliced on |
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/servo-cam | |
| majorwidth = 13.763 | |
| minorwidth = 6.260 | |
| height = 7.000 | |
| slotwidth = 3.000 | |
| baseheight = 2.000 | |
| servoheight = 4.000 | |
| servoinside = 4.200 | |
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/scaling-a-sketch | |
| Units.Current = UnitTypes.Inches | |
| TestRoom = Part('TEST ROOM Scaled', False) | |
| OriginalSketch = TestRoom.GetSketch('Sketch<1>') | |
| # currently 8.25' wide, need it to be 4.125' | |
| ScaleFactor = 4.125 / 8.25 * 100.0 | |
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/default-reference-geometry | |
| # create a new part | |
| P = Part("Test") | |
| # access reference geometry | |
| print P.XYPlane | |
| print P.YZPlane | |
| print P.ZXPlane | |
| print P.XAxis |
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/rectangular-hollow-formed-profiles | |
| # Rectangular hollow hot and cold formed profiles according to BS/EN-10210-2:1997 and BS/EN-10219:1997 | |
| # Measurements table H,B,T,ro,ri from here http://www.roymech.co.uk/Useful_Tables/Sections/RHS_cf.html | |
| from collections import OrderedDict | |
| PData = 0 |
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/reading-from-a-spreadsheet | |
| from openpyxl import load_workbook | |
| # open a workbook, replace with your own path | |
| wb = load_workbook(filename = 'C:\\Users\\<username>\\Downloads\\Book1.xlsx') | |
| # get access to the sheet | |
| Sheet1 = wb['Sheet1'] | |
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/profile-and-sweep-path | |
| # create the part and get the yz plane | |
| MyPart = Part('Test') | |
| YZPlane = MyPart.GetPlane('YZ-Plane') | |
| # create the route for the pipe | |
| PipeRoute = MyPart.Add3DSketch('Pipe Route') | |
| PipeRoute.AddBspline([0, 0, 0, 5, 0, 0, 10, 5, 5, 15, 10, 5, 15, 15, 15]) | |
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/polygon-incircle | |
| import math | |
| # diameter of circle that fits inside polygon | |
| Diameter = 100 | |
| # number of sides | |
| Sides = 6 | |
| # calculate exterior diameter of polygon |
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/pocket-hole-creator | |
| # Pocket Hole Creator | |
| # (c) Alibre, LLC 2019, All Rights Reserved | |
| # Version 1.00 | |
| from __future__ import division | |
| from math import * | |
| # compares two points [X1, Y1, Z1] and [X2, Y2, Z2] |
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/parameters-with-units | |
| # this script uses inches for it's units | |
| Units.Current = UnitTypes.Inches | |
| MyPart = Part('Foo') | |
| # create parameter using current script units | |
| LengthParam = MyPart.AddParameter('Length', ParameterTypes.Distance, 123.4) | |
| # parameter value reads back in current script units |