TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: Amsterdammed on July 02, 2010, 02:21:59 PM

Title: error catch in vla-getboundingbox
Post by: Amsterdammed 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?




Title: Re: error catch in vla-getboundingbox
Post by: kpblc on July 02, 2010, 02:51:47 PM
What kind of entity you're using for test?
Title: Re: error catch in vla-getboundingbox
Post by: CAB on July 02, 2010, 04:36:08 PM
For more info see these:
http://www.theswamp.org/index.php?topic=15323.msg188915#msg188915
http://www.theswamp.org/index.php?topic=15323.msg190278#msg190278
http://forums.augi.com/showpost.php?p=902301&postcount=2
http://www.theswamp.org/index.php?topic=32597
http://www.theswamp.org/index.php?topic=20534.msg250025#msg250025
Title: Re: error catch in vla-getboundingbox
Post by: alanjt 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))
    )
  )
)
Title: Re: error catch in vla-getboundingbox
Post by: Amsterdammed on July 07, 2010, 08:27:32 AM
Thanks!!

That works!

Bernd
Title: Re: error catch in vla-getboundingbox
Post by: alanjt on July 07, 2010, 08:48:21 AM
Good deal. :)