home *** CD-ROM | disk | FTP | other *** search
- REM Name: sh_kin.cdl
- REM
- REM Date: 011089 simon izraelevitz
- REM
- REM Task: Constructs a keyway shape given the shaft diameter, the
- REM distance of the key way to the opposite edge, and the
- REM key way width.
- REM The user has the option to create the key way centerlines.
- REM
- REM Note: A message is displayed for all error conditions.
- REM
- REM -----------------------------------------------
-
- CLEAR
-
- REM define icon scale factor
- sc = 1 / @scale
-
- REM compute icon oval origin
- xinc = (@xmax - @xmin)/10
- yinc = (@ymax - @ymin)/10
- ox = @xmax - 3*xinc
- oy = @ymax - 3*yinc
-
- REM create icon geometry
- MODE DRAW
-
- x = ox + ( 0.0000000*sc)
- y = oy + ( 0.0000000*sc)
- r = 1.0000000*sc
- ARC x, y, @depth, r, 41.5369587, 378.4630324, 0, 5
-
- x1 = ox + ( 0.9485281*sc)
- y1 = oy + ( 0.3166929*sc)
- x2 = ox + ( 0.6712232*sc)
- y2 = oy + ( 0.1565909*sc)
- VLINE x1, y1, @depth, x2, y2, @depth, 0, 5
-
- x1 = ox + ( 0.7485281*sc)
- y1 = oy + ( 0.6631030*sc)
- x2 = ox + ( 0.4712233*sc)
- y2 = oy + ( 0.5030010*sc)
- VLINE x1, y1, @depth, x2, y2, @depth, 0, 5
-
- x1 = ox + ( 0.6712232*sc)
- y1 = oy + ( 0.1565909*sc)
- x2 = ox + ( 0.4712233*sc)
- y2 = oy + ( 0.5030010*sc)
- VLINE x1, y1, @depth, x2, y2, @depth, 0, 5
-
- x1 = ox + ( 0.6000000*sc)
- y1 = oy + (-1.0392305*sc)
- x2 = ox + (-0.6000000*sc)
- y2 = oy + ( 1.0392305*sc)
- VLINE x1, y1, @depth, x2, y2, @depth, 0, 5, 0, 3
-
- x1 = ox + (-1.0392305*sc)
- y1 = oy + (-0.6000000*sc)
- x2 = ox + ( 1.0392305*sc)
- y2 = oy + ( 0.6000000*sc)
- VLINE x1, y1, @depth, x2, y2, @depth, 0, 5, 0, 3
-
- x1 = ox + ( 1.5022154*sc)
- y1 = oy + ( 0.0000000*sc)
- x2 = ox + (-1.3720618*sc)
- y2 = oy + ( 0.0000000*sc)
- VLINE x1, y1, @depth, x2, y2, @depth, 0, 5, 0, 3
-
- REM draw 'W' dimension
- ARRAY GENDAT[22]
- GENDAT[ 0] = ox + ( 0.8784319*sc)
- GENDAT[ 1] = oy + ( 0.7381030*sc)
- GENDAT[ 2] = ox + ( 1.2729704*sc)
- GENDAT[ 3] = oy + ( 0.9658900*sc)
- GENDAT[ 4] = ox + ( 1.0784320*sc)
- GENDAT[ 5] = oy + ( 0.3916928*sc)
- GENDAT[ 6] = ox + ( 1.4729705*sc)
- GENDAT[ 7] = oy + ( 0.6194797*sc)
- GENDAT[ 8] = ox + ( 0.9080186*sc)
- GENDAT[ 9] = oy + ( 1.4480053*sc)
- GENDAT[10] = ox + ( 1.2080185*sc)
- GENDAT[11] = oy + ( 0.9283900*sc)
- GENDAT[12] = ox + ( 1.7080185*sc)
- GENDAT[13] = oy + ( 0.0623643*sc)
- GENDAT[14] = ox + ( 1.4080186*sc)
- GENDAT[15] = oy + ( 0.5819796*sc)
- GENDAT[16] = ox + ( 1.2080185*sc)
- GENDAT[17] = oy + ( 0.9283900*sc)
- GENDAT[18] = 120.0000000
- GENDAT[19] = ox + ( 1.4080186*sc)
- GENDAT[20] = oy + ( 0.5819796*sc)
- GENDAT[21] = -60.0000000
-
- x = ox + ( 1.2301614*sc)
- y = oy + ( 0.6101335*sc)
-
- GENDIM 50, 4, 0, 2, GENDAT, 1, x, y, `W
- `, 0.0000000, 0.3000000*sc, 0.5000000, 0, 5
-
- REM draw 'L' dimension
- ARRAY GENDAT[22]
- GENDAT[ 0] = ox + (-0.7910254*sc)
- GENDAT[ 1] = oy + (-0.6299038*sc)
- GENDAT[ 2] = ox + (-0.1049144*sc)
- GENDAT[ 3] = oy + (-1.8182828*sc)
- GENDAT[ 4] = ox + ( 0.6462232*sc)
- GENDAT[ 5] = oy + ( 0.1998921*sc)
- GENDAT[ 6] = ox + ( 1.3323343*sc)
- GENDAT[ 7] = oy + (-0.9884869*sc)
- GENDAT[ 8] = ox + ( 0.3482646*sc)
- GENDAT[ 9] = oy + (-1.4700372*sc)
- GENDAT[10] = ox + (-0.1424144*sc)
- GENDAT[11] = oy + (-1.7533309*sc)
- GENDAT[12] = ox + ( 0.7982646*sc)
- GENDAT[13] = oy + (-1.2102296*sc)
- GENDAT[14] = ox + ( 1.2948343*sc)
- GENDAT[15] = oy + (-0.9235350*sc)
- GENDAT[16] = ox + (-0.1424144*sc)
- GENDAT[17] = oy + (-1.7533309*sc)
- GENDAT[18] = 30.0000000
- GENDAT[19] = ox + ( 1.2948343*sc)
- GENDAT[20] = oy + (-0.9235350*sc)
- GENDAT[21] = -150.0000000
-
- x = ox + ( 0.4982646*sc)
- y = oy + (-1.4901334*sc)
-
- GENDIM 50, 4, 0, 2, GENDAT, 1, x, y, `L
- `, 0.0000000, 0.3000000*sc, 0.5000000, 0, 5
-
- REM draw 'D' dimension
- ARRAY GENDAT[22]
- GENDAT[ 0] = ox + ( 0.1663187*sc)
- GENDAT[ 1] = oy + ( 1.5077335*sc)
- GENDAT[ 2] = ox + ( 0.4663187*sc)
- GENDAT[ 3] = oy + ( 1.5077335*sc)
- GENDAT[ 4] = ox + ( 0.4663187*sc)
- GENDAT[ 5] = oy + ( 1.5077335*sc)
- GENDAT[ 6] = ox + ( 0.2954751*sc)
- GENDAT[ 7] = oy + ( 0.9553505*sc)
- GENDAT[ 8] = ox + ( 0.0000000*sc)
- GENDAT[ 9] = oy + ( 0.0000000*sc)
- GENDAT[10] = ox + ( 0.2954751*sc)
- GENDAT[11] = oy + ( 0.9553505*sc)
- GENDAT[12] = ox + ( 0.0000000*sc)
- GENDAT[13] = oy + ( 0.0000000*sc)
- GENDAT[14] = ox + (-0.2954751*sc)
- GENDAT[15] = oy + (-0.9553505*sc)
- GENDAT[16] = ox + ( 0.2954751*sc)
- GENDAT[17] = oy + ( 0.9553505*sc)
- GENDAT[18] = 252.8139648
- GENDAT[19] = ox + (-0.2954751*sc)
- GENDAT[20] = oy + (-0.9553505*sc)
- GENDAT[21] = 72.8139725
-
- x = ox + (-0.1336814*sc)
- y = oy + ( 1.3577335*sc)
-
- GENDIM 52, 4, 0, 2, GENDAT, 1, x, y, `D
- `, 0.0000000, 0.3000000*sc, 0.5000000, 0, 5
-
- REM draw 'Rot' dimension
- ARRAY GENDAT[24]
- GENDAT[ 0] = ox + (-1.5220618*sc)
- GENDAT[ 1] = oy + ( 0.0000000*sc)
- GENDAT[ 2] = ox + (-1.6873851*sc)
- GENDAT[ 3] = oy + ( 0.0000000*sc)
- GENDAT[ 4] = ox + (-1.1691343*sc)
- GENDAT[ 5] = oy + (-0.6750000*sc)
- GENDAT[ 6] = ox + (-1.4613183*sc)
- GENDAT[ 7] = oy + (-0.8436925*sc)
- GENDAT[ 8] = ox + ( 0.0000000*sc)
- GENDAT[ 9] = oy + ( 0.0000000*sc)
- GENDAT[10] = 1.6123850*sc
- GENDAT[11] = 158.6791229
- GENDAT[12] = 180.0000000
- GENDAT[13] = ox + ( 0.0000000*sc)
- GENDAT[14] = oy + ( 0.0000000*sc)
- GENDAT[15] = 1.6123850*sc
- GENDAT[16] = 210.0000000
- GENDAT[17] = 231.3208923
- GENDAT[18] = ox + (-1.6123850*sc)
- GENDAT[19] = oy + ( 0.0000000*sc)
- GENDAT[20] = 84.6620636
- GENDAT[21] = ox + (-1.3963664*sc)
- GENDAT[22] = oy + (-0.8061925*sc)
- GENDAT[23] = 305.3379517
-
- x = ox + (-1.6308904*sc)
- y = oy + ( 0.6394668*sc)
-
- GENDIM 53, 2, 2, 2, GENDAT, 1, x, y, `Rot
- `, 0.0000000, 0.3000000*sc, 0.5000000, 0, 5
-
- REM get data to create permanent geometry
- REM default values
- dia = 2.00
- widthx = .50
- dist = 1.5
- rot = 0
-
- REM get shaft diameter
- :get_dia
- GETFLT "Enter (D) shaft diameter (%f):",dia,dia
- ON (@key + 3) GOTO exit,exit,
- rad = abs(dia/2)
- IF ((rad <= .00005) || (rad >= 10000))
- GOTO message1
- GOTO get_width
-
- REM get width
- :get_width
- GETFLT "Enter (W) keyway width (%f):",widthx,widthx
- ON (@key + 3) GOTO exit,get_dia,
- width = abs(widthx/2)
- IF ((width <= .00005) || (width >= 10000))
- GOTO message1
-
- REM get dist
- :get_dist
- GETFLT "Enter (L) dist. from keyway to opp. shaft side (%f):",dist,dist
- ON (@key + 3) GOTO exit,get_width,
- dist = abs(dist)
- IF ((dist <= .00005) || (dist >= 10000))
- GOTO message1
- GOTO check_data
-
- :message1
- PROMPT "Entered value is out of range ..."
- WAIT 3
- GOTO get_dia
-
- :check_data
- c = sqrt(rad*rad - width*width)
- IF (dist >= (rad + c))
- GOTO message2
- GOTO get_rot
-
- :message2
- PROMPT "Construction not possible per given data ..."
- WAIT 3
- GOTO get_dia
-
- :get_rot
- GETFLT "Enter (Rot) rotation angle (%f):",rot,rot
- ON (@key + 3) GOTO exit,get_dist,
-
- REM construct keyway
- :geom_constr
- MODE NORMAL
- posdef = 1
- GETPOS "Indicate shaft center position",posdef
- ON (@key + 3) GOTO exit,get_rot,geom_constr,
- xc = @XVIEW
- yc = @YVIEW
- zc = @DEPTH
-
- c = sqrt(rad*rad - width*width)
- ang = atan2(width,c)
- sinrot = sin(rot)
- cosrot = cos(rot)
-
- REM construct arc
- ARC xc,yc,zc,rad,(rot + ang),(rot + 360 - ang)
-
- REM construct lines
- ax = c
- ay = -width
- bx = dist - rad
- by = -width
- lntype = 1
- DOSUB sh_drwln
-
- ax = c
- ay = width
- bx = dist - rad
- by = width
- lntype = 1
- DOSUB sh_drwln
-
- ax = dist - rad
- ay = width
- bx = dist - rad
- by = -width
- lntype = 1
- DOSUB sh_drwln
-
- :do_ctrlines
- GETMENU "Do you want the shaft center lines (YES) ?",\
- "YES",\
- "NO"
- ON (@key + 3) GOTO exit,get_dia,yes,do_ctrlines,yes,no,
-
- :yes
- ax = -(rad + .2)
- ay = 0
- bx = dist - rad + .2
- by = 0
- lntype = 3
- DOSUB sh_drwln
-
- ax = 0
- ay = -(rad + .2)
- bx = 0
- by = rad + .2
- lntype = 3
- DOSUB sh_drwln
-
- REM back to the begining
- :no
- GOTO get_dia
-
- :exit
- MODE NORMAL
- CHAIN shapes
- exit
-