Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

need a xdata removal program

1 view
Skip to first unread message

Scott Williams

unread,
Dec 2, 1998, 3:00:00 AM12/2/98
to
Does anyone have a program to strip xdata from entities? Your help would be
greatly appreciated!

Scott

Morten Warankov

unread,
Dec 2, 1998, 3:00:00 AM12/2/98
to
Scott,
load this function into ACAD:

(defun RmXdata ( appname)

(entmod (list (assoc -1 (entget (car(entsel)))) (list -3 (list
appname)))
)

Then type (RmXdata "MYAPP") to remove the xdata for application "MYAPP"

Hope this helps,

Mortenw

--
***************************************************************************
* A B A C U S
*
* Prof. Brochs gt. 6 Phone: (+47) 73 54 03 15 *
* N-7030 TRONDHEIM Fax: (+47) 73 94 38 61 *
* NORWAY E-mail: aba...@abacus.no *
* URL: http://www.abacus.no
*
*
*
* Formula for success: Underpromise and overdeliver. *
***************************************************************************
Scott Williams wrote in message <743s0r$3v...@adesknews2.autodesk.com>...

Tony Tanzillo

unread,
Dec 2, 1998, 3:00:00 AM12/2/98
to
;; REMXDATA.LSP Copyright (c)1994-98 Tony Tanzillo
;;
;; Removes XDATA for a given Application ID from
;; selected objects.
;;
;; Enter "REMXDATA" at command prompt, enter the
;; name of the application ID, then select the
;; objects to remove xdata from.

(defun C:REMXDATA ( / ss app filter id)
(while (member (setq app (getstring "\nApplication name/<?>: "))
'("" "?"))
(setq id nil)
(princ "\nRegistered applications: \n")
(while (setq id (tblnext "appid" (not id)))
(write-line (cdr (assoc 2 id)))
)
)
(if (not (tblsearch "APPID" app))
(progn
(alert "Application not registered.")
(exit)
)
)
(setq ss (ssget (list (list -3 (list app)))))
(if (not ss)
(princ "\nNo objects with xdata found.")
(progn
(setvar "CMDECHO" 0)
(command "._UNDO" "_Begin")
(repeat (setq i (sslength ss))
(xdmod (ssname ss (setq i (1- i))) app nil)
)
(command "._UNDO" "_En")
(princ
(strcat
"\nFound and removed xdata from "
(itoa (sslength ss))
" objects "
)
)
)
)
(princ)
)


;; (xdmod <ename> <appid> <xdata>)
;;
;; Modify an entity's xdata for a given
;; appid, without altering other xdata
;; of other appid's.
;;
;; <ename> = Entity name to modify
;; <appid> = (string) The xdata application name
;; <xdata> = list of xdata (without appid)
;;
;; Example:
;;
;; (xdmod
;; (entlast)
;; "TEST"
;; '( (1000 . "A string")
;; (1070 . 99)
;; (1040 . 1.666667)
;; )
;; )
;;
;; To remove the xdata for a given APPID, just
;; pass NIL in the <xdata> argument:
;;
;; (xdmod (entlast) "TEST" nil)
;;

(defun xdmod (ent appid xdata / d newxd)
(setq d (entget ent (list (strcat appid ",ACAD"))))
(setq newxd (list (cons appid xdata)))
(if (and (not xdata)
(/= (strcase appid) "ACAD")
(eq (cdr (assoc 0 d)) "DIMENSION")
(not (assoc "ACAD" (cdr (assoc -3 d))))
)
(setq newxd
(cons
'("ACAD" (1000 . "DSTYLE"))
newxd
)
)
)
(entmod (list (cons -1 ent) (cons -3 newxd)))
)

;; REMXDATA.LSP =====================================================

Scott Williams wrote:
>
> Does anyone have a program to strip xdata from entities? Your help would be
> greatly appreciated!
>
> Scott

--
/*********************************************************/
/* Tony Tanzillo Design Automation Consulting */
/* Programming & Customization for AutoCAD & Compatibles */
/* ----------------------------------------------------- */
/* tony.t...@worldnet.att.net */
/* http://ourworld.compuserve.com/homepages/tonyt */
/*********************************************************/

0 new messages