Author Topic: error catch in vla-getboundingbox  (Read 3214 times)

0 Members and 1 Guest are viewing this topic.

Amsterdammed

  • Guest
error catch in vla-getboundingbox
« on: July 02, 2010, 02:21:59 PM »
Hello there,

error catchin never was my game. now it bites me.

I use that code

 
Code: [Select]
(defun ax:GetBoundingBox (ent / ll ur)
      (if ent
        (progn
          (vl-load-com)
          (vla-getboundingbox (vlax-ename->vla-object ent) 'll 'ur)
          (mapcar 'vlax-safearray->list (list ll ur))
          ) ;_ end of progn
 ;_ end of defun
        ) ;_ end of if
      )


to find out the actual size of an section created by an vertical we work with, but there seem to be entities with null extents

Quote
Automation Error. Null extents

how can i alter my code so that it doesn't crash anymore?





kpblc

  • Bull Frog
  • Posts: 396
Re: error catch in vla-getboundingbox
« Reply #1 on: July 02, 2010, 02:51:47 PM »
What kind of entity you're using for test?
Sorry for my English.


alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: error catch in vla-getboundingbox
« Reply #3 on: July 02, 2010, 05:25:49 PM »
Alan's posted some really nice examples, but here's one that SHOULD catch the possible errors from vla-getboundingbox...

Code: [Select]
(defun BBox (ent / ll ur)
  (if (eq (type ent) 'ENAME)
    (if (not (vl-catch-all-error-p
               (vl-catch-all-apply
                 (function vla-getboundingbox)
                 (list (vlax-ename->vla-object ent) 'll 'ur)
               )
             )
        )
      (mapcar (function vlax-safearray->list) (list ll ur))
    )
  )
)
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

Amsterdammed

  • Guest
Re: error catch in vla-getboundingbox
« Reply #4 on: July 07, 2010, 08:27:32 AM »
Thanks!!

That works!

Bernd

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: error catch in vla-getboundingbox
« Reply #5 on: July 07, 2010, 08:48:21 AM »
Good deal. :)
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox