Computer Aided Design
Sometimes it is useful to cover vias with solder mask. Here is how to do it in DesignSpark PCB. First the solder mask with the vias exposed:
1. Choose Design Technology… from the Settings menu
2. Click on the Solder Mask row and then the Edit… button
3. Uncheck the Vias setting and click on OK.
4. Click on OK to close the dialog window.
At this point the solder mask should automatically update to show the vias are now covered. If it doesn’t deselect the layer and reselect it to force a refresh.
This tutorial demonstrates how to create a library of parts in a CAD neutral format based on a single template part. It takes advantage of parameterization in Geomagic Design.
We will start by creating the base part that we will use to create the library. This will be a simple cap head bolt.
Next we will use WizoScript to generate a library of 10 bolts of different lengths.
This type of task is ideally suited to scripting because it handles the tedious repetitive operations needed. While the part demonstrated in this tutorial is simple the same principles can easily be used for complex parts with multiple parameters.
Creating the Template Part
In Geomagic Design create a new part and then a sketch on the XY-Plane. On this sketch draw a circle centered on the origin with a diameter of 4mm and then extrude into a cylinder with a length of 10mm.
Under the Viewing and Analysis tab click on the Equation Editor button.
Double-click on “D2” and enter “Length” to give the length of the bolt a useful name then close the equation editor window.
Create the bolt head by adding a sketch to the end of the cylinder on the XY-Plane, setting the diameter to 8mm and extruding 4mm.
Create a new sketch on the top of the bolt head, draw a hexagon with an inside diameter of 4mm and then extrude cut 2mm.
Create a new folder called “PartLibrary” and save as TemplatePart.AD_PRT. Keep the part open in Geomagic to continue with the tutorial.
Writing a Basic Script
Start WizoScript 1.70 or later. When it runs it automatically creates an empty script that we can start using right away.
First we need to tell the script about our template part. For this tutorial the part must be open in Geomagic when the script runs, however it is possible to use a saved part that is not currently open. Please see the WizoScript reference manual for further details.
The following script line tells WizoScript “I have a part open and I want you to use it”:
TemplatePart = Part(“TemplatePart”, False)
Next we need to get access to the length parameter that we have already created it. Once we have access to it we can change its value
Length = TemplatePart.GetParameter("Length")
The default units for a script are millimeters, so if we enter the following:
Length.Value = 10
Then we are setting the length of the bolt to 10mm. Enter this into the script.
Now that we have set the length of the bolt we need to export it in a CAD-neutral formal so it can be shared with others. Here is how to do it:
This is what you should have so far:
Save the script and click on the Run button. If there are any errors correct them in the script and try again. If the script is successful you should now have a M4-Bolt-10.stp file.
Generating Multiple Parts
So far it’s not very interesting. We’ve generated a single STEP part that we could have easily created directly in Geomagic Design without needing scripting. Now we will look at generating multiple parts in one go.
The first step is to create a function that is given a length and creates a STEP file. A function is a way of grouping parts of a script together so they can be run over and over again. Edit your script to look like the following:
def GenerateBolt(NewLength): Length.Value = NewLength TemplatePart.ExportSTEP214("C:\Users\Andy\Desktop\M4-Bolt-"+str(NewLength)) TemplatePart = Part("TemplatePart", False) Length = TemplatePart.GetParameter("Length") GenerateBolt(10) GenerateBolt(12)
We now have a function called GenerateBolt that takes a length and creates a STEP file. The function has to be defined before it is used so put it at the start of the script.
Another key change is that the name of the STEP file contains the length, whatever that may be. This is achieved by appending “M4-Bolt-“ with the length value.
Run the script. It will call GenerateBolt twice and create two STEP files containing a 10mm bolt and a 12mm bolt.
The final step is to create a loop that goes from a minimum length to a maximum length creating bolts. Replace the two calls to GenerateBolt with the following:
MinimumLength = 10 MaximumLength = 20 for NewLength in range(MinimumLength, MaximumLength + 1): GenerateBolt(NewLength)
Run the script and it will generate bolts with lengths from 10mm to 20mm.
Here is the final script with comments added to explain:
# Takes a template bolt and creates a library of bolts of different lengths in # a CAD neutral format # Creates a bolt of a specific length. NewLength = desired length of bolt in mm # Saves the bolt to the desktop as a STEP file def GenerateBolt(NewLength): Length.Value = NewLength TemplatePart.ExportSTEP214("C:\Users\Andy\Desktop\M4-Bolt-" + str(NewLength)) # Get access to currently opened part that we will used as a template TemplatePart = Part("TemplatePart", False) # The template part has a Length parameter defined which we will control Length = TemplatePart.GetParameter("Length") # Create bolts from 10mm to 20mm MinimumLength = 10 MaximumLength = 20 for NewLength in range(MinimumLength, MaximumLength + 1): GenerateBolt(NewLength)
The Cooke Triplet is a system of three lenses designed in the 19th century to reduce distortion. In 1950 a specific triplet was invented and patented by Eastman Kodak (EF=100mm, f/1.9) and we will look at how to recreate it in Geomagic Design using scripting. We will create a script that can generate any type of thick lens, including how to solve the lensmaker’s equation. Hopefully the techniques demonstrated here will be useful to others solving and creating mathematical shapes in Geomagic Design.
Download, install and run WizoScript 1.70 or later. Start Geomagic Design. This script was tested with version 126.96.36.19990.
First we must enable a couple of useful libraries and make sure our script is using millimeters to match the values in the patent.
import sympy from sympy import * import math Units.Current = UnitTypes.Millimeters
We are going to generate three lens parts and save them so we need to specify a location to save to. Change this to make your PC.
OutputFolder = "P:\\temp"
The patent completely describes the three lenses but we are going to make it a bit more interesting by calculating the radius of the back of the lens from the focal length. To do that we need to use the lensmaker’s equation.
In the formula the radius of the back of the lens is R2. This appears in two locations in the formula. We could rearrange it to give us R2 = … but that is a bit tedious. Instead we can leave WizoScript to worry about it instead. Here is how we enter the equation into the script using ‘rb’ to represent the radius of the back of the lens.
# calculates the back radius of a lens based on the other parameters # uses the lensmaker's equation def GetBackRadius(FrontRadius, Thickness, RefractiveIndex, FocalLength): rb = Symbol('rb') Equation = Eq((RefractiveIndex-1)*((1/FrontRadius)-(1/rb)+(((RefractiveIndex-1)*Thickness)/(RefractiveIndex*FrontRadius*rb))),(1/FocalLength)) # we don't bother rearranging the equation, instead we let the sympy module do that for us BackRadius = solve(Equation) return BackRadius
WizoScript rearranges the equation and calculates the value we need using the single line:
BackRadius = solve(Equation)
The equation is placed into a function called ‘GetBackRadius’ which calculates the value when given a set of parameters, such as the thickness of the lens, refractive index of the material, etc. We can call the function repeatedly for different parameters.
Now we need to start creating a part for a single lens. First we tell Geomagic Design to create a part. We are going to do that in a new function.
# creates a part representing a lens based on a set of parameters def GenerateLens(Name, Folder, FrontRadius, Thickness, RefractiveIndex, FocalLength, Diameter): # get missing parameter BackRadius = GetBackRadius(FrontRadius, Thickness, RefractiveIndex, FocalLength) # check diameter is small enough if Diameter > abs(FrontRadius): print "%s diameter is larger than the front radius %f" % (Name, FrontRadius) return if Diameter > abs(BackRadius): print "%s diameter is larger than the back radius %f" % (Name, BackRadius) return # create new part Lens = Part(Name)
The general approach we will take is to draw a 2D profile of half of the lens on the XY plane and then create a revolve boss around the X axis. The X axis is the optical axis (i.e. the center of rotation for the lens).
# start creating the 2d sketch representing the shape of the lens Profile = Lens.AddSketch("Profile", Lens.GetPlane("XY-Plane")) LensRadius = Diameter / 2.0
First we will draw the front of the lens. There are three possibilities, the front is flat (infinite radius), bulging out aka convex (positive radius) or indented aka concave (negative radius). We treat each case individually. Simple trigonometry is used to calculate the end points of the front. Note that infinity is represented in the script by ‘oo’.
# draw shape of the front of the lens, it can be flat, convex or concave if FrontRadius == oo: FEndX = 0 Profile.AddLine(0, 0, FEndX, LensRadius, False) elif FrontRadius > 0: Angle = asin(LensRadius / FrontRadius) FEndX = FrontRadius - (cos(Angle) * FrontRadius) Profile.AddArcCenterStartEnd(FrontRadius, 0, FEndX, LensRadius, 0, 0, False) else: FrontRadius = -FrontRadius Angle = asin(LensRadius / FrontRadius) FEndX = (cos(Angle) * FrontRadius) - FrontRadius Profile.AddArcCenterStartEnd(-FrontRadius, 0, 0, 0, FEndX, LensRadius, False)
The back of the lens is treated in the same way except the sign of the radius is reversed. This means that a convex shape is a negative radius and a concave shape is a positive radius.
# draw shape of the back of the lens, it can be flat, convex or concave if BackRadius == oo: BEndX = Thickness Profile.AddLine(Thickness, 0, BEndX, LensRadius, False) elif BackRadius < 0: BackRadius = -BackRadius Angle = asin(LensRadius / BackRadius) BEndX = (cos(Angle) * BackRadius) - BackRadius + Thickness Profile.AddArcCenterStartEnd(Thickness - BackRadius, 0, Thickness, 0, BEndX, LensRadius, False) else: Angle = asin(LensRadius / BackRadius) BEndX = -(cos(Angle) * BackRadius) + BackRadius + Thickness Profile.AddArcCenterStartEnd(Thickness + BackRadius, 0, BEndX, LensRadius, Thickness, 0, False)
Before we can add the revolve boss we must make sure the sketch is closed by drawing the line for the outside of the lens and the line along the optical axis
# check diameter of lens again if FEndX > BEndX: print "%s diameter is too large" % Name return # if this is not a "thin" lens then draw top of profile if FEndX != BEndX: Profile.AddLine(FEndX, LensRadius, BEndX, LensRadius, False) # draw line of profile along x axis (optical axis) Profile.AddLine(0, 0, Thickness, 0, False)
Now for the revolve boss.
# create lens by revolving sketch around x axis Lens.AddRevolveBoss("Lens", Profile, Lens.GetAxis("X-Axis"), 360.0)
Creating two reference planes for the front and back of the lens will help with aligning them to create the triplet. Finally we save and close the part.
# add reference planes to aid in aligning this lens with others Lens.AddPlane("Front", Lens.GetPlane("YZ-Plane"), 0); Lens.AddPlane("Back", Lens.GetPlane("YZ-Plane"), Thickness); # save and close Lens.Save(Folder) Lens.Close()
The last step is to generate the three lenses needed for the triplet using the values from the patent along with the focal length.
# lens 1 GenerateLens("Lens1", OutputFolder, 62.63, 25.56, 1.745, 73.2, 40.0) # lens 2 GenerateLens("Lens2", OutputFolder, -66.47, 4.51, 1.647, -37.74, 36.0) # lens 3 GenerateLens("Lens3", OutputFolder, 119.5, 19.92, 1.697, 54.88, 30.0)
The complete script can be obtained from the script library. Running it will generate three part files, one for each lens.
Create a new assembly and add the three lenses in the order lens1, lens2 and lens3. Align the X axis of all three lenses. Align the front plane of lens2 7.89mm from the back plane of lens1. Align the front plane of lens3 14.14mm from the back plane of lens2.
This mini tutorial shows how to generate custom Mobius strips with minimum effort. It demonstrates that python scripting can be used to ask the user for information and then apply it to a part the user is already working on. Hopefully that will be useful to some people when solving problems.
1. Download and install WizoScript 1.70 or later and start it.
2. Start Geomagic Design V16 hotfix 1 (188.8.131.5290) or later.
3. Create a new part and set the units to millimeters.
4. Create a new sketch on the XY plane.
5. Draw a triangle centered on the X axis and set the size of the reference circle to 10mm.
6. Set the center of the triangle 30mm from the origin and exit sketch editing mode.
7. Go to the WizoScript script library and copy the Interactive Mobius Strip Generator. Paste it into WizoScript. Hint: double-clicking on the script in the web-page selects the entire script.
8. Run the script.
9. You will be asked for the name of the part. Assuming you haven’t saved it enter “New Part (1)”. Then you will be asked for the name of the sketch. Enter “Sketch<1>”.
10. Next you will be asked the rotation point along the X axis. Enter “30”. This puts the rotation point at the center of the triangle.
11. You will be asked for the number of rotations. This is the number of times the mobius strip will completely rotate. Enter “3”.
12. Finally you will be asked to enter the number of steps. Enter “30”.
Now the mobius strip will be generated. Be patient as this can take several minutes. Here is what you should have:
Now it’s time to experiment! You can change the shape of the sketch to create different effects. Setting the rotation point closer or further away from the origin will create a “corkscrew” effect. You can increase or decrease the number of rotations. Reducing the number of steps will make the part faster to create but you might have to manually add a guide curve to get a true mobius strip.
Using this script it is possible to run it multiple times on the same part. For example create two sketches, run it on the first sketch and then run it on the second sketch to create two Mobius strips that are intertwined.
- loosen the screws holding the servo and move it back slightly so the gears are still meshing but there is no sideways pressure on the servo shaft.
- make sure the pivot servo is not near the limit of it’s range at any point. When near the limit it will attempt continuous rotation and will lose it’s position.
- check the hub retainer is not touching the lower bearing.
- move the gear housing away from the servo and make sure it rotates freely.
- rotate the in tray outwards slightly and update the in tray position in config.xml. This will move the center of the in tray slightly further from the center of the pivot.
- make sure y axis is vertical (see item 6).
- rotate the out tray outwards slightly and update the out tray position in config.xml. This will move the center of the out tray slightly further from the center of the pivot.
- make sure y axis is vertical (see item 6).
- make sure both sides of the grabber are vertical.
- raise the toolhead microswitch so that more of the grabber is lowered into the hole in the center of the disc.
- make sure that the y axis is exactly horizontal.
- make sure that the y axis is exactly horizontal.
- check that the Y axis is vertical (see item 6).
- make sure that both sides of the grabber are vertical.
- make sure the hub retainer is close to, but not touching, the lower bearing.
- loosen the nuts holding the gear housing to the threaded rod and re-tighten while pressing down on the rear of the gear housing.
- check the y axis is securely attached to the threaded rod.
- adjust the two M8 nuts on the threaded rod at the hub to shorten/lengthen the arm from the pivot to y axis. Make sure the grabber is exactly over the center of the disc.
- tweak the drive tray position in config.xml
2. Ideas for Improvements
- Increase DVD capacity for faster PCs.
- Redesign main gear housing to use less plastic.
- Sugru veneers for grippers.
- Eliminate Raspberry Pi.
– merge BotServer into JacktheRipperBot.exe
– PC communicates directly with Pololu Maestro
- PC farm for faster ripping
– use Raspberry Pi to create image of discs which are then put into a queue. A farm of PCs work on encoding the queue.
- Cable management on top of support ring to keep wires away from gears.
- Stack two or three DVD drives vertically so the robot can load and unload into all of them.
- Add support for ripping “profiles” to JacktheRipperBot.exe, allowing different Handbrake settings to be used for specific discs in the in tray.
Install the Pololu Maestro software and then connect the Maestro to your PC and start the software.
The microswitches should already be displaying their status. Press the switches and make sure they are working.
Enable the three servo channels and manually move each servo to make sure it works.
Use the software to position the arm over the in tray, DVD drive and out tray. Make a note of the servo position values. Be careful not to go near the limits of the servo as it turns into a continuous rotation servo and loses position.
Use the software to work out a slow speed for raising and lowering the toolhead and also the value to make it stop without the servo making a buzzing sound. Make a note of these values.
Finally use the software to determine the servo values for the grippers being fully open and fully closed. Make a note of these values.
Open the DVD tray and put a DVD into it.
Use the two M8 nuts next to the hub to adjust the length of the arm so that the grippers are directly above the hole in the DVD.
Swing the arm over the in tray and check if the grippers are positioned over the center. If not swing the tray outwards slightly or add M8 washers as spacers between the tray and the tray anchor. If you move the tray then you will need to check again the servo value need for the in tray position.
Repeat this for the out tray.
3. Raspberry Pi Setup
Copy to the Raspberry Pi (RPi) the following:
Edit config.xml in a text editor and insert the servo values you have worked out.
Mono needs to be installed on the RPi but the version in the repositories does not work. Instead use the version found here.
Run the server with:
mono ./BotServer.exe config.xml
Open the DVD tray and put a DVD into the in tray.
Load a disc by visiting: http://192.168.1.70/botapi/?command=loaddisc
Replace the IP address with the address of your RPi. The disc should be loaded into the tray.
You may have to adjust the YAxisLowertoDriveTime in config.xml which is given in 1/1000th of a second and governs the time spent lowering the toolhead before dropping the disc into the drive tray.
Once the load disc function is working test the unloading with: http://192.168.1.70/botapi/?command=unloaddisc
The YAxisLowertoOutTrayDropTime in config.xml governs the time spent lowering the toolhead before dropping the disc into the out tray. It has to drop from low enough that it consistently goes into the tray, but high enough that when the stack in the out tray is full there is space to drop the last disc.
4. PC Setup
Copy the following files to your PC:
Make sure the full .NET Framework 4.0 is installed. If you need to install it then reboot before running JacktheRipperBot.exe.
Install DVDFab Passkey or AnyDVD. Both applications have the option to execute a command when scanning of a disc has completed. Set this up to run ScanningFinished.bat.
Install Handbrake and check the correct path to HandbrakeCLI.exe is used in Rip.bat.
Start JacktheRipperBot.exe and enter the IP address of your RPi.
Go to the advanced tab and try the various operations individually.
Once you are happy everything is working enter the number of discs in the in tray and click on Start to start ripping!
The following block diagram shows the arrangement of the electronics.
For wifi connect a USB wifi interface to the Raspberry Pi (RPi). Connect a USB cable from the RPi to the Maestro. I connect to the RPi via SSH and I have configured my router to always assign the same IP address.
The Maestro requires a separate 5V power supply for the servos.
Connect the servos to the Maestro as follows:
- Channel 0 = Core servo for pivoting
- Channel 1 = Y axis servo
- Channel 2 = Toolhead servo
Use the servo extension cables for the Y axis and toolhead servo.
Wire the microswitches as shown in this diagram. I used servo extension cables and the colors mentioned reflect that. Note that the signal wire could also be white.
The 5V connection to the Maestro is not the one on the servo connectors. There is a separate 5V and GND along the top edge. See this section of the Maestro user’s guide for details.
Solder a two pin header onto the pads for the 5V and GND. Use the two way molex connector and 0.1 inch pins to create a connector to plug onto the header. Note that the ground pin is not used, instead the ground on the servo connectors is used.
Part I covered the introduction to the robot. This part covers the mechanical assembly.
I divided the mechanical design into several groups, which I will refer to throughout. These names are also used for the part designs.
The frame holds everything together. It attaches to the DVD drive. Onto the frame is the in and out trays and what I call the “core”. The core is the main pivoting mechanism for the arm that loads and unloads discs.
At the end of the arm is the YAxis which raises and lowers discs. This should have been called the ZAxis but C’est la vie…
Finally the toolhead is at the bottom of the YAxis and grabs and releases discs.
I printed all parts in PLA with three perimeters and 20% fill.
No support is required. The STLs are already correctly orientated.
Any STL name ending in _X2.stl means print two copies of that part.
Whereever M8 nuts are used always use a M8 lock washer against the nut, unless the nut goes into a nut trap.
Exploded diagrams don’t show M8 lock washers, M3 hardware or M2 hardware.
Filing of the printed parts may be needed, especially for the M2 nut traps and if the first layer has a lip because it was squashed.
If you are unsure about any step you can download a 3D PDF of the entire robot. Open in Adobe Reader and click on the image. You can then spin the model around and zoom in to examine it from every angle.
1. DVD Drive
The DVD drive must be an internal 5.25 inch type designed to be used horizontally. The tray electronics must open and close the tray fully by pressing the front button on the drive. When the tray is open it must be possible to lower a disc into the tray vertically. I.e. make sure the front of the drive does not overhang the back of the tray slightly.
Attach the left and right brackets onto the drive using M3x12 bolts and the rear mounting holes in the drive case. The curved ends go towards the rear.
Attach the tray anchors to the left and right brackets using M3x18mm bolts. M3 nuts go into the recesses on the bottom of the tray anchors.
Attach the in and out trays to the tray anchors. Use M8x30mm threaded rod, M8 nuts and M8 lock washers. The out tray has slightly sloping sides at the top. The in tray does not.
Attach the electronics caddy to the left bracket using two M3x14mm bolts. Put M3 nuts into the nut traps.
Attach the four M3x100mm threaded rods to the left and right brackets. M8 nuts are placed into the recesses in the bottom of the brackets.
Attach the corners to the threaded rods you just added. They should be positioned as close as possible to the top of the threaded rods.
Attach the GWS S125 1T servo to the servo bracket. The end of the servo with the shaft must go to the end of the servo bracket that is built up underneath. Use four M3x14mm bolts with M3 washers next to the bolt heads.
Press the servo gear onto the shaft of the servo. It will be a tight fit. Note that there are three servo gears. Use the “core” servo gear.
Press a 608ZZ bearing into the recesses in the top and bottom of the gear housing.
Slide the main gear into the slot in the gear housing.
Press the hub into the gear housing so that it goes through the upper 608ZZ bearing, the main gear and then the lower 608ZZ bearing. Make sure it is all the way in. It will be a tight fit. If you can’t make it fit through the gear then carefully file the hole in the gear, but do not overfile.
Attach the hub retainers to the bottom of the hub. These clamp onto the cross-shaped part of the hub. Use two M3x16mm bolts with nuts. It should be close to the bottom of the gear housing without touching it.
Place the support ring on top of the gear housing.
Slide two M8x200mm threaded rods through the left corner, servo bracket, gear housing and right corner. The order should be (from left to right):
M8 nut, M8 lock washer, left corner, servo bracket, gear housing, M8 lock washer, M8 nut, M8 nut, M8 lock washer, right corner, M8 lock washer, M8 nut.
Press the servo gear onto the Futaba S3003 servo (modified for continuous rotation). The fit will be tight. Be sure to use the servo gear for the Y axis.
Slide the servo down into the Y axis. The tabs on the servo go towards the front of the Y axis.
Push the rod up into the Y axis from the bottom. When it reaches the servo gear you will have to move the servo up and down a bit to get the rod to slide in. You can also carefully turn the servo by hand.
Attach the servo to the Y axis using four M3x14mm bolts. Use M3 washers next to the bold heads.
Attach the microswitch without a roller to the side of the Y axis using M2x14mm bolts. Put M2 nuts into the nut traps. Use the image above to orientate the microswitch.
Attach the Y axis to the core using a M8x220mm threader rod. A M8 nut goes into the nut trap on the underneath of the Y axis. The order should be (from front to back):
M8 nut (in nut trap), Y axis, M8 lock nut, M8 nut, M8 nut, M8 lock nut, hub, M8 lock nut, M8 nut
Screw the 9g micro servo to the back of the frame using two M2x10mm bolts.
Attach the guide which goes between the two forks using a single M2x10mm bolt.
Slide the rack into position.
Press the servo gear onto the servo shaft. It will be a tight fit. The teeth on the gear should mesh with the teeth on the rack.
Attach the fixed gripper to the frame using a M2x10mm bolt.
Attach the moving gripper to the rack using a M2x10mm bolt.
Attach the microswitch with the roller to the frame using two M2x10mm bolts.
Attach the toolhead to the bottom of the rod on the Y axis using two M3x14mm bolts.
I had a problem.
Over the last 15 years my wife has amassed a huge DVD collection and we don’t have enough space for shelving to access them all. About a year and a half ago I decided to start ripping the discs to a media server. This went well initially but it was tedious. Ripping is a slow business and every hour I had to feed the computer another disc which was disruptive to normal life. I gave up.
Recently inspired and armed with a 3D printer I decided to build a robot to perform the disc changing. Jack the Ripper Bot was born.
View the video of the robot in action: http://www.youtube.com/watch?v=mmHycIOtYHA
I will divide the description of Jack into five parts: introduction, mechanics, electronics, software and troubleshooting.
My aims were:
- Modular software and hardware design
- Open source
- Low cost
- Using off-the-shelf electronics
A stack of discs are placed into the “in tray”. An arm moves over to the stack and grabs the top disc. The disc is then lowered into the drive tray. Ripping takes place. Once complete the disc is removed from the drive tray and the arm takes it over to the “out tray” and places it there.
A Raspberry Pi is used to control the robot and a PC is used to control the overall process and the ripping.
I have a laptop which is about four years old and it can rip a DVD in about 1 hour 15 minutes. The in tray is designed to hold 24 discs to give about 28 hours of ripping time. It is of course possible to increase the capacity of the in tray and the out tray if your PC is faster than mine.
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: