Archived issue #0030998
STEPCAFControl_Writer will not export shape with Identity Location if there are other partner shapes with diff Location.
Description
const Handle(ADVOCCT_OCAFApplication)& aApplication = getGlobalApplication();
Handle(TDocStd_Document) aXCAFDocument;
aApplication->NewDocument("BinXCAF", aXCAFDocument);
XCAFDoc_DocumentTool::Set(aXCAFDocument->Main());
Handle(XCAFDoc_ShapeTool) aShapeTool = XCAFDoc_DocumentTool::ShapeTool(aXCAFDocument->Main());
Handle(XCAFDoc_ColorTool) aColorTool = XCAFDoc_DocumentTool::ColorTool(aXCAFDocument->Main());
for(auto aIter= theGlobalObjectList; aIter->More(); aIter->Next())
{
TDF_Label aNewShape = aShapeTool->AddShape(aIter->Shape(), Standard_False, Standard_False);
Quantity_Color aColor(Quantity_NameOfColor(aIter->ColorLive()));
aColorTool->SetColor(aNewShape, aColor, XCAFDoc_ColorGen);
TDataStd_Name::Set(aNewShape, aIter->Name());
}
// Write out
STEPCAFControl_Writer aXCAFWriter;
aXCAFWriter.SetNameMode(Standard_True);
aXCAFWriter.SetColorMode(Standard_True);
aXCAFWriter.Transfer(aXCAFDocument);
aXCAFWriter.Write(theFilePath);
aApplication->Close(aXCAFDocument);
The uploaded files contain input file: "Attachment 4 (BREP)"
and output file: "Attachment 5 (STEP)"
NOTE: IGESCAFControl_Writer has the same issue.
Public activity
18 archived notes
Participants are labeled by their role within this record.
For processing.
In order to reproduce mentioned problem I have prepared Draw command with following code:
Handle(TDocStd_Document) aXCAFDocument = new TDocStd_Document("dummy");
XCAFDoc_DocumentTool::Set(aXCAFDocument->Main());
Handle(XCAFDoc_ShapeTool) aShapeTool = XCAFDoc_DocumentTool::ShapeTool(aXCAFDocument->Main());
TopoDS_Shape aSh;
BRep_Builder aB;
BRepTools::Read(aSh, "Attachment 4 (BREP)", aB);
TDF_Label aNewShape = aShapeTool->AddShape(aSh, Standard_False, Standard_False);
TDataStd_Name::Set(aNewShape, "TestSh");
STEPCAFControl_Writer aXCAFWriter;
aXCAFWriter.SetNameMode(Standard_True);
aXCAFWriter.Transfer(aXCAFDocument);
aXCAFWriter.Write("testres.stp");
After import a written STEP file ("testres.stp") we receive a good result (see attached image Attachment 6 (PNG)).
Handle(TDocStd_Document) aXCAFDocument = new TDocStd_Document("dummy");
XCAFDoc_DocumentTool::Set(aXCAFDocument->Main());
Handle(XCAFDoc_ShapeTool) aShapeTool = XCAFDoc_DocumentTool::ShapeTool(aXCAFDocument->Main());
TopoDS_Shape aSh;
BRep_Builder aB;
BRepTools::Read(aSh, "Attachment 4 (BREP)", aB);
TDF_Label aNewShape = aShapeTool->AddShape(aSh, Standard_False, Standard_False);
TDataStd_Name::Set(aNewShape, "TestSh");
STEPCAFControl_Writer aXCAFWriter;
aXCAFWriter.SetNameMode(Standard_True);
aXCAFWriter.Transfer(aXCAFDocument);
aXCAFWriter.Write("testres.stp");
After import a written STEP file ("testres.stp") we receive a good result (see attached image Attachment 6 (PNG)).
We can not reproduce this bug.
Please see our last comment and describe how we can reproduce mentioned problem.
Please see our last comment and describe how we can reproduce mentioned problem.
Dear skl, To reproduce the issue, you have to add sub-shapes using iterator. There are two shapes in the top one.
get two shapes: aSh1,aSha2
TDF_Label aNewShape = aShapeTool->AddShape(aSh1, Standard_False, Standard_False);
TDF_Label aNewShape = aShapeTool->AddShape(aSh2, Standard_False, Standard_False);
get two shapes: aSh1,aSha2
TDF_Label aNewShape = aShapeTool->AddShape(aSh1, Standard_False, Standard_False);
TDF_Label aNewShape = aShapeTool->AddShape(aSh2, Standard_False, Standard_False);
Dear bugmaster, please add attached file Attachment 3 (BREP) to repository.
Branch [archived branch] has been created by Participant.
[revision removed]
Detailed log of new commits:
Author: skl
Date: Tue Nov 3 15:18:44 2020 +0300
0030998: STEPCAFControl_Writer will not export shape with Identity Location if there are other partner shapes with diff Location.
Fix + 2 Draw tests.
[revision removed]
Detailed log of new commits:
Author: skl
Date: Tue Nov 3 15:18:44 2020 +0300
0030998: STEPCAFControl_Writer will not export shape with Identity Location if there are other partner shapes with diff Location.
Fix + 2 Draw tests.
is it possible to add this patch to version 7.5?
Branch [archived branch] has been updated forcibly by Participant.
[revision removed]
[revision removed]
Branch [archived branch] has been updated forcibly by Participant.
[revision removed]
[revision removed]
Branch [archived branch] has been updated forcibly by Participant.
[revision removed]
[revision removed]
Branch [archived branch] has been updated forcibly by Participant.
[revision removed]
[revision removed]
Branch [archived branch] has been created by Participant.
[revision removed]
Detailed log of new commits:
Author: skl
Date: Sat Nov 7 16:42:27 2020 +0300
0030998: STEPCAFControl_Writer will not export shape with Identity Location if there are other partner shapes with diff Location.
Fix + 2 tests.
[revision removed]
Detailed log of new commits:
Author: skl
Date: Sat Nov 7 16:42:27 2020 +0300
0030998: STEPCAFControl_Writer will not export shape with Identity Location if there are other partner shapes with diff Location.
Fix + 2 tests.
Branch [archived branch] has been updated forcibly by Participant.
[revision removed]
[revision removed]
Branch [archived branch] has been updated forcibly by Participant.
[revision removed]
[revision removed]
Dear Participant,
At present mentioned problem cannot be correctly solved within the existing structure of XCAF document. The satisfactory solution needs a change in conceptual approaches and cannot be implemented at this moment.
As workaround we can to suggest you to add whole compound to XCAF document or, if you needs to use iterator, check each shape before adding to the XCAF document and set location with default gp_Trsf if current shape hasn`t location.
We will not close this bug - we will simply postpone it until such fundamental changes becomes possible.
At present mentioned problem cannot be correctly solved within the existing structure of XCAF document. The satisfactory solution needs a change in conceptual approaches and cannot be implemented at this moment.
As workaround we can to suggest you to add whole compound to XCAF document or, if you needs to use iterator, check each shape before adding to the XCAF document and set location with default gp_Trsf if current shape hasn`t location.
We will not close this bug - we will simply postpone it until such fundamental changes becomes possible.
Dear skl,
Thanks for your suggesion. We did as the workaround with default gp_Trsf. Thanks for your hard working on this.
Thanks for your suggesion. We did as the workaround with default gp_Trsf. Thanks for your hard working on this.
Branch [archived branch] has been updated forcibly by Participant.
[revision removed]
[revision removed]
Branch [archived branch] has been updated forcibly by Participant.
[revision removed]
[revision removed]