Command: DISPROP
Displays (in form of line after line) all parameters and supported methods of an object available for visuallisp / autolisp. Object can be preselected.
Command: DISPROP2
As above but displays Properties and supported methods
Command: DISPROPNESTED
As above but works with nested object. Does not support object preselection.
Code:
;;; =================================================
;;; DISPROP_v4_03.LSP
;;;
;;; Written by Andrzej Kalinowski, www.autolisps.blogspot.com
;;; v4.00 - 05.10.2015
;;; v4.01 - 05.04.2020 - added DISPROPNESTED command
;;; v4.02 - 30.05.2020 - added errorsection
;;; v4.03 - 23.07.2022 - added separate command for displaying properties with suppered methods.
;;;
;;; Command: DISPROP - displays (in form of line after line) all parameters of an object available for visuallisp / autolisp. Object can be preselected.
;;; Command: DISPROP2 - As above but displays Properties and supported methods
;;; Command: DISPROPNESTED - As above but works with nested object. Does not support object preselection.
;;;
;;; =================================================
(vl-load-com)
(defun c:DISPROP () (DISPROP_COMMON 0) );defun
(defun c:DISPROP2 () (DISPROP_COMMON 2) );defun
(defun c:DISPROPNESTED () (DISPROP_COMMON 1) );defun
(defun DISPROP_COMMON ( mode1 / obj1 entlist1 cnt1 entlen1 curelm)
;-----------------------------------------
;error section
;-----------------------------------------
(defun *error* (msg) (princ "error: ") (princ msg) (princ) )
(defun errtrap1 (errormsg1 / )
(if (and errormsg1 (not (wcmatch (strcase errormsg1) "*BREAK*,*CANCEL*,*QUIT*") ) )
(prompt (strcat "Error: " errormsg1) );then
);if
(princ)
);defun err
(setq temperr *error*)
(setq *error* errtrap1 )
;-----------------------------------------
;object selection
;-----------------------------------------
(setq obj1 nil)
(if (member mode1 (list 0 2))
(progn
(prompt "select object")
(while (= obj1 nil)
(setq obj1 (ssget "_:S+."))
(if (= (getvar "ERRNO") 52) (exit))
(if (= obj1 nil)
(princ "\nwrong object");then
(if (> (sslength obj1) 1);else
(progn
(princ "\nselect only one object")(princ)
(setq obj1 nil)
);progn
);end if
);end if
);end while
(setq obj1 (ssname obj1 0))
);progn
(progn
(while (= obj1 nil)
(setq obj1 (setq obj1 (car (nentsel "\nSelect nested object ") )))
(if (= (getvar "ERRNO") 52) (quit))
(if (= obj1 nil)
(princ "\nwrong object");then
);end if
);while
);progn
);if
(setq *error* temperr);restoring to previous *error* definition
(setq temperr nil )
;-----------------------------------------
;reading of parameters
;-----------------------------------------
(setq
entlist1 (entget obj1)
entlen1 (length entlist1)
cnt1 0
);setq
(princ "\n------------------------------------------")
(princ "\n visuallisp ")
(princ "\n------------------------------------------")
(setq obj1 (vlax-ename->vla-object obj1))
(if (member mode1 (list 0 1))
(vlax-dump-object obj1);Displays only parameters
(vlax-dump-object obj1 T) ;Displays parameters and methods
);if
(princ "\n------------------------------------------")
(princ "\n autolisp ")
(princ "\n------------------------------------------")
(repeat entlen1
(progn
(setq curelm (nth cnt1 entlist1))
(terpri)
(princ curelm) (princ "\t")
(cond
( (= (car curelm) -5) (princ "...............persistent reactor chain") )
( (= (car curelm) -4) (princ "...............conditional operator") )
( (= (car curelm) -3) (princ "...............extended data") )
( (= (car curelm) -2) (princ "...............fixed entity name") )
( (= (car curelm) -1) (princ "...............not fixed entity name") )
( (= (car curelm) 0) (princ "...............entity type (fixed)") )
( (= (car curelm) 1) (princ "...............Primary text value") )
( (= (car curelm) 2) (princ "...............Name (attribute tag, block name, etc)") )
( (= (car curelm) 3) (princ "...............other text") )
( (= (car curelm) 4) (princ "...............other text") )
( (= (car curelm) 5) (princ "...............Entity handle") )
( (= (car curelm) 6) (princ "...............Linetype name") )
( (= (car curelm) 7) (princ "...............Text style name") )
( (= (car curelm) 8) (princ "...............Layer name (fixed)") )
( (= (car curelm) 9) (princ "...............variable name identifier") )
( (= (car curelm) 10) (princ "...............Primary point") )
( (= (car curelm) 11) (princ "...............Other point") )
( (= (car curelm) 38) (princ "...............entity's elevation if nonzero") )
( (= (car curelm) 39) (princ "...............Entity's thickness if nonzero (fixed)") )
( (= (car curelm) 40) (princ "...............scale-height etc") )
( (= (car curelm) 41) (princ "...............scale-height etc") )
( (= (car curelm) 42) (princ "...............scale-height etc") )
( (= (car curelm) 43) (princ "...............scale-height etc") )
( (= (car curelm) 48) (princ "...............Linetype scale. Floating-point scalar value.") )
( (= (car curelm) 49) (princ "...............Repeated floating-point value") )
( (= (car curelm) 50) (princ "...............angle (radians)") )
( (= (car curelm) 60) (princ "...............Entity visibility. Integer value. Absence or 0 -visible, 1-invisible") )
( (= (car curelm) 62) (princ "...............Color number (fixed)") )
( (= (car curelm) 66) (princ "...............Entities follow flag") )
( (= (car curelm) 67) (princ "...............model or paper space") )
( (= (car curelm) 68) (princ "...............identifies whether viewport is on but fully off screen; is not active or is off") )
( (= (car curelm) 69) (princ "...............viewport identification number") )
( (= (car curelm) 71) (princ "...............Text generation flag: 2=Text is backward (mirrored in X), 4 = Text is upside down (mirrored in Y)") )
( (= (car curelm) 100) (princ "...............Subclass data marker") )
( (= (car curelm) 102) (princ "...............Control string") )
( (= (car curelm) 210) (princ "...............Extrusion direction") )
( (= (car curelm) 340) (princ "...............arbitrary hard pointer to other object") )
);cond
(setq cnt1 (+ 1 cnt1))
); progn
); repeat
(textscr)
(princ)
);defun
Example:
1.00 - 05.10.2015 - first release
[...] - misc updates
4.01 - 05.04.2020 - added DISPROPNESTED commandcommand.
4.02 - 30.05.2020 - added errorsection
4.03 - 30.05.2020 - added separate command for displaying properties with suppered methods.
Compatibility:
-All Autocad versions
Remarks:
-The application comes with the long command names listed above. To create your own short aliases for these commands, go to ACAD.PGP file or Menu Manage->Customization->Edit aliases->Edit Aliases. Command aliases used in video-example: DP for DISPROP, DPN for DISPROPNESTED
Download file: DISPROP_v4_03.FAS

No comments:
Post a Comment