mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-03 17:56: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
|
||||
@ -814,42 +851,49 @@ Handle(Transfer_Binder) STEPControl_ActorWrite::TransferShape
|
||||
|
||||
// create a list of items to translate
|
||||
Handle(TopTools_HSequenceOfShape) RepItemSeq = new TopTools_HSequenceOfShape();
|
||||
|
||||
Standard_Boolean isSeparateVertices =
|
||||
|
||||
Standard_Boolean isSeparateVertices =
|
||||
Interface_Static::IVal("write.step.vertex.mode") == 0;//bug 23950
|
||||
// PTV 16.09.2002 OCC725 separate shape from solo vertices.
|
||||
Standard_Boolean isOnlyVertices = Standard_False;
|
||||
if (theShape.ShapeType() == TopAbs_COMPOUND) {
|
||||
Standard_Integer countVrtx = 0;
|
||||
Standard_Integer countSh = 0;
|
||||
if (theShape.ShapeType() == TopAbs_COMPOUND && isSeparateVertices)
|
||||
{
|
||||
TopoDS_Compound aNewShape, aCompOfVrtx;
|
||||
BRep_Builder aB;
|
||||
aB.MakeCompound(aNewShape);
|
||||
aB.MakeCompound(aCompOfVrtx);
|
||||
TopoDS_Iterator anCompIt(theShape);
|
||||
if (isSeparateVertices) {
|
||||
for (; anCompIt.More(); anCompIt.Next()) {
|
||||
TopoDS_Shape aCurSh = anCompIt.Value();
|
||||
if (aCurSh.ShapeType() != TopAbs_VERTEX) {
|
||||
aB.Add(aNewShape, aCurSh);
|
||||
countSh++;
|
||||
BRep_Builder aBuilder;
|
||||
aBuilder.MakeCompound(aNewShape);
|
||||
aBuilder.MakeCompound(aCompOfVrtx);
|
||||
TopTools_SequenceOfShape aVertices;
|
||||
isOnlyVertices = separateShapeToSoloVertex(theShape, aVertices);
|
||||
if (!isOnlyVertices)
|
||||
{
|
||||
for (TopoDS_Iterator anCompIt(theShape); anCompIt.More(); anCompIt.Next())
|
||||
{
|
||||
const TopoDS_Shape& aCurSh = anCompIt.Value();
|
||||
TopTools_SequenceOfShape aVerticesOfSubSh;
|
||||
if (separateShapeToSoloVertex(aCurSh, aVerticesOfSubSh))
|
||||
{
|
||||
aVertices.Append(aVerticesOfSubSh);
|
||||
}
|
||||
else {
|
||||
aB.Add(aCompOfVrtx, aCurSh);
|
||||
countVrtx++;
|
||||
else
|
||||
{
|
||||
aBuilder.Add(aNewShape, aCurSh);
|
||||
}
|
||||
}
|
||||
// replace the shapes
|
||||
if (countSh)
|
||||
theShape = aNewShape;
|
||||
if (countVrtx)
|
||||
RepItemSeq->Append(aCompOfVrtx);
|
||||
if (countSh == 0)
|
||||
isOnlyVertices = Standard_True;
|
||||
theShape = aNewShape;
|
||||
}
|
||||
}
|
||||
|
||||
if (theShape.ShapeType() == TopAbs_COMPOUND) {
|
||||
for (TopTools_HSequenceOfShape::Iterator anIterV(aVertices);
|
||||
anIterV.More(); anIterV.Next())
|
||||
{
|
||||
aBuilder.Add(aCompOfVrtx, anIterV.Value());
|
||||
}
|
||||
if (!aVertices.IsEmpty())
|
||||
{
|
||||
RepItemSeq->Append(aCompOfVrtx);
|
||||
}
|
||||
}
|
||||
|
||||
if (theShape.ShapeType() == TopAbs_COMPOUND)
|
||||
{
|
||||
TopExp_Explorer SolidExp, ShellExp, FaceExp;
|
||||
if (mymode != STEPControl_GeometricCurveSet) {
|
||||
for (SolidExp.Init(theShape, TopAbs_SOLID);
|
||||
|
@ -117,6 +117,15 @@ private:
|
||||
//! 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;
|
||||
|
||||
//! 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_Real mytoler;
|
||||
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