DeltaCad User's Group Forums will shut down at the end of 2024

Full Version: Macro for Sprocket
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
Hi, Is it possible to write Macro to draw Sprocket?

Thanks
Pawel
In the original DeltaCad Version 8 installation there are two Macros called Gears.bas and Makegear.bas
Check your DeltaCad / MACROS folder.
If you do not have them, then download them here:
Gears.bas ]
Makegear.bas ]

Also in the DeltaCad User's Group website there is a tutorial to draw gears >> [ Gear Tutorial ]
The tutorial talks about the Gear Maker Macro.
Yes I have them in version 8.

Thanks AlwMVMO
If you put 0 (zero) teeth in the first gear and put the number of teeth you want in the 2nd gear, you will get an error message but you will still get a gear.

If you put a number in the first gear and zero on the second gear you will not get any gears.
It works fine. What about sprocket for chain, is it hard do modyficate gear macro?
I don't know who wrote the gear macro and I don't know anything about sprocket and gear design.

You could draw a link of chain and then draw a tooth to match it.
Then copy and rotate it to the diameter and number of teeth you want.
I did this some time ago, it's not a macro but maybe you can convert it to one.

Drawing a Sprocket Tutorial ]

P.S. from AlwMVMO
added boxes around each page of Drawing a Sprocket Tutorial file.
And I made a PDF file from it.
(09-10-2020, 02:52 PM)williamj Wrote: [ -> ]I did this some time ago, it's not a macro but maybe you can convert it to one.

Drawing a Sprocket Tutorial ]

P.S. from AlwMVMO
added boxes around each page of Drawing a Sprocket Tutorial file.
And I made a PDF file from it.

I did this macro with your tutorial help and makegear.bas. Thanks.
It works but need draw two lines ant some trim. Copy rotate and it's done Rolleyes  

Code:
Sub Main()
Begin Dialog SPROCKETDIALOG 50,47, 182, 74, "Sprocket Maker"
 Text 4,10,65,12, "Number of Teetch"
 TextBox 68,8,49,12, .IDD_Tn
 Text 4,26,65,12, "Pitch of Chain"
 TextBox 68,24,49,12, .IDD_P
 Text 4,42,97,12, "Roler Diameter"
 TextBox 68,40,49,12, .IDD_Rd
 Text 4,58,97,12, "Roller Clearance"
 TextBox 68,56,49,12, .IDD_Backlash
 OKButton 136,15,37,12
 CancelButton 136,40,37,12
End Dialog
Dim dlg As SprocketDialog
Dim ot As Long


dcSetDrawingScale 1.0
dcSetDrawingUnits dcMillimeters
dcSetLineParms dcBLACK, dcSOLID, dcNORMAL
dcSetCircleParms dcBLACK, dcSOLID, dcNORMAL



dlg.IDD_Tn = "18"                     'Teetch number
dlg.IDD_P = "12.7"                 'Pitch
dlg.IDD_Rd = "8.5"                     'Roler circle
dlg.IDD_Backlash = "0.15"
Button = Dialog(dlg)

If Button = -1 Then
Sprock  dlg.IDD_Tn,dlg.IDD_P,dlg.IDD_Rd,dlg.IDD_Backlash,0,0
dcViewAll
End If
End Sub

Sub Sprock(ByVal Tn As Double,ByVal P As Double,ByVal Rd As Double,ByVal BACKLASH As Double, ByVal cx As Double, ByVal cy As Double)
                    
Pi=3.1415926535897932384626433832795028841971

Pr = ((P * Tn) / Pi) / 2                      'Pitch Diameter
W=((Pr+(Rd*0.5))-(Pr+(Rd*0.25)))    

dcSelectAll
dcEraseSelObjs

dcCreateLine 0, 0, 0, Pr+(Rd*0.5)

dcCreateCircle 0, 0, Pr                     'Pitch Diameter
dcCreateCircle 0, 0, Pr+(Rd*0.25)             'Pitch Circumferen ce 25% of Roller Diameter  

dcCreateCircle 0, Pr, (Rd+Backlash)/2         'Roler circle plus 0.15

dcCreateCircle 0, W/2+(Pr+(Rd*0.25)) ,W/2     'Little circleS

dcSelectObjInBox -1, Pr+(Rd*0.25), 1,W/2+(Pr+(Rd*0.25))
dcSetSelectBase 0, 0
dcRotateSelObjs 360/Tn/2
dcSetSelCopyMode True
dcRotateSelObjs (360/Tn/2)*(Tn-1)*2
dcUnSelectAll


dcCreateText -20, -5, 5, "Teeth="
dcCreateText -5, -5, 5,   Tn
dcCreateText -20, -10, 5, "Pitch="
dcCreateText -7, -10, 5, P
dcCreateText -20, -15, 5, "Roller_D="
dcCreateText 1, -15, 5,    Rd



End Sub
Works pretty well.

I added connecting lines between the large and two smaller circles at the top, cropped the circles, shortened the circle arc lines, and copy/pasted around the midpoint 360/18 times.

Thank you quarkqq
There are formulae that calculate tangent lines to circles only if a person can understand them.

Tangent line between 2 circles ]
Pages: 1 2 3