Author Topic: vlax-dump-object->List  (Read 8345 times)

0 Members and 1 Guest are viewing this topic.

Andrea

  • Water Moccasin
  • Posts: 2372
vlax-dump-object->List
« on: December 15, 2016, 03:40:58 PM »
Hi all,.

I'm looking to get a list of dump object..

something like:
Code: [Select]
(("Application (RO) =" #<VLA-OBJECT IAcadApplication 00007ff796ce44f8>)
  ("Area =" 4807.45)
  ("Center =" (2831.45 1200.59 0.0))
  ("Circumference =" 245.789)
  ("Diameter =" 78.2371)
  ....
  ....
  )

or even Text can be useful..
something like
Code: [Select]
(vl-princ-to-string (vlax-dump-object (vlax-ename->vla-object (car (entsel))) t))

Maybe anything simple to do that I don't know ? or any suggestion ?
Thank you
Keep smile...

Lee Mac

  • Seagull
  • Posts: 12906
  • London, England
Re: vlax-dump-object->List
« Reply #1 on: December 15, 2016, 03:57:47 PM »
The following is built on code I developed in conjunction with MP during a conversation a few years ago, it may prove useful:

Code: [Select]
(defun vlax-dump-object->list ( obj mth )
    (append
        (list
            (mapcar
                (function
                    (lambda ( prp )
                        (list prp (vlax-get obj prp))
                    )
                )
                (_GetObjectProperties obj)
            )
        )
        (if mth (list (_GetObjectMethods obj)))
    )
)

(defun _GetObjectProperties ( obj )
    (vl-remove-if-not
        (function
            (lambda ( prp )
                (vlax-property-available-p obj prp)
            )
        )
        (_GetVlaProperties)
    )
)

(defun _GetObjectMethods ( obj )
    (vl-remove-if-not
        (function
            (lambda ( mth )
                (vlax-method-applicable-p obj mth)
            )
        )
        (_GetVlaMethods)
    )
)

(defun _GetVlaAtoms ( )
    (eval
        (list 'defun '_GetVlaAtoms '( )
            (list 'quote
                (vl-sort
                    (vl-remove-if-not
                        (function
                            (lambda ( sym )
                                (wcmatch (vl-symbol-name sym) "vla`-*")
                            )
                        )
                        (atoms-family 0)
                    )
                    (function
                        (lambda ( a b )
                            (<
                                (vl-symbol-name a)
                                (vl-symbol-name b)
                            )
                        )
                    )
                )
            )
        )
    )
    (_GetVlaAtoms)
)

(defun _GetVlaProperties ( )
    (eval
        (list 'defun '_GetVlaProperties '( )
            (list 'quote
                (mapcar
                    (function
                        (lambda ( sym )
                            (substr (vl-symbol-name sym) 9)
                        )
                    )
                    (vl-remove-if-not
                        (function
                            (lambda ( sym )
                                (wcmatch (strcase (vl-symbol-name sym)) "VLA`-GET`-*")
                            )
                        )
                        (_GetVlaAtoms)
                    )
                )
            )
        )
    )
    (_GetVlaProperties)
)

(defun _GetVlaMethods ( )
    (eval
        (list 'defun '_GetVlaMethods '( )
            (list 'quote
                (mapcar
                    (function
                        (lambda ( sym )
                            (substr (vl-symbol-name sym) 5)
                        )
                    )
                    (vl-remove-if
                        (function
                            (lambda ( sym )
                                (wcmatch (strcase (vl-symbol-name sym)) "VLA`-GET`-*,VLA`-PUT`-*")
                            )
                        )
                        (_GetVlaAtoms)
                    )
                )
            )
        )
    )
    (_GetVlaMethods)
)

(vl-load-com) (princ)

Andrea

  • Water Moccasin
  • Posts: 2372
Re: vlax-dump-object->List
« Reply #2 on: December 15, 2016, 04:36:11 PM »
Wow !....amazing...  :smitten:

Thank you very much Lee..
I was thinking differently..

I'm on my way to create a quick tool helping me to have fast information when selecting an object .... :)

Keep smile...

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: vlax-dump-object->List
« Reply #3 on: December 15, 2016, 04:37:54 PM »
Here's the original code posted about 11 years ago: link.
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

Grrr1337

  • Swamp Rat
  • Posts: 812
Re: vlax-dump-object->List
« Reply #4 on: December 15, 2016, 04:38:05 PM »
From my stash (studied from hmsilva):
Heres the original thread
Code: [Select]
(defun C:test ( / e o StrMark opn row LstRows rest n itm str LstDump newf newopn a )

(while (not (setq e (car (entsel "\nSelect object to dump to file: ")))) e)
(if (setq o (vlax-ename->vla-object e))
(progn
(SetVarP SysVars2 'cmdecho 0)
(setq StrMark (rtos (rem (getvar 'date) 1) 2 10))
(setvar 'LOGFILEMODE 1)
(princ (strcat "\n" StrMark "\n"))
(princ)
(foreach x (entget e) (print x)(princ "\n"))
(princ "\n;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\n")
(princ)
(vlax-dump-object o T)
(princ)
(setvar 'LOGFILEMODE 0)

(if (setq opn (open (getvar 'LOGFILENAME) "r"))
(progn (while (setq row (read-line opn)) (if (> (strlen row) 0) (setq LstRows (cons row LstRows)))) (close opn))
      )
(if LstRows (progn (setq LstRows (reverse LstRows)) (setq LstRows (cdr (member StrMark LstRows)))))
(ListAlertEach LstRows)

(if
        (and
          LstRows
          (setq newf (getfiled "Create New TXT File" "" "txt" 1))
          (setq newopn (open newf "w"))
        )
        (progn
          (foreach x LstRows (write-line x newopn))
          (close newopn)
          (or a (setq a "Yes")) (initget "Yes No Y N")
          (setq a (cond ((getkword (strcat "\nDo you want to open the TXT file? [Yes/No] <" a ">: "))) ( a )))
          (if (member (strcase a) '("Y" "YES")) (startapp "explorer" newf))
        ); progn
      ); if

    ); progn
  ); if o

(princ)
);| defun |; (vl-load-com) (princ)

(defun SetVarP ( SysVarLst VarName Val ); <- UNTESTED !
(and
(= 'LIST (type SysVarLst))
(if (not (zerop (length SysVarLst))) (apply 'and (mapcar '(lambda (x) (= (length x) 3)) SysVarLst)))
(member VarName (mapcar 'car SysVarLst))
(not (vl-catch-all-error-p (vl-catch-all-apply 'setvar (list VarName Val))))
  )
);| defun SetVarP |; (vl-load-com) (princ)

(defun ListPrintEach ( Lst ) (if (listp Lst) (foreach x Lst (princ "\n") (print x))) (princ))
(defun ListAlertEach ( Lst ) (if (listp Lst) (alert (apply 'strcat (mapcar '(lambda (x) (strcat "\n" (vl-princ-to-string x))) Lst)))) (princ))
Entget, and Dump with option to save as TXT file, the only problem is that the List is contained entirely of strings.
Figured out to put the StrMark variable, so everytime the log file can be re-readen 8)
(apply ''((a b c)(a b c))
  '(
    (( f L ) (apply 'strcat (f L)))
    (( L ) (if L (cons (chr (car L)) (f (cdr L)))))
    (72 101 108 108 111 32 87 111 114 108 100)
  )
)
vevo.bg

Andrea

  • Water Moccasin
  • Posts: 2372
Re: vlax-dump-object->List
« Reply #5 on: December 15, 2016, 04:43:51 PM »
Thank you Guys..  8-)
Keep smile...

Grrr1337

  • Swamp Rat
  • Posts: 812
Re: vlax-dump-object->List
« Reply #6 on: December 15, 2016, 04:53:26 PM »
Thanks for sharing this, Lee!
Its not very friendly to LWpolylines:
Code: [Select]
_$ (vlax-dump-object->list (vlax-ename->vla-object (car (entsel))) nil)
Error: Invalid number of parameters
_1$

Here's the original code posted about 11 years ago: link.
WTH MP?!
 That thread is insane!!!  :uglystupid2:  :uglystupid2:  :angel:
After seeing this, now I'm subscribed to T.Willey's ideas!  :idea:
(apply ''((a b c)(a b c))
  '(
    (( f L ) (apply 'strcat (f L)))
    (( L ) (if L (cons (chr (car L)) (f (cdr L)))))
    (72 101 108 108 111 32 87 111 114 108 100)
  )
)
vevo.bg

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: vlax-dump-object->List
« Reply #7 on: December 15, 2016, 04:58:48 PM »
Tim is an awesome programmer and artist.
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

Grrr1337

  • Swamp Rat
  • Posts: 812
Re: vlax-dump-object->List
« Reply #8 on: December 15, 2016, 05:24:23 PM »
By the way Andrea, I had a similar idea. However I'm a "hobby programmer" so wrote only this (BrowseThruDictionaries - starting from the namedobjdict):

I used LM:ListBox to achieve this, but its actually unfinished, because wanted to include "back" button.
One day I might get it done  :cry2:
(apply ''((a b c)(a b c))
  '(
    (( f L ) (apply 'strcat (f L)))
    (( L ) (if L (cons (chr (car L)) (f (cdr L)))))
    (72 101 108 108 111 32 87 111 114 108 100)
  )
)
vevo.bg

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: vlax-dump-object->List
« Reply #9 on: December 15, 2016, 05:33:40 PM »
In before the deluge.

Wrote this back in 2010, first incarnation originated about 6 years prior.
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: vlax-dump-object->List
« Reply #10 on: December 15, 2016, 05:38:30 PM »
Also does the dxf data and yes -- everything is live linked -- can dance about the object model at will (sorry, no vid available):
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

Grrr1337

  • Swamp Rat
  • Posts: 812
Re: vlax-dump-object->List
« Reply #11 on: December 15, 2016, 05:43:58 PM »
In before the deluge.

Wrote this back in 2010, first incarnation originated about 6 years prior.

The conclusion is that this applies to you also mr.Puckett !   :grinwink:
Tim is an awesome programmer and artist.
(apply ''((a b c)(a b c))
  '(
    (( f L ) (apply 'strcat (f L)))
    (( L ) (if L (cons (chr (car L)) (f (cdr L)))))
    (72 101 108 108 111 32 87 111 114 108 100)
  )
)
vevo.bg

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: vlax-dump-object->List
« Reply #12 on: December 15, 2016, 05:54:34 PM »
Don't know about awesome but I'm stubborn and determined. The original was actually a dll I wrote using Visual Studio 6 enterprise. Mid 90's. It was slick and very graphical (icons for each data type) using a listview widget and was good for a couple versions, then knackered by Autodesk. Rewrote it in lisp exploiting a std type library dll. Worked for years then knackered again. Rewrote again in 2010 pure lisp. Fingers crossed its not knackered for awhile.
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

kdub_nz

  • Mesozoic keyThumper
  • SuperMod
  • Water Moccasin
  • Posts: 2122
  • class keyThumper<T>:ILazy<T>
Re: vlax-dump-object->List
« Reply #13 on: December 15, 2016, 06:06:19 PM »
< ... >  (sorry, no vid available):

I remember a time when a whiff of a hint was appreciated.

don't get me started ....
Called Kerry in my other life
Retired; but they dragged me back in !

I live at UTC + 13.00

---
some people complain about loading the dishwasher.
Sometimes the question is more important than the answer.

Andrea

  • Water Moccasin
  • Posts: 2372
Re: vlax-dump-object->List
« Reply #14 on: December 15, 2016, 06:08:05 PM »
I knew that you guru did something like that...
awesome ! :)

but to be honest...I was thinking creating something like that since 2001,..:)
never had time.. haha :oops:

...you did very nice tools guys...congrats. :)
Keep smile...

Grrr1337

  • Swamp Rat
  • Posts: 812
Re: vlax-dump-object->List
« Reply #15 on: December 15, 2016, 06:12:22 PM »
Don't know about awesome but I'm stubborn and determined.
IMO Thats a part from the definition of being awesome programmer.
The original was actually a dll I wrote using Visual Studio 6 enterprise. Mid 90's. It was slick and very graphical (icons for each data type) using a listview widget and was good for a couple versions, then knackered by Autodesk. Rewrote it in lisp exploiting a std type library dll. Worked for years then knackered again. Rewrote again in 2010 pure lisp. Fingers crossed its not knackered for awhile.
So you were rolling with a few languages, I thought once you started with one language you continue(d) with it.

Sounds interesting (for me - a person that never opened ACAD till 2010's)
I'm not gonna reveal when I was born to make you feel old, so Lets just say you are very experienced (append valuable).  :-o
(apply ''((a b c)(a b c))
  '(
    (( f L ) (apply 'strcat (f L)))
    (( L ) (if L (cons (chr (car L)) (f (cdr L)))))
    (72 101 108 108 111 32 87 111 114 108 100)
  )
)
vevo.bg

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: vlax-dump-object->List
« Reply #16 on: December 15, 2016, 06:50:13 PM »
Thanks for the complimentary thoughts. LISP was technically my fourth language if I get to count ladder logic. As for feeling old, worry not, the snow on the roof and sidewalk is a constant reminder. :cry:
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: vlax-dump-object->List
« Reply #17 on: December 16, 2016, 01:52:36 AM »
I remember a time when a whiff of a hint was appreciated.

don't get me started ....

The internet has become a demanding mistress?
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

kdub_nz

  • Mesozoic keyThumper
  • SuperMod
  • Water Moccasin
  • Posts: 2122
  • class keyThumper<T>:ILazy<T>
Re: vlax-dump-object->List
« Reply #18 on: December 16, 2016, 02:09:09 AM »
I remember a time when a whiff of a hint was appreciated.

don't get me started ....

The internet has become a demanding mistress?

Essentially yes .. which is incredible since it is an object without volition.
Called Kerry in my other life
Retired; but they dragged me back in !

I live at UTC + 13.00

---
some people complain about loading the dishwasher.
Sometimes the question is more important than the answer.

Andrea

  • Water Moccasin
  • Posts: 2372
Re: vlax-dump-object->List
« Reply #19 on: December 16, 2016, 01:21:58 PM »
just showing where i'm going with this...
not finished yet,..to much idea on table..
:)



Keep smile...

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: vlax-dump-object->List
« Reply #20 on: December 16, 2016, 01:24:41 PM »
Nicely done. Reminds me of my old dll version. But nicer.
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: vlax-dump-object->List
« Reply #21 on: December 16, 2016, 01:28:06 PM »
Make sure it will also make a hard copy, I find it very useful:

================================================================================

<Dwg: OMG.dwg> <Object: AcDbPolyline "2BC9">

====================================== PROPERTIES ==============================

Application®                           <Object: IAcadApplication>
Area®                                  447.23669466
Closed                                 :vlax-false
Color                                  256
ConstantWidth                          1.0
Coordinate                             
Coordinates                            (438.02349191 103.48063257 438.02349191 ... 171.07034114)
Database®                              <Object: IAcadDatabase>
Document®                              <Object: IAcadDocument>
Elevation                              0.0
EntityTransparency                     "ByLayer"
Handle®                                "2BC9"
HasExtensionDictionary®                :vlax-false
Hyperlinks®                            <Object: IAcadHyperlinks>
Layer                                  "HIDDEN"
Length®                                84.48966663
Linetype                               "BYLAYER"
LinetypeGeneration                     :vlax-true
LinetypeScale                          1.0
LineWeight                             -1
Material                               "ByLayer"
Normal                                 (0.0 0.0 1.0)
ObjectID®                              49
ObjectID32®                            49
ObjectName®                            "AcDbPolyline"
OwnerID®                               48
OwnerID32®                             48
PlotStyleName                          "ByLayer"
Thickness                              0.0
TrueColor                              <Object: IAcadAcCmColor>
Visible                                :vlax-true
                                       
====================================== DXF DATA ================================

  -1                                   <Ename: LWPOLYLINE "2BC9">
   0                                   "LWPOLYLINE"
 330                                   <Ename: BLOCK_RECORD "86">
   5                                   "2BC9"
 100                                   "AcDbEntity"
  67                                   1
 410                                   "Layout1"
   8                                   "HIDDEN"
 100                                   "AcDbPolyline"
  90                                   6
  70                                   128
  43                                   1.0
  38                                   0.0
  39                                   0.0
  10                                   (438.02349191 103.48063257)
  40                                   1.0
  41                                   1.0
  42                                   0.0
  91                                   0
  10                                   (438.02349191 103.48063257)
  40                                   1.0
  41                                   1.0
  42                                   0.41421356
  91                                   0
  10                                   (443.02349191 108.48063257)
  40                                   1.0
  41                                   1.0
  42                                   0.0
  91                                   0
  10                                   (443.02349191 166.07034114)
  40                                   1.0
  41                                   1.0
  42                                   -0.41421356
  91                                   0
  10                                   (448.02349191 171.07034114)
  40                                   1.0
  41                                   1.0
  42                                   0.0
  91                                   0
  10                                   (459.2154867 171.07034114)
  40                                   1.0
  41                                   1.0
  42                                   0.0
  91                                   0
 210                                   (0.0 0.0 1.0)
                                       
====================================== METHODS =================================

AddRef                                 
AddVertex                              
ArrayPolar                             
ArrayRectangular                       
Copy                                   
Delete                                 
Erase                                  
Explode                                
GetBoundingBox                         
GetBulge                               
GetExtensionDictionary                 
GetIDsOfNames                          
GetTypeInfo                            
GetTypeInfoCount                       
GetWidth                               
GetXData                               
Highlight                              
IntersectWith                          
Invoke                                 
Mirror                                 
Mirror3D                               
Move                                   
Offset                                 
QueryInterface                         
Release                                
Rotate                                 
Rotate3D                               
ScaleEntity                            
SetBulge                               
SetWidth                               
SetXData                               
TransformBy                            
Update
                                 
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

Andrea

  • Water Moccasin
  • Posts: 2372
Re: vlax-dump-object->List
« Reply #22 on: December 16, 2016, 02:09:12 PM »
Yes,...Thank you..is on the list..

if you notice,...when I clic on some #<Variant.... I use functions to get result..
so,..I'll do same thing for many other selection, like showing directly some info in AutoCAD.
I want to add also to allow to modify few value.. :)
Keep smile...

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: vlax-dump-object->List
« Reply #23 on: December 16, 2016, 03:00:13 PM »
Thanks, did notice the mouse gesturing :) and best of luck with editing properties -- it can become a rabbit hole of validation.
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

Grrr1337

  • Swamp Rat
  • Posts: 812
Re: vlax-dump-object->List
« Reply #24 on: January 08, 2017, 06:06:30 AM »
I really liked LM's suggestion, but was annoyed that it crashes on LWPOLYLINES / SPLINES, because of a properties with values of "...Indexed contents not shown...", so I performed the following modification (the hammer approach):

Code - Auto/Visual Lisp: [Select]
  1. (if (eq 'VLA-OBJECT (type obj))
  2.   (append
  3.     (list
  4.       (mapcar
  5.         (function
  6.           (lambda ( prp / prpval )
  7.             (if (not (vl-catch-all-error-p (setq prpval (vl-catch-all-apply 'vlax-get (list obj prp)))))
  8.               (list prp prpval)
  9.               (list prp nil)
  10.             )
  11.           )
  12.         )
  13.         (_GetObjectProperties obj)
  14.       )
  15.     )
  16.     (if mth (list (_GetObjectMethods obj)))
  17.   )
  18. )
  19.  

Soo for example when you have such property:
Code: [Select]
;   Coordinate = ...Indexed contents not shown...The list will turn it to:
Code: [Select]
("Coordinate" nil)
HTH, sorry for bumping this thread.
(apply ''((a b c)(a b c))
  '(
    (( f L ) (apply 'strcat (f L)))
    (( L ) (if L (cons (chr (car L)) (f (cdr L)))))
    (72 101 108 108 111 32 87 111 114 108 100)
  )
)
vevo.bg

mailmaverick

  • Bull Frog
  • Posts: 494
Re: vlax-dump-object->List
« Reply #25 on: January 08, 2017, 10:24:16 AM »
Courtesy Forum Members, my Code :

Code: [Select]
(defun c:LM_DumpObject (/ prop&methods)
  ;; Dumps Selected Object in a DCL Box having two List Boxes, one containing Object Properties and second containing Object Methods
  ;; Courtesy Lee Mac
  ;; Source : https://www.theswamp.org/index.php?topic=52409.0
  (vl-load-com)
  ;| -------------------------------------------------------------------------
------------------------------------------------------------------------------
          FUNCTION DEFINITIONS       
------------------------------------------------------------------------------
------------------------------------------------------------------------------
  |;
  ;;
  (defun vlax-dump-object->list (obj mth)
    (if (eq 'VLA-OBJECT (type obj))
      (append (list
                (mapcar (function
                          (lambda (prp / prpval)
                            (if (not (vl-catch-all-error-p (setq prpval (vl-catch-all-apply 'vlax-get (list obj prp)))))
                              (list prp prpval)
                              (list prp nil)
                            )
                          )
                        )
                        (_GetObjectProperties obj)
                )
              )
              (if mth
                (list (_GetObjectMethods obj))
              )
      )
    )
  )
  ;;
  (defun _GetObjectProperties (obj)
    (vl-remove-if-not (function (lambda (prp) (vlax-property-available-p obj prp))) (_GetVlaProperties))
  )
  ;;
  (defun _GetObjectMethods (obj)
    (vl-remove-if-not (function (lambda (mth) (vlax-method-applicable-p obj mth))) (_GetVlaMethods))
  )
  ;;
  (defun _GetVlaAtoms ()
    (eval (list 'defun
                '_GetVlaAtoms
                '()
                (list 'quote
                      (vl-sort (vl-remove-if-not
                                 (function (lambda (sym) (wcmatch (vl-symbol-name sym) "vla`-*")))
                                 (atoms-family 0)
                               )
                               (function (lambda (a b) (< (vl-symbol-name a) (vl-symbol-name b))))
                      )
                )
          )
    )
    (_GetVlaAtoms)
  )
  ;;
  (defun _GetVlaProperties ()
    (eval
      (list 'defun
            '_GetVlaProperties
            '()
            (list 'quote
                  (mapcar (function (lambda (sym) (substr (vl-symbol-name sym) 9)))
                          (vl-remove-if-not
                            (function (lambda (sym) (wcmatch (strcase (vl-symbol-name sym)) "VLA`-GET`-*")))
                            (_GetVlaAtoms)
                          )
                  )
            )
      )
    )
    (_GetVlaProperties)
  )
  ;;
  (defun _GetVlaMethods ()
    (eval
      (list 'defun
            '_GetVlaMethods
            '()
            (list 'quote
                  (mapcar (function (lambda (sym) (substr (vl-symbol-name sym) 5)))
                          (vl-remove-if
                            (function (lambda (sym) (wcmatch (strcase (vl-symbol-name sym)) "VLA`-GET`-*,VLA`-PUT`-*")))
                            (_GetVlaAtoms)
                          )
                  )
            )
      )
    )
    (_GetVlaMethods)
  )
  ;;
  (defun LM:ListBox2 (lis1 lis2 / DCH DCL DES)
    ;; Makes two List Boxes, each filled with supplied lists
    ;; lis1 : List1 to be appended in Left List Box
    ;; lis2 : List2 to be appended in Right List Box
    (defun *error* (msg)
      (if (and (= 'int (type dch)) (< 0 dch))
        (unload_dialog dch)
      )
      (if (= 'file (type des))
        (close des)
      )
      (if (and (= 'str (type dcl)) (setq dcl (findfile dcl)))
        (vl-file-delete dcl)
      )
      (if (and msg (not (wcmatch (strcase msg t) "*break,*cancel*,*exit*")))
        (princ (strcat "\nError: " msg))
      )
      (princ)
    )
    (if
      (and
        (setq dcl (vl-filename-mktemp "tmp.dcl"))
        (setq des (open dcl "w"))
        (write-line
          (strcat
            "listbox : list_box { }
          example : dialog { label = \"Dump Object\"; spacer; : row {
          : listbox { key = \"ls1\"; label =  \"Properties\"; width = 50; height = 20; fixed_width = false; fixed_height = false; multiple_select = false ; }
          : column {}
          : listbox { key = \"ls2\"; label =  \"Methods\"; width = 30; height = 20; fixed_width = false; fixed_height = false; multiple_select = false ; }}
          ok_only;}"
          )
          des
        )
        (not (setq des (close des)))
        (< 0 (setq dch (load_dialog dcl)))
        (new_dialog "example" dch)
      )
       (progn (if lis1
                (progn (start_list "ls1")
                       (foreach itm lis1
                         (add_list (strcat (vl-princ-to-string (car itm)) " = " (vl-princ-to-string (cadr itm))))
                       )
                       (end_list)
                )
              )
              (if lis2
                (progn (start_list "ls2") (foreach itm lis2 (add_list itm)) (end_list))
              )
              (start_dialog)
       )
    )
    (if (< 0 dch)
      (unload_dialog dch)
    )
    (if (setq dcl (findfile dcl))
      (vl-file-delete dcl)
    )
    (princ)
  )
  ;;
  ;| -------------------------------------------------------------------------
------------------------------------------------------------------------------
         ACTUAL PROGRAM STARTED       
------------------------------------------------------------------------------
------------------------------------------------------------------------------
  |;
  (setq prop&methods (vlax-dump-object->list (vlax-ename->vla-object (car (entsel))) T))
  (LM:ListBox2 (car prop&methods) (cadr prop&methods))
  (princ)
)

Run by typing LM_DumpObject in command prompt.

T.Willey

  • Needs a day job
  • Posts: 5251
Re: vlax-dump-object->List
« Reply #26 on: January 10, 2017, 09:19:35 AM »
By the way Andrea, I had a similar idea. However I'm a "hobby programmer" so wrote only this (BrowseThruDictionaries - starting from the namedobjdict):
<snip>
You may be interested in this post then, as it is an entity walker program (not a full as MP's though): https://www.theswamp.org/index.php?topic=51751.0
Once the code is loaded, you can look through the NamedObjDict like
(ChaseEntData (NamedObjDict))

Tim is an awesome programmer and artist.
Thanks MP (for the compliment and all the help along the way).
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.