home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 15 / CD_ASCQ_15_070894.iso / vrac / mar94cad.zip / TIP967.LSP < prev   
Lisp/Scheme  |  1994-02-15  |  2KB  |  83 lines

  1. ; TIP967.LSP: SPLIT.LSP   Split a Plot into A-size Sheets
  2. ;                           (c)1994, Randy Steele
  3.  
  4. ; split.lsp  split up a c or d size dwg into plot files 
  5. ; sizes 8.5 x 11   c size 4 views   d size 8 views
  6.  
  7. (defun c:split ()
  8.  
  9.    (setq olderr *error*
  10.    *error* err)
  11.  
  12.    (setvar "CMDECHO" 1)
  13.    ( setq size ( car ( getvar "EXTMAX")))
  14.  
  15.    ( cond 
  16.       ((= size 22 ) (c_size) )
  17.       ((= size 34 ) (d_size) )
  18.       ( princ "DRAWING IS NOT C OR D SIZE")
  19.    )
  20. )
  21.  
  22. ( defun c_size ()    ; divide in to 4 views
  23.    (setq count 1)        ; for view names
  24.    (command ".view" "w" count "0.0,0.0" "11.0,8.5")
  25.    (setq count (+ 1 count))
  26.    (command ".view" "w" count "11.0,0.0" "22.0,8.5"   )
  27.    (setq count (+ 1 count))
  28.    (command ".view" "w" count "0.0,8.50" "11.0,19.0" )
  29.    (setq count (+ 1 count))
  30.    (command ".view" "w" count "11.0,8.50"  "22.0,19.0" )
  31.    (plots) ; create laser plots
  32. )
  33.  
  34. ( defun d_size ()  ;divide into 8 views
  35.    (setq count 1)        ; for view names
  36.    (command ".view" "w" count "0.0,0.0" "8.5,11.0")
  37.    (setq count (+ 1 count))
  38.    (command ".view" "w" count "8.5,0.0" "17.0,11.0"   )
  39.    (setq count (+ 1 count))
  40.    (command ".view" "w" count "17.0,0.0" "25.5,11.0" )
  41.    (setq count (+ 1 count))
  42.    (command ".view" "w" count "25.5,0.0"  "34.0,11.0" )
  43.    (setq count (+ 1 count))
  44.    (command ".view" "w" count "0.0,11.0" "8.5,22.0")
  45.    (setq count (+ 1 count))
  46.    (command ".view" "w" count "8.5,11.0" "17.0,22.0"  )
  47.    (setq count (+ 1 count))
  48.    (command ".view" "w" count "17.0,11.0" "25.5,22.0" )
  49.    (setq count (+ 1 count))
  50.    (command ".view" "w" count "25.5,11.0"  "34.0,22.0" )
  51.    (plots) ; create laser plots
  52. )
  53.  
  54. (defun plots ()
  55.    (setq num 1)
  56.    (setq cr (open "runplot.scr" "w" ))
  57.    (repeat count 
  58.       (setq conv (itoa num) )
  59.       (write-line ".plot" cr)
  60.       (write-line "v" cr)
  61.       (write-line conv cr)
  62.       (write-line "n" cr)
  63.       (write-line conv cr)
  64.       ;;;(write-line "" cr)
  65.       (setq num (+ 1 num))
  66.    ) ; repeat end
  67.  
  68.    (close cr)
  69.    (command ".script" "runplot" )
  70. )
  71.  
  72. ; error function
  73. (defun err (s)
  74.  
  75.    (if (/= s "SPLIT WAS CANCELLED")
  76.       (princ (strcat "\nError: SPLIT CANCELED BECAUSE OF: " s ))
  77.    )
  78.    (princ)
  79. )
  80.  
  81. (c:split) ; end split.lsp
  82.  
  83.