TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: Grrr1337 on November 24, 2016, 03:21:38 PM
-
Hi guys, I've got a few(2) questions:
1. Why this work
(vla-GetBoundingBox o 'll 'ur)
But these don't
(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,
(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):
(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:
(setq cen (apply '(lambda (x) ????? ) (mapcar 'vlax-safearray->list (list ll ur))))
-
2.:
-
Alternatively:
-
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: