TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: taner on July 12, 2009, 09:10:09 PM

Title: need a function to gather the object's property
Post by: taner 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.
Title: Re: need a function to gather the object's property
Post by: kdub_nz 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
Title: Re: need a function to gather the object's property
Post by: Lee Mac 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 (http://www.theswamp.org/index.php?topic=29276.0)

And a similar thing here:

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

Lee
Title: Re: need a function to gather the object's property
Post by: VovKa on July 13, 2009, 02:05:11 PM
a very nice method is here
http://www.theswamp.org/index.php?topic=19890.0
Title: Re: need a function to gather the object's property
Post by: GDF 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)
)
Title: Re: need a function to gather the object's property
Post by: DEVITG 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)
  )
;;