Message 1 of 2
AcCoreConsole - GetBoundingBox
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
I'm trying to extract all the bounding boxes and handles from a drawing to do some automation.
I've been looking at using a combination of tools and came down to looking at AcCoreConsole and using a lisp routine to extract this information from a folder. I'm currently stuck, as I'm not familiar with the vanilla syntax for Lisp.
Here is my lisp routine for reference. Would greatly appreciate any help on making this work.
(defun c:ShowHandle (/ I ITEM SS LST DOC PATH fnName)
(vl-load-com)
(setq doc (vl-filename-base (getvar "dwgname")))
(print doc)
(setq path "C:/temp/" )
(setq fnName (strcat path doc ".csv"))
(if (findfile fnName)
(vl-file-delete fnName)
)
;Write Headers
(setq filldata (open fnName "A"))
(write-line (strcat "Handle" "," "minPointX" "," "minPointY" "," "maxPointX" "," "MaxPointY") filldata)
(close filldata)
(setq i 0)
;(setq fnName (getfiled "Create Output File" "" "csv" 1))
(setq ss (ssget "_A"))
(repeat (setq i (sslength ss))
(setq item (ssname ss (setq i (1- i)))) ;Get the specific object
(vla-getboundingbox (vlax-ename->vla-object item) 'minPt 'maxPt)
(setq minPt (vlax-safeArray->list minPt))
(setq maxPt (vlax-safeArray->list maxPt))
(setq minPtString (strcat (rtos (car minPt) 2 3) ", " (rtos (cadr minPt) 2 3)))
(setq maxPtString (strcat (rtos (car maxPt) 2 3) ", " (rtos (cadr maxPt) 2 3)))
(setq filldata (open fnName "A"))
(write-line (strcat (cdr (assoc 5 (entget item))) "," minPtString "," maxPtString) filldata)
(close filldata)
) ;end repeat
) ;end defun