AutoCAD Architecture Customization
Welcome to Autodesk’s AutoCAD Architecture Customization Forums. Share your knowledge, ask questions, and explore popular AutoCAD Architecture Customization topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Obtaining MVblock insertion point

3 REPLIES 3
Reply
Message 1 of 4
eddyrichardson
1426 Views, 3 Replies

Obtaining MVblock insertion point

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.

3 REPLIES 3
Message 2 of 4

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 Koch
AutoCAD Architecture and Revit User
Blog | LinkedIn
EESignature

Message 3 of 4

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

Message 4 of 4

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

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost