Fix for the "0020750: EDF 1296 GEOM: Naming during STEP import" issue.

This commit is contained in:
ana 2012-03-15 13:49:46 +00:00
parent 311af584c2
commit 9b14149777

View File

@ -53,6 +53,8 @@
#include <TopoDS_Compound.hxx> #include <TopoDS_Compound.hxx>
#include <TopoDS_Shape.hxx> #include <TopoDS_Shape.hxx>
#include <TDF_Label.hxx> #include <TDF_Label.hxx>
#include <TDF_ChildIDIterator.hxx>
#include <TNaming_NamedShape.hxx>
#include <TDF_Tool.hxx> #include <TDF_Tool.hxx>
#include <Interface_Static.hxx> #include <Interface_Static.hxx>
@ -232,14 +234,29 @@ extern "C"
{ {
TopoDS_Shape aSub = anIndices.FindKey(isub); TopoDS_Shape aSub = anIndices.FindKey(isub);
if (aSub.IsPartner(S)) { if (aSub.IsPartner(S)) {
// create label and set shape
TDF_Label L; TDF_Label L;
TDF_TagSource aTag; if (enti->IsKind(tGeom)) {
L = aTag.NewChild(theShapeLabel); // check all named shapes using iterator
TNaming_Builder tnBuild (L); TDF_ChildIDIterator anIt (theShapeLabel, TDataStd_Name::GetID(), Standard_True);
//tnBuild.Generated(S); for (; anIt.More(); anIt.Next()) {
tnBuild.Generated(aSub); Handle(TDataStd_Name) nameAttr =
Handle(TDataStd_Name)::DownCast(anIt.Value());
if (nameAttr.IsNull()) continue;
TDF_Label Lab = nameAttr->Label();
Handle(TNaming_NamedShape) shAttr;
if (Lab.FindAttribute(TNaming_NamedShape::GetID(), shAttr) && shAttr->Get().IsEqual(aSub))
L = Lab;
}
}
// create label and set shape
if (L.IsNull())
{
TDF_TagSource aTag;
L = aTag.NewChild(theShapeLabel);
TNaming_Builder tnBuild (L);
//tnBuild.Generated(S);
tnBuild.Generated(aSub);
}
// set a name // set a name
TDataStd_Name::Set(L, aNameExt); TDataStd_Name::Set(L, aNameExt);
} }