mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-05-16 10:54:53 +03:00
Data Exchange, IGES Export - Missing Model Curves in transfer cache #483
Check if the curve was already created and use it. Works for shared edges cases.
This commit is contained in:
parent
7aa85582ad
commit
3ee97f70d0
@ -317,6 +317,13 @@ Handle(IGESData_IGESEntity) BRepToIGESBRep_Entity::TransferShape(
|
|||||||
|
|
||||||
Handle(IGESData_IGESEntity) BRepToIGESBRep_Entity::TransferEdge(const TopoDS_Edge& myedge)
|
Handle(IGESData_IGESEntity) BRepToIGESBRep_Entity::TransferEdge(const TopoDS_Edge& myedge)
|
||||||
{
|
{
|
||||||
|
Standard_Integer anInd = IndexEdge(myedge);
|
||||||
|
if (anInd != 0)
|
||||||
|
{
|
||||||
|
Handle(IGESData_IGESEntity) ICurve3d = Handle(IGESData_IGESEntity)::DownCast(myCurves(anInd));
|
||||||
|
if (!ICurve3d.IsNull())
|
||||||
|
return ICurve3d;
|
||||||
|
}
|
||||||
BRepToIGES_BRWire BR(*this);
|
BRepToIGES_BRWire BR(*this);
|
||||||
BR.SetModel(GetModel());
|
BR.SetModel(GetModel());
|
||||||
TopTools_DataMapOfShapeShape anEmptyMap;
|
TopTools_DataMapOfShapeShape anEmptyMap;
|
||||||
|
@ -2,4 +2,5 @@
|
|||||||
set(OCCT_TKDEIGES_GTests_FILES_LOCATION "${CMAKE_CURRENT_LIST_DIR}")
|
set(OCCT_TKDEIGES_GTests_FILES_LOCATION "${CMAKE_CURRENT_LIST_DIR}")
|
||||||
|
|
||||||
set(OCCT_TKDEIGES_GTests_FILES
|
set(OCCT_TKDEIGES_GTests_FILES
|
||||||
|
IGESExportTest.cxx
|
||||||
)
|
)
|
||||||
|
54
src/DataExchange/TKDEIGES/GTests/IGESExportTest.cxx
Normal file
54
src/DataExchange/TKDEIGES/GTests/IGESExportTest.cxx
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
// Copyright (c) 2025 OPEN CASCADE SAS
|
||||||
|
//
|
||||||
|
// This file is part of Open CASCADE Technology software library.
|
||||||
|
//
|
||||||
|
// This library is free software; you can redistribute it and/or modify it under
|
||||||
|
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||||
|
// by the Free Software Foundation, with special exception defined in the file
|
||||||
|
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||||
|
// distribution for complete text of the license and disclaimer of any warranty.
|
||||||
|
//
|
||||||
|
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||||
|
// commercial license or contractual agreement.
|
||||||
|
|
||||||
|
#include <BRepPrimAPI_MakeBox.hxx>
|
||||||
|
#include <IGESData_IGESEntity.hxx>
|
||||||
|
#include <IGESData_IGESModel.hxx>
|
||||||
|
#include <IGESGeom_Line.hxx>
|
||||||
|
#include <IGESControl_Writer.hxx>
|
||||||
|
#include <Transfer_SimpleBinderOfTransient.hxx>
|
||||||
|
#include <Transfer_FinderProcess.hxx>
|
||||||
|
|
||||||
|
#include <gtest/gtest.h>
|
||||||
|
|
||||||
|
// Check that 2d curves of shared edges are not lost in BRep mode.
|
||||||
|
TEST(IGESExportTest, SharedCurvesBRepMode)
|
||||||
|
{
|
||||||
|
TopoDS_Shape aSolid = (TopoDS_Solid)BRepPrimAPI_MakeBox(gp_Pnt(0, 0, 0), 1, 1, 1);
|
||||||
|
|
||||||
|
Standard_Integer aBRepMode = 1;
|
||||||
|
IGESControl_Writer aWriter("MM", aBRepMode);
|
||||||
|
aWriter.AddShape(aSolid);
|
||||||
|
|
||||||
|
const Handle(Transfer_FinderProcess)& aFP = aWriter.TransferProcess();
|
||||||
|
const Handle(IGESData_IGESModel)& aModel = aWriter.Model();
|
||||||
|
|
||||||
|
for (Standard_Integer i = 1; i <= aFP->NbMapped(); i++)
|
||||||
|
{
|
||||||
|
Handle(Transfer_SimpleBinderOfTransient) aBinder =
|
||||||
|
Handle(Transfer_SimpleBinderOfTransient)::DownCast(aFP->MapItem(i));
|
||||||
|
if (aBinder.IsNull())
|
||||||
|
continue;
|
||||||
|
|
||||||
|
Handle(IGESData_IGESEntity) anEnt = Handle(IGESData_IGESEntity)::DownCast(aBinder->Result());
|
||||||
|
if (anEnt.IsNull())
|
||||||
|
continue;
|
||||||
|
|
||||||
|
Handle(IGESGeom_Line) aLine = Handle(IGESGeom_Line)::DownCast(anEnt);
|
||||||
|
if (aLine.IsNull())
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// Check that all the entities are in the model.
|
||||||
|
EXPECT_TRUE(aModel->DNum(anEnt) != 0);
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user