AcCoreConsole - GetBoundingBox

AcCoreConsole - GetBoundingBox

johan_germishuys
Contributor Contributor
211 Views
1 Reply
Message 1 of 2

AcCoreConsole - GetBoundingBox

johan_germishuys
Contributor
Contributor

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
0 Likes
212 Views
1 Reply
Reply (1)
Message 2 of 2

Sea-Haven
Mentor
Mentor

Bounding box uses VL code and may not work, but in saying that there was posts about loading a ARX file as part of the code then the VL code will work. Hope fully someone will remember about accoreconsole and VL.

0 Likes