home *** CD-ROM | disk | FTP | other *** search
- REM Name: Sh_sslot.cdl
- REM
- REM Date: 010589 simon izraelevitz
- REM
- REM Task: Constructs a slot given the length, width and radius.
- REM The user has the option to create the slot axes.
- REM
- REM Note: A message is displayed for all error conditions.
- REM
- REM
- REM -----------------------------------------------
-
- CLEAR
-
- REM define icon scale factor
- sc = .75 / @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.4330127*sc)
- y = oy + (-0.2500000*sc)
- r = 1.0000000*sc
- ARC x, y, @depth, r, 180.0000000, 240.0000000, 0, 5
-
- x = ox + ( 0.4330127*sc)
- y = oy + ( 0.2500000*sc)
- r = 1.0000000*sc
- ARC x, y, @depth, r, 360.0000000, 420.0000000, 0, 5
-
- x1 = ox + ( 0.9330127*sc)
- y1 = oy + ( 1.1160254*sc)
- x2 = ox + (-1.4330127*sc)
- y2 = oy + (-0.2500000*sc)
- VLINE x1, y1, @depth, x2, y2, @depth, 0, 5
-
- x1 = ox + ( 1.4330127*sc)
- y1 = oy + ( 0.2500000*sc)
- x2 = ox + (-0.9330127*sc)
- y2 = oy + (-1.1160254*sc)
- VLINE x1, y1, @depth, x2, y2, @depth, 0, 5
-
- x1 = ox + ( 1.3856406*sc)
- y1 = oy + ( 0.8000000*sc)
- x2 = ox + (-1.3856406*sc)
- y2 = oy + (-0.8000000*sc)
- VLINE x1, y1, @depth, x2, y2, @depth, 0, 5, 0, 3
-
- x1 = ox + (-0.1330127*sc)
- y1 = oy + (-0.7696153*sc)
- x2 = ox + (-0.7330127*sc)
- y2 = oy + ( 0.2696151*sc)
- VLINE x1, y1, @depth, x2, y2, @depth, 0, 5, 0, 3
-
- x1 = ox + ( 0.7330127*sc)
- y1 = oy + (-0.2696152*sc)
- x2 = ox + ( 0.1330127*sc)
- y2 = oy + ( 0.7696152*sc)
- VLINE x1, y1, @depth, x2, y2, @depth, 0, 5, 0, 3
-
- x1 = ox + ( 1.5308385*sc)
- y1 = oy + ( 0.0000000*sc)
- x2 = ox + (-1.5840101*sc)
- y2 = oy + ( 0.0000000*sc)
- VLINE x1, y1, @depth, x2, y2, @depth, 0, 5, 0, 3
-
- REM draw 'L' dimension
- ARRAY GENDAT[22]
- GENDAT[ 0] = ox + (-1.2240380*sc)
- GENDAT[ 1] = oy + (-0.8799038*sc)
- GENDAT[ 2] = ox + (-0.7087167*sc)
- GENDAT[ 3] = oy + (-1.7724665*sc)
- GENDAT[ 4] = ox + ( 1.3740381*sc)
- GENDAT[ 5] = oy + ( 0.6200962*sc)
- GENDAT[ 6] = ox + ( 1.8893594*sc)
- GENDAT[ 7] = oy + (-0.2724665*sc)
- GENDAT[ 8] = ox + ( 0.3033761*sc)
- GENDAT[ 9] = oy + (-1.1015319*sc)
- GENDAT[10] = ox + (-0.7462167*sc)
- GENDAT[11] = oy + (-1.7075146*sc)
- GENDAT[12] = ox + ( 0.7533761*sc)
- GENDAT[13] = oy + (-0.8417242*sc)
- GENDAT[14] = ox + ( 1.8518593*sc)
- GENDAT[15] = oy + (-0.2075146*sc)
- GENDAT[16] = ox + (-0.7462167*sc)
- GENDAT[17] = oy + (-1.7075146*sc)
- GENDAT[18] = 30.0000000
- GENDAT[19] = ox + ( 1.8518593*sc)
- GENDAT[20] = oy + (-0.2075146*sc)
- GENDAT[21] = -150.0000000
-
- x = ox + ( 0.4533761*sc)
- y = oy + (-1.1216280*sc)
-
- GENDIM 50, 4, 0, 2, GENDAT, 1, x, y, `L
- `, 0.0000000, 0.3000000*sc, 0.5000000, 0, 5
-
- REM draw 'W' dimension
- ARRAY GENDAT[22]
- GENDAT[ 0] = ox + (-1.5629165*sc)
- GENDAT[ 1] = oy + (-0.3250001*sc)
- GENDAT[ 2] = ox + (-2.4319620*sc)
- GENDAT[ 3] = oy + (-0.8267438*sc)
- GENDAT[ 4] = ox + (-1.0629165*sc)
- GENDAT[ 5] = oy + (-1.1910255*sc)
- GENDAT[ 6] = ox + (-1.9319621*sc)
- GENDAT[ 7] = oy + (-1.6927692*sc)
- GENDAT[ 8] = ox + (-2.6670101*sc)
- GENDAT[ 9] = oy + (-0.2696285*sc)
- GENDAT[10] = ox + (-2.3670101*sc)
- GENDAT[11] = oy + (-0.7892438*sc)
- GENDAT[12] = ox + (-1.5670103*sc)
- GENDAT[13] = oy + (-2.1748843*sc)
- GENDAT[14] = ox + (-1.8670102*sc)
- GENDAT[15] = oy + (-1.6552691*sc)
- GENDAT[16] = ox + (-2.3670101*sc)
- GENDAT[17] = oy + (-0.7892438*sc)
- GENDAT[18] = 120.0000000
- GENDAT[19] = ox + (-1.8670102*sc)
- GENDAT[20] = oy + (-1.6552691*sc)
- GENDAT[21] = -60.0000000
-
- x = ox + (-2.2105601*sc)
- y = oy + (-1.3401272*sc)
-
- GENDIM 50, 4, 0, 2, GENDAT, 1, x, y, `W
- `, 0.0000000, 0.3000000*sc, 0.5000000, 0, 5
-
- REM draw 'Rot' dimension
- ARRAY GENDAT[24]
- GENDAT[ 0] = ox + ( 1.6808385*sc)
- GENDAT[ 1] = oy + ( 0.0000000*sc)
- GENDAT[ 2] = ox + ( 2.4800098*sc)
- GENDAT[ 3] = oy + ( 0.0000000*sc)
- GENDAT[ 4] = ox + ( 1.5155444*sc)
- GENDAT[ 5] = oy + ( 0.8750000*sc)
- GENDAT[ 6] = ox + ( 2.1477513*sc)
- GENDAT[ 7] = oy + ( 1.2400049*sc)
- GENDAT[ 8] = ox + ( 0.0000000*sc)
- GENDAT[ 9] = oy + ( 0.0000000*sc)
- GENDAT[10] = 2.4050097*sc
- GENDAT[11] = 0.0000000
- GENDAT[12] = 7.0284281
- GENDAT[13] = ox + ( 0.0000000*sc)
- GENDAT[14] = oy + ( 0.0000000*sc)
- GENDAT[15] = 2.4050097*sc
- GENDAT[16] = 21.8292027
- GENDAT[17] = 30.0000000
- GENDAT[18] = ox + ( 2.4050097*sc)
- GENDAT[19] = oy + ( 0.0000000*sc)
- GENDAT[20] = 93.5758438
- GENDAT[21] = ox + ( 2.0827994*sc)
- GENDAT[22] = oy + ( 1.2025049*sc)
- GENDAT[23] = -63.5758438
-
- x = ox + ( 2.1054294*sc)
- y = oy + ( 0.4442813*sc)
-
- GENDIM 53, 2, 2, 2, GENDAT, 1, x, y, `Rot
- `, 0.0000000, 0.3000000*sc, 0.5000000, 0, 5
-
- REM draw radius 'R' dimension
- ARRAY GENDAT[15]
- GENDAT[ 0] = ox + ( 1.5837173*sc)
- GENDAT[ 1] = oy + ( 1.5411104*sc)
- GENDAT[ 2] = ox + ( 1.2837174*sc)
- GENDAT[ 3] = oy + ( 1.5411104*sc)
- GENDAT[ 4] = ox + ( 1.2837174*sc)
- GENDAT[ 5] = oy + ( 1.5411104*sc)
- GENDAT[ 6] = ox + ( 0.9832113*sc)
- GENDAT[ 7] = oy + ( 1.0850338*sc)
- GENDAT[ 8] = ox + ( 0.4330127*sc)
- GENDAT[ 9] = oy + ( 0.2500000*sc)
- GENDAT[10] = ox + ( 0.9832113*sc)
- GENDAT[11] = oy + ( 1.0850338*sc)
- GENDAT[12] = ox + ( 0.9832113*sc)
- GENDAT[13] = oy + ( 1.0850338*sc)
- GENDAT[14] = 236.6193542
-
- x = ox + ( 1.7337173*sc)
- y = oy + ( 1.3911104*sc)
-
- GENDIM 51, 3, 0, 1, GENDAT, 1, x, y, `R
- `, 0.0000000, 0.3000000*sc, 0.5000000, 0, 5
-
- REM get data to create permanent geometry
- MODE NORMAL
-
- REM default values
- lengthx = 5.00
- widthx = 3.00
- rad = 2.00
- rot = 0
-
- REM get slot length
- :get_length
- GETFLT "Enter (L) slot length (%f):",lengthx,lengthx
- ON (@key + 3) GOTO exit,exit,
- length = abs(lengthx/2)
- IF ((length <= .00005) || (length >= 10000))
- GOTO message1
-
- REM get slot width
- :get_width
- GETFLT "Enter (W) slot width (%f):",widthx,widthx
- ON (@key + 3) GOTO exit,get_length,
- width = abs(widthx/2)
- IF ((width <= .00005) || (width >= 10000))
- GOTO message1
-
- REM get slot radius
- :get_radius
- GETFLT "Enter (R) slot radius (%f):",rad,rad
- ON (@key + 3) GOTO exit,get_width,
- rad = abs(rad)
- IF ((rad <= .00005) || (rad >= 10000))
- GOTO message1
- GOTO check_data
-
- :message1
- PROMPT "Entered value is out of range ..."
- WAIT 3
- GOTO get_length
-
- REM check if the width is larger than the length or radius
- REM smaller than the width
- :check_data
- IF (rad < width)
- GOTO message2
- a = length - rad
- b = sqrt(rad*rad - width*width)
- c = a + b
- IF (c <= 0.00005)
- goto message2
- goto get_rot
-
- :message2
- PROMPT "Slot construction not possible per given data ..."
- WAIT 3
- GOTO get_length
-
- :get_rot
- GETFLT "Enter (Rot) rotation angle (%f):",rot,rot
- ON (@key + 3) GOTO exit,get_radius,
-
- REM construct slot
- :geom_constr
- MODE NORMAL
- posdef = 1
- GETPOS "Indicate slot center position",posdef
- ON (@key + 3) GOTO exit,get_rot,geom_constr,
- xc = @XVIEW
- yc = @YVIEW
- zc = @DEPTH
-
- sinrot = sin(rot)
- cosrot = cos(rot)
- ang2 = atan2(width,b)
-
- REM construct lines
- :lines
-
- ax = -c
- ay = width
- bx = c
- by = width
- lntype = 1
- DOSUB sh_drwln
-
- ax = -c
- ay = -width
- bx = c
- by = -width
- lntype = 1
- DOSUB sh_drwln
-
- REM right arc
- x = xc + a*cosrot
- y = yc + a*sinrot
- ARC x,y,zc,rad,(-ang2 + rot),(ang2 + rot)
-
- REM left arc
- x = xc - a * cosrot
- y = yc - a * sinrot
- ARC x,y,zc,rad,(180 - ang2 + rot),(-180 + ang2 + rot)
-
- :do_ctrlines
- GETMENU "Do you want the slot center lines (YES) ?",\
- "YES",\
- "NO"
- ON (@key + 3) GOTO exit,get_length,yes,do_ctrlines,yes,no,
-
- :yes
- ax = -c
- ay = -(width + .1)
- bx = -c
- by = width + .1
- lntype = 3
- DOSUB sh_drwln
-
- ax = c
- ay = -(width + .1)
- bx = c
- by = width + .1
- lntype = 3
- DOSUB sh_drwln
-
- ax = -(a + rad + .1)
- ay = 0
- bx = a + rad + .1
- by = 0
- lntype = 3
- DOSUB sh_drwln
-
- REM back to the begining
- :no
- GOTO get_length
-
- :exit
- MODE NORMAL
- CHAIN shapes
- exit
-