Forum archiveIssue archiveOther usage issues

Archived discussion

Attributes

Other usage issuesTue, 08/03/2004 - 23:575 replies

Browse this forum
QuestionAuthor

Hi everybody,

I wonder if there is any solution to attach a simple attribute to any TopoDS_Shape, without using OCAF? Let's suppose that we have a simple, viewer type application, which doesn't support OCAF and I want to attach some simple type of attributes like: string, integer, double etc.

Thank's in advance,
Author Kiss

Discussion

5 archived replies

Posts are displayed in their archived order.

01Commenter-1

Hi Author,

I'm not 100% sure but :
you can attach attributes to a shape inside an application (as long as your shape is in memory) using for example a std::map or its OCC equivalent.
The problem is if you want to save this information. I think, whithout OCAF, you have no way to associate something to a shape in the .brep file.
The only way is to modify the code used for reading/writing shapes.

BTW, I'm planning to do that in exoTKAD.

HTH,

Commenter-1
http://www.exotk.org

02Author

Thanks. This should be a "good" solution, but what if my attribute is a more complex one. Let's say it's a struct.

Author.

03Commenter-1

about the struct 2 solutions :
1/ you decompose your struct into basic types (int, double, char* ) and you save them all in the file.
2/ you serialize your struct into a string with a separator like :
struct mystruct
{
bool b;
int i;
double d;
strng s;
};
give "true@!@2@!@3.141592654@!@this is a string" with "@!@" as separator.
when you read it, you tokenize your string according to the separator and get all what you need.

HTH,

Commenter-1

04Author

Another question. This time very "off topic". Do you know how can I subscribe myself to this list? I changed my mail address and I want to receive the mailing list to my new address, but I dont find any info on how should I subscribe.

Author.

05Commenter-2

Hello Author,

Szeretném veled felvenni a kapcsolatot munka ügyben. Megtudnád adni az e-mail cimmed. Magyarországon laksz?
Légy szives küld el az e-mail cimmed a [email removed] cimre.

Üdv: Commenter-2 Drága