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/geodesic-dome-reference-geometry | |
| # tessellates a sphere into triangles and generates a reference point at each vertex | |
| # adapted from | |
| # http://musingsofninjarat.wordpress.com/spheres-through-triangle-tessellation/ | |
| from math import * | |
| A = 0.525731112119133606 | |
| B = 0.850650808352039932 |
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/gear-example | |
| Units.Current = UnitTypes.Millimeters | |
| PressureAngle = 20 | |
| Thickness = 3 | |
| MercuryDiameter = 32 | |
| # replace with your own path | |
| OutputFolder = 'C:\Users\username\Desktop\ScriptDir/' | |
| SizeFile = open(OutputFolder + 'EarthGearSizes.txt', 'w') |
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/everyone-loves-a-slinky | |
| # Everyone Loves a Slinky | |
| # Adapted from: | |
| # http://forum.alibre.com/viewtopic.php?f=9&t=5752&p=30750&hilit=Spring#p30750 | |
| import sys | |
| import math | |
| # create dialog window |
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/drop-down-lists | |
| import glob | |
| import os | |
| import re | |
| # default diameter to show | |
| DefaultDiameter = 'M6' | |
| # called when an input changes in the dialog window |
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/custom-values-and-settings-window | |
| # create windows object | |
| Win = Windows() | |
| # construct list of items for the window | |
| Options = [] | |
| # ask user for text | |
| Options.append(['Name of the item', WindowsInputTypes.String, 'Baz']) | |
| # ask user for a floating point (real) value |
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/creating-and-manipulating-assemblies | |
| # create a new empty assembly | |
| Asm = Assembly("Test"); | |
| # add an existing part, located at the origin, replace path with your own | |
| NewPart1 = Asm.AddPart(r'C:\Users\Brian\Desktop\PartA.AD_PRT', 0, 0, 0, 0, 0, 0, True) | |
| # duplicate the part, translate it to x = 5, y = 10, z = 15 and rotate it x 30 deg, y 40 deg, z 50 deg | |
| NewPart2 = Asm.DuplicatePart(NewPart1, 5, 10, 15, 30, 40, 50, True) | |
| # duplicate the part, rotate it x 30 deg, y 40 deg, z 50 deg and translate it x = 5, y = 10, z = 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/creating-a-cylinder-between-two-points | |
| # creates a cylinder between two arbitrary points | |
| from math import sqrt | |
| # ends of cylinder are centered on these points | |
| cyl_p1 = [1, 5, 2] | |
| cyl_p2 = [10, 14, 8] | |
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/creating-a-3d-sketch-with-a-spline-and-an-arc | |
| Units.Current = UnitTypes.Inches | |
| P = Part('My Part') | |
| # create 3d spline from a set of interpolation points | |
| Path = P.Add3DSketch('Path') | |
| Points = [0.6, -0.6625, 0.0] | |
| Points.extend([0.6, -0.6625, -0.2175]) |
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/create-reference-planes-axes-and-points | |
| # demonstrates creating reference geometry | |
| # create a new part and get the xy plane | |
| MyPart = Part('My Part') | |
| XYPlane = MyPart.GetPlane('XY-Plane') | |
| # create planes 100mm above and below the xy plane | |
| TopPlane = MyPart.AddPlane('Top Plane', XYPlane, 100.0) |