XDATA eXpert please help

Discussion in 'AutoCAD' started by Big 'D', Jun 25, 2004.

  1. Big 'D'

    Big 'D' Guest

    I have objects on my drawing with xdata. If I have xdata text infomation and I want to know what graphic on the screen contains that information, how can I query this? In description, say I have a line on my drawing with XYZ text xdata, can I search on XYZ and have the line with that xdata info attached highlight? This question is a long shot but I though someone may know the answer (there are some smart people in this discussion group).
    Thanks for any help you can offer.
    D
     
    Big 'D', Jun 25, 2004
    #1
  2. Big 'D'

    Rudy Tovar Guest

    xshow.lsp published ;;
    ;; Bill Kramer 2002
    ;; View extended data attached to an object.
    a loooonggggg timmmmeee aaaggooo.....

    ;; Point A
    ;; A potion from the Wizard's Lab.
    ;;
    ;; Bill Kramer 2002
    ;; View extended data attached to an object.
    ;;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;; XSHOW Command Function
    (defun C:XSHOW (/
    EN ; Entity name selected
    EL ;Entity data list
    XLIST ; Extended data list
    X ; Temporary variable
    TMP1 ; Temporary variable
    TMP2 ; Temporary variable
    )
    ;
    (setq XLIST (X_DATA_APPIDS) ;obtain a list of APPID values in drawing
    TMP1 ""
    TMP1 (apply ; create string of APPID values for use as filter
    'strcat ;concat the strings returned from MAPCAR
    (mapcar
    '(lambda (X) ;add a comma at the end of each string
    (strcat X ","))
    XLIST)) ;XLIST is list of APPID value strings
    TMP1 (substr TMP1 1 (1- (strlen TMP1)))
    ;remove extra comma at end
    SS1 (ssget "X" ;find all objects with XDATA
    (list
    (list -3 (list TMP1))))
    )
    (if SS1 ;If entity objects with XDATA are found,
    (progn
    ;;
    ;; Loop through selection set and highlight each object
    (repeat (setq TMP2 (sslength SS1))
    (redraw (ssname SS1
    (setq TMP2 (1- TMP2)))
    3))
    ;;
    ;; Operator selection of object in drawing
    (setq EN (car (entsel "\nPick object: ")))
    ;find all objects with XDATA
    (print XLIST) ;Display the list of APPID values
    (if EN
    (progn
    (setq EL (entget EN XLIST)
    TMP1 (assoc -3 EL)
    )
    (if TMP1
    ;;find any X data?
    (progn
    (setq XLIST (cdr TMP1)
    ;;remove -3 ((APPID...)...)
    )
    (textscr) ; flip to the text screen
    (setq LNCount 20) ;set a line counter to hold screen
    (prompt
    "\n\nXDATA was found attached to the object selected.")
    (foreach Item XLIST ;XLIST contains extended data list
    (if (< LNCount 5) ;Check line counter
    (progn
    (setq LNCount 20) ;reset value and hold for user
    (getstring
    "\n ---- Press Enter to continue.")))
    ;; Display application ID string
    (prompt (strcat "\n\nAPPID = \""
    (car Item)
    "\"\n"))
    (setq LNCount (- LNCount 3))
    (Xshow_1 (cdr Item))) ;Show the values
    )
    ;;end PROGN
    (prompt
    "\n\nNo XDATA in object selected.")
    )
    ;;End IF TMP1
    )
    ;;end PROGN
    (prompt "\n\nNothing selected.")
    )
    ;;End IF EN
    )
    ;;end PROGN
    (prompt
    "\nNo XDATA objects found in drawing.")
    )
    ;;end IF SS1
    (princ)
    )
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    (defun XSHOW_1 (ID)
    ;;fill in X_DATA details for all
    (mapcar ;;Loop through all the members of the list
    '
    (lambda (X)
    (setq LNCount (1- LNCount)) ;decrement line counter
    (if (< LNCount 1) ;check line counter
    (progn
    (setq LNCount 20) ;reset value and wait for operator
    (getstring
    "\n ---- Press Enter to continue.")))
    (prompt ;output the code and the value
    (strcat "\n\t"
    (itoa (car X))
    " "
    (cond
    ((or (= (car X) 1000)
    ;;Check for strings
    (= (car X) 1005)
    (= (car X) 1003)
    ;;layer string
    (= (car X) 1002)
    ;;control string
    )
    (strcat "\"" (cdr X) "\"")
    )
    ((or (= (car X) 1040)
    ;;Check for real numbers
    (= (car X) 1041)
    (= (car X) 1042)
    )
    (rtos (cdr X))
    )
    ((= (car X) 1070)
    ;;Check for integers
    (itoa (cdr X))
    )
    ((or (= (car X) 1010)
    ;;Check for points
    (= (car X) 1011)
    (= (car X) 1012)
    )
    (strcat
    (rtos (cadr X))
    ", "
    (rtos (caddr X))
    ", "
    (rtos (cadddr X)))
    )
    (t "**CANNOT DISPLAY")
    ))))
    ID)
    )
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;; Build list of X data ID names
    (defun X_DATA_APPIDS (/ TMP1 TMP2)
    ;;Build list of X data ID's
    (setq TMP1 (tblnext "APPID" 't))
    ;;get 1st APPID
    (while TMP1
    ;;loop until no more APPID's in table
    (setq TMP2 (cons ;;add APPID to list
    (cdr (assoc 2 TMP1))
    TMP2)
    TMP1 (tblnext "APPID")
    ;;get next APPID
    )
    )
    TMP2
    ;;return TMP2 list
    )
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    (princ)
    ;; end of file

    and I want to know what graphic on the screen contains that information, how
    can I query this? In description, say I have a line on my drawing with XYZ
    text xdata, can I search on XYZ and have the line with that xdata info
    attached highlight? This question is a long shot but I though someone may
    know the answer (there are some smart people in this discussion group).
     
    Rudy Tovar, Jun 25, 2004
    #2
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.