home *** CD-ROM | disk | FTP | other *** search
/ Share Gallery 1 / share_gal_1.zip / share_gal_1 / GR / GR505.ZIP / LSP.EXE / LOGLIN.LSP < prev    next >
Text File  |  1989-09-06  |  2KB  |  50 lines

  1. ;-----------------------------------------------------------------------------
  2. ;This routine will convert a continuous line to an ISA standard
  3. ;data logic line for process flow drawings. Simply load and invoke
  4. ;"logic" and select the line to convert. Then select the line.
  5. ;The line will be broken up and circles added to it to
  6. ;make an ISA standard data logic linetype. This routine is cheerfully
  7. ;written and given away! If any improvements can be made feel free to 
  8. ;do so!     Jeff L. Nims
  9. ;        Compuserve ID: 72047,632
  10. ;-----------------------------------------------------------------------------
  11. (defun C:LOGIC (/ E ENAME ETBL XYstart XYend XYS XYE A XYEE D Dfixed)
  12.    (setvar "cmdecho" 0)                ;Initialization
  13.    (graphscr)                    ;Initialization
  14.    (setq E (entsel "\nSelect the line you wish to convert: "))
  15.    (setq ENAME (car E))
  16.    (setq ETBL (entget ENAME))            ;Produce entity table
  17.    (setq XYstart (car (cdddr ETBL)))        ;Line XY start
  18.    (setq XYend (car (cddddr ETBL)))        ;Line XY end
  19.    (setq XYS (cdr XYstart))            ;Extract xy beginning
  20.    (setq XYE (cdr XYend))            ;Extract xy ending
  21.    (setq A (angle XYS XYE))            ;Obtain line angle
  22.    (setq XYEE (polar XYE A -0.25))        ;Trim .25 from end of line
  23.    (setq D (distance XYS XYEE))            ;Find line length
  24.    (setq D2 (/ D 0.5))                ;Calculate how many conversions
  25.    (setq Dfix (fix D2))             ;Filter out the fraction
  26.    (setq Dfixed (- Dfix 1))
  27.    (setq PT (polar XYS A 0.5))            ;Find break starting point
  28.    (setq PT2 (polar PT A 0.25))            ;Find break ending point
  29.       (if (< Dfixed 1)                ;Test to see if line can be
  30.                              ; converted
  31.          (prompt "\nLINE TOO SHORT TO BE CONVERTED! ")
  32.      (convert)
  33.       )
  34.    (terpri)
  35.    (princ)
  36. )
  37.  
  38. (defun convert ()
  39.    (prompt "\nConverting... ")
  40.    (command "break" E "f" PT PT2)
  41.    (command "circle" (polar PT A 0.125) "d" 0.0625)
  42.       (Repeat Dfixed
  43.      (setq PT (polar PT A 0.5)) 
  44.      (command "break" PT (polar PT A 0.25))
  45.      (command "circle" (polar PT A 0.125) "d" 0.0625)
  46.       )
  47.    (terpri)
  48.    (princ)
  49. )
  50.