Attributes

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,
Andras Kiss

Stephane Routelous's picture

Hi Andras,

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,

Stephane
http://www.exotk.org

Andras's picture

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

Andras.

Stephane Routelous's picture

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,

Stephane

Andras's picture

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.

Andras.

Zsolt Draga's picture

Hello Andras,

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 dragazsolt@chello.hu cimre.

Üdv: Zsolt Drága