home *** CD-ROM | disk | FTP | other *** search
- REM Name: sh_kout.cdl
- REM
- REM Date: 010989 simon izraelevitz
- REM
- REM Task: Constructs a keyway shape given the hole 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 + ( 1.2258329*sc)
- y2 = oy + ( 0.4767949*sc)
- VLINE x1, y1, @depth, x2, y2, @depth, 0, 5
-
- x1 = ox + ( 0.7485281*sc)
- y1 = oy + ( 0.6631030*sc)
- x2 = ox + ( 1.0258330*sc)
- y2 = oy + ( 0.8232051*sc)
- VLINE x1, y1, @depth, x2, y2, @depth, 0, 5
-
- x1 = ox + ( 1.2258329*sc)
- y1 = oy + ( 0.4767949*sc)
- x2 = ox + ( 1.0258330*sc)
- y2 = oy + ( 0.8232051*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.2990381*sc)
- y2 = oy + ( 0.7500000*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 + ( 1.1557368*sc)
- GENDAT[ 1] = oy + ( 0.8982050*sc)
- GENDAT[ 2] = ox + ( 1.4742442*sc)
- GENDAT[ 3] = oy + ( 1.0820954*sc)
- GENDAT[ 4] = ox + ( 1.3557367*sc)
- GENDAT[ 5] = oy + ( 0.5517949*sc)
- GENDAT[ 6] = ox + ( 1.6742442*sc)
- GENDAT[ 7] = oy + ( 0.7356851*sc)
- GENDAT[ 8] = ox + ( 1.1092924*sc)
- GENDAT[ 9] = oy + ( 1.5642107*sc)
- GENDAT[10] = ox + ( 1.4092923*sc)
- GENDAT[11] = oy + ( 1.0445954*sc)
- GENDAT[12] = ox + ( 1.9092922*sc)
- GENDAT[13] = oy + ( 0.1785698*sc)
- GENDAT[14] = ox + ( 1.6092923*sc)
- GENDAT[15] = oy + ( 0.6981851*sc)
- GENDAT[16] = ox + ( 1.4092923*sc)
- GENDAT[17] = oy + ( 1.0445954*sc)
- GENDAT[18] = 120.0000000
- GENDAT[19] = ox + ( 1.6092923*sc)
- GENDAT[20] = oy + ( 0.6981851*sc)
- GENDAT[21] = -60.0000000
-
- x = ox + ( 1.4462570*sc)
- y = oy + ( 0.7006666*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.8025609*sc)
- GENDAT[ 1] = oy + (-0.6359127*sc)
- GENDAT[ 2] = ox + (-0.2454613*sc)
- GENDAT[ 3] = oy + (-1.8289710*sc)
- GENDAT[ 4] = ox + ( 1.2892975*sc)
- GENDAT[ 5] = oy + ( 0.3408822*sc)
- GENDAT[ 6] = ox + ( 1.8463970*sc)
- GENDAT[ 7] = oy + (-0.8521761*sc)
- GENDAT[ 8] = ox + ( 0.6558472*sc)
- GENDAT[ 9] = oy + (-1.3253306*sc)
- GENDAT[10] = ox + (-0.2771936*sc)
- GENDAT[11] = oy + (-1.7610147*sc)
- GENDAT[12] = ox + ( 1.1058471*sc)
- GENDAT[13] = oy + (-1.1152028*sc)
- GENDAT[14] = ox + ( 1.8146647*sc)
- GENDAT[15] = oy + (-0.7842198*sc)
- GENDAT[16] = ox + (-0.2771936*sc)
- GENDAT[17] = oy + (-1.7610147*sc)
- GENDAT[18] = 25.0302582
- GENDAT[19] = ox + ( 1.8146647*sc)
- GENDAT[20] = oy + (-0.7842198*sc)
- GENDAT[21] = -154.9697418
-
- x = ox + ( 0.8058472*sc)
- y = oy + (-1.3702667*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 = 2.5
- rot = 0
-
- REM get hole diameter
- :get_dia
- GETFLT "Enter (D) hole 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. hole 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 hole 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 hole 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
-