home *** CD-ROM | disk | FTP | other *** search
/ Piper's Pit BBS/FTP: ibm 0010 - 0019 / ibm0010-0019 / ibm0010.tar / ibm0010 / CADKEY_C.ZIP / CADKEY14.ZIP / CDL / SH_OSLOT.CDL < prev    next >
Encoding:
Text File  |  1980-01-01  |  6.7 KB  |  267 lines

  1.  
  2. REM     Name:     sh_oslot.cdl
  3. REM
  4. REM     Date:     010689 simon izraelevitz
  5. REM
  6. REM     Task:     Constructs an open slot given the width and distance
  7. REM               between center.
  8. REM               The user has the option to create the slot centerline.
  9. REM 
  10. REM     Note:     A message is displayed for all error conditions.
  11. REM
  12. REM
  13. REM     -----------------------------------------------
  14.  
  15.    CLEAR
  16.  
  17. REM define icon scale factor
  18.    sc = 1.5 / @scale
  19.  
  20. REM compute icon oval origin
  21.    xinc = (@xmax - @xmin)/10
  22.    yinc = (@ymax - @ymin)/10
  23.    ox = @xmax - 3*xinc
  24.    oy = @ymax - 3*yinc
  25.  
  26. REM create icon geometry
  27.    MODE DRAW
  28.  
  29.    x = ox + (-0.64951902*sc)
  30.    y = oy + (-0.3750000*sc)
  31.    r = 0.2500000*sc
  32.    ARC x, y, @depth, r, 120.0000000, 300.0000000, 0, 5
  33.  
  34.    x1 = ox + (-0.5245190*sc)
  35.    y1 = oy + (-0.5915064*sc)
  36.    x2 = ox + ( 0.7745190*sc)
  37.    y2 = oy + ( 0.1584937*sc)
  38.    VLINE x1, y1, @depth, x2, y2, @depth, 0, 5
  39.  
  40.    x1 = ox + ( 0.5245190*sc)
  41.    y1 = oy + ( 0.5915064*sc)
  42.    x2 = ox + (-0.7745190*sc)
  43.    y2 = oy + (-0.1584937*sc)
  44.    VLINE x1, y1, @depth, x2, y2, @depth, 0, 5
  45.  
  46.    x1 = ox + (-0.8245190*sc)
  47.    y1 = oy + (-0.0718912*sc)
  48.    x2 = ox + (-0.4745190*sc)
  49.    y2 = oy + (-0.6781090*sc)
  50.    VLINE x1, y1, @depth, x2, y2, @depth, 0, 5, 0, 3
  51.  
  52.    x1 = ox + (-0.3464102*sc)
  53.    y1 = oy + (-0.2000001*sc)
  54.    x2 = ox + (-0.9526279*sc)
  55.    y2 = oy + (-0.5500001*sc)
  56.    VLINE x1, y1, @depth, x2, y2, @depth, 0, 5, 0, 3
  57.  
  58.    x1 = ox + ( 0.8513851*sc)
  59.    y1 = oy + (-0.3750001*sc)
  60.    x2 = ox + (-1.2303174*sc)
  61.    y2 = oy + (-0.3750001*sc)
  62.    VLINE x1, y1, @depth, x2, y2, @depth, 0, 5, 0, 3
  63.  
  64. REM draw 'W' dimension
  65.    ARRAY GENDAT[22]
  66.    GENDAT[ 0] = ox + (-0.8394709*sc)
  67.    GENDAT[ 1] = oy + (-0.1959937*sc)
  68.    GENDAT[ 2] = ox + (-1.5536252*sc)
  69.    GENDAT[ 3] = oy + (-0.6083108*sc)
  70.    GENDAT[ 4] = ox + (-0.5894709*sc)
  71.    GENDAT[ 5] = oy + (-0.6290064*sc)
  72.    GENDAT[ 6] = ox + (-1.3036252*sc)
  73.    GENDAT[ 7] = oy + (-1.0413235*sc)
  74.    GENDAT[ 8] = ox + (-1.6711493*sc)
  75.    GENDAT[ 9] = oy + (-0.3297532*sc)
  76.    GENDAT[10] = ox + (-1.5211493*sc)
  77.    GENDAT[11] = oy + (-0.5895608*sc)
  78.    GENDAT[12] = ox + (-1.1211493*sc)
  79.    GENDAT[13] = oy + (-1.2823812*sc)
  80.    GENDAT[14] = ox + (-1.2711493*sc)
  81.    GENDAT[15] = oy + (-1.0225736*sc)
  82.    GENDAT[16] = ox + (-1.5211493*sc)
  83.    GENDAT[17] = oy + (-0.5895608*sc)
  84.    GENDAT[18] = 120.0000000
  85.    GENDAT[19] = ox + (-1.2711493*sc)
  86.    GENDAT[20] = oy + (-1.0225736*sc)
  87.    GENDAT[21] = -60.0000000
  88.  
  89.    x = ox + (-1.4391031*sc)
  90.    y = oy + (-0.8716208*sc)
  91.  
  92.    GENDIM    50, 4, 0, 2, GENDAT, 1, x, y, `W
  93. `, 0.0000000, 0.1500000*sc, 0.5000000, 0, 5
  94.  
  95. REM draw 'L' dimension
  96.    ARRAY GENDAT[22]
  97.    GENDAT[ 0] = ox + (-0.8620190*sc)
  98.    GENDAT[ 1] = oy + (-0.0069393*sc)
  99.    GENDAT[ 2] = ox + (-0.9370843*sc)
  100.    GENDAT[ 3] = oy + ( 0.1230775*sc)
  101.    GENDAT[ 4] = ox + ( 0.4370191*sc)
  102.    GENDAT[ 5] = oy + ( 0.7430609*sc)
  103.    GENDAT[ 6] = ox + ( 0.3619539*sc)
  104.    GENDAT[ 7] = oy + ( 0.8730776*sc)
  105.    GENDAT[ 8] = ox + (-0.4089177*sc)
  106.    GENDAT[ 9] = oy + ( 0.3847134*sc)
  107.    GENDAT[10] = ox + (-0.9183342*sc)
  108.    GENDAT[11] = oy + ( 0.0906015*sc)
  109.    GENDAT[12] = ox + (-0.1839177*sc)
  110.    GENDAT[13] = oy + ( 0.5146172*sc)
  111.    GENDAT[14] = ox + ( 0.3807039*sc)
  112.    GENDAT[15] = oy + ( 0.8406017*sc)
  113.    GENDAT[16] = ox + (-0.9183342*sc)
  114.    GENDAT[17] = oy + ( 0.0906015*sc)
  115.    GENDAT[18] = 30.0000000
  116.    GENDAT[19] = ox + ( 0.3807039*sc)
  117.    GENDAT[20] = oy + ( 0.8406017*sc)
  118.    GENDAT[21] = -150.0000000
  119.  
  120.    x = ox + (-0.3339176*sc)
  121.    y = oy + ( 0.3746653*sc)
  122.  
  123.    GENDIM    50, 4, 0, 2, GENDAT, 1, x, y, `L
  124. `, 0.0000000, 0.1500000*sc, 0.5000000, 0, 5
  125.  
  126. REM draw 'Rot' dimension
  127.    ARRAY GENDAT[24]
  128.    GENDAT[ 0] = ox + ( 0.9263850*sc)
  129.    GENDAT[ 1] = oy + (-0.3750000*sc)
  130.    GENDAT[ 2] = ox + ( 1.3542095*sc)
  131.    GENDAT[ 3] = oy + (-0.3750000*sc)
  132.    GENDAT[ 4] = ox + ( 1.0175799*sc)
  133.    GENDAT[ 5] = oy + ( 0.5875001*sc)
  134.    GENDAT[ 6] = ox + ( 1.0857607*sc)
  135.    GENDAT[ 7] = oy + ( 0.6268643*sc)
  136.    GENDAT[ 8] = ox + (-0.6495190*sc)
  137.    GENDAT[ 9] = oy + (-0.3750000*sc)
  138.    GENDAT[10] = 1.9662285*sc
  139.    GENDAT[11] = 0.0000000
  140.    GENDAT[12] = 9.4202213
  141.    GENDAT[13] = ox + (-0.6495190*sc)
  142.    GENDAT[14] = oy + (-0.3750000*sc)
  143.    GENDAT[15] = 1.9662285*sc
  144.    GENDAT[16] = 18.4363232
  145.    GENDAT[17] = 30.0000000
  146.    GENDAT[18] = ox + ( 1.3167095*sc)
  147.    GENDAT[19] = oy + (-0.3750000*sc)
  148.    GENDAT[20] = 92.1860275
  149.    GENDAT[21] = ox + ( 1.0532848*sc)
  150.    GENDAT[22] = oy + ( 0.6081143*sc)
  151.    GENDAT[23] = -62.1860237
  152.  
  153.    x = ox + ( 1.1467606*sc)
  154.    y = oy + ( 0.0218207*sc)
  155.  
  156.    GENDIM    53, 2, 2, 2, GENDAT, 1, x, y, `Rot
  157. `, 0.0000000, 0.1500000*sc, 0.5000000, 0, 5
  158.  
  159. REM draw label 'PT'
  160.    x1 = ox + ( 0.4239290*sc)
  161.    y1 = oy + (-0.7773314*sc)
  162.    x2 = ox + ( 0.1239290*sc)
  163.    y2 = oy + (-0.7773314*sc)
  164.    x3 = ox + (-0.6495190*sc)
  165.    y3 = oy + (-0.3750000*sc)
  166.    x = ox + ( 0.4989290*sc)
  167.    y = oy + (-0.8523313*sc)
  168.  
  169.    LABEL   x1, y1, x2, y2, x3, y3, 1, x, y, `PT
  170. `, 0.0000000, 0.1500000*sc, 0.5000000, 0, 5
  171.  
  172. REM get data to create permanent geometry
  173. REM default values
  174.    length = 3.00
  175.    width = 2.00
  176.    rot = 0
  177.  
  178. REM get length
  179. :get_length
  180.    GETFLT "Enter (L) distance from arc center to edge (%f):",length,length
  181.    ON (@key + 3) GOTO exit,exit,
  182.    length = abs(length)
  183.    IF ((length <= .00005) || (length >= 10000))
  184.      GOTO message1
  185.  
  186. REM get width
  187. :get_width
  188.    GETFLT "Enter (W) slot width (%f):",width,width
  189.    ON (@key + 3) GOTO exit,get_length,
  190.    rad = abs(width/2)
  191.    IF ((rad <= .00005) || (rad >= 10000))
  192.      GOTO message1
  193.    GOTO get_rot
  194.  
  195. :message1
  196.    PROMPT "Entered value is out of range ..."
  197.    WAIT 3
  198.    GOTO get_length
  199.  
  200. :get_rot
  201.    GETFLT "Enter (Rot) rotation angle (%f):",rot,rot
  202.    ON (@key + 3) GOTO exit,get_width,
  203.  
  204. REM construct slot
  205. :geom_constr
  206.    MODE NORMAL
  207.    posdef = 1
  208.    GETPOS "Indicate (PT) arc center position",posdef
  209.    ON (@key + 3) GOTO exit,get_rot,geom_constr,
  210.    xc     = @XVIEW
  211.    yc     = @YVIEW
  212.    zc     = @DEPTH
  213.  
  214.    sinrot = sin(rot)
  215.    cosrot = cos(rot)
  216.  
  217. REM construct lines
  218. :lines
  219.    ax = 0
  220.    ay = rad
  221.    bx = length
  222.    by = rad
  223.    lntype = 1
  224.    DOSUB sh_drwln
  225.  
  226.    ax = 0
  227.    ay = -rad
  228.    bx = length
  229.    by = -rad
  230.    lntype = 1
  231.    DOSUB sh_drwln
  232.  
  233. REM arc
  234.    x = xc
  235.    y = yc
  236.    ARC x,y,zc,rad,(90 + rot),(-90 + rot)
  237.  
  238. :do_ctrlines
  239.    GETMENU "Do you want the slot center lines (YES) ?",\
  240.            "YES",\
  241.            "NO"
  242.    ON (@key + 3) GOTO exit,get_length,yes,do_ctrlines,yes,no,
  243.  
  244. :yes
  245.    ax = 0
  246.    ay = -(rad + .1)
  247.    bx = 0
  248.    by = rad + .1
  249.    lntype = 3
  250.    DOSUB sh_drwln
  251.  
  252.    ax = -(rad + .1)
  253.    ay = 0
  254.    bx = rad + .1
  255.    by = 0
  256.    lntype = 3
  257.    DOSUB sh_drwln
  258.  
  259. REM back to the begining
  260. :no
  261.    GOTO get_length
  262.  
  263. :exit
  264.    MODE NORMAL
  265.    CHAIN shapes
  266.    exit
  267.