• Industries
  • Products
  • Buy
  • Services & Support
  • Communities
  • Discussion Groups

    AutoCAD Architecture Customization

    Reply
    Active Contributor
    Posts: 33
    Registered: 10-21-2008

    Obtaining MVblock insertion point

    902 Views, 3 Replies
    07-20-2010 02:02 AM

    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.

    *Pro
    Posts: 1,589
    Registered: 12-09-2003

    Re: Obtaining MVblock insertion point

    07-20-2010 08:46 AM in reply to: eddyrichardson

    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)))
    )

    Active Contributor
    Posts: 33
    Registered: 10-21-2008

    Re: Obtaining MVblock insertion point

    07-20-2010 11:17 AM in reply to: eddyrichardson

    Never done any Visual Lisp using VBA comands, oh well time to start....

    Active Contributor
    Posts: 33
    Registered: 10-21-2008

    Re: Obtaining MVblock insertion point

    07-29-2010 01:36 AM in reply to: David_W._Koch

    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