cagorskij Posted April 2 Posted April 2 Apologies if my questions are tedious, i'm trying to learn as much as i can on my own before asking, but when it comes to disambiguating objects, entities and activex objects i'm still struggling to completely wrap my head around it. i guess i'm just looking for some simple explanation. ive never been great at understanding these sorts of layered disambiguations whether it be networking layers or this ~_~ i've read a little but it's hard for me to search when i'm not sure which words to even use haha ^^; this old post, this less old post & this one, this autocad 2023 help page, & this autocad 2024 page. as i understand it, cad has entities and objects, which are distinguised by whether they have a graphical representation or not (respectively) does this mean all entities are objects? vl stands for visual lisp? vlax objects are higher level Visual LISP representations of regular cad objects and entities to access the vlax functions it is required to load the library first then retrieve or generate(?) the vlax representation the objects enames are the identifiers of vanilla lisp entities which are basically older versions of vlax objects (from here, but im not sure i interpreted correctly) that is why there are functions like vlax-ename->vla-object, so that you can run with the same variable rather than having 2 i guess? i dont understand the use of entity name (ename) here instead of object name. i thought enames were a pre-vl thing the vla-get-<property> and vla-put-<property> are effectively equivalent to the vlax versions? object methods are just complicated gets or puts, using more arguments or modifying more properties. Quote
Danielm103 Posted April 2 Posted April 2 this might be helpful too. https://help.autodesk.com/view/ACD/2024/ENU/?guid=GUID-FC6FC3E3-ED3E-4E4D-9766-8E4D037241A5 1 Quote
CyberAngel Posted April 2 Posted April 2 You may want to do a little research on object-oriented programming (OOP). Once you understand inheritance, abstraction, encapsulation, and polymorphism, it's easier to see how the pieces of an OOP system fit together. For instance, an AutoCAD object is more like a class, while an entity is more like an instance of a class. The class defines how the entity can behave, but the instance tells you how a particular entity does behave. Visual LISP is a dialect of AutoLISP that works in an Integrated Development Environment (IDE). It's supposed to make programming easier. Visual LISP objects aren't higher level, they're the same objects in a different space. The libraries are necessary to run code in that space. Visual LISP, in effect, adds a layer of abstraction so that you don't get stuck in the weeds of AutoLISP. Commands that start with vla- are part of Visual LISP. Commands that start with vlax- are part of the ActiveX system, which allows you to access other types of documents, such as Word or Excel. ActiveX commands are at once more generic and more powerful. Unfortunately, you can only use ActiveX with Windows. If you want to retrieve the layer of an object, you can do it either way, but notice the difference: (vla-get-layer 'obj) (vlax-get-property 'obj Layer) With the first command, you get the layer of an object. With the second one, you can get any property of that object, even if the property isn't related to AutoCAD. You can use either one, depending on how you feel about context, readability, and consistency. 2 Quote
cagorskij Posted April 4 Author Posted April 4 Thank you Danielm103 for the visualization & CyberAngel for the very helpful explanation. With both I'm feeling a lot more comfortable with my understanding now 1 Quote
mhupp Posted April 4 Posted April 4 Here are the two lisp I use to dump data. should update to use (ssget "_+.:E:S") instead of entsel this means you can select things before you run the command. always bugs me I will have the thing selected that I want to dump and then type the command and still have to select it again. ;;----------------------------------------------------------------------------;; ;; Dump All Visual Lisp Methods and Properties for Selected Entity ;; RO = Read Only and cant be changed with lisp (defun C:VDumpIt (/ ent) (while (setq ent (car (entsel "\nSelect Entity to Dump"))) (vlax-Dump-Object (vlax-Ename->Vla-Object ent) t) ) (princ) ) ;;----------------------------------------------------------------------------;; ;; Dump all DXF Group Data (defun C:DumpIt (/ ent) (while (setq ent (car (entsel "\nSelect Entity to Dump"))) (mapcar 'print (entget ent '( "*"))) ) (princ) ) 1 Quote
BIGAL Posted April 4 Posted April 4 (edited) Another example of how you can write 1 function in different ways. (vlax-get obj 'Layer) ; opposite (vlax-put obj 'Layer "Text") I use this for entget object checking I just type it or I have a shortcut. It is a real short just pick an object, there is no prompt. (entget (car (entsel))) In the developers help there are pretty pictures where they talk about classes and objects . https://help.autodesk.com/view/OARX/2023/ENU/?guid=GUID-FC6FC3E3-ED3E-4E4D-9766-8E4D037241A5 A great document you should be able to find "The_Visual_LISP_Developers_Bible" Edited April 4 by BIGAL Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.