Author Topic: need a function to gather the object's property  (Read 2647 times)

0 Members and 1 Guest are viewing this topic.

taner

  • Guest
need a function to gather the object's property
« on: July 12, 2009, 09:10:09 PM »
Hi,

vlax-dump-object  can list the object's properties. Similarly, I need a function can gather the object's properties
so that the propertiy's name can buildup a list.

Say test is the function, (test circleobj)can get a list of the circle object's properties name,just lick("Area" "Center" "Circumference" "Layer" "Linetype" " Lineweight" " Material "Normal"
" PlotStyleName"  "Radius"   "Thickness" and other property).

Any one can help me?

Thanks in advance.

kdub

  • Mesozoic keyThumper
  • SuperMod
  • Water Moccasin
  • Posts: 1509
  • class keyThumper<T>:ILazy<T>
Re: need a function to gather the object's property
« Reply #1 on: July 12, 2009, 10:30:36 PM »

Perhaps make a list of ALL available properties for ALL objects

Then when you select your object, test vlax-property-available-p  with each property, if it returns true get the property value and save the property name and value into an association list.


... but really, the method depends on what you want to use the resulting data for ..

regards
Kerry
called Kerry in my other life

Sometimes the question is more important than the answer.

I don't really work crazy hours . . I just live at UTC + 13.00
#ridesober

Lee Mac

  • Seagull
  • Posts: 12726
  • London, England
Re: need a function to gather the object's property
« Reply #2 on: July 13, 2009, 04:28:27 AM »
I used an idea along the same lines here:

http://www.theswamp.org/index.php?topic=29276.0

And a similar thing here:

http://www.theswamp.org/index.php?topic=28710.0


Lee

VovKa

  • Water Moccasin
  • Posts: 1504
  • Ukraine
Re: need a function to gather the object's property
« Reply #3 on: July 13, 2009, 02:05:11 PM »

GDF

  • Water Moccasin
  • Posts: 2071
Re: need a function to gather the object's property
« Reply #4 on: July 13, 2009, 02:58:57 PM »
Code: [Select]
(defun C:VDOT (/ OBJ)
 (vl-load-com)
 (vlax-dump-object
  (setq OBJ (vlax-ename->vla-object
             (car (entsel "\n* Select object to examine Methods and Properties *"))
            )
  )
  T
 )
 (textscr)
 (prin1)
)
Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64

DEVITG

  • Bull Frog
  • Posts: 475
Re: need a function to gather the object's property
« Reply #5 on: July 18, 2009, 06:10:39 PM »
Hi,

vlax-dump-object  can list the object's properties. Similarly, I need a function can gather the object's properties
so that the propertiy's name can buildup a list.

Say test is the function, (test circleobj)can get a list of the circle object's properties name,just lick("Area" "Center" "Circumference" "Layer" "Linetype" " Lineweight" " Material "Normal"
" PlotStyleName"  "Radius"   "Thickness" and other property).

Any one can help me?

Thanks in advance.

It is not mine.

Code: [Select]
;;*//*/*/*/*/*/*/*/*/*/*/*/*/**/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*
;;
;; -- DEFUN ax-get-properties
;;RETIREVE listed property values from an object
;; Recupera los valores de las propiedades especificadas de un objeto.
;; Copyright: en AutoCAD - ©2005 scaner, Spain."
;;   ... / ...
;; Arguments [Type]:
;;   Obj = ActiveX object [VLA-object]
;; lst = props-list  [LIST]
;;   lst = Lista de propiedades [LIST]
;; Retorna [Type]:
;; dotted pairs list
;;   lst = Lista de pares punteados '(("Pro1" . "Val1")...) [LIST]
;;           car -> Prop (symbol) [SYM]
;;           cdr ->  propie value  [REAL/INT/STR/variant ]
;; Notas:
;; it check if prop is available
;;   Comprueba si las propiedades están disponibles para el objeto.
;;
(defun ax-get-properties  (Obj lst / lstPro)
  (foreach x  lst
    (if (vlax-property-available-p Obj x)
      (setq lstPro (cons (cons x (vlax-get-property Obj x)) lstPro))
      )
    )
  (reverse lstPro)
  )
;;




Location @ Córdoba Argentina Using ACAD 2019  at Window 10