Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

vla & vlax et. al.

9 REPLIES 9
Reply
Message 1 of 10
doni49
617 Views, 9 Replies

vla & vlax et. al.

There have been a bunch of times that I've needed to do something and the solution ended up involving these vla & vlax commands.  Can someone PLEASE point me to some documentation on using them (their syntaxt) and hopefully some sort of list of available functions?

 

I *think* these are classified as Visual Lisp functions.  But when I search for visual lisp documentation, all I find is info on using the VLISP IDE.

 

TIA!



Don Ireland
Engineering Design Technician




If a reply solves your issue, please remember to click on "Accept as Solution". This will help other users looking to solve a similar issue. Thank you.


Please do not send a PM asking for assistance. That's what the forums are for. This allows everyone to benefit from the question asked and the answers given.

9 REPLIES 9
Message 2 of 10
doni49
in reply to: doni49

I just came across what seems like a pretty good tutorial on Visual Lisp. 

 

http://www.afralisp.net/visual-lisp/tutorials/beginning-visual-lisp-part-1.php

 

I don't know yet if it lists all the available functions -- I guess I'll find out (eventually  :))



Don Ireland
Engineering Design Technician




If a reply solves your issue, please remember to click on "Accept as Solution". This will help other users looking to solve a similar issue. Thank you.


Please do not send a PM asking for assistance. That's what the forums are for. This allows everyone to benefit from the question asked and the answers given.

Message 3 of 10
Kent1Cooper
in reply to: doni49

This has come up several times before, for example, here.  There are lists of function names out there, but I've also found it frustrating that there doesn't seem to be the kind of information that's in the AutoLISP Reference about Lisp functions [i.e. syntax, what the arguments need to be and in what order, what it returns].  I've developed a feel for some of them just from their usage in things people post here, and I still often run across something that way that I didn't know existed.

Kent Cooper, AIA
Message 4 of 10
dbroad
in reply to: doni49

First, learn to use vlide.  There are links within vlide to access the documentation.  The first is apropos, where you can type any method or property name and find a function that works with that property.  Once you double click on that function name in the list, then push the help button to get the old vba active access help.  There is a format for translating the vba help to lisp help.

 

object.method args goes to (vla-method object args)

object.getproperty ags goes to (vla-get-property object args)

 

vlax methods can sometimes be simpler by directly accessing lists in normal form rather than in variant form.

(vlax-get...

(vlax-put...

(vlax-invoke...

etc

 

David Stein's Visual Lisp Bible is here.  It is an OK start.

 

Recently, Autodesk has added some functions, courtesy of Lee Ambrosius, that allow more direct and simpler access.  I keep forgetting to use them.

 

getpropertyvalue

setpropertyvalue

 

A more complete reference to that is here.

Architect, Registered NC, VA, SC, & GA.
Message 5 of 10
dgorsman
in reply to: doni49

One of the most important thing is to understand the object oriented nature of what is being done.  From there, it becomes simple to use vla- with all sorts of objects, not just AutoCAD COM (e.g. MSXML DOMDocument, ProSteel COM interface).

----------------------------------
If you are going to fly by the seat of your pants, expect friction burns.
"I don't know" is the beginning of knowledge, not the end.


Message 6 of 10
martti.halminen
in reply to: doni49


@doni49 wrote:

There have been a bunch of times that I've needed to do something and the solution ended up involving these vla & vlax commands.  Can someone PLEASE point me to some documentation on using them (their syntaxt) and hopefully some sort of list of available functions?

 


The vlax-  functions are documented in the AutoLISP Reference Guide

- except, of course, the three most useful: vlax-get, vlax-put and vlax-invoke. Those behave like vlax-get-property, vlax-put-property and vlax-invoke-method, but with the difference  that they try to convert the values handled to and from Lisp datatypes where possible, so that you save some explicit fiddling with variants etc.

 

The vla- functions are not directly documented (at least on older versions, I haven't done serious searching of 2014 docs), there are just conversion rules how to convert the VBA calls to Lisp.

The VBA stuff used to be documented in the ActiveX and VBA Reference.

 

--

Message 7 of 10
martti.halminen
in reply to: dbroad


@Anonymous wrote:

  There is a format for translating the vba help to lisp help.

 

object.method args goes to (vla-method object args)

object.getproperty ags goes to (vla-get-property object args)

 


The additional trick to this rule is handling of situations where in VBA the results are returned in the parameters instead of as the return value of the function. For example:

 

object.GetBoundingBox MinPoint, MaxPoint

Object:       All Drawing Objects, AttributeReferenceThe object this method applies to.

MinPoint:   Variant (three-element array of doubles); output-only The 3D WCS coordinates specifying the minimum point of the object's bounding box.

MaxPoint:  Variant (three-element array of doubles); output-only The 3D WCS coordinates specifying the maximum point of the object's bounding box.

 

As Lisp doesn't have the concept of output parameters, this is handled so that you give the names of variables, where to assign the results:

 

(vla-getboundingbox obj 'minpt 'maxpt)

 

so, after this call the results are in the variables minpnt and maxpnt.

 

--

Message 8 of 10
dbroad
in reply to: martti.halminen

@martti,

 

Yes, thanks for the addition.  There is also probably much more to say about how to use and how to avoid using safe arrays and variants but perhaps this thread is not the best place for that.  I have enjoyed reading your replies  while lurking.

Architect, Registered NC, VA, SC, & GA.
Message 9 of 10
doni49
in reply to: dbroad

Thanks everyone for all the info.  I'll definitely be digging into all this.



Don Ireland
Engineering Design Technician




If a reply solves your issue, please remember to click on "Accept as Solution". This will help other users looking to solve a similar issue. Thank you.


Please do not send a PM asking for assistance. That's what the forums are for. This allows everyone to benefit from the question asked and the answers given.

Message 10 of 10
Lee_Mac
in reply to: doni49

To add to the excellent information already provided:

 

ActiveX & VBA Reference (Russian site - not sure if there is an equivalent published by Autodesk)

Explanation of how to use the reference

 

Lee

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

Post to forums  

Autodesk Design & Make Report

”Boost