home *** CD-ROM | disk | FTP | other *** search
-
- ; bdrsurf - create a bigd revolved surface
-
- (defun c:bdrsurf ( / cecho blipmde regenmde attflags blkname s ename revang ss
- elist eaxis l n e etype point)
- ; save current modes
- (setq attflags (getvar "AFLAGS"))
- (setvar "AFLAGS" 3)
- (setq blipmde (getvar "BLIPMODE"))
- (setvar "BLIPMODE" 0)
- (setq cecho (getvar "CMDECHO"))
- (setvar "CMDECHO" 0)
- (setq regenmde (getvar "REGENMODE"))
- (setvar "REGENMODE" 0)
- (graphscr)
-
- ; get block name
- (while (or (null blkname) (= blkname ""))
- (setq blkname (getstring "\nBlock name: "))
- (if (and (tblsearch "block" blkname)
- (/= "Y" (strcase (substr (getstring (strcat "\nBlock "
- (strcase blkname) " already exists.\nRedefine it? <N> "))
- 1 1))))
- (setq blkname nil)
- )
- )
-
- ; get insertion point
- (initget 17)
- (setq insertpt (getpoint "\nInsertion base point: "))
-
- ; get included angle
- (setq revang (getangle insertpt
- "\nIncluded angle (+=ccw,-=cw) <Full circle>: "))
-
- ; get selected entities to be revolved
- (setq ss (ssget))
- (if (boundp 'ss)
- (progn
- ; draw axis of revolution
- (command "LINE" insertpt "@0,1" "")
- (setq eaxis (list (entlast) insertpt))
-
- ; draw attribute definition for included angle
- (if (null revang)
- (command "ATTDEF" "" "REVANG" "0.0" insertpt "" "")
- (command "ATTDEF" "" "REVANG" (rtos revang 2 16)
- insertpt "" ""))
- (setq ss (ssadd (entlast) ss))
-
- ; draw each revolved entity
- (setq l 0 n (sslength ss))
- (while (< l n)
- (setq ename (ssname ss l))
- (setq e (entget ename))
- (setq etype (cdr (assoc 0 e)))
- (setq point (cdr (assoc 10 e)))
- (setq elist (list ename point))
- (if (or (= etype "LINE") (= etype "ARC") (= etype "CIRCLE"))
- (progn
- (if (null revang)
- (command "REVSURF" elist eaxis "" "")
- (command "REVSURF" elist eaxis "" (angtos revang)))
- (setq ss (ssadd (entlast) ss))
- )
- )
- (setq l (1+ l))
- )
-
- ; create block
- (if (tblsearch "block" blkname)
- (command "BLOCK" blkname "Y" insertpt ss "")
- (command "BLOCK" blkname insertpt ss ""))
-
- ; erase axis of revolution
- (command "ERASE" (cadr eaxis) "")
- )
- )
- (setvar "AFLAGS" attflags)
- (setvar "BLIPMODE" blipmde)
- (setvar "CMDECHO" cecho)
- (setvar "REGENMODE" regenmde)
- (princ)
- )
-
-
- ; edrsurf - edit a bigd revolved surface
-
- (defun c:edrsurf ( / cecho blkname blk insertpt e elast)
- (setq cecho (getvar "CMDECHO"))
- (setvar "CMDECHO" 0)
-
- ; get block name
- (setq blkname nil)
- (while (or (null blkname) (= blkname ""))
- (setq blkname (getstring "\nBIG D block to edit: "))
- (if (null (setq blk (tblsearch "block" blkname)))
- (progn
- (prompt (strcat "\n*** Error: Block " blkname
- " does not exist ***"))
- (setq blkname nil)
- )
- )
- )
-
- ; get insertion point
- (initget 1)
- (setq insertpt (getpoint "Insertion point: "))
-
- ; save the last main entity
- (setq elast (entlast))
-
- ; insert the block as separate parts
- (command "INSERT" (strcat "*" blkname) insertpt "" "")
-
- ; if no entities previously existed, start with first entity
- (if (null elast)
- (setq elast (entnext))
- (setq elast (entnext elast)))
-
- ; delete all new non-valid entities
- (while (setq e elast)
- (setq etype (cdr (assoc 0 (entget e))))
- (if (or (= etype "POLYLINE") (= etype "ATTDEF"))
- (entdel e)
- (setq elast (entnext elast))
- )
- )
-
- ; redraw the screen
- (command "REDRAW")
-
- (setvar "CMDECHO" cecho)
- (princ)
- )
-
-