[Bug report + patch] TNaming_NamedShape with TNaming_REPLACE status

Hello,

I have noticed that copying labels having TNaming_NamedShape attribute with TNaming_REPLACE evolution attached fails.

To fix this bug the processing of TNaming_REPLACE must be added to
- TNaming_NamedShape::Paste and
- LoadNamedShape

The patch below was made for OCC6.3.0. However, the problem exists also in OCC5.2 and 6.5.0 (at least, I haven't checked any others).

Pawel

Index: TNaming_NamedShape.cxx
===================================================================
--- TNaming_NamedShape.cxx
+++ TNaming_NamedShape.cxx
@@ -526,6 +526,13 @@
B.Select(copNS,copOS);
break;
}
+ //Kowalski - 26.05.2011
+ case TNaming_REPLACE :
+ {
+ B.Replace(copOS,copNS);
+ break;
+ }
+ //===

default:
break;

Index: TNaming.cxx
===================================================================
--- TNaming.cxx
+++ TNaming.cxx
@@ -335,7 +335,15 @@
case TNaming_SELECTED :
{
B.Select(NS,OS);
+ break; //Kowalski - 26.05.2011
}
+ //Kowalski - 26.05.2011
+ case TNaming_REPLACE :
+ {
+ B.Replace(OS,NS);
+ break;
+ }
+ //===
default:
break;
}

Forum supervisor's picture

Hi Pawel,
I would like to inform you that it is rather bug of documentation, because evolution TNaming_REPLACE of NamedShape is not yet implemented in OCAF component of OCCT (it is not cpmpleted). And we don't recommend to use it.
As result your patch has no sense, because it can't be regenerated by Naming algorithm.
At the moment the next evolutions are supported only (see paragraph "5. 2. 1 Registering shapes and their evolution" of Application Framework User's Guide):
- PRIMITIVE
- GENERATED
- MODIFY
- DELETE,
- SELECTED
Regards

Pawel's picture

Dear Forum supervisor,

thank you for your comment!

Indeed, the documentation does not mention supporting TNaming_REPLACE.

As we have a lot of legacy data having NamedShapes with TNaming_REPLACE evolution, could you please explain what you mean by "the patch can't be regenerated by Naming algorithm" and how it can be observed? Browsing the code of the TNaming package I couldn't find any other places where TNaming_REPLACE is omitted.

Thank you
Pawel

Forum supervisor's picture

Dear Pawel,
You can find some general information at the paragraph "8. 2 Services provided" of OCAF User's Guide. Several words below to make it more clear.
There is only one client on Naming evolution in OCCT. It is the Naming algorithm covered by 3 top classes: TNaming_Selector, TNaming_Naming and TNaming_Name. It is necessary only if you are designing parametric CAD system. If not, i.e you don't track history of modifications, you may name it as PRIMITIVE.
Regards

Pawel's picture

Thank you!