Interesting Tech Projects
Posts tagged alibre design
Involute Gears in Alibre Design
Apr 25th
The most common type of gear is the involute gear, which provides smooth and efficient operation. A gear is defined by the following parameters:
- Pitch diameter (diameter of gear)
- Diametral pitch (tooth size)
- Number of teeth
- Pressure angle (commonly 14.5, 20 or 25 degrees)
The pressure angle defines the shape of a tooth. For two gears to mesh the pressure angle and diametral pitch must be the same (i.e. the shape and size of the teeth must match). There is a simple relationship between pitch diameter, diametral pitch and number of teeth so when defining a gear we only need to specify two of those parameters.
The ability to create involute gears is included in python-based ADScript. Let’s see how.
NumberofTeeth = 20 PitchDiameter = 30 PressureAngle = 20 InputGear = Part("Input Gear") XYPlane = InputGear.GetPlane("XY-Plane") GearSketch = InputGear.AddGearNP("Gear Profile", NumberofTeeth, PitchDiameter, PressureAngle, 0, 0, XYPlane)
This script creates a new part called Input Gear and then adds a sketch to it on the XY-plane for the profile of a gear by calling AddGearNP. NP shows which two parameters are used, N = number of teeth and P = pitch diameter.
The 0, 0 defines the coordinates of the center of the gear.
Once the gear has been created we can read out the diametral pitch:
DiametralPitch = GearSketch.DiametralPitch
There are two other functions that we can call to create gears, depending on which two parameters we wish to use.
GearSketch1 = MyPart.AddGearDN("Gear Profile", DiametralPitch, NumberofTeeth, PressureAngle, 0, 0, XYPlane) PitchDiameter = GearSketch1.PitchDiameter GearSketch2 = MyPart.AddGearDP("Gear Profile", DiametralPitch, PitchDiameter, PressureAngle, 0, 0, XYPlane) NumberofTeeth = GearSketch2.NumberofTeeth
Here is an example script that shows how we can create two gears that can be used together to provide a 3:1 reduction ratio:
# all values are in millimeters Units.Current = UnitTypes.Millimeters # pressure angle has to be the same for both gears # common values are 14.5, 20 and 25 # larger pressure angle = stronger teeth PressureAngle = 20 # thickness of gears Thickness = 2 # shaft diameter ShaftDiameter = 5 # define input gear - 20 teeth and 30mm pitch diameter Gear1Teeth = 20 Gear1Diameter = 30 # create input gear using number of teeth and pitch diameter Gear1Part = Part("Input Gear") Gear1 = Gear1Part.AddGearNP("Gear Profile", Gear1Teeth, Gear1Diameter, PressureAngle, 0, 0, Gear1Part.GetPlane("XY-Plane")) Gear1.AddCircle(0, 0, ShaftDiameter, False) Gear1Part.AddExtrudeBoss("Gear", Gear1, Thickness, False) # diametral pitch must be the same for both gears as this defines tooth size # use diametral pitch for output gear from input gear calculated value Gear2DiametralPitch = Gear1.DiametralPitch # we want a ratio of 1:3 so output gear has three times the number of teeth Gear2Teeth = Gear1Teeth * 3 # create output gear using number of teeth and diametral pitch Gear2Part = Part("Output Gear") Gear2 = Gear2Part.AddGearDN("Gear Profile", Gear2DiametralPitch, Gear2Teeth, PressureAngle, 0, 0, Gear2Part.GetPlane("XY-Plane")) Gear2.AddCircle(0, 0, ShaftDiameter, False) Gear2Part.AddExtrudeBoss("Gear", Gear2, Thickness, False) # get the calculated pitch diameter of the output gear Gear2Diameter = Gear2.PitchDiameter # calculate distance between gear centers so we know how far apart the shafts need to be print "Distance between gear centers = %fmm\n" % ((Gear1Diameter + Gear2Diameter) / 2)
And the result:
Scripting Metric Screws in Alibre Design
Apr 10th
Creating screws is tedious. There are lots of diameter and length combinations and there is more to a screw than first meets the eye. Creating a parts library containing lots of variations is a perfect use for ADScript.
Here is a M3 x 20mm socket cap screw generated from the script below.
This screw is modeled to the ISO 4762 standard. Notice the threads are missing? Modeling the threads is generally a waste of time and resources as the aim is to ensure a screw fits, is long enough and there is enough clearance to install it.
# Creates a metric socket cap screw using ISO 4762 # See: http://practicalmaintenance.wordpress.com/2009/01/30/socket-head-cap-screws-article-13/ # Size of screw Diameter = 3.0 Length = 20.0 # Measurements table containing H, F, E, T, C from web page MetricData = {} MetricData[1.6] = [3.14, 2.0, 1.73, 0.7, 0.16] MetricData[2.0] = [3.98, 2.6, 1.73, 1.0, 0.2] MetricData[2.5] = [4.68, 3.1, 2.3, 1.1, 0.25] MetricData[3.0] = [5.68, 3.6, 2.87, 1.3, 0.3] MetricData[4.0] = [7.22, 4.7, 3.44, 2.0, 0.4] MetricData[5.0] = [8.72, 5.7, 4.58, 2.5, 0.5] MetricData[6.0] = [10.22, 6.8, 5.72, 3.0, 0.6] MetricData[8.0] = [13.27, 9.2, 6.86, 4.0, 0.8] MetricData[10.0] = [16.27, 11.2, 9.15, 5.0, 1.0] MetricData[12.0] = [18.27, 13.7, 11.43, 6.0, 1.2] MetricData[16.0] = [24.33, 17.7, 16.0, 8.0, 1.6] MetricData[20.0] = [30.33, 22.4, 19.44, 10.0, 2.0] MetricData[24.0] = [36.39, 26.4, 21.73, 12.0, 2.4] MetricData[30.0] = [45.39, 33.4, 25.15, 15.5, 3.0] MetricData[36.0] = [54.46, 39.4, 30.85, 19.0, 3.6] MetricData[42.0] = [63.46, 45.6, 36.57, 24.0, 4.2] MetricData[48.0] = [72.46, 52.6, 41.13, 28.0, 4.8] MetricData[56.0] = [84.54, 63.0, 46.83, 34.0, 5.6] MetricData[64.0] = [96.54, 71.0, 52.53, 38.0, 6.4] CapDiameter = MetricData[Diameter][0] FilletTransitionDiameter = MetricData[Diameter][1] HexHoleDiameter = MetricData[Diameter][2] HexHoleDepth = MetricData[Diameter][3] RimFilletRadius = MetricData[Diameter][4] # all values are in millimeters Units.Current = UnitTypes.Millimeters # Create part Screw = Part("Cap Screw M%dx%d" % (Diameter, Length)) # body Profile = Screw.AddSketch("Profile", Screw.GetPlane("XY-Plane")) Profile.AddLines([0, 0, 0, CapDiameter / 2, Diameter, CapDiameter / 2, Diameter, Diameter / 2, Diameter + Length, Diameter / 2, Diameter + Length, 0, 0, 0], False) Screw.AddRevolveBoss("Body", Profile, Screw.GetAxis("X-Axis"), 360) # hex hole HexHole = Screw.AddSketch("Hole", Screw.GetFace("Face<5>")) HexHole.AddPolygon(0, 0, HexHoleDiameter, 6, False) Screw.AddExtrudeCut("Hex Hole", HexHole, HexHoleDepth + ((FilletTransitionDiameter - Diameter) / 2.0), True) # fillet from cap to shaft Screw.AddFillet("Cap Joint", Screw.GetEdge("Edge<21>"), (FilletTransitionDiameter - Diameter) / 2.0, False) # fillet at bottom of hex hole Screw.AddFillet("Hex Hole Bottom", [Screw.GetEdge("Edge<5>"), Screw.GetEdge("Edge<9>"), Screw.GetEdge("Edge<12>"), Screw.GetEdge("Edge<21>"), Screw.GetEdge("Edge<18>"), Screw.GetEdge("Edge<15>")], (FilletTransitionDiameter - Diameter) / 2.0, False) # fillet on rim Screw.AddFillet("Cap Rim", Screw.GetEdge("Edge<35>"), RimFilletRadius, False)
Scripting Polyholes in Alibre Design
Apr 6th
3D printing by using layers of melted plastic filament, such as used by RepRap printers, causes small holes (less than 15mm in diameter) to end up smaller than the designed size. To compensate for this people create designs with larger holes so they shrink to the right size. It’s not an ideal solution – how much do they need to be increased by? What if you later want to send the same design to a commercial printing service that is more accurate?
The RepRap developer Nophead examined this issue and came up with a simple way to design holes that print at the right size regardless of the printing method. He called them polyholes.
In short the solution is to approximate the hole with a polygon and increase it’s size slightly.
Creating these polyholes in a CAD package is tedious. The size has to be calculated and the number of sides varies with the hole size. ADScript has this functionality baked right in. Here is an example python script:
# use millimeters for all values Units.Current = UnitTypes.Millimeters # test block dimensions length = 15 width = 10 depth = 3 # size of test holes diameter = 3 # create a new part, get the XY plane and create a sketch on the plane PolyholeTest = Part("PolyholeTest") XYPlane = PolyholeTest.GetPlane("XY-Plane") Base = PolyholeTest.AddSketch("Base", XYPlane) # draw the part outline Base.AddPolyline([0, 0, length, 0, length, width, 0, width, 0, 0], False) # draw a regular hole Base.AddCircle(length / 3, width / 2, diameter, False) # draw a polyhole Base.AddPolyhole(length / 3 * 2, width / 2, diameter, False) # extrude the sketch into a part PolyholeTest.AddExtrudeBoss("Block", Base, depth, False) # save and export to STL for printing PolyholeTest.Save("C:\Users\Andy\Desktop") PolyholeTest.ExportSTL("C:\Users\Andy\Desktop\PolyholeTest.stl")
When this script is run it produces the following test part with the regular hole on the left and the polyhole on the right:
To rotate the part simply change the plane used, perhaps to “ZX-Plane”, and run the script again.
Python Scripting with Alibre Design
Apr 3rd
ADScript makes it easy to use Alibre Design with Python scripting. For example creating a new part:
Test = Part("Test")
We can get access to planes in the design workspace, for example:
XYPlane = Test.GetPlane("XY-Plane")
Once we have a part and plane we can create a sketch on the plane:
MySketch = Test.AddSketch("MySketch", XYPlane)
Adding to the sketch is easy:
MySketch.AddCircle(0, 0, 10, False)
Now we can extrude it:
Object = Test.AddExtrudeBoss("Object", MySketch, 5, False)
Using Alibre Design for 3D Printing of Multi-Part Projects
Mar 13th
The easiest way to design projects that involve multiple parts in Alibre Design is to create and edit parts inside an assembly workspace. This allows the edges and cross-sections of one part to be reused in another part which is very useful.
However for 3D printing there is a downside – creating a part inside an assembly results in that part being orientated the same way in the part workspace as it in the assembly workspace. For 3D printing we want a specific side face down on the XY plane. That choice of side depends on the part.
So we have taken advantage of the tools and features that Alibre Design offers but we now have parts that are not orientated correctly for printing. They can be rotated in Alibre Design by creating a new assembly just for that part but there must be an easier way.
The following screenshot illustrates the problem. The circular panel is in an assembly and orientated the way we need it to check that everything fits together.
Opening the part in it’s own workspace shows the orientation.
Exporting and slicing this part as it is results in the following g-code.
So how can we make this easier, especially if we have an assembly with lots of parts? By using an add-on for Alibre Design.
I’ve updated my AD Assembly Exporter utility that I have previously written about. It can now automatically rotate STLs when they are exported so that the desired face is aligned with the XY plane.
First you must choose the face that will be placed on the print bed.
- Edit the part
- Right-click on the face and choose Insert Plane..
.
- Click on OK
- In the Design Explorer right-click on the new plane and choose Rename
- Enter the name “Bottom”
Now save the part and open the assembly containing it, if it wasn’t already open. Repeat this for all parts in the assembly that will be printed.
Run AD Assembly Exporter, click on the STL tab and choose the option to rotate using the “Bottom” plane.
Then click on Generate STLs. Here is the new g-code output:
Using Alibre Design for Multi-color and Multi-material 3D Printing Part II
Feb 27th
Previously I wrote about my little utility that allows exporting properly positioned STLs from Alibre Design so they can be imported into a slicing program for multi-color printing. This is fine for use with the RepRapPro slicer but perhaps not with other slicers.
Slic3r is a very popular, fast and flexible slicing program and now it also supports printing multi-color objects. The file format chosen by it’s author is AMF – Additive Manufacturing File. It is essentially a way to group STL files together into a single object and specify different colors or materials for various parts.
I’ve now updated my exporter utility to support saving Alibre Design assemblies directly to this format:
When an assembly is opened the application obtains the colors used by the parts in the assembly. It is then possible to assign the colors to extruders on the 3D printer. For example in this image black is the body of the object and has been assigned to the primary extruder. It’s necessary to choose which slicing program is being used as there isn’t a standard way of mapping colors to extruders. In particular Slic3r currently has several limitations so by choosing Slic3r the application will stop you from making invalid choices.
Once generated the AMF file can be loaded directly into Slic3r and sliced. Here is the g-code output shown in Repeiter-Host:
Note that the colors don’t match the Alibre Design assembly because Repetier-Host uses it’s own coloring scheme to represent the different extruders. For example blue is always the first extruder.
Now the object is ready to be printed. The estimated print time for this example is five hours and 45 minutes.
Ray Tracing (Rendering) with Alibre Design PE
Feb 15th
The Professional and Expert versions of Alibre Design come with a ray tracer called Keyshot but the Personal Edition of Alibre Design does not. However it is easily possible to use the free and very powerful Blender to generate ray traces of your 3D models.
First you must design the parts in Alibre Design and put them together into an assembly. For example here is an assembly showing a pyramid stacked on top of a cube.
Now use my free utility AD Assembly Exporter to export the assembly as a set of STL files. You can download the utility from here. More details on using it can be found in my previous post on 3D printing with Alibre Design.
Next install and run Blender.
Press Delete to delete the default cube. Then go to File -> Import -> STL and choose the STL files that were generated. They will appear in the view in the same positions as they were in the assembly in Alibre Design.
Optionally you can select all the STLs and press ‘S’ to scale them down as they may be a bit large. Now you can assign materials, add lights, position the camera, etc. to render the scene.
Using Alibre Design for Multi-color and Multi-material 3D Printing
Feb 14th
When you wish to print out a part on a 3D printer the workflow is simple – design the part, export to STL and print it. This is fine when you are only printing with a single material or color. Becoming increasingly popular and affordable are 3D printers that support printing with two or three colors/materials at once, such as the Prusa Mendel from RepRapPro. How can Alibre Design be used for this scenario?
In general the easiest way to allocate different colors/materials to a part is to design that part using multiple smaller pieces. Each piece is assigned a color/material for printing. Alibre Design has a very flexible and easy to use way of grouping parts together called an assembly. What we would need therefore is a way of exporting multiple STLs from an assembly preserving their relationships to one another.
For example, suppose we have a cube and a pyramid and we wanted to place the pyramid on top of the cube and print it in a different color to the cube. We would design the cube and pyramid as two parts then use an assembly to stack the pyramid on top of the cube. Now we need to export the two STLs preserving their position relative to the same origin. This would allow the 3D slicing software to know to stack the pyramid on top of the cube. This is where the problems start.
Alibre Design supports exporting an assembly to a single STL. It merges all the parts together and produces a single object. Information about the individual parts is lost, so this is not usable for our purposes. If you export an individual part or you hide/suppress parts in an assembly then Alibre Design exports the STL using the position and origin in the part file not the assembly, causing the position information to be lost.
An additional problem is the units used in STL files are not defined. If you create a part using centimeters then Alibre Design exports an STL that uses centimeters. Likewise if you create a part using inches then the STL uses inches. The problem is that most, if not all, 3D slicing software assumes the units are millimeters. Solving this for a single part is easy – simply change the units used to millimeters before exporting. However an assembly can be made from multiple parts that all use different units. Regardless of the units chosen for the assembly the STL export will always use the units the part was designed with.
There is one more issue that needs to be addressed. When creating an assembly parts become rotated but the final positions may not be the best for 3D printing. Consider the lid for a box. When creating the assembly it will be rotated so the top is facing upwards but the optimal orientation for printing is probably for the top to be facing downwards onto the build surface. Currently the easiest way to rotate an assembly is to place it into a new assembly as a sub-assembly. This creates an unnecessary extra file and step to perform.
Fortunately Alibre Design has an easy to use API that allows these problems to be solved and I present here my free utility with an exciting name: AD Assembly Exporter.
To use start the application and Alibre Design and open an assembly. In the assembly you can optionally hide/suppress parts you do not want to export. The name of the assembly will be shown in the title bar of the AD Assembly Exporter application. Enter the desired settings and click on the Generate STLs button.
The utility supports forcing the units in STLs to millimeters and rotation around an axis. The STL export options match those found in Alibre Design so please see the Alibre Design manual for a description of what they do. Sub-assembly nesting is supported.
Only open one assembly at a time when using the utility. It will export the first assembly found from your open Alibre Design sessions.
Please note that this software is provided “as-is”. More details can be found in the license shown during installation.
Click here to download AD Assembly Exporter (now called WizoPrint)