Author Topic: Few GetBoundingBox issues  (Read 338 times)

0 Members and 1 Guest are viewing this topic.

Grrr1337

  • Bull Frog
  • Posts: 380
Few GetBoundingBox issues
« on: November 24, 2016, 03:21:38 pm »
Hi guys, I've got a few(2) questions:

1. Why this work
Code: [Select]
(vla-GetBoundingBox o 'll 'ur)
But these don't
Code: [Select]
(vlax-invoke-method o 'GetBoundingBox 'll 'ur)
(vlax-invoke o 'GetBoundingBox 'll 'ur)


Getting the BBox's centroid
2. Is there a way to get rid of the Lst quote,
Code: [Select]
(setq Lst (mapcar 'vlax-safearray->list (list ll ur)))
(setq cen (mapcar '(lambda (a b) (/ (+ a b) 2.)) (car Lst) (cadr Lst)))
Without using this (obviously):
Code: [Select]
(setq cen
(mapcar '(lambda (a b) (/ (+ a b) 2.))
(car (mapcar 'vlax-safearray->list (list ll ur)))
(cadr (mapcar 'vlax-safearray->list (list ll ur)))
)
)

With something like:
Code: [Select]
(setq cen (apply '(lambda (x) ????? ) (mapcar 'vlax-safearray->list (list ll ur))))

roy_043

  • Swamp Rat
  • Posts: 1477
  • BricsCAD 16
Re: Few GetBoundingBox issues
« Reply #1 on: November 24, 2016, 03:39:34 pm »
2.:
Code - Auto/Visual Lisp: [Select]
  1. (setq cen (mapcar '(lambda (a b) (/ (+ a b) 2.)) (vlax-safearray->list ll) (vlax-safearray->list ur)))

Lee Mac

  • Seagull
  • Posts: 11793
  • AutoCAD 2015 Windows 7 London, England
Re: Few GetBoundingBox issues
« Reply #2 on: November 24, 2016, 04:34:16 pm »
Alternatively:
Code - Auto/Visual Lisp: [Select]
  1. (setq cen (apply 'mapcar (cons '(lambda (a b) (/ (+ a b) 2.)) (mapcar 'vlax-safearray->list (list ll ur)))))

Grrr1337

  • Bull Frog
  • Posts: 380
Re: Few GetBoundingBox issues
« Reply #3 on: November 24, 2016, 04:46:14 pm »
Thanks guys!
I've used before Roy's suggestion (Its my fault not to mention it), so tried to figure out something like Lee's (apply with mapcar 'vlax-safearray->list combo).

About #1 I suspect that when you provide quotes that have to be set by visual lisp after invoking the method (like GetBoundingBox), it will use safearrays/variants and not vanilla lisp type values (in this case point of list type was expected). Atleast thats what I think for now  :thinking: