Best place for xdata

Best place for xdata

Anonymous
Not applicable
363 Views
9 Replies
Message 1 of 10

Best place for xdata

Anonymous
Not applicable
Hi all.

I have an application which needs to save its data into the AutoCAD file.
The data is basically a long list, which is made up of other nested lists.
It can be of variable length.

I've read the xdata stuff in the ACG, but I have a couple of outstanding
questions.

1) What is the best entity to attach the xdata to ? I need to be able to
hide the entity from the user, stop him/her from deleting it and it must
survive between sessions. I would guess it should be a block insertion, but
can I create an "empty", unselectable block ?

2) I understand that the data should be an association list. However, in my
case this seems unecessary - I could just add (-3 (the big list)) to the
end. Is this a bad idea ?

Thanks

Andy
0 Likes
364 Views
9 Replies
Replies (9)
Message 1 of 10

Anonymous
Not applicable
Hi all.

I have an application which needs to save its data into the AutoCAD file.
The data is basically a long list, which is made up of other nested lists.
It can be of variable length.

I've read the xdata stuff in the ACG, but I have a couple of outstanding
questions.

1) What is the best entity to attach the xdata to ? I need to be able to
hide the entity from the user, stop him/her from deleting it and it must
survive between sessions. I would guess it should be a block insertion, but
can I create an "empty", unselectable block ?

2) I understand that the data should be an association list. However, in my
case this seems unecessary - I could just add (-3 (the big list)) to the
end. Is this a bad idea ?

Thanks

Andy
0 Likes
Message 3 of 10

Anonymous
Not applicable
Andrew,
1) You can have a blank unselectable block.
e.g. start a new dwg with no template & save as XYX.DWG.
Your program can insert XYZ.DWG as a block insert
and then attach extended entity data to this block insert.
The user can't pick the block insert because it has no graphical
entities to select.
The problem you have to deal with is what happens when a dwg file
containing this block is inserted as a block or an exploded block
into another dwg.
2) Use an association list if the data that is dependant on position, scale
factor etc.
Regards Ian

IAndrew le Bihan wrote in message ...
>Hi all.
>
>I have an application which needs to save its data into the AutoCAD file.
>The data is basically a long list, which is made up of other nested lists.
>It can be of variable length.
>
>I've read the xdata stuff in the ACG, but I have a couple of outstanding
>questions.
>
>1) What is the best entity to attach the xdata to ? I need to be able to
>hide the entity from the user, stop him/her from deleting it and it must
>survive between sessions. I would guess it should be a block insertion,
but
>can I create an "empty", unselectable block ?
>
>2) I understand that the data should be an association list. However, in
my
>case this seems unecessary - I could just add (-3 (the big list)) to the
>end. Is this a bad idea ?
>
>Thanks
>
>Andy
>
0 Likes
Message 4 of 10

Anonymous
Not applicable
Andy,

Have you considered using a dictionary to store this information? Its
probably easier to set up and to maintain the data. keep and theres more
flexibility in the amount of data that you can store.
"Andrew le Bihan" wrote in message
news:[email protected]...
> Hi all.
>
> I have an application which needs to save its data into the AutoCAD file.
> The data is basically a long list, which is made up of other nested lists.
> It can be of variable length.
>
> I've read the xdata stuff in the ACG, but I have a couple of outstanding
> questions.
>
> 1) What is the best entity to attach the xdata to ? I need to be able to
> hide the entity from the user, stop him/her from deleting it and it must
> survive between sessions. I would guess it should be a block insertion,
but
> can I create an "empty", unselectable block ?
>
> 2) I understand that the data should be an association list. However, in
my
> case this seems unecessary - I could just add (-3 (the big list)) to the
> end. Is this a bad idea ?
>
> Thanks
>
> Andy
>
0 Likes
Message 5 of 10

Anonymous
Not applicable
Andrew,

Extended entitiy data has a limit of 16,383 bytes so if the list of xdata
you plan to store can concievably become larger than this you should put the
data in a dictionary.

--

Cliff

Andrew le Bihan wrote in message
news:[email protected]...
| Hi all.
|
| I have an application which needs to save its data into the AutoCAD file.
| The data is basically a long list, which is made up of other nested lists.
| It can be of variable length.
|
| I've read the xdata stuff in the ACG, but I have a couple of outstanding
| questions.
|
| 1) What is the best entity to attach the xdata to ? I need to be able to
| hide the entity from the user, stop him/her from deleting it and it must
| survive between sessions. I would guess it should be a block insertion,
but
| can I create an "empty", unselectable block ?
|
| 2) I understand that the data should be an association list. However, in
my
| case this seems unecessary - I could just add (-3 (the big list)) to the
| end. Is this a bad idea ?
|
| Thanks
|
| Andy
|
0 Likes
Message 6 of 10

Anonymous
Not applicable
I would recommend a dictionary also but if you must use XDATA, layer 0 works
great.

-mjm
"Cliff Middleton" wrote in message
news:[email protected]...
> Andrew,
>
> Extended entitiy data has a limit of 16,383 bytes so if the list of xdata
> you plan to store can concievably become larger than this you should put
the
> data in a dictionary.
>
> --
>
> Cliff
>
> Andrew le Bihan wrote in message
> news:[email protected]...
> | Hi all.
> |
> | I have an application which needs to save its data into the AutoCAD
file.
> | The data is basically a long list, which is made up of other nested
lists.
> | It can be of variable length.
> |
> | I've read the xdata stuff in the ACG, but I have a couple of outstanding
> | questions.
> |
> | 1) What is the best entity to attach the xdata to ? I need to be able
to
> | hide the entity from the user, stop him/her from deleting it and it must
> | survive between sessions. I would guess it should be a block insertion,
> but
> | can I create an "empty", unselectable block ?
> |
> | 2) I understand that the data should be an association list. However,
in
> my
> | case this seems unecessary - I could just add (-3 (the big list)) to the
> | end. Is this a bad idea ?
> |
> | Thanks
> |
> | Andy
> |
>
0 Likes
Message 7 of 10

Anonymous
Not applicable
I don't know if this applies in 2000, but custom dictionaries are lost when
wblocking an R14 drawing.

Mark
0 Likes
Message 8 of 10

Anonymous
Not applicable
If you use xdata, how about an empty text entity (no text, and not visible).

-Steve

michael montagne wrote:

> I would recommend a dictionary also but if you must use XDATA, layer 0 works
> great.
>
> -mjm
> "Cliff Middleton" wrote in message
> news:[email protected]...
> > Andrew,
> >
> > Extended entitiy data has a limit of 16,383 bytes so if the list of xdata
> > you plan to store can concievably become larger than this you should put
> the
> > data in a dictionary.
> >
> > --
> >
> > Cliff
> >
> > Andrew le Bihan wrote in message
> > news:[email protected]...
> > | Hi all.
> > |
> > | I have an application which needs to save its data into the AutoCAD
> file.
> > | The data is basically a long list, which is made up of other nested
> lists.
> > | It can be of variable length.
> > |
> > | I've read the xdata stuff in the ACG, but I have a couple of outstanding
> > | questions.
> > |
> > | 1) What is the best entity to attach the xdata to ? I need to be able
> to
> > | hide the entity from the user, stop him/her from deleting it and it must
> > | survive between sessions. I would guess it should be a block insertion,
> > but
> > | can I create an "empty", unselectable block ?
> > |
> > | 2) I understand that the data should be an association list. However,
> in
> > my
> > | case this seems unecessary - I could just add (-3 (the big list)) to the
> > | end. Is this a bad idea ?
> > |
> > | Thanks
> > |
> > | Andy
> > |
> >
0 Likes
Message 9 of 10

Anonymous
Not applicable
Andrew,

Please see our TechCenter website (URL below). In the Xdata section, there are
two functions : (XD_ReadX....) and (XD_WriteX...) which will allow you to save
and retrieve any xdata (included deepely nested lists fo complex data types).
Let me know if you need he;lp.

Regards
Rakesh

Andrew le Bihan wrote:

> Hi all.
>
> I have an application which needs to save its data into the AutoCAD file.
> The data is basically a long list, which is made up of other nested lists.
> It can be of variable length.
>
> I've read the xdata stuff in the ACG, but I have a couple of outstanding
> questions.
>
> 1) What is the best entity to attach the xdata to ? I need to be able to
> hide the entity from the user, stop him/her from deleting it and it must
> survive between sessions. I would guess it should be a block insertion, but
> can I create an "empty", unselectable block ?
>
> 2) I understand that the data should be an association list. However, in my
> case this seems unecessary - I could just add (-3 (the big list)) to the
> end. Is this a bad idea ?
>
> Thanks
>
> Andy

--
-----------------------------------------------
Four Dimension Technologies, Singapore

AutoCAD application development & customization
GIS/CAD Implementation & support
Technical & Geographic data processing

TechCenter URL: http://www.4d-technologies.com/techcenter
URL : http://www.4d-technologies.com
Member of the Autodesk Developer Network(ADN)
------------------------------------------------
0 Likes
Message 10 of 10

Anonymous
Not applicable
Thanks everyone for all the help. I have coded the thing as an association
list tagged onto a block insertion - this is working fine. I'm not too
worried about the xdata limits (my most complex test drawing took up
2000bytes).

Rakesh - thanks, but I'd already written the code before your reply ! I
will dig deeper into your site though - it looks very interesting.

Andy
0 Likes