|
Top Document: comp.cad.autocad AutoLISP FAQ (part 2/2) - samples, code Previous Document: [25] DCL: listboxes with tabs or monotext font Next Document: [27] How to break a command in Lisp? See reader questions & answers on this topic! - Help others by sharing your knowledge
[26.1] Select objects on their EED with (ssget "X")
;;; defines your appname header and delimiter (4 char regapp name
;;; according AAIG, AutoDESK Application Interoperation Guidelines)
(setq appname "HUBU-")
;;; defines * for all sub types
(setq allappnames (strcat appname "*"))
;;; eg: HUBU-LIST1, HUBU-LIST2
;;; here is how to get the first eed list from one element
(defun get-eed-1st (ele)
(cdadr (assoc -3 (entget (entity ele) (list allappnames)))))
;;; this gets all elements of appnames typ (wildcards allowed)
(defun ssget-app (typ) ;fast
(ssget "X" (list (list -3 (list typ))))
;;; this gets only your elements
(defun ssget-hubu (typ) ;fast
(ssget "X" (list (list -3 (list (strcat appname typ)))))
(ssget-hubu "*") ; will get all your elements
------------------------------
[26.2] Get EED from an object
Check any XDATA with: (entget (car (entsel)) '("*"))
;;; GETXDATA - get all XDATA lists from an element
;;; i.e with XDATA:
;;; (-3 ("HUBU-1" (1000 ."ASSHATCH")(1002 ."{")
;;; (1070 . 1)(1002 ."}")))
;;; =>(("HUBU-1" (1000 ."ASSHATCH")(1002 ."{")(1070 . 1)(1002 ."}")))
(defun getxdata (e apnlst)
(cdr (assoc -3 (entget e apnlst))))
;;; GETXDATA-ALL - all lists without the regapp name
;;; => ((1000 ."ASSHATCH")(1002 ."{")(1070 . 1)(1002 ."}"))
(defun getxdata-all (e apnlst)
(apply 'append (mapcar 'cdr (getxdata e apnlst))))
The regapp name is stripped here, because it's only used for fast
ssget access. The different apps are divided by different
(1000 . name) groups as it's used by AutoDESK.
For storing XDATA in an element see XDATA.LSP or XED.LSP though those
examples are a bit disturbing.
For advanced EED tricks, esp. converting the "{" "}" ADS resbuf style
to Lisp lists and back, see
http://xarch.tu-graz.ac.at/autocad/news/eed_retrieval.txt
User Contributions:Top Document: comp.cad.autocad AutoLISP FAQ (part 2/2) - samples, code Previous Document: [25] DCL: listboxes with tabs or monotext font Next Document: [27] How to break a command in Lisp? Part1 - Part2 - Single Page [ Usenet FAQs | Web FAQs | Documents | RFC Index ] Send corrections/additions to the FAQ Maintainer: rurban@xarch.tu-graz.ac.at (Reini Urban)
Last Update March 27 2014 @ 02:11 PM
|

Comment about this article, ask questions, or add new information about this topic: