home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 13 / 13.iso / p / p024 / 5.img / R11SUPP.EXE / PROJECT.LSP < prev    next >
Encoding:
Lisp/Scheme  |  1990-09-10  |  36.4 KB  |  1,198 lines

  1. ;;;  PROJECT.LSP / Release 10 or 11
  2. ;;;  Copyright (C) 1990 by Autodesk, Inc.
  3. ;;;   
  4. ;;;   Permission to use, copy, modify, and distribute this software and its
  5. ;;;   documentation for any purpose and without fee is hereby granted.  
  6. ;;;
  7. ;;;   THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY. 
  8. ;;;   ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF 
  9. ;;;   MERCHANTABILITY ARE HEREBY DISCLAIMED.
  10. ;;;   
  11. ;;;--------------------------------------------------------------------------
  12. ;;; DESCRIPTION
  13. ;;;  
  14. ;;;  This LISP routine allows for two different kinds of 
  15. ;;;  projection.  The commands are named:
  16. ;;;  
  17. ;;;     PROJECT
  18. ;;;     PROJECT1
  19. ;;;     PROJECT2
  20. ;;;  
  21. ;;;  An explanation of each command is shown below.
  22. ;;;  
  23. ;;;  (C:PROJECT)
  24. ;;;  Calls up a menu with a choice of projections.
  25. ;;;  
  26. ;;;  (C:PROJECT1)
  27. ;;;  Allows a "flat" projection of wireframe 3D models (lines,
  28. ;;;  arcs, circles, polylines, solids, points) onto the current
  29. ;;;  UCS.  This could be a useful aid for generating working
  30. ;;;  drawings from a 3D model.  Width information will be 
  31. ;;;  ignored.   Entities not capable of projection (3Dmesh,
  32. ;;;  text, blocks) will be highlighted and tallied.
  33. ;;;  
  34. ;;;  After projection, the user is allowed to make the 
  35. ;;;  projected entities into a block, or write it out as a
  36. ;;;  drawing file.  These blocks or drawing files (typically
  37. ;;;  Top, Front, Side, and Iso projections) could be re-
  38. ;;;  inserted onto a single UCS and annotated to create a
  39. ;;;  multi-view orthographic drawing.  The prompt sequence is:
  40. ;;;  
  41. ;;;    Layer name <current>: 
  42. ;;;    Select entities:  {do so}
  43. ;;;    Project more entities? <N>:  {Y or N}
  44. ;;;    Make projected entity(s) into a block? <N>:  {Y or N}
  45. ;;;    Write projected entities to disk as DWG file? <N>:  {Y or N}
  46. ;;;  
  47. ;;;  
  48. ;;;  (C:PROJECT2)
  49. ;;;  This routine projects an entity normal from the current 
  50. ;;;  UCS onto a designated oblique construction plane.  This 
  51. ;;;  may be useful in the construction of 3D wireframe and 
  52. ;;;  surface models.
  53. ;;;  
  54. ;;;  The user is prompted to enter the name of the UCS he 
  55. ;;;  wishes to project onto, or to select 3 points which lie on 
  56. ;;;  the construction plane.  The prompt sequence is:
  57. ;;;  
  58. ;;;    Layer name <current>: 
  59. ;;;    UCS namd or <RETURN> to select 3 points:
  60. ;;;    Select entities:  {do so}
  61. ;;;    Project more entities? <N>:  {Y or N}
  62. ;;;  
  63. ;;;  Lines, arcs, circles, solids, 3d faces, polylines, and
  64. ;;;  3d polylines will be projected.  The routine will not
  65. ;;;  project text, meshes, or blocks.  Width information will
  66. ;;;  be ignored.
  67. ;;;  
  68. ;;;  *** Word of Caution ***
  69. ;;;  If you try to project an entity onto a plane that is near
  70. ;;;  perpendicular to the current plane, then the entity will
  71. ;;;  be projected over a very great distance.  When you do a 
  72. ;;;  "ZOOM All" your drawing will appear to disappear.
  73. ;;;  
  74. ;;;  Autodesk Training Department
  75. ;;;  9/10/90
  76. ;;;  
  77. ;;;-----------------------------------------------------------
  78.  
  79. (vmon) 
  80.  
  81. ;;;  Won't fit in 40K heap unless VMON is enabled
  82. ;;;  Extended AutoLISP is highly recommended
  83.  
  84. ;;;----- Redefined error function ----------------------------
  85.  
  86. (defun proj-err (s)
  87.   (if (/= s "Function cancelled")
  88.       (princ (strcat "\nError: " s))
  89.   )
  90.   (setq *error* olderr)
  91.   (setvar "ucsicon" icon)
  92.   (setq copy-set nil
  93.         entset nil
  94.         entities nil
  95.         reject-set nil
  96.         err-set nil
  97.   )
  98.   (moder)
  99.   (princ)
  100. )
  101.  
  102. ;;;----- Superfulous translation counter ---------------------
  103.  
  104. (defun call ()
  105.   (princ (strcat (chr 008) (chr 008) (chr 008)))
  106.   (if (= numctr 1) (princ "  |"))
  107.   (if (= numctr 2) (princ "  /"))
  108.   (if (= numctr 3) (princ "  -"))
  109.   (if (= numctr 4) (princ "  \\"))
  110.   (setq numctr (+ 1 numctr))
  111.   (if (= numctr 5) (setq numctr 1))
  112. )
  113.  
  114. ;;;----- Mode Save -- Saves system variables in a list -------
  115.  
  116. (defun MODES (a)
  117.   (setq MLST '())
  118.   (repeat (length a)
  119.     (setq MLST (append MLST (list (list (car a) (getvar (car a))))))
  120.     (setq a (cdr a))
  121.   )
  122. )
  123.  
  124. ;;;----- Mode Reset -- Resets system variables ---------------
  125.  
  126. (defun MODER ()
  127.   (repeat (length MLST)
  128.     (setvar (caar MLST) (cadar MLST))
  129.     (setq MLST (cdr MLST))
  130.   )
  131. )
  132.  
  133. ;;;----- Converts radians to degrees -------------------------
  134.  
  135. (defun rtd (r)
  136.   (* 180 (/ r pi))
  137. )
  138.  
  139. ;;;----- Find current entity color ---------------------------
  140.  
  141. (defun getcolor (/ max ctr ccolor)
  142.   (setq ncolor nil)
  143.   (setq ccolor (getvar "cecolor"))
  144.   (setq ctr 1)
  145.   (setq max (strlen ccolor))
  146.   (while (< ctr max)
  147.     (if (= (substr ccolor ctr 1) " ")
  148.       (progn
  149.          (setq ncolor (substr ccolor 1 (- ctr 1)))
  150.          (setq ctr max)
  151.       )
  152.       (setq ctr (1+ ctr))
  153.     )
  154.   )
  155.   (if (not ncolor) (setq ncolor ccolor))
  156. )
  157.  
  158. ;;;----- Redraw rejected entities ----------------------------
  159.  
  160. (defun redraw-rej (ss tp / r-ctr)
  161.   (if (not proj2)
  162.     (progn
  163.       (setq r-ctr 0)
  164.       (while (> n-of-ents r-ctr)
  165.         (redraw (ssname ss r-ctr) tp)
  166.         (setq r-ctr (1+ r-ctr))
  167.       )
  168.     )
  169.   )
  170. )
  171.  
  172. ;;;----- "Please wait ..." function --------------------------
  173.  
  174. (defun prmpt ()
  175.   (prompt "\nProjecting . . .     please wait \n")
  176. )
  177.  
  178. ;;;----- UCS parallel check ----------------------------------
  179.  
  180. (defun ucsp (edir udir / arbval dx dy dz)
  181.   (setq dx     (- (car edir) (car udir))
  182.         dy     (- (cadr edir) (cadr udir))
  183.         dz     (- (caddr edir) (caddr udir))
  184.         arbval (/ 1.0 64.0)
  185.   )
  186.   (if (< (+ (* dx dx) (* dy dy) (* dz dz)) 1E-20)
  187.     (equal (and (< (abs (car edir)) arbval) (< (abs (cadr edir))))
  188.            (and (< (abs (car udir)) arbval) (< (abs (cadr udir))))
  189.     )
  190.     nil
  191.   )
  192. )
  193.  
  194. ;;;----- Select projection plane (for use with "PROJECT2") ---
  195.  
  196. (defun getplane (/ 1st 2nd 3rd)
  197.   (setq ucs-a "$$PLANE-A")
  198.   (command "ucs" "s" ucs-a)
  199.   (setq ucs-b
  200.     (getstring "\nUCS name or <RETURN> to select 3 points: ")
  201.   )
  202.   (while (and (not (tblsearch "UCS" ucs-b))
  203.               (/= ucs-b "")
  204.          )
  205.     (prompt "\nUCS does not exist ")
  206.     (setq ucs-b
  207.       (getstring "\nUCS name or <RETURN> to select 3 points: ")
  208.     )
  209.   )
  210.   (if (= ucs-b "")                    ;if you hit <RETURN>
  211.     (progn                            ;then select new UCS
  212.       (setq 1st (getpoint "\nOrigin point: "))
  213.       (setq 2nd (getpoint 1st "\nPoint on positive portion of X-axis: "))
  214.       (setq 3rd
  215.        (getpoint 1st "\nPoint on positive portion of the UCS X-Y plane: ")
  216.       )
  217.       (command "ucs" "3" 1st 2nd 3rd)
  218.       (setq ucs-b "$$PLANE-B")
  219.       (command "ucs" "s" ucs-b)
  220.     )
  221.     (command "ucs" "r" ucs-b)         ;else restore named UCS
  222.   )
  223.   (setq udir (trans '(0 0 1) 1 0 T))
  224.   (command "ucs" "p")
  225. )
  226.  
  227. ;;;----- Set projection layer --------------------------------
  228.  
  229. (defun slayer (/ clay laynam)
  230.  (setq clay (getvar "CLAYER"))
  231.  (setq laynam (getstring (strcat "\nLayer name <" clay ">: ")))
  232.  (if (not (= laynam ""))
  233.    (progn 
  234.      (while (not (tblsearch "LAYER" laynam))
  235.        (prompt (strcat "\nCannot find layer " laynam))
  236.        (setq laynam (getstring (strcat "\nLayer name <" clay ">: ")))
  237.        (if (= laynam "") (setq laynam clay))
  238.      )
  239.      (if (not (= laynam clay))
  240.        (command "layer" "s" laynam "")
  241.      )
  242.    )
  243.  )
  244. )
  245.  
  246. ;;;----- Make BLOCK from projected entities ------------------
  247.  
  248. (defun make-blk (ss / blknam blkflg ip)
  249.  (while (= (setq blknam (getstring "\nBlock name: ")) "")
  250.         (prompt "\nBlock name not specified - Try again!")
  251.  )
  252.  (setq blkflg "")  ;init flag to redefine exist block
  253.  (if (tblsearch "BLOCK" blknam)
  254.    (while
  255.      (and (tblsearch "BLOCK" blknam) (not (eq blkflg "Yes")))
  256.      (prompt (strcat "\nBlock " blknam " already exists. "))
  257.      (initget "Yes No")
  258.      (setq blkflg (getkword "\nRedefine it? <N>: "))
  259.      (if (/= blkflg "Yes")
  260.          (setq blknam (getstring "\Block name: "))
  261.      )
  262.    )
  263.  )
  264.  (setq ip (getpoint "\nInsertion point <UCS 0,0,0>: "))
  265.  (if (not ip) (setq ip '(0 0 0)))
  266.  (command "block" blknam ip ss "")
  267.  (command "regenall")
  268. )
  269.  
  270. ;;;----- Write projected entities to disk as DWG file --------
  271.  
  272. (defun write-blk (ss / flname dwgflg filept ip)
  273.   (while (= (setq flname (getstring "\nFile name: ")) "")
  274.          (prompt "\nFile name not specified - Try again!")
  275.   )
  276.   (setq dwgflg "")                    ;initialize flag to redefine exist file
  277.   (if                                 ;file of same name?
  278.     (setq filept (open (strcat flname ".DWG") "r"))
  279.     (progn
  280.       (setq filept (close filept))  ;close file
  281.       (while
  282.         (and (setq filept (open (strcat flname ".DWG") "r"))
  283.              (not (eq dwgflg "Yes"))
  284.         )
  285.         (prompt (strcat "\nFile " flname " already exists. "))
  286.         (initget "Yes No")
  287.         (setq dwgflg (getkword "\nOverwrite it? <N>: "))
  288.         (if (/= dwgflg "Yes")
  289.           (progn
  290.             (setq filept (close filept))
  291.             (setq flname (getstring "\File name: "))
  292.           )
  293.           (setq filept (close filept))
  294.         )
  295.       )
  296.     )
  297.   )
  298.   (setq ip (getpoint "\nInsertion point <UCS 0,0,0>: "))
  299.   (if (not ip) (setq ip '(0 0 0)))
  300.   (command "wblock" flname "" ip ss "")
  301.   (command "regenall")
  302. )
  303.  
  304. ;;;----- Insert extra vertex for bulges & arcs ---------------
  305. ;;;   This is to allow for exact tangency of silhouette edges
  306. ;;;   on curved enitities that have a thickness
  307. ;;;   sang1 & sang2 are silhouette angles
  308.  
  309. (defun insert-tv (/ p-pt)
  310.   (if (and (>  sang1 (+ st-ang (* p-ctr angmult)))
  311.            (<= sang1 (+ st-ang (* (+ p-ctr 1) angmult)))
  312.       )
  313.     (progn
  314.       (setq p-pt (pro-point (polar center sang1 radius)))
  315.       (setq pntlst (cons (list 'quote p-pt) pntlst))
  316.     )
  317.   )
  318.   (if (and (>  sang2 (+ st-ang (* p-ctr angmult)))
  319.            (<= sang2 (+ st-ang (* (+ p-ctr 1) angmult)))
  320.       )
  321.     (progn
  322.       (setq p-pt (pro-point (polar center sang2 radius)))
  323.       (setq pntlst (cons (list 'quote p-pt) pntlst))
  324.     )
  325.   )
  326. )
  327.  
  328. ;;;---- Increase # of vertices  ------------------------------
  329. ;;;   If silhouette lines need to be drawn then increase the
  330. ;;;   number of vertices in pline that approximates the curve
  331.  
  332. (defun bump-ver ()
  333.   (if (or S1 S2)
  334.     (cond 
  335.       ((< incl-ang (/ pi 8)) (setq pt-num 6))
  336.       ((< incl-ang (/ pi 4)) (setq pt-num 8))
  337.       ((< incl-ang (/ pi 2)) (setq pt-num 10))
  338.       ((< incl-ang (/ pi 1.5)) (setq pt-num 12))
  339.       ((< incl-ang pi) (setq pt-num 14))
  340.       (T (setq pt-num 18))
  341.     )
  342.   )
  343.   (if (and S1 S2) (setq pt-num 18))
  344. )
  345.  
  346. ;;;----- Find silhouette edge point of arc or circle ---------
  347.  
  348. (defun s-edge (cntr rad ang / pt c)
  349.   (setq c  (pro-point cntr))
  350.   (setq pt (pro-point (polar cntr (+ ad-ang ang) rad)))
  351.   (setq t-list (cons (list 'quote pt) t-list))
  352. )
  353.  
  354. ;;;---- Draw silhouette lines & edges of thick entities  -----
  355.  
  356. (defun tessilate (t-list / bp tesline ncopy)
  357.   (setq bp (eval (car t-list)))
  358.   (setq t-list (cdr t-list))
  359.   (command "line" bp (polar bp uvang uvd) "")
  360.   (setq entset (ssadd (entlast) entset))
  361.   (setq tesline (entlast))
  362.   (while (setq ncopy (eval (car t-list)))
  363.     (command "copy" tesline "" bp ncopy)
  364.     (setq entset (ssadd (entlast) entset))
  365.     (setq t-list (cdr t-list))
  366.   )
  367. )
  368.  
  369. ;;;----- Project LINE ----------------------------------------
  370.  
  371. (defun lines-pro (/ stpt endpt pntlst t-list)
  372.   (setq stpt  (cdr (assoc 10 elist))
  373.         endpt (cdr (assoc 11 elist))
  374.   )
  375.   (setq stpt  (pro-point stpt))
  376.   (setq endpt (pro-point endpt))
  377.   (setq pntlst (list (list 'quote stpt)
  378.                      (list 'quote endpt)
  379.                )
  380.   )
  381.   (eval (append '(command "line") pntlst '("")))
  382.   (setq entset (ssadd (entlast) entset))
  383.   (if thickness
  384.     (progn
  385.       (setq t-list pntlst)
  386.       (command "copy" (entlast) "" displace "")
  387.       (setq entset (ssadd (entlast) entset))
  388.       (tessilate t-list)
  389.     )
  390.   )
  391. )
  392.  
  393. ;;;-----Project CIRCLE -- projected as curve fit polyline ----
  394. ;;;  derived 0.3926990817 with (/ (* 2 pi) 16)
  395.  
  396. (defun circ-pro (/ planar radius center p-pt pntlst t-list)
  397.   (setq planar T
  398.         radius (cdr (assoc 40 elist))
  399.         center (cdr (assoc 10 elist))
  400.         p-ctr  0
  401.         pntlst '("c")                 ;initialize pt list for PLINE command
  402.         t-list '()
  403.   )
  404.  
  405.   (while (< p-ctr 16)
  406.     (setq p-pt 
  407.       (polar center (+ (* p-ctr 0.3926990817) ad-ang) radius)
  408.     )
  409.     (setq p-pt
  410.       (list (car p-pt) (cadr p-pt) (caddr center))
  411.     )
  412.     (setq p-pt (pro-point p-pt))
  413.     (setq pntlst (cons (list 'quote p-pt) pntlst))
  414.     (setq p-ctr (1+ p-ctr))
  415.   )
  416.   (eval (append '(command "pline") pntlst))
  417.   (command "pedit" (entlast) "f" "x")
  418.  
  419.   (setq entset (ssadd (entlast) entset))
  420.   (if thickness
  421.     (progn
  422.       (command "copy" (entlast) "" displace "")
  423.       (setq entset (ssadd (entlast) entset))
  424.       (s-edge center radius (/ pi 2))
  425.       (s-edge center radius (- 0 (/ pi 2)))
  426.       (tessilate t-list)
  427.     )
  428.   )
  429. )
  430.  
  431. ;;;----- Project ARC -- projected as curve fit polyline ------
  432. ;;;   derive 6.2831853072 with (* 2 pi)
  433.  
  434. (defun arc-pro (/ center radius st-ang end-ang planar
  435.                   pntlst t-list)
  436.   (setq center (cdr (assoc 10 elist))
  437.       radius (cdr (assoc 40 elist))
  438.       st-ang (cdr (assoc 50 elist))
  439.       end-ang (cdr (assoc 51 elist))
  440.       planar T
  441.   )
  442.  
  443.   (arc-draw center radius st-ang end-ang)
  444.  
  445.   (eval (append '(command "pline") pntlst '("")))
  446.   (command "pedit" (entlast) "f" "x")
  447.   (setq entset (ssadd (entlast) entset))
  448.   (if thickness
  449.     (progn
  450.       (command "copy" (entlast) "" displace "")
  451.       (setq entset (ssadd (entlast) entset))
  452.       (setq t-list (cons (car pntlst) t-list))
  453.       (setq t-list (cons (last pntlst) t-list))
  454.       (tessilate t-list)
  455.     )
  456.   )
  457. )
  458.  
  459. (defun arc-draw (center radius st-ang end-ang / pt-num
  460.                  incl-ang angmult p-ctr edgetest S1 S2 p-pt)
  461.   (setq incl-ang (- end-ang st-ang) p-ctr 0)
  462.   (if (< incl-ang 0) 
  463.     (setq incl-ang (+ 6.2831853072 incl-ang))
  464.   )
  465.   (if thickness
  466.     ;;then check if silhoulette lines need to be drawn
  467.     (progn 
  468.       (setq end-ang (+ st-ang incl-ang))
  469.       (while (>= end-ang (* 2 pi))
  470.         (setq end-ang (- end-ang  (* 2 pi)))
  471.       )
  472.       (setq edgetest (- end-ang sang1))
  473.       (if (< edgetest 0)
  474.         (setq edgetest (+ edgetest (* 2 pi)))
  475.       ) 
  476.       (if (> incl-ang edgetest)
  477.         (progn
  478.           (s-edge center radius (/ pi 2))
  479.           (setq S1 T)
  480.         )
  481.       )
  482.       (setq edgetest (- end-ang sang2))
  483.       (if (<= edgetest 0)
  484.         (setq edgetest (+ edgetest (* 2 pi)))
  485.       ) 
  486.       (if (> incl-ang edgetest)
  487.         (progn
  488.           (s-edge center radius (- 0 (/ pi 2)))
  489.           (setq S2 T)
  490.         )
  491.       )
  492.     )
  493.   )
  494.  
  495.   (setq pt-num (fix (+ 1 (/ incl-ang 0.3927))))
  496.   (if (< pt-num 4) (setq pt-num 4))   ;minimum # of vertex
  497.   (if thickness (bump-ver))
  498.   (setq angmult (/ incl-ang (- pt-num 1)))
  499.   (while (< p-ctr pt-num)
  500.     (setq p-pt 
  501.       (polar center (+ st-ang (* p-ctr angmult)) radius)
  502.     )
  503.     (setq p-pt 
  504.       (list (car p-pt) (cadr p-pt) (caddr center))
  505.     )
  506.     (setq p-pt (pro-point p-pt))
  507.     (setq pntlst (cons (list 'quote p-pt) pntlst))
  508.     (if thickness
  509.         (if (< p-ctr (1- pt-num)) (insert-tv))
  510.     )
  511.     (setq p-ctr (1+ p-ctr))
  512.   )
  513. )
  514.  
  515. ;;;----- Project PLINE -- projected as polyline(s) -----------
  516.  
  517. (defun pline-pro (/ planar bit-70 close-pt pntlst copy-set t-list)
  518.   (setq planar nil copy-set nil t-list nil)
  519.   (setq copy-set (ssadd))
  520.   (setq bit-70 (cdr (assoc 70 elist)));type of polyline
  521.   (if (= (boole 1 bit-70 1) 1)        ;if closed
  522.     (setq close-pt                    ;save first vertex
  523.       (cdr (assoc 10 (entget (entnext ename))))
  524.     )
  525.     (setq close-pt nil)
  526.   )
  527.   (if (= (boole 1 bit-70 5) 5)        ;closed spline
  528.     (progn
  529.       (setq closure '("c"))
  530.       (setq close-pt nil)
  531.     )
  532.     (setq closure '(""))
  533.   )
  534.  
  535.   (cond 
  536.     ((= (boole 1 bit-70 8) 8)         ;space poly
  537.       (setq planar 0) (pline-dr)
  538.     )
  539.     ((= (boole 1 bit-70 16) 16)       ;3D-mesh
  540.       (if proj2 (prompt "\nCan't project 3DMESH   "))
  541.       (setq reject-set (ssadd ename reject-set))
  542.     )
  543.     ((= (boole 1 bit-70 64) 64)       ;Polyface
  544.       (if proj2 (prompt "\nCan't project Polyface MESH   "))
  545.       (setq reject-set (ssadd ename reject-set))
  546.     )
  547.     (t (setq planar T)                ;then it must be 2D poly
  548.       (if parallel (copy-ent) (pline-dr))
  549.     )
  550.   )
  551. )
  552.  
  553. (defun pline-dr (/ subname sublist sub-etype bulge
  554.                    sp ep ctr firstbpt v-pt b-flag lastbpt)
  555.   (setq subname (entnext ename))
  556.   (setq sublist (entget subname))
  557.   (if (not close-pt) (setq b-flag T)) ;to flag first bulge
  558.   (while                              ;while there is a vertex
  559.     (eq (setq sub-etype (cdr (assoc 0 sublist))) "VERTEX")
  560.     (if                               ;if not spline frame pt
  561.       (/= (logand (cdr (assoc 70 sublist)) 16) 16) 
  562.       (progn                          ;then test for bulge, if so
  563.         (if (/= (setq bulge (cdr (assoc 42 sublist))) 0)
  564.           (progn                      ;then
  565.             (d-polyseg)               ;project poly-segment
  566.             (setq sp (cdr (assoc 10 sublist))) ;new stpt for pline
  567.             (if                       ;if end of bulge
  568.               (setq ep (cdr (assoc 10 (entget (entnext subname)))))
  569.               (progn
  570.                 (if b-flag (setq firstbpt sp))
  571.                 (setq b-flag nil)
  572.                 (setq lastbpt ep)
  573.                 (d-bulge)             ;then project polyarc
  574.               )
  575.               (if close-pt            ;else if polyline is closed
  576.                 (progn                ;then project closure of polyarc
  577.                   (setq ep close-pt)
  578.                   (d-bulge)
  579.                   (setq close-pt nil)
  580.                   (setq lastbpt nil)
  581.                 )
  582.               )
  583.             )
  584.           )
  585.           (progn                      ;store vertex in point list
  586.             (setq b-flag nil)
  587.             (setq lastbpt nil)
  588.             (setq v-pt (cdr (assoc 10 sublist)))
  589.             (setq v-pt (pro-point v-pt))
  590.             (setq pntlst (cons (list 'quote v-pt) pntlst))
  591.             (setq t-list (cons (list 'quote v-pt) t-list))
  592.           )
  593.         )
  594.       )
  595.     )
  596.     (setq subname (entnext subname))
  597.     (setq sublist (entget subname))
  598.   )                                   ;end of while loop
  599.   
  600.   (if pntlst (eval (append '(command "pline") pntlst closure)))
  601.   (setq copy-set (ssadd (entlast) copy-set))
  602.   (setq entset (ssadd (entlast) entset))
  603.  
  604.   (if close-pt                        ;close polyline
  605.     (progn
  606.       (setq lastpt (pro-point close-pt))
  607.       (command "pline" (cadr (car pntlst)) lastpt "")
  608.       (setq copy-set (ssadd (entlast) copy-set))
  609.       (setq entset (ssadd (entlast) entset))
  610.     )
  611.   )
  612.  
  613.   (if thickness
  614.     (progn
  615.       (if firstbpt
  616.         (progn
  617.           (setq bp (pro-point firstbpt))
  618.           (setq t-list (cons (list 'quote bp) t-list))
  619.         )
  620.       )
  621.       (if lastbpt
  622.         (progn
  623.           (setq lp (pro-point lastbpt))
  624.           (setq t-list (cons (list 'quote lp) t-list))
  625.         )
  626.       )
  627.       (setq ctr 0)
  628.       (setq count (sslength copy-set))
  629.       (while (< ctr count)
  630.          (setq e (ssname copy-set ctr))
  631.          (command "copy" e "" displace "")
  632.          (setq entset (ssadd (entlast) entset))
  633.          (setq ctr (1+ ctr))
  634.       )
  635.       (if (> (length t-list) 0)
  636.           (tessilate t-list)
  637.       )
  638.     )
  639.   )
  640.   (setq copy-set nil)
  641. )
  642.  
  643. (defun d-polyseg ()   ;project polyline segment
  644.   (setq v-pt (cdr (assoc 10 sublist)))
  645.   (setq v-pt (pro-point v-pt))
  646.   (setq pntlst (cons (list 'quote v-pt) pntlst))
  647.   (if (> (length pntlst) 1)
  648.     (progn
  649.       (eval (append '(command "pline") pntlst closure))
  650.       (setq copy-set (ssadd (entlast) copy-set))
  651.       (setq entset (ssadd (entlast) entset))
  652.       (setq t-list (cons (list 'quote v-pt) t-list))
  653.     )
  654.   )
  655.   (setq pntlst '())
  656. )
  657.  
  658. (defun d-bulge ()     ;project polyline bulge
  659.   (cvtbulge sp ep bulge)
  660.   (setq pntlst '(""))
  661.   (arc-draw center radius st-ang end-ang)
  662.   (eval (append '(command "pline") pntlst))
  663.   (command "pedit" (entlast) "f" "x")
  664.   (setq copy-set (ssadd (entlast) copy-set))
  665.   (setq entset (ssadd (entlast) entset))
  666.   (setq pntlst '())
  667. )
  668.  
  669. ;;;----- Project 3DFACE -- projected as lines or polyline ----
  670. ;;;    Will project visible edges only as lines.  If SPLFRAME 
  671. ;;;    is set to 1, will project all edges as single polyline
  672.  
  673. (defun face-pro (/ bit-70 e1 e2 e3 e4 pt1 pt2 pt3 pt4)
  674.   (setq bit-70 (cdr (assoc 70 elist)))
  675.   (if (= (boole 1 bit-70 1) 1) (setq e1 T))
  676.   (if (= (boole 1 bit-70 2) 2) (setq e2 T))
  677.   (if (= (boole 1 bit-70 4) 4) (setq e3 T))
  678.   (if (= (boole 1 bit-70 8) 8) (setq e4 T))
  679.   (setq pt1 (pro-point (cdr (assoc 10 elist))))
  680.   (setq pt2 (pro-point (cdr (assoc 11 elist))))
  681.   (setq pt3 (pro-point (cdr (assoc 12 elist))))
  682.   (setq pt4 (pro-point (cdr (assoc 13 elist))))
  683.   (if (equal (getvar "splframe") 1)
  684.     (progn
  685.       (command "pline" pt1 pt2 pt3 pt4 "c")
  686.       (setq entset (ssadd (entlast) entset))
  687.     )
  688.     (progn
  689.       (if (not e1) 
  690.         (progn (command "line" pt1 pt2 "")
  691.                (setq entset (ssadd (entlast) entset))
  692.         )
  693.       )
  694.       (if (not e2)
  695.         (progn (command "line" pt2 pt3 "")
  696.                (setq entset (ssadd (entlast) entset))
  697.         )
  698.       )
  699.       (if (not e3)
  700.         (progn (command "line" pt3 pt4 "")
  701.                (setq entset (ssadd (entlast) entset))
  702.         )
  703.       )
  704.       (if (not e4)
  705.         (progn (command "line" pt4 pt1 "")
  706.                (setq entset (ssadd (entlast) entset))
  707.         )
  708.       )
  709.     )
  710.   )
  711. )
  712.  
  713. ;;;----- Project SOLID -- projected as single polyline -------
  714.  
  715. (defun solid-pro (/ planar c-type pntlst p-pt)
  716.   (setq planar T)
  717.   (setq pntlst '())     ;initialize point list for solid
  718.   (setq c-type 10) (findcorner)
  719.   (setq c-type 11) (findcorner)
  720.   (setq c-type 13) (findcorner)
  721.   (setq c-type 12) (findcorner)
  722.   (eval (append '(command "pline") pntlst)) (command "c")
  723.   (setq entset (ssadd (entlast) entset))
  724.   (if thickness
  725.     (progn
  726.       (setq t-list pntlst)
  727.       (command "copy" (entlast) "" displace "")
  728.       (setq entset (ssadd (entlast) entset))
  729.       (tessilate t-list)
  730.     )
  731.   )
  732. )
  733.  
  734. (defun findcorner (/ corner)
  735.   (setq corner (cdr (assoc c-type elist)))
  736.   (setq p-pt (pro-point corner))
  737.   (setq pntlst (cons (list 'quote p-pt) pntlst))
  738. )
  739.  
  740. ;;;----- Project POINT ---------------------------------------
  741.  
  742. (defun point-pro (/ wpta pt t-list)
  743.   (setq wpta (cdr (assoc 10 elist)))
  744.   (setq pt (pro-point wpta))
  745.   (setq pt (list (car pt) (cadr pt) 0))
  746.   (command "point" pt)
  747.   (setq entset (ssadd (entlast) entset))
  748.   (if thickness
  749.      (progn
  750.         (setq t-list (list (list 'quote pt)))
  751.         (command "copy" (entlast) "" displace "")
  752.         (setq entset (ssadd (entlast) entset))
  753.         (tessilate t-list)
  754.      )
  755.   )
  756. )
  757.  
  758. ;;;----- Copy entity -----------------------------------------
  759.  
  760. (defun copy-ent (/ fr-pt to-pt)
  761.   (if (not ncolor) (getcolor))
  762.   (if proj2 (command "ucs" "r" ucs-b))
  763.   (setq fr-pt (trans (cdr (assoc 10 elist)) ename 1))
  764.   (setq to-pt (list (car fr-pt) (cadr fr-pt) 0))
  765.   (command "copy" ename "" fr-pt to-pt)
  766.   (command "chprop" (entlast) ""
  767.            "c"  ncolor
  768.            "la" (getvar "clayer")
  769.            "t" 0
  770.            ""
  771.   )
  772.   (setq entset (ssadd (entlast) entset))
  773.   (setq parallel nil)
  774. )
  775.  
  776. ;;;--------- Convert bulge information -----------------------
  777. ;;;  AutoLISP function to convert from Polyline "Bulge" representation
  778. ;;;  of an arc to AutoCAD's normal "center, radius, start/end angles"
  779. ;;;  form of arc.     This function applies the bulge between two adjacent
  780. ;;;  vertices.  It assumes that global symbols "sp", "ep", and "bulge"
  781. ;;;  contain the current vertex (start point), next vertex (end point),
  782. ;;;  and bulge, respectively.  It sets the appropriate values in global
  783. ;;;  symbols "center", "radius", "st-ang", and "end-ang".
  784.  
  785. ;;;  subroutine borrowed from
  786. ;;;  Duff Kurland - Autodesk, Inc.
  787. ;;;  July 7, 1986
  788.  
  789. (defun cvtbulge (sp ep bulge / x1 x2 y1 y2 cotbce)
  790.   (setq x1 (car  sp) x2 (car  ep))
  791.   (setq y1 (cadr sp) y2 (cadr ep))
  792.   (setq cotbce (/ (- (/ 1.0 bulge) bulge) 2.0))
  793.   ;;  Compute center point and radius
  794.   (setq center (list (/ (+ x1 x2 (- (* (- y2 y1) cotbce))) 2.0)
  795.                      (/ (+ y1 y2    (* (- x2 x1) cotbce) ) 2.0)
  796.                      (caddr sp)
  797.                )
  798.   )
  799.   (setq radius (distance center sp))
  800.   ;;  Compute start and end angles
  801.   (setq st-ang   (atan (- y1 (cadr center)) (- x1 (car center))))
  802.   (setq end-ang  (atan (- y2 (cadr center)) (- x2 (car center))))
  803.   (if (< st-ang 0.0)                  ;  Eliminate negative angles
  804.     (setq st-ang (+ st-ang (* 2.0 pi)))
  805.   )
  806.   (if (< end-ang 0.0)
  807.     (setq end-ang (+ end-ang (* 2.0 pi)))
  808.   )
  809.   (if (< bulge 0.0)                   ;  Swap angles if clockwise
  810.     (progn
  811.       (setq temp st-ang)
  812.       (setq st-ang end-ang)
  813.       (setq end-ang temp)
  814.     )
  815.   )
  816. )
  817.  
  818. ;;;----- Point projection Subroutine  ------------------------
  819.  
  820. (defun pro-point (pta-w / pta-a pta-b ptb-b ptb-w ptc-a
  821.                           ptc-b ptc-w ptx d1 new-ptb ang-a neg d2)
  822.   (if planar (setq pta-w (trans pta-w ename 0)))
  823.   (if proj2 ;if projecting to a designated plane (ucs-b)
  824.     (progn   ;then
  825.       (if (/= (getvar "ucsname") (strcase ucs-a))
  826.           (progn (command "ucs" "r" ucs-a) (call))
  827.       )
  828.       (setq pta-a (trans pta-w 0 1))
  829.       (setq ptc-a (list (car pta-a) (cadr pta-a) (+ (caddr pta-a) 3)))
  830.       (setq ptc-w (trans ptc-a 1 0))
  831.       (command "ucs" "r" ucs-b) (call)
  832.       (setq pta-b (trans pta-w 0 1))
  833.       (setq ptb-b (list (car pta-b) (cadr pta-b) 0.0))
  834.       (setq ptb-w (trans ptb-b 1 0))
  835.       (setq ptc-b (trans ptc-w 0 1))
  836.       (if          ;test for coincident points
  837.           (or (< (distance pta-b ptb-b) 0.0000000001)
  838.               (< (distance pta-b ptc-b) 0.0000000001)
  839.               (< (distance ptb-b ptc-b) 0.0000000001)
  840.               (equal (list (car ptb-b) (cadr ptb-b) 0) 
  841.                      (list (car ptc-b) (cadr ptc-b) 0)
  842.                      0.0000000001
  843.               )
  844.           )
  845.         (progn   ;then no further projection is needed
  846.           (setq ptx ptb-b)
  847.         )
  848.         (progn   ;else do more calculations
  849.           (command "ucs" "3" pta-b ptc-b ptb-b) (call)
  850.           (setq d1 (distance pta-b ptb-b))
  851.           (setq new-ptb (trans ptb-w 0 1))
  852.           (setq ang-a (angle (list 0.0 0.0 0.0) new-ptb))
  853.           (if (> ang-a (/ pi 2))
  854.             (progn (setq ang-a (- pi ang-a)) (setq neg T))
  855.           )
  856.           (setq d2 (* (/ 1 (cos ang-a)) d1))
  857.           (if neg (setq d2 (- 0 d2)))
  858.           (setq neg nil)
  859.           (setq ptx (trans (list d2 0.0 0.0) 1 0))
  860.           (command "ucs" "r" ucs-b) (call)
  861.           (setq ptx (trans ptx 0 1))
  862.           (list (car ptx) (cadr ptx) 0.0)
  863.         )
  864.       )
  865.     )
  866.     (progn   ;else project onto the current plane (ucs-a)
  867.       (setq pta-b (trans pta-w 0 1))
  868.       (setq ptb-b (list (car pta-b) (cadr pta-b) 0.0))
  869.     )
  870.   )
  871. )
  872.  
  873.  
  874. ;;;---- Find projected extrusion direction in current UCS ----
  875.  
  876. (defun u-vector (thk xtru / uv uv1 uv2 uv1-w uv2-w)
  877.   (setq uv (trans (list 0 0 thk) xtru 0 T))
  878.   (setq uv1 (pro-point '(0 0 0)))
  879.   (setq uv1-w (trans uv1 1 0))
  880.   (setq uv2 (pro-point uv))
  881.   (setq uv2-w (trans uv2 1 0))
  882.   (setq uvd (distance uv1 uv2))
  883.   (setq uvang (angle uv1 uv2))
  884.   (setq displace (polar '(0 0 0) uvang uvd))
  885.  
  886.  
  887.   (if (or (equal etype "CIRCLE")
  888.           (equal etype "ARC")
  889.           (equal etype "POLYLINE")
  890.       )
  891.     (progn
  892.       (if perpendicular
  893.         (progn
  894.           (setq uv2 (list (car uv2)
  895.                           (cadr uv2)
  896.                           (+ (caddr uv2) 0.000000000001)
  897.                     )
  898.           )
  899.           (setq uv2-w (trans uv2 1 0))
  900.         )
  901.       )
  902.       (e-vector)
  903.     )
  904.   )
  905. )
  906.  
  907. ;;;---- Find ECS angle that is parallel to projected u-dir ---
  908. ;;;    Also find silhouette angles (sang1 & sang2) to later
  909. ;;;    draw silhouette lines  extruded curves
  910.  
  911. (defun e-vector (/ ad-ang1 ad-ang-2)
  912.   (command "ucs" "e" ename)
  913.   (command "ucs" "s" "wtest")
  914.   (setq uv1-e (trans uv1-w 0 1))
  915.   (setq uv2-e (trans uv2-w 0 1))
  916.   (setq ad-ang1 (angle uv2-e uv1-e))
  917.   (setq ad-ang2 
  918.       (angle (trans '(0 0 0) ename 1)
  919.              (trans (polar '(0 0 0) 0 1) ename 1)
  920.       )
  921.   )
  922.   (setq ad-ang2 (- (* 2 pi) ad-ang2))
  923.   (setq ad-ang (+ ad-ang1 ad-ang2))
  924.   (if (> ad-ang (* 2 pi)) (setq ad-ang (- ad-ang (* 2 pi))))
  925.   (setq sang1 (+ ad-ang (/ pi 2)))
  926.   (if (>= sang1 (* 2 pi)) (setq sang1 (- sang1 (* 2 pi))))
  927.   (setq sang2 (+ ad-ang (* 3 (/ pi 2))))
  928.   (if (>= sang2 (* 2 pi)) (setq sang2 (- sang2 (* 2 pi))))
  929.   (command "ucs" "p")
  930. )
  931.  
  932. ;;;----- test parallel, thickness, then call *-pro function --
  933.  
  934. (defun proj-ent (/ t-list elist thickness
  935.                    extrusion tp planar uvang uvd ad-ang)
  936.   (setq elist (entget ename) etype (cdr (assoc 0 elist)))
  937.   (if (or (ucsp (trans '(0 0 1)  ename 0 T) udir)
  938.           (ucsp (trans '(0 0 -1) ename 0 T) udir)
  939.       )
  940.     (setq parallel T)
  941.     (setq parallel nil)
  942.   )
  943.  
  944.   (if proj2                           ;  ignore extrusions
  945.     (setq thickness nil ad-ang 0)
  946.     ;; else find thickness & extrusion direction
  947.     (if (setq thickness (cdr (assoc 39 elist)))
  948.       (progn
  949.         (setq extrusion (cdr (assoc 210 elist)))
  950.         (if (equal (distance extrusion udir)
  951.                    (sqrt 2) 0.000000000001
  952.             )
  953.           (setq perpendicular T)
  954.           (setq perpendicular nil)
  955.         )
  956.         (u-vector thickness extrusion)
  957.       )
  958.       (setq thickness nil ad-ang 0)
  959.     )
  960.   )
  961.  
  962.   (cond 
  963.     ((eq etype "LINE")       (lines-pro))
  964.     ((eq etype "3DLINE")     (lines-pro))
  965.     ((eq etype "3DFACE")     (face-pro))
  966.     ((eq etype "POINT")      (point-pro))
  967.     ((eq etype "POLYLINE")   (pline-pro))
  968.     ((eq etype "CIRCLE")
  969.       (if parallel (copy-ent) (circ-pro)))
  970.     ((eq etype "ARC")
  971.       (if parallel (copy-ent) (arc-pro)))
  972.     ((eq etype "TRACE")
  973.       (if parallel (copy-ent) (solid-pro)))
  974.     ((eq etype "SOLID")
  975.       (if parallel (copy-ent) (solid-pro)))
  976.     (T 
  977.       (if proj2 
  978.         (prompt (strcat "\nCan't project " etype "   "))
  979.         (setq reject-set (ssadd ename reject-set))
  980.       )
  981.     )
  982.   )
  983.   (princ (strcat (chr 008) (chr 008) (chr 008)))
  984. )
  985.  
  986. ;;;---- Select entities, find name, call proj-ent function ---
  987.  
  988. (defun get-ent (/ ename ptx ctr entities)
  989.   (setq entities nil)
  990.   (if proj2                           ;if project to plane
  991.     (progn                            ;then get a single entity
  992.       (setq ename (car (entsel "\nSelect entity to project: \n")))
  993.       (if ename                       ;if found
  994.         (progn                        ;then turn off icon and project
  995.           (setvar "ucsicon" 0)
  996.           (proj-ent)
  997.         )
  998.         (prompt "\nEntity not found ")
  999.       )
  1000.       (command "ucs" "r" ucs-a)       ;reset UCS
  1001.       (if ename (setvar "ucsicon" icon)) ;reset ucsicon
  1002.     )
  1003.     (progn                            ;else get a selection set
  1004.       (setq ctr 0)
  1005.       (if (setq entities (ssget))
  1006.         (progn
  1007.           (setq setlength (sslength entities))
  1008.           (prmpt)
  1009.           (while (setq ename (ssname entities ctr))
  1010.             (proj-ent)
  1011.             (setq ctr (+ ctr 1))
  1012.           )
  1013.           (if (> (setq n-of-ents (sslength reject-set)) 0)
  1014.             (progn
  1015.               (princ (strcat "\n" (itoa n-of-ents)
  1016.                              " entities not projected"
  1017.                      )
  1018.               )
  1019.               (setq tp 3)
  1020.               (redraw-rej reject-set tp) ;redraw rejection set
  1021.             )
  1022.           )
  1023.         )
  1024.         (prompt "\nNo entities found")
  1025.       )
  1026.     )
  1027.   )
  1028. )
  1029. ;;;---- Set variables, get projection plane, call (get-ent) -
  1030.  
  1031. (defun project (/ numctr ucs-a ucs-b n-color old-err
  1032.                   entset reject-set entities n-of-ents cudir udir notperp
  1033.                   perpt2 perpang)
  1034.   (modes '("cmdecho" "blipmode" "expert" "flatland"
  1035.            "gridmode" "osmode" "thickness")
  1036.   )
  1037.   (setq icon (getvar "ucsicon"))
  1038.   (mapcar 'setvar
  1039.     '("cmdecho" "blipmode" "expert" "flatland" "gridmode"
  1040.       "osmode" "thickness")
  1041.     '(0 0 4 0 0 0 0)
  1042.   )
  1043.   (setq planar nil numctr 1 neg nil parallel nil)
  1044.   (setq reject-set (ssadd))           ;initialize rejection set
  1045.   (setq entset (ssadd))               ;initialize block set
  1046.   (setq notperp T)
  1047.  
  1048.   (if proj2  ;if using C:PROJECT2
  1049.     (getplane)
  1050.     (setq udir (trans '(0 0 1) 1 0 T))
  1051.   )                                   
  1052.  
  1053.   (setq cudir (trans '(0 0 1) 1 0 T)) ;current extrusion direction
  1054.   (setq u2 (cdr (assoc 210 elist)))
  1055.   (setq u1 (trans '(0 0 1) 1 0 T))
  1056.  
  1057.   (if (and proj2                      ;if UCS' are not parallel
  1058.            (and (not (ucsp cudir udir))
  1059.                 (not (equal (distance udir cudir) 2 0.000001))
  1060.            )
  1061.       )
  1062.     ;;test for perpendicular projection plane
  1063.     (if (equal (distance udir cudir) (sqrt 2) 0.00000000001)
  1064.       (progn
  1065.         (setq notperp nil)
  1066.         (prompt "\nUCS is perpendicular ")
  1067.         (prompt "\nCan't project entities to plane.")
  1068.       )
  1069.       (setq notpert T)
  1070.     )
  1071.   )
  1072.  
  1073.   (if notperp    ;if projection plane is not perpendicular
  1074.     (progn
  1075.       (slayer)     ;get projection layer
  1076.       (get-ent)    ;continue with projection
  1077.       (initget "Yes No")
  1078.       (while       ;continue projecting more entities
  1079.         (eq (getkword "\nProject another entity? Y/N <N>: ") "Yes" )
  1080.         (setq tp 1)
  1081.         (if n-of-ents (redraw-rej reject-set tp))
  1082.         (setq reject-set (ssadd))
  1083.         (get-ent)
  1084.         (initget "Yes No")
  1085.       )
  1086.     )
  1087.   )
  1088.   (setq tp 1)
  1089.   (if n-of-ents (redraw-rej reject-set tp))
  1090.  
  1091.   (if (and (not proj2) (/= (sslength entset) 0))
  1092.     (progn
  1093.       (initget "Yes No")
  1094.       (if (eq (getkword "\nMake into block? <N>: ") "Yes")
  1095.         (make-blk entset)
  1096.         (progn
  1097.           (initget "Yes No")
  1098.           (if (eq (getkword "\nWrite to disk as DWG file? <N>: ") "Yes")
  1099.               (write-blk entset)
  1100.           )
  1101.         )
  1102.       )
  1103.     )
  1104.   )
  1105.  
  1106.   (if proj2     ;if you used C:PROJECT2
  1107.     (progn      ;then delete temporary ucs'
  1108.       (command "ucs" "d" ucs-a)
  1109.       (if (= ucs-b "$$PLANE-B") (command "ucs" "d" ucs-b))
  1110.     )
  1111.   )
  1112.  
  1113.   (moder)
  1114.   (setq ncolor nil)
  1115.   (setvar "ucsicon" icon)
  1116.   (setq *error* olderr)  ;reset error function
  1117.   (princ)
  1118. )
  1119.  
  1120. (defun C:PROJECT1 ()
  1121.   (if (not err-set)
  1122.       (setq olderr *error* *error* proj-err)
  1123.   )
  1124.   (setq proj2 nil)
  1125.   (project)
  1126.   (princ)
  1127. )
  1128.  
  1129. (defun C:PROJECT2 ()
  1130.   (if (not err-set)
  1131.       (setq olderr *error* *error* proj-err)
  1132.   )
  1133.   (setq proj2 T)
  1134.   (project)
  1135.   (princ)
  1136. )
  1137.  
  1138. (defun C:PROJECT (/ choice err-set)
  1139.   (setq olderr *error* *error* proj-err)
  1140.   (setq err-set T)
  1141.   (textscr)
  1142.   (prompt "\n\n\n\n\n\n\n")
  1143.   (prompt "------------------------------ PROJECT.LSP ------------------------\n")
  1144.  
  1145.   (prompt "\n1) PROJECT1")
  1146.   (prompt (strcat "\n    Allows a \"flat\" "
  1147.                   "projection of wireframe 3D models (lines, arcs,"))
  1148.   (prompt
  1149.     "\n    circles, polylines, solids, points) onto the current UCS.  This")
  1150.   (prompt
  1151.     "\n    could be a useful aid for generating working drawings from a 3D")
  1152.   (prompt"\n    model.\n")
  1153.   (prompt
  1154.     "\n    After projection,  the user  is allowed  to make  the projected")
  1155.   (prompt
  1156.     "\n    entities into  a block,  or write  it out  as a  drawing  file.")
  1157.   (prompt
  1158.     "\n    These blocks  or drawing files (typically Top, Front, Side, and")
  1159.   (prompt
  1160.     "\n    Iso projections)  could be  re-inserted onto  a single  UCS and")
  1161.   (prompt"\n    annotated to create a multi-view orthographic drawing.\n")
  1162.  
  1163.   (prompt"\n2)  PROJECT2")
  1164.   (prompt
  1165.     "\n    This routine  projects an entity perpendicular from the current")
  1166.   (prompt
  1167.     "\n    UCS onto  a designated  construction plane.  This may be useful")
  1168.   (prompt"\n    in the construction of 3D wireframe models.\n")
  1169.   (prompt
  1170.     "\nTo avoid  this menu  in the  future the  user can type the commands")
  1171.   (prompt "\nPROJECT1 or PROJECT2 at the command prompt.\n")
  1172.  
  1173.   (if (and (= (substr (getvar "acadver") 1 2) "10")
  1174.            (/= (substr (getvar "acadver") 1 6) "10 c10")
  1175.       )
  1176.     (progn
  1177.       (prompt "\nFor DOS users not using Extended AutoLISP:")
  1178.       (prompt "\n             *** LISPHEAP  should be set to 35000 ***")
  1179.       (prompt "\n             *** LISPSTACK should be set to 10000 ***")
  1180.     )
  1181.     (prompt"\n\n")
  1182.   )
  1183.  
  1184.   (initget "1 2")
  1185.   (setq choice (getkword "\nEnter projection type (1 or 2) <1>: "))
  1186.   (if (or (equal choice "1")
  1187.           (equal choice nil)
  1188.       )
  1189.     (C:PROJECT1)
  1190.     (C:PROJECT2)
  1191.   )
  1192.   (princ)
  1193. )
  1194.  
  1195. (prompt "C:PROJECT")
  1196. (princ)
  1197.  
  1198.