How can I get the Insertion Point of an MVblock using Autolisp?
If you list the MVblock it tells you the Insertion point - but how?
If you explode the MVblock the resultant block returns it's insertion point so it must be nested in there somewhere....
Thanks in advance.
The ENTGET function return values for AEC objects is a little on the light side. You can access the properties of AEC objects from within AutoLISP, but you will need to make use of the Visual LISP functions. Assuming that you have the entity name of an AEC object that has an "insertion point" (a Location property), the following subroutine (which does no error checking) will get the Location property value. This is a variant (three-element array of doubles), which must then be converted to safearray (using the vlax-variant-value function) so that the vlax-safearray->list command can be used to convert the safearray to a simple AutoLISP list of three real numbers representing the insertion point.
Perhaps a more clever person who actually understands the VL functions better than I do could go straight from the Location property to a list, but I stumbled on this and it appears to work, so it is good enough for me. 😉
(defun AECINS (ename / ob ptarray ptins)
(setq ob (vlax-ename->vla-object ename))
(setq ptarray (vlax-get-property ob 'Location))
(setq ptins (vlax-safearray->list (vlax-variant-value ptarray)))
)
David
I got that working thanks..
First time in 16 years of Lisping I have used (vl-load-com). Will alll the VBA based commands still work, even if Autodesk no longer support VBA?
Thanks again for your help.
Eddy