1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-14 13:30:48 +03:00

0032666: Data Exchange - Cannot write STEP file from an XCAF document containing only triangulations in the faces

Added support of reading and writing of the triangulated_surface_set.
Prevented creation of tesselated geometry under the schemas different from AP242DIS.
test step_read corrected, switched parameter write.step.schema to AP242DIS in begin and back to AP214CD at the end
This commit is contained in:
dorlov
2022-11-21 18:13:43 +00:00
committed by ichesnok
parent 38581280d0
commit 58390c4eb1
26 changed files with 1343 additions and 548 deletions

View File

@@ -308,3 +308,5 @@ StepVisual_TessellatedWire.cxx
StepVisual_TessellatedWire.hxx
StepVisual_TriangulatedFace.cxx
StepVisual_TriangulatedFace.hxx
StepVisual_TriangulatedSurfaceSet.cxx
StepVisual_TriangulatedSurfaceSet.hxx

View File

@@ -23,7 +23,8 @@ IMPLEMENT_STANDARD_RTTIEXT(StepVisual_TriangulatedFace, StepVisual_TessellatedFa
//purpose :
//=======================================================================
StepVisual_TriangulatedFace::StepVisual_TriangulatedFace ()
StepVisual_TriangulatedFace::StepVisual_TriangulatedFace()
: StepVisual_TessellatedFace()
{
}

View File

@@ -32,7 +32,7 @@ class StepVisual_TriangulatedFace : public StepVisual_TessellatedFace
public :
//! default constructor
//! Default constructor
Standard_EXPORT StepVisual_TriangulatedFace();
//! Initialize all fields (own and inherited)

View File

@@ -0,0 +1,78 @@
// Copyright (c) Open CASCADE 2023
//
// 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 <StepVisual_TriangulatedSurfaceSet.hxx>
IMPLEMENT_STANDARD_RTTIEXT(StepVisual_TriangulatedSurfaceSet, StepVisual_TessellatedSurfaceSet)
//=======================================================================
//function : StepVisual_TriangulatedSurfaceSet
//purpose :
//=======================================================================
StepVisual_TriangulatedSurfaceSet::StepVisual_TriangulatedSurfaceSet()
{
}
//=======================================================================
//function : Init
//purpose :
//=======================================================================
void StepVisual_TriangulatedSurfaceSet::Init(const Handle(TCollection_HAsciiString)& theRepresentationItemName,
const Handle(StepVisual_CoordinatesList)& theTessellatedSurfaceSetCoordinates,
const Standard_Integer theTessellatedSurfaceSetPnmax,
const Handle(TColStd_HArray2OfReal)& theTessellatedSurfaceSetNormals,
const Handle(TColStd_HArray1OfInteger)& thePnindex,
const Handle(TColStd_HArray2OfInteger)& theTriangles)
{
StepVisual_TessellatedSurfaceSet::Init(theRepresentationItemName,
theTessellatedSurfaceSetCoordinates,
theTessellatedSurfaceSetPnmax,
theTessellatedSurfaceSetNormals);
myPnindex = thePnindex;
myTriangles = theTriangles;
}
//=======================================================================
//function : NbPnindex
//purpose :
//=======================================================================
Standard_Integer StepVisual_TriangulatedSurfaceSet::NbPnindex() const
{
if (myPnindex.IsNull())
{
return 0;
}
return myPnindex->Length();
}
//=======================================================================
//function : PnindexValue
//purpose :
//=======================================================================
Standard_Integer StepVisual_TriangulatedSurfaceSet::PnindexValue(const Standard_Integer theNum) const
{
return myPnindex->Value(theNum);
}
//=======================================================================
//function : NbTriangles
//purpose :
//=======================================================================
Standard_Integer StepVisual_TriangulatedSurfaceSet::NbTriangles() const
{
if (myTriangles.IsNull())
{
return 0;
}
return myTriangles->ColLength();
}

View File

@@ -0,0 +1,70 @@
// Copyright (c) Open CASCADE 2023
//
// 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.
#ifndef _StepVisual_TriangulatedSurfaceSet_HeaderFile_
#define _StepVisual_TriangulatedSurfaceSet_HeaderFile_
#include <Standard.hxx>
#include <StepVisual_TessellatedSurfaceSet.hxx>
#include <TColStd_HArray1OfInteger.hxx>
#include <TColStd_HArray2OfInteger.hxx>
//! Representation of STEP entity TriangulatedSurfaceSet
class StepVisual_TriangulatedSurfaceSet : public StepVisual_TessellatedSurfaceSet
{
public:
//! default constructor
Standard_EXPORT StepVisual_TriangulatedSurfaceSet();
//! Initialize all fields (own and inherited)
Standard_EXPORT void Init(const Handle(TCollection_HAsciiString)& theRepresentationItemName,
const Handle(StepVisual_CoordinatesList)& theTessellatedFaceCoordinates,
const Standard_Integer theTessellatedFacePnmax,
const Handle(TColStd_HArray2OfReal)& theTessellatedFaceNormals,
const Handle(TColStd_HArray1OfInteger)& thePnindex,
const Handle(TColStd_HArray2OfInteger)& theTriangles);
//! Returns field Pnindex
const Handle(TColStd_HArray1OfInteger) Pnindex() const { return myPnindex; }
//! Sets field Pnindex
void SetPnindex(const Handle(TColStd_HArray1OfInteger)& thePnindex) { myPnindex = thePnindex; }
//! Returns number of Pnindex
Standard_EXPORT Standard_Integer NbPnindex() const;
//! Returns value of Pnindex by its num
Standard_EXPORT Standard_Integer PnindexValue(const Standard_Integer theNum) const;
//! Returns field Triangles
const Handle(TColStd_HArray2OfInteger) Triangles() const { return myTriangles; }
//! Sets field Triangles
void SetTriangles(const Handle(TColStd_HArray2OfInteger)& theTriangles)
{
myTriangles = theTriangles;
}
//! Returns number of Triangles
Standard_EXPORT Standard_Integer NbTriangles() const;
DEFINE_STANDARD_RTTIEXT(StepVisual_TriangulatedSurfaceSet, StepVisual_TessellatedSurfaceSet)
private:
Handle(TColStd_HArray1OfInteger) myPnindex;
Handle(TColStd_HArray2OfInteger) myTriangles;
};
#endif // _StepVisual_TriangulatedSurfaceSet_HeaderFile_