View Res Overkill Explode Lisp

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello all,
New to the forum. I have searched and searched and it does not seem like this particular lisp has been covered anywhere as a whole.
Background information: I have a bunch of drawings which were converted from Catia (when converted, it splits each sheet into its own drawing) and I was assigned with the task of taking each sheet from each Catia drawing and combining them back in to one drawing in AutoCAD. So, with AutoCAD open I would take and drag the converted Catia files onto a layout, adding a layout for each sheet and combining the converted Catia files into one AutoCAD drawing with all of the necessary sheets. When I drag the converted Catia files onto the AutoCAD layout it forms each sheet as a block. Once the Catia files were combined into one AutoCAD drawing I need to Explode, Overkill and change the View Res to 20,000 for each sheet. The drawing then needed to be Purged and Zoomed to the Extents of each Sheet and Units Changed to inches. I have taken the "ZEAS" lisp and added the command to change the View Res to 20,000.
Question/problem: No matter what I do I cannot get the Lisp to "Select All" "Explode" and then "Select All" "Overkill" for each sheet. I also need the Lisp to change the Units to inches. The lisp will go through each sheet, Regen All, Zoom Extents and change the View Res to 20,000 but will not Explode and Overkill. Is it possible to do this all in one lisp?
Any help is much appreciated, as you can imagine this has been a grueling task without such a lisp. I have been Exploding, Overkilling?, and changing the View Res manually for every sheet in every drawing. I have over 75 drawings from Catia to combine in AutoCAD each containing 20+ sheets. If I could create such a lisp it would save me hours if not days and maybe I can keep the skin on my fingertips.
Here is what I have so far:
;File Name: ze-all-sheets
;Written By: derek 'maverick' beals
;Version: a
;Date: 08/23/06
;Description: zoom extents all sheets
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;Non-Standard Lisp Functions
(defun rtd (R) (/ (* R 180.0) pi)) ; Radians to Degrees
(defun dtr (D) (/ (* D pi) 180.0)) ; Degrees to Radians
(defun hyp (a b) (sqrt (+ (expt a 2.0)(expt b 2.0)))) ; figures hypotenuse of triangle when other 2 legs are given
(defun deg (G) (strcat G "%%d")) ; Add degree symbol to string
(defun tan (A) (/ (sin A) (cos A))) ; Tangent of variable (A) in Radians
(defun sqr (S) (* S S)) ; Squares the variable (S)
(defun feet (dec) (rtos dec 4 4)) ; converts decimal inches to feet and inches
(defun fixx (realnum) ; Rounds the variable (realnum) to the next highest whole integer (opposite of the "fix" function)
(if (> realnum (+ (fix realnum) 0))
(setq realnum (1+ (fix realnum)))
(setq realnum (fix realnum))
)
realnum
)
(defun getarc ()
(setq en (car (entsel "\nSelect Arc for Radius/Arc Length/Chord Length/Arc Angle: ")))
(setq enlist (entget en))
(setq RAD (cdr (assoc 40 enlist)))
(setq ANG1 (cdr (assoc 50 enlist)))
(setq ANG2 (cdr (assoc 51 enlist)))
(setq ANG (- ANG2 ANG1))
(if
(< ANG 0)
(setq ANG (- (* 2 pi) (abs ANG)))
)
(setq ANG3 (rtd ANG))
(setq ARCLENGTH (* RAD ANG))
(setq CHORDLENGTH (* 2 (* RAD (sin (/ ANG 2)))))
)
(defun ceiling (x n)
(setq CN (* (fix (atof (rtos (* x (/ 1.0 n)) 2 0))) n))
(if
(< CN x)
(setq CN (+ CN n))
(setq CN CN)
)
)
(setq ANGDIR 0)
(defun setvariables ()
(setq ANGBASE (getvar "ANGBASE"))
(setq ANGDIR (getvar "ANGDIR"))
(setq APERTURE (getvar "APERTURE"))
(setq ATTDIA (getvar "ATTDIA"))
(setq BLIPMODE (getvar "BLIPMODE"))
(setq CLAYER (getvar "CLAYER"))
(setq CMDECHO (getvar "CMDECHO"))
(setq OSMODE (getvar "OSMODE"))
(setq PICKBOX (getvar "PICKBOX"))
(setq TILEMODE (getvar "TILEMODE"))
)
(defun resetvariables ()
(setvar "ANGBASE" ANGBASE)
(setvar "ANGDIR" ANGDIR)
(setvar "APERTURE" APERTURE)
(setvar "ATTDIA" ATTDIA)
(setvar "BLIPMODE" BLIPMODE)
(setvar "CLAYER" CLAYER)
(setvar "CMDECHO" CMDECHO)
(setvar "OSMODE" OSMODE)
(setvar "PICKBOX" PICKBOX)
(setvar "TILEMODE" TILEMODE)
)
(setvar "blipmode" 0)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;Lisp Programming starts here
(setvariables)
(defun c:bb (/ x layouts)
(setq layouts (getvar "ctab"))
(foreach x (layoutlist)
(setvar "ctab" x)
(command "pspace")
(command "zoom" "e")
(command "viewres" "y" 20000)
(ssget "_A")
(command"explode")
(ssget "_A")
(command "overkill")
)
(command "fieldeval" 31)
(command "fielddisplay" 0)
(command "regenall")
(command "insunits" 1)
(setvar "ctab" layouts)
(princ)
Thanks!