Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations IDS on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Drawing Alxe splines

Status
Not open for further replies.

Jeepwidow

Mechanical
Oct 23, 2003
5
Very simple question. How do I draw axle splines? Lets say its 1.5" diam, and 35 spline. How do I draw this?
 
Replies continue below

Recommended for you

Not as simple as you might think, you must first draw your circle of 1.5Ø, then define a tooth with the proper pitch diameter, straight sided, angled sides, pressure angle and so forth. you can get this information from a machinist handbook or maybe a bearing supply house. Once you have your tooth drawn you can do a polar array around the center of your circle.
 
;Copy and paste all this and save as 2dspline at your
;support phat , the load it and type 2dspline at the
;command line
; Copyright 2001 by EMT Software Inc. - by Scott Hull
05/30/01
;
; updated: 07/20/01
;
; This program will draw 2D profiles of SAE shaft splines.
;
; Data from Engineering Handbook
;
(defun C:2DSPLINE (/ #DCL-FILE #DCL-ID #DCL-LIST #FILE #HELP #SIZE
#SIZELIST @ARC @BLOCK @INSERT @LINE @POLYARC @POLYLINE @SPLINE-PTS
@SPLINE-DRAW *error*)

; start or R14 compatibility library
(if (= (substr (getvar "acadver") 1 2) "14")
(progn
(defun vl-file-delete (%A) nil)

(defun vl-filename-mktemp (%A / #DIR)
(cond
((setq #DIR (getenv "tmp")) nil)
((setq #DIR (getenv "temp")) nil)
(T (setq #DIR "")))
(strcat #DIR "\\" %A))

(defun vl-position (%A %B)
(if (member %A %B) (- (length %B) (length (member %A %B)))))
))
; end of R14 compatibility library

(defun *error* (%A)
(if (= (type #FILE) 'FILE) (close #FILE))
(cond
((= %A "Function cancelled") nil)
(t (princ (strcat "\nerror: " %A "\007\n"))))
(princ))

(if (not (and (equal (getvar "ucsorg") (list 0.0 0.0 0.0))
(equal (getvar "ucsxdir") (list 1.0 0.0 0.0))
(equal (getvar "ucsydir") (list 0.0 1.0 0.0))))
(progn (alert "You must be in the World UCS to use this program")
(quit)))

(setq #DCL-LIST (list
"spline2d : dialog {"
" label = \"2D Spline\";"
" : row {"
" : text {"
" label = \"SAE inch shaft splines\";"
" }"
" : popup_list {"
" height = 3; "
" label = \"&Size\";"
" key = \"size\";"
" width = 16;"
" }"
" }"
" spacer;"
" ok_cancel_help_cadalog_errtile;"
"}"
""
"cadalog_button : retirement_button {"
" key = \"cadalog\";"
" label = \"&CADalog.com...\";"
"}"
""
"ok_cancel_help_cadalog : column {"
" : row {"
" fixed_width = true;"
" alignment = centered;"
" ok_button;"
" : spacer {"
" width = 2;"
" }"
" cancel_button;"
" : spacer {"
" width = 2;"
" }"
" help_button;"
" : spacer {"
" width = 2;"
" }"
" cadalog_button;"
" }"
"}"
""
"ok_cancel_help_cadalog_errtile : column {"
" ok_cancel_help_cadalog;"
" errtile;"
"}"))

(setq #HELP (strcat
"2D Spline Profiles\n\n"
"This program draws 2D profiles of SAE inch shaft splines. \n"
"You can specify the size and insertion point."))

;SAE spline sizes
;
; "SIZE" "NOM_SIZE" "MIN_DIA" "WIDTH" "FLUTES"
(setq #SIZELIST (list
'("4-.750, FIXED" 0.75 0.6375 0.181 4)
'("4-.750, MVBL" 0.75 0.5625 0.181 4)
'("4-.875, FIXED" 0.875 0.74375 0.211 4)
'("4-.875, MVBL" 0.875 0.65625 0.211 4)
'("4-1.0, FIXED" 1.0 0.85 0.241 4)
'("4-1.0, MVBL" 1.0 0.75 0.241 4)
'("4-1.125, FIXED" 1.125 0.95625 0.271 4)
'("4-1.125, MVBL" 1.125 0.84375 0.271 4)
'("4-1.25, FIXED" 1.25 1.0625 0.301 4)
'("4-1.25, MVBL" 1.25 0.9375 0.301 4)
'("4-1.375, FIXED" 1.375 1.16875 0.331 4)
'("4-1.375, MVBL" 1.375 1.03125 0.331 4)
'("4-1.5, FIXED" 1.5 1.275 0.361 4)
'("4-1.5, MVBL" 1.5 1.125 0.361 4)
'("4-1.625, FIXED" 1.625 1.38125 0.391 4)
'("4-1.625, MVBL" 1.625 1.21875 0.391 4)
'("4-1.75, FIXED" 1.75 1.4875 0.422 4)
'("4-1.75, MVBL" 1.75 1.3125 0.422 4)
'("4-2.0, FIXED" 2.0 1.7 0.482 4)
'("4-2.0, MVBL" 2.0 1.5 0.482 4)
'("4-2.25, FIXED" 2.25 1.9125 0.542 4)
'("4-2.25, MVBL" 2.25 1.6875 0.542 4)
'("4-2.5, FIXED" 2.5 2.125 0.602 4)
'("4-2.5, MVBL" 2.5 1.875 0.602 4)
'("4-3.0, FIXED" 3.0 2.55 0.723 4)
'("4-3.0, MVBL" 3.0 2.25 0.723 4)
'("6-.750, FIXED" 0.75 0.675 0.188 6)
'("6-.750, MVBL" 0.75 0.6375 0.188 6)
'("6-.750, FREE" 0.75 0.6 0.188 6)
'("6-.875, FIXED" 0.875 0.7875 0.219 6)
'("6-.875, MVBL" 0.875 0.74375 0.219 6)
'("6-.875, FREE" 0.875 0.7 0.219 6)
'("6-1.0, FIXED" 1.0 0.9 0.25 6)
'("6-1.0, MVBL" 1.0 0.85 0.25 6)
'("6-1.0, FREE" 1.0 0.8 0.25 6)
'("6-1.125, FIXED" 1.125 1.0125 0.281 6)
'("6-1.125, MVBL" 1.125 0.95625 0.281 6)
'("6-1.125, FREE" 1.125 0.9 0.281 6)
'("6-1.25, FIXED" 1.25 1.125 0.313 6)
'("6-1.25, MVBL" 1.25 1.0625 0.313 6)
'("6-1.25, FREE" 1.25 1.0 0.313 6)
'("6-1.375, FIXED" 1.375 1.2375 0.344 6)
'("6-1.375, MVBL" 1.375 1.0625 0.344 6)
'("6-1.375, FREE" 1.375 1.0 0.344 6)
'("6-1.5, FIXED" 1.5 1.35 0.375 6)
'("6-1.5, MVBL" 1.5 1.275 0.375 6)
'("6-1.5, FREE" 1.5 1.2 0.375 6)
'("6-1.625, FIXED" 1.625 1.4625 0.406 6)
'("6-1.625, MVBL" 1.625 1.38125 0.406 6)
'("6-1.625, FREE" 1.625 1.3 0.406 6)
'("6-1.75, FIXED" 1.75 1.575 0.438 6)
'("6-1.75, MVBL" 1.75 1.4875 0.438 6)
'("6-1.75, FREE" 1.75 1.4 0.438 6)
'("6-2.0, FIXED" 2.0 1.8 0.5 6)
'("6-2.0, MVBL" 2.0 1.7 0.5 6)
'("6-2.0, FREE" 2.0 1.6 0.5 6)
'("6-2.25, FIXED" 2.25 2.025 0.563 6)
'("6-2.25, MVBL" 2.25 1.9125 0.563 6)
'("6-2.25, FREE" 2.25 1.8 0.563 6)
'("6-2.5, FIXED" 2.5 2.25 0.625 6)
'("6-2.5, MVBL" 2.5 2.125 0.625 6)
'("6-2.5, FREE" 2.5 1.8 0.625 6)
'("6-3.0, FIXED" 3.0 2.7 0.75 6)
'("6-3.0, MVBL" 3.0 2.55 0.75 6)
'("6-3.0, FREE" 3.0 2.4 0.75 6)
'("10-.750, FIXED" 0.75 0.6825 0.117 10)
'("10-.750, MVBL" 0.75 0.645 0.117 10)
'("10-.750, FREE" 0.75 0.6075 0.117 10)
'("10-.875, FIXED" 0.875 0.7963 0.137 10)
'("10-.875, MVBL" 0.875 0.7525 0.137 10)
'("10-.875, FREE" 0.875 0.7088 0.137 10)
'("10-1.0, FIXED" 1.0 0.91 0.156 10)
'("10-1.0, MVBL" 1.0 0.86 0.156 10)
'("10-1.0, FREE" 1.0 0.81 0.156 10)
'("10-1.125, FIXED" 1.125 1.0238 0.176 10)
'("10-1.125, MVBL" 1.125 0.9675 0.176 10)
'("10-1.125, FREE" 1.125 0.9113 0.176 10)
'("10-1.25, FIXED" 1.25 1.1375 0.195 10)
'("10-1.25, MVBL" 1.25 1.075 0.195 10)
'("10-1.25, FREE" 1.25 1.0125 0.195 10)
'("10-1.375, FIXED" 1.375 1.2513 0.215 10)
'("10-1.375, MVBL" 1.375 1.1825 0.215 10)
'("10-1.375, FREE" 1.375 1.1138 0.215 10)
'("10-1.5, FIXED" 1.5 1.365 0.234 10)
'("10-1.5, MVBL" 1.5 1.29 0.234 10)
'("10-1.5, FREE" 1.5 1.215 0.234 10)
'("10-1.625, FIXED" 1.625 1.4788 0.254 10)
'("10-1.625, MVBL" 1.625 1.3975 0.254 10)
'("10-1.625, FREE" 1.625 1.3163 0.254 10)
'("10-1.75, FIXED" 1.75 1.5925 0.273 10)
'("10-1.75, MVBL" 1.75 1.505 0.273 10)
'("10-1.75, FREE" 1.75 1.4175 0.273 10)
'("10-2.0, FIXED" 2.0 1.82 0.312 10)
'("10-2.0, MVBL" 2.0 1.72 0.312 10)
'("10-2.0, FREE" 2.0 1.62 0.312 10)
'("10-2.25, FIXED" 2.25 2.0475 0.351 10)
'("10-2.25, MVBL" 2.25 1.935 0.351 10)
'("10-2.25, FREE" 2.25 1.8225 0.351 10)
'("10-2.5, FIXED" 2.5 2.275 0.390 10)
'("10-2.5, MVBL" 2.5 2.15 0.390 10)
'("10-2.5, FREE" 2.5 2.025 0.390 10)
'("10-3.0, FIXED" 3.0 2.73 0.468 10)
'("10-3.0, MVBL" 3.0 2.58 0.468 10)
'("10-3.0, FREE" 3.0 2.43 0.468 10)
'("10-3.5, FIXED" 3.5 3.185 0.546 10)
'("10-3.5, MVBL" 3.5 3.01 0.546 10)
'("10-3.5, FREE" 3.5 2.835 0.546 10)
'("10-4.0, FIXED" 4.0 3.64 0.624 10)
'("10-4.0, MVBL" 4.0 3.44 0.624 10)
'("10-4.0, FREE" 4.0 3.24 0.624 10)
'("10-4.5, FIXED" 4.5 4.095 0.702 10)
'("10-4.5, MVBL" 4.5 3.87 0.702 10)
'("10-4.5, FREE" 4.5 3.645 0.702 10)
'("10-5.0, FIXED" 5.0 4.55 0.78 10)
'("10-5.0, MVBL" 5.0 4.3 0.78 10)
'("10-5.0, FREE" 5.0 4.05 0.78 10)
'("10-5.5, FIXED" 5.5 5.005 0.858 10)
'("10-5.5, MVBL" 5.5 4.73 0.858 10)
'("10-5.5, FREE" 5.5 4.455 0.858 10)
'("10-6.0, FIXED" 6.0 5.46 0.936 10)
'("10-6.0, MVBL" 6.0 5.16 0.936 10)
'("10-6.0, FREE" 6.0 4.86 0.936 10)
'("16-2.0, FIXED" 2.0 1.82 0.196 16)
'("16-2.0, MVBL" 2.0 1.72 0.196 16)
'("16-2.0, FREE" 2.0 1.62 0.196 16)
'("16-2.5, FIXED" 2.5 2.275 0.245 16)
'("16-2.5, MVBL" 2.5 2.15 0.245 16)
'("16-2.5, FREE" 2.5 2.025 0.245 16)
'("16-3.0, FIXED" 3.0 2.73 0.294 16)
'("16-3.0, MVBL" 3.0 2.58 0.294 16)
'("16-3.0, FREE" 3.0 2.43 0.294 16)
'("16-3.5, FIXED" 3.5 3.185 0.343 16)
'("16-3.5, MVBL" 3.5 3.01 0.343 16)
'("16-3.5, FREE" 3.5 2.835 0.343 16)
'("16-4.0, FIXED" 4.0 3.64 0.392 16)
'("16-4.0, MVBL" 4.0 3.44 0.392 16)
'("16-4.0, FREE" 4.0 3.24 0.392 16)
'("16-4.5, FIXED" 4.5 4.095 0.441 16)
'("16-4.5, MVBL" 4.5 3.87 0.441 16)
'("16-4.5, FREE" 4.5 3.645 0.441 16)
'("16-5.0, FIXED" 5.0 4.55 0.49 16)
'("16-5.0, MVBL" 5.0 4.3 0.49 16)
'("16-5.0, FREE" 5.0 4.05 0.49 16)
'("16-5.5, FIXED" 5.5 5.005 0.539 16)
'("16-5.5, MVBL" 5.5 4.73 0.539 16)
'("16-5.5, FREE" 5.5 4.455 0.539 16)
'("16-6.0, FIXED" 6.0 5.46 0.588 16)
'("16-6.0, MVBL" 6.0 5.16 0.588 16)
'("16-6.0, FREE" 6.0 4.86 0.588 16)))

(defun @ARC (%A %B %C %D / #CEN)
(setq #CEN (list (car %A) (cadr %A) (if (caddr %A) (caddr %A) 0)))
(entmake (append (list '(0 . "ARC") '(8 . "0") (cons 10 #CEN)
(cons 40 %B) (cons 50 %C) (cons 51 %D)))))

(defun @BLOCK ()
(entmake '((0 . "ENDBLK")))
(entmake (list '(0 . "BLOCK") '(2 . "*XXX") '(70 . 1) '(10 0 0 0))))

(defun @INSERT (%A)
(entmake (append
(list '(0 . "INSERT") (cons 2 (entmake '((0 . "ENDBLK")))))
%A (list (cons 41 1.0) (cons 42 1.0) (cons 43 1.0)))))

;%A - start point
;%B - endpoint
(defun @LINE (%A %B / #A #B)
(setq #A (if (caddr %A) (caddr %A) 0))
(setq #B (if (caddr %B) (caddr %B) 0))
(entmake (append '((0 . "LINE") (8 . "0"))
(list (list 10 (car %A) (cadr %A) #A)
(list 11 (car %B) (cadr %B) #B)))))

(defun @POLYARC (%PT1 %PT2 %PT3 / #1-2 #2-3 #ANG1-2 #ANG2-3 #END
#MID #PROJ1 #PROJ2 #PT0 #START)
(setq #ANG1-2 (angle %PT1 %PT2)
#ANG2-3 (angle %PT2 %PT3)
#1-2 (polar %PT1 #ANG1-2 (* 0.5 (distance %PT1 %PT2)))
#2-3 (polar %PT2 #ANG2-3 (* 0.5 (distance %PT2 %PT3)))
#PROJ1 (polar #1-2 (+ #ANG1-2 (* 0.5 pi)) 1.0)
#PROJ2 (polar #2-3 (+ #ANG2-3 (* 0.5 pi)) 1.0)
#PT0 (inters #1-2 #PROJ1 #2-3 #PROJ2 nil)
#START (angle #PT0 %PT1)
#MID (angle #PT0 %PT2)
#END (angle #PT0 %PT3))
(if (or (and (< #START #END) (or (> #MID #END) (< #MID #START)))
(and (< #MID #START) (> #MID #END)))
(setq #START #END #END (angle #PT0 %PT1)))
(@ARC #PT0 (distance #PT0 %PT1) #START #END))

(defun @POLYLINE (%PTLIST / #1 #2 #3 #FIRST #LAST
#PT1 #PT2 #PT3 #PTLIST)
(setq #PTLIST %PTLIST
#FIRST (car #PTLIST)
#LAST (last #PTLIST))
(while (> (length #PTLIST) 1)
(setq #1 (car #PTLIST)
#2 (cadr #PTLIST)
#3 (caddr #PTLIST)
#PTLIST (cdr #PTLIST)
#PT1 (list (car #1) (cadr #1))
#PT2 (list (car #2) (cadr #2)))
(if #3
(setq #PT3 (list (car #3) (cadr #3))))
(cond
((= (caddr #3) 1)
(@POLYARC #PT1 #PT2 #PT3)
(setq #PTLIST (cdr #PTLIST)))
(T (@LINE #PT1 #PT2)))))

(defun @SPLINE-DRAW (/ #PT0 #PTS)
(initget 1)
(setq #PT0 (getpoint &quot;\nInsert point: &quot;)
#PTS
(@SPLINE-PTS (nth 4 #SIZE) (nth 1 #SIZE) (nth 2 #SIZE) (nth 3 #SIZE)))
(@BLOCK)
(@POLYLINE #PTS)
(@INSERT (list (cons 10 #PT0))))

(defun @SPLINE-PTS (%FLUTES %SPLN-M %SPLN-N %SPLN-P / #ANG #ANG_X #ANG1
#ANG2 #ANG3 #ANG4 #LIST #P0 #P1 #P2 #P3 #P4 #PTS #RAD1 #RAD3 @SPLN_PTS)

(defun @SPLN_PTS (%FLUTES %M %N %P / #M/2 #N/2 #P/2 #P1 #P2 #P3 #P4)
(setq #M/2 (* 0.5 %M)
#N/2 (* 0.5 %N)
#P/2 (* 0.5 %P)
#P1 (list (sqrt (- (expt #M/2 2) (expt #P/2 2))) (- #P/2))
#P2 (list (car #P1) #P/2)
#P3 (list (sqrt (- (expt #N/2 2) (expt #P/2 2))) #P/2)
#P4 (polar '(0 0) (- (/ (* 2 pi) %FLUTES) (angle '(0 0) #P3)) #N/2))
(list %FLUTES #P1 #P2 #P3 #P4))

(setq #PTS (@SPLN_PTS %FLUTES %SPLN-M %SPLN-N %SPLN-P)
#P0 '(0 0)
#P1 (nth 1 #PTS)
#P2 (nth 2 #PTS)
#P3 (nth 3 #PTS)
#P4 (nth 4 #PTS)
#ANG (/ (* 2.0 pi) %FLUTES)
#ANG_X 0.0
#ANG1 (angle #P0 #P1)
#ANG2 (angle #P0 #P2)
#ANG3 (angle #P0 #P3)
#ANG4 (angle #P0 #P4)
#RAD1 (distance #P0 #P1)
#RAD3 (distance #P0 #P3))
(repeat %FLUTES
(setq #LIST (cons (polar #P0 (+ #ANG_X #ANG1) #RAD1) #LIST)
#LIST (cons (polar #P0 #ANG_X #RAD1) #LIST)
#LIST (cons (append
(polar #P0 (+ #ANG_X #ANG2) #RAD1) '(1)) #LIST)
#LIST (cons (polar #P0 (+ #ANG_X #ANG3) #RAD3) #LIST)
#LIST (cons
(polar #P0 (+ #ANG_X (* 0.5 (+ #ANG4 #ANG3))) #RAD3) #LIST)
#LIST (cons (append
(polar #P0 (+ #ANG_X #ANG4) #RAD3) '(1)) #LIST)
#ANG_X (+ #ANG_X #ANG)))
(setq #P0 (car #LIST)
#LIST (cons (list (car #P0) (cadr #P0)) (reverse #LIST)))
#LIST)

(setvar &quot;cmdecho&quot; 0)
(setq #DCL-FILE (vl-filename-mktemp &quot;2Dspline.dcl&quot;)
#FILE (open #DCL-FILE &quot;w&quot;))
(foreach #X #DCL-LIST (write-line #X #FILE))
(close #FILE)
(if (< (setq #DCL-ID (load_dialog #DCL-FILE)) 0)
(progn
(alert &quot;\nCan't load DCL file.&quot;)
(quit))
(vl-file-delete #DCL-FILE))
(if (not (new_dialog &quot;spline2d&quot; #DCL-ID)) (quit))
(start_list &quot;size&quot;)
(foreach #X #SIZELIST
(add_list (car #X)))
(end_list)
(setq #SIZE (assoc &quot;6-1.0, FIXED&quot; #SIZELIST))
(set_tile &quot;size&quot; (itoa (vl-position #SIZE #SIZELIST)))
(action_tile &quot;accept&quot; &quot;(done_dialog 1)&quot;)
(action_tile &quot;cadalog&quot; &quot;(done_dialog 2)&quot;)
(action_tile &quot;help&quot; &quot;(alert #HELP)&quot;)
(action_tile &quot;size&quot; &quot;(setq #SIZE (nth (atoi $value) #SIZELIST))&quot;)
(setq #GO (start_dialog))
(cond
((= #GO 1) (@SPLINE-DRAW))
((= #GO 2) (command &quot;_.browser&quot; &quot; (princ))


;;; Uncomment for the language needed.
;(princ &quot;\n\n2DSPLINE ‚ð“ü—Í‚µ‚ÄŠJŽn&quot;) ; For Japanese.
(princ &quot;\n\nType 2DSPLINE to start.&quot;) ; For English.

(princ)


Pardal
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor