mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-10 18:51:21 +03:00
0033053: Data Exchange, Step Export - Compound with vertex is ignored
Fixed problem with deep compound including with vertex group.
This commit is contained in:
parent
7aaed2ce3b
commit
acac44d571
@ -341,6 +341,43 @@ void STEPControl_ActorWrite::mergeInfoForNM(const Handle(Transfer_FinderProcess)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : separateShapeToSoloVertex
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
Standard_Boolean STEPControl_ActorWrite::separateShapeToSoloVertex(const TopoDS_Shape& theShape,
|
||||||
|
TopTools_SequenceOfShape& theVertices)
|
||||||
|
{
|
||||||
|
if (theShape.IsNull())
|
||||||
|
{
|
||||||
|
return Standard_False;
|
||||||
|
}
|
||||||
|
switch (theShape.ShapeType())
|
||||||
|
{
|
||||||
|
case TopAbs_COMPOUND:
|
||||||
|
{
|
||||||
|
for (TopoDS_Iterator anIter(theShape); anIter.More(); anIter.Next())
|
||||||
|
{
|
||||||
|
if (!separateShapeToSoloVertex(anIter.Value(), theVertices))
|
||||||
|
{
|
||||||
|
return Standard_False;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case TopAbs_VERTEX:
|
||||||
|
{
|
||||||
|
theVertices.Append(theShape);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
theVertices.Clear();
|
||||||
|
return Standard_False;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Standard_True;
|
||||||
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : SetMode
|
//function : SetMode
|
||||||
@ -819,37 +856,44 @@ Handle(Transfer_Binder) STEPControl_ActorWrite::TransferShape
|
|||||||
Interface_Static::IVal("write.step.vertex.mode") == 0;//bug 23950
|
Interface_Static::IVal("write.step.vertex.mode") == 0;//bug 23950
|
||||||
// PTV 16.09.2002 OCC725 separate shape from solo vertices.
|
// PTV 16.09.2002 OCC725 separate shape from solo vertices.
|
||||||
Standard_Boolean isOnlyVertices = Standard_False;
|
Standard_Boolean isOnlyVertices = Standard_False;
|
||||||
if (theShape.ShapeType() == TopAbs_COMPOUND) {
|
if (theShape.ShapeType() == TopAbs_COMPOUND && isSeparateVertices)
|
||||||
Standard_Integer countVrtx = 0;
|
{
|
||||||
Standard_Integer countSh = 0;
|
|
||||||
TopoDS_Compound aNewShape, aCompOfVrtx;
|
TopoDS_Compound aNewShape, aCompOfVrtx;
|
||||||
BRep_Builder aB;
|
BRep_Builder aBuilder;
|
||||||
aB.MakeCompound(aNewShape);
|
aBuilder.MakeCompound(aNewShape);
|
||||||
aB.MakeCompound(aCompOfVrtx);
|
aBuilder.MakeCompound(aCompOfVrtx);
|
||||||
TopoDS_Iterator anCompIt(theShape);
|
TopTools_SequenceOfShape aVertices;
|
||||||
if (isSeparateVertices) {
|
isOnlyVertices = separateShapeToSoloVertex(theShape, aVertices);
|
||||||
for (; anCompIt.More(); anCompIt.Next()) {
|
if (!isOnlyVertices)
|
||||||
TopoDS_Shape aCurSh = anCompIt.Value();
|
{
|
||||||
if (aCurSh.ShapeType() != TopAbs_VERTEX) {
|
for (TopoDS_Iterator anCompIt(theShape); anCompIt.More(); anCompIt.Next())
|
||||||
aB.Add(aNewShape, aCurSh);
|
{
|
||||||
countSh++;
|
const TopoDS_Shape& aCurSh = anCompIt.Value();
|
||||||
|
TopTools_SequenceOfShape aVerticesOfSubSh;
|
||||||
|
if (separateShapeToSoloVertex(aCurSh, aVerticesOfSubSh))
|
||||||
|
{
|
||||||
|
aVertices.Append(aVerticesOfSubSh);
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
aB.Add(aCompOfVrtx, aCurSh);
|
{
|
||||||
countVrtx++;
|
aBuilder.Add(aNewShape, aCurSh);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// replace the shapes
|
theShape = aNewShape;
|
||||||
if (countSh)
|
}
|
||||||
theShape = aNewShape;
|
for (TopTools_HSequenceOfShape::Iterator anIterV(aVertices);
|
||||||
if (countVrtx)
|
anIterV.More(); anIterV.Next())
|
||||||
RepItemSeq->Append(aCompOfVrtx);
|
{
|
||||||
if (countSh == 0)
|
aBuilder.Add(aCompOfVrtx, anIterV.Value());
|
||||||
isOnlyVertices = Standard_True;
|
}
|
||||||
|
if (!aVertices.IsEmpty())
|
||||||
|
{
|
||||||
|
RepItemSeq->Append(aCompOfVrtx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (theShape.ShapeType() == TopAbs_COMPOUND) {
|
if (theShape.ShapeType() == TopAbs_COMPOUND)
|
||||||
|
{
|
||||||
TopExp_Explorer SolidExp, ShellExp, FaceExp;
|
TopExp_Explorer SolidExp, ShellExp, FaceExp;
|
||||||
if (mymode != STEPControl_GeometricCurveSet) {
|
if (mymode != STEPControl_GeometricCurveSet) {
|
||||||
for (SolidExp.Init(theShape, TopAbs_SOLID);
|
for (SolidExp.Init(theShape, TopAbs_SOLID);
|
||||||
|
@ -117,6 +117,15 @@ private:
|
|||||||
//! bind already written shared faces to STEP entity for non-manifold
|
//! bind already written shared faces to STEP entity for non-manifold
|
||||||
Standard_EXPORT void mergeInfoForNM(const Handle(Transfer_FinderProcess)& theFP, const Handle(Standard_Transient) &theInfo) const;
|
Standard_EXPORT void mergeInfoForNM(const Handle(Transfer_FinderProcess)& theFP, const Handle(Standard_Transient) &theInfo) const;
|
||||||
|
|
||||||
|
//! Gets sequence of vertices of all compounds level by recursive
|
||||||
|
//! @param[in] theShape shape to iterate, checked for compound type and sub shapes vertex type
|
||||||
|
//! @param[out] theVertices sequence of found vertices via recursively iterate of shape
|
||||||
|
//! @return TRUE if one or more vertex was found and all shapes were compound or vertex
|
||||||
|
Standard_Boolean separateShapeToSoloVertex(const TopoDS_Shape& theShape,
|
||||||
|
TopTools_SequenceOfShape& theVertices);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Standard_Integer mygroup;
|
Standard_Integer mygroup;
|
||||||
Standard_Real mytoler;
|
Standard_Real mytoler;
|
||||||
STEPConstruct_ContextTool myContext;
|
STEPConstruct_ContextTool myContext;
|
||||||
|
23
tests/bugs/step/bug33053
Normal file
23
tests/bugs/step/bug33053
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
puts "===================================="
|
||||||
|
puts "0033053: Data Exchange, Step Export - Compound with vertex is ignored"
|
||||||
|
puts "===================================="
|
||||||
|
puts ""
|
||||||
|
|
||||||
|
pload OCAF
|
||||||
|
|
||||||
|
Close D_orig -silent
|
||||||
|
Close D_comp -silent
|
||||||
|
|
||||||
|
ReadStep D_orig [locate_data_file bug33053_shapes_2d.stp]
|
||||||
|
|
||||||
|
WriteStep D_orig $imagedir/${casename}_D.stp
|
||||||
|
|
||||||
|
ReadStep D_comp $imagedir/${casename}_D.stp
|
||||||
|
|
||||||
|
file delete $imagedir/${casename}_D.stp
|
||||||
|
|
||||||
|
XGetOneShape orig D_orig
|
||||||
|
XGetOneShape comp D_comp
|
||||||
|
|
||||||
|
checkshape comp
|
||||||
|
checknbshapes orig -ref [nbshapes comp]
|
Loading…
x
Reference in New Issue
Block a user