Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Change appid on existing xdata

5 REPLIES 5
Reply
Message 1 of 6
Anonymous
478 Views, 5 Replies

Change appid on existing xdata

Hi there,

I am thinking about replacing the appid on xdata attached to block inserts
in legacy drawings. I want to match a new app name. Would some one care
share this experience or technique. I'd like to save programming effort for
more important chores.

It looks like if would go something like this.
If drawing contains old appid name, get all the blocks with this xdata.
Foreach block in the list, retrieve the assoc list and substitute the new
name for the old name, then entmod the block.

Jim
5 REPLIES 5
Message 2 of 6
Anonymous
in reply to: Anonymous

I think that would wind up with two XDATA lists attached to each entity.

For each insert in the list, entmod the insert with the old APPID and an
empty XDATA list, then entmod the insert with the new APPID and the non-empty
XDATA list.

jrf
Member of the Autodesk Discussion Forum Moderator Program
Please do not email questions unless you wish to hire my services

In article <2FCE9A454792DEAA74613A85BC2D80BA@in.WebX.maYIadrTaRb>, Jim Short
wrote:
> Hi there,
>
> I am thinking about replacing the appid on xdata attached to block inserts
> in legacy drawings. I want to match a new app name. Would some one care
> share this experience or technique. I'd like to save programming effort for
> more important chores.
>
> It looks like if would go something like this.
> If drawing contains old appid name, get all the blocks with this xdata.
> Foreach block in the list, retrieve the assoc list and substitute the new
> name for the old name, then entmod the block.
>
> Jim
>
Message 3 of 6
Anonymous
in reply to: Anonymous

John,
Thanks for your tip. I tried the empty list suggestion but maybe I didn't do
it right. It worked out for me that an entmod with the xdata stripped from
the elist cleared the xdata. Then I added new x-data with a new appid.

The routine attached is what I ended up with. Function has two arguments
that are not case sensitive: old and new appid names

(appid-update "OldName" "NewName")

Returns nil if no blocks to update otherwise the entmod elist. I include
some supporting functions and hope I covered all that were called.
Jim


"Jon Fleming" wrote in message
news:VA.00001127.0a343d46@fleming-group.com...
> I think that would wind up with two XDATA lists attached to each entity.
>
> For each insert in the list, entmod the insert with the old APPID and an
> empty XDATA list, then entmod the insert with the new APPID and the
non-empty
> XDATA list.
>
> jrf
> Member of the Autodesk Discussion Forum Moderator Program
> Please do not email questions unless you wish to hire my services
>
> In article <2FCE9A454792DEAA74613A85BC2D80BA@in.WebX.maYIadrTaRb>, Jim
Short
> wrote:
> > Hi there,
> >
> > I am thinking about replacing the appid on xdata attached to block
inserts
> > in legacy drawings. I want to match a new app name. Would some one care
> > share this experience or technique. I'd like to save programming effort
for
> > more important chores.
> >
> > It looks like if would go something like this.
> > If drawing contains old appid name, get all the blocks with this xdata.
> > Foreach block in the list, retrieve the assoc list and substitute the
new
> > name for the old name, then entmod the block.
> >
> > Jim
> >
>
>
Message 4 of 6
Anonymous
in reply to: Anonymous

A bit short a full load, I see that the code I posted still leaves the old
x-data attached.
I will get back when I know something.

"Jim Short" wrote in message
news:BBF0D7A86F051AF6791A8E590EBA44C1@in.WebX.maYIadrTaRb...
> John,
> Thanks for your tip. I tried the empty list suggestion but maybe I didn't
do
> it right. It worked out for me that an entmod with the xdata stripped from
> the elist cleared the xdata. Then I added new x-data with a new appid.
>
> The routine attached is what I ended up with. Function has two arguments
> that are not case sensitive: old and new appid names
>
> (appid-update "OldName" "NewName")
>
> Returns nil if no blocks to update otherwise the entmod elist. I include
> some supporting functions and hope I covered all that were called.
> Jim
>
>
> "Jon Fleming" wrote in message
> news:VA.00001127.0a343d46@fleming-group.com...
> > I think that would wind up with two XDATA lists attached to each entity.
> >
> > For each insert in the list, entmod the insert with the old APPID and an
> > empty XDATA list, then entmod the insert with the new APPID and the
> non-empty
> > XDATA list.
> >
> > jrf
> > Member of the Autodesk Discussion Forum Moderator Program
> > Please do not email questions unless you wish to hire my services
> >
> > In article <2FCE9A454792DEAA74613A85BC2D80BA@in.WebX.maYIadrTaRb>, Jim
> Short
> > wrote:
> > > Hi there,
> > >
> > > I am thinking about replacing the appid on xdata attached to block
> inserts
> > > in legacy drawings. I want to match a new app name. Would some one
care
> > > share this experience or technique. I'd like to save programming
effort
> for
> > > more important chores.
> > >
> > > It looks like if would go something like this.
> > > If drawing contains old appid name, get all the blocks with this
xdata.
> > > Foreach block in the list, retrieve the assoc list and substitute the
> new
> > > name for the old name, then entmod the block.
> > >
> > > Jim
> > >
> >
> >
>
>
Message 5 of 6
Anonymous
in reply to: Anonymous

I went back through some older messages and found that we're both on the
wrong path. You can do your change easily in a few lines of code. Just
change it in the APPID table! See this thread:

From: aberkey
Newsgroups: autodesk.autocad.customization
Subject: Rename Registered App
Date: Wed, 3 Oct 2001 16:46:48 -0700

Is there an easy way to rename an xdata registered application name
without having to re-create all the entities with the xdata of that
name? e.g. change (1001 . "NAME") to (1001 . "RENAME"). LISP or VBA.
Thanks.

From: Stephan Koster
Newsgroups: autodesk.autocad.customization
Subject: Re: Rename Registered App
Date: Thu, 4 Oct 2001 02:09:51 -0700

Try this:

;;; by Stephan Koster 2001
(defun rename-appid(oldname newname / ename o)
(and (not (tblsearch "appid" newname))
(setq ename (tblobjname "appid" oldname))
(setq o (vlax-ename->vla-object ename))
(not (vlax-put-property o 'Name newname))
(vlax-release-object o)
)
)

Stephan

From: "Cliff Middleton"
Newsgroups: autodesk.autocad.customization
Subject: Re: Rename Registered App
Date: Thu, 4 Oct 2001 04:39:44 -0700

Wouldn't you orphan any objects that have xdata registered under the old
name? I would think you'd have to get a selection set of all objects
having oldname xdata, remove its xdata, rename the xdata, and then
reattach it. Never tried it though, I may be out in left field here.

From: "Alex Januszkiewicz"
Newsgroups: autodesk.autocad.customization
Subject: Re: Rename Registered App
Date: Thu, 4 Oct 2001 11:21:29 -0700

In DWG file regapp name is stored only once in AcDbRegAppTableRecord,
all entities that have extended data attached refer to this record via
pointer. When entget returns the object list to lisp, it copies the name
of regapp from the record, much the same as it does it with name of the
layer in the same list. So renaming regapp in one place works (same as
renaming the layer, linetype and other symbols). ARX has the function
for all symbol tables, including RegApp that can be used to rename the
table record (provided the name is legal and not used yet):

Acad::ErrorStatus AcDbSymbolTableRecord::setName(const char* pName)

--
Alex Januszkiewicz
IntelCAD Systems / DWG Data Recovery Services
Autodesk Authorized Developer
http://www.intelcad.com
* BLITZ! - Standalone Tools For Processing DWG/DXF *
* DWF => DWG converter for AutoCAD 2000(i)*
--

jrf
Member of the Autodesk Discussion Forum Moderator Program
Please do not email questions unless you wish to hire my services
Message 6 of 6
Anonymous
in reply to: Anonymous

John,
That does look interesting! I am stashing it for future ref. In the mean
time the code snippet below removes the xdata from an entity:

(entmod (list (cons -1 ename) (list -3 (list appid))))

Anyone wishing to use the code previously attached should replace the remove
if with this.

Jim

"Jon Fleming" wrote in message
news:VA.0000112a.0f3303ea@fleming-group.com...
> I went back through some older messages and found that we're both on the
> wrong path. You can do your change easily in a few lines of code. Just
> change it in the APPID table! See this thread:
>
> From: aberkey
> Newsgroups: autodesk.autocad.customization
> Subject: Rename Registered App
> Date: Wed, 3 Oct 2001 16:46:48 -0700
>
> Is there an easy way to rename an xdata registered application name
> without having to re-create all the entities with the xdata of that
> name? e.g. change (1001 . "NAME") to (1001 . "RENAME"). LISP or VBA.
> Thanks.
>
> From: Stephan Koster
> Newsgroups: autodesk.autocad.customization
> Subject: Re: Rename Registered App
> Date: Thu, 4 Oct 2001 02:09:51 -0700
>
> Try this:
>
> ;;; by Stephan Koster 2001
> (defun rename-appid(oldname newname / ename o)
> (and (not (tblsearch "appid" newname))
> (setq ename (tblobjname "appid" oldname))
> (setq o (vlax-ename->vla-object ename))
> (not (vlax-put-property o 'Name newname))
> (vlax-release-object o)
> )
> )
>
> Stephan
>
> From: "Cliff Middleton"
> Newsgroups: autodesk.autocad.customization
> Subject: Re: Rename Registered App
> Date: Thu, 4 Oct 2001 04:39:44 -0700
>
> Wouldn't you orphan any objects that have xdata registered under the old
> name? I would think you'd have to get a selection set of all objects
> having oldname xdata, remove its xdata, rename the xdata, and then
> reattach it. Never tried it though, I may be out in left field here.
>
> From: "Alex Januszkiewicz"
> Newsgroups: autodesk.autocad.customization
> Subject: Re: Rename Registered App
> Date: Thu, 4 Oct 2001 11:21:29 -0700
>
> In DWG file regapp name is stored only once in AcDbRegAppTableRecord,
> all entities that have extended data attached refer to this record via
> pointer. When entget returns the object list to lisp, it copies the name
> of regapp from the record, much the same as it does it with name of the
> layer in the same list. So renaming regapp in one place works (same as
> renaming the layer, linetype and other symbols). ARX has the function
> for all symbol tables, including RegApp that can be used to rename the
> table record (provided the name is legal and not used yet):
>
> Acad::ErrorStatus AcDbSymbolTableRecord::setName(const char* pName)
>
> --
> Alex Januszkiewicz
> IntelCAD Systems / DWG Data Recovery Services
> Autodesk Authorized Developer
> http://www.intelcad.com
> * BLITZ! - Standalone Tools For Processing DWG/DXF *
> * DWF => DWG converter for AutoCAD 2000(i)*
> --
>
> jrf
> Member of the Autodesk Discussion Forum Moderator Program
> Please do not email questions unless you wish to hire my services
>
>
>

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost