mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-10 18:51:21 +03:00
0029391: Invalid import of TrimmedSurface
Fix and test for bug 29391.
This commit is contained in:
parent
d9f2bc6b08
commit
153fee015d
@ -32,6 +32,7 @@
|
|||||||
#include <BRep_Builder.hxx>
|
#include <BRep_Builder.hxx>
|
||||||
#include <BRep_Tool.hxx>
|
#include <BRep_Tool.hxx>
|
||||||
#include <BRepAdaptor_Curve.hxx>
|
#include <BRepAdaptor_Curve.hxx>
|
||||||
|
#include <BRepBuilderAPI_GTransform.hxx>
|
||||||
#include <BRepBuilderAPI_MakeFace.hxx>
|
#include <BRepBuilderAPI_MakeFace.hxx>
|
||||||
#include <BRepFill.hxx>
|
#include <BRepFill.hxx>
|
||||||
#include <BRepGProp.hxx>
|
#include <BRepGProp.hxx>
|
||||||
@ -83,6 +84,7 @@
|
|||||||
#include <IGESData_IGESEntity.hxx>
|
#include <IGESData_IGESEntity.hxx>
|
||||||
#include <IGESData_IGESModel.hxx>
|
#include <IGESData_IGESModel.hxx>
|
||||||
#include <IGESData_ToolLocation.hxx>
|
#include <IGESData_ToolLocation.hxx>
|
||||||
|
#include <IGESData_TransfEntity.hxx>
|
||||||
#include <IGESGeom_BoundedSurface.hxx>
|
#include <IGESGeom_BoundedSurface.hxx>
|
||||||
#include <IGESGeom_BSplineSurface.hxx>
|
#include <IGESGeom_BSplineSurface.hxx>
|
||||||
#include <IGESGeom_CircularArc.hxx>
|
#include <IGESGeom_CircularArc.hxx>
|
||||||
@ -1223,6 +1225,42 @@ TopoDS_Shape IGESToBRep_TopoSurface::TransferTrimmedSurface
|
|||||||
for (Standard_Integer i = 1; i <= st->NbInnerContours(); i++) {
|
for (Standard_Integer i = 1; i <= st->NbInnerContours(); i++) {
|
||||||
TopoDS_Shape myshape2 = TC.TransferCurveOnFace (face, st->InnerContour(i), trans, uFact, Standard_False);
|
TopoDS_Shape myshape2 = TC.TransferCurveOnFace (face, st->InnerContour(i), trans, uFact, Standard_False);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Handle(IGESData_TransfEntity) aTransf = st->Transf();
|
||||||
|
if (!aTransf.IsNull()) {
|
||||||
|
// make transformation
|
||||||
|
gp_GTrsf aGT = aTransf->Value();
|
||||||
|
gp_XYZ aTrans = aGT.TranslationPart();
|
||||||
|
gp_Mat aMat = aGT.VectorialPart();
|
||||||
|
Standard_Real s1 = aMat.Value(1, 1)*aMat.Value(1, 1) + aMat.Value(2, 1)*aMat.Value(2, 1) + aMat.Value(3, 1)*aMat.Value(3, 1);
|
||||||
|
Standard_Real s2 = aMat.Value(1, 2)*aMat.Value(1, 2) + aMat.Value(2, 2)*aMat.Value(2, 2) + aMat.Value(3, 2)*aMat.Value(3, 2);
|
||||||
|
Standard_Real s3 = aMat.Value(1, 3)*aMat.Value(1, 3) + aMat.Value(2, 3)*aMat.Value(2, 3) + aMat.Value(3, 3)*aMat.Value(3, 3);
|
||||||
|
if (fabs(s1 - s2) > Precision::Confusion() || fabs(s1 - s3) > Precision::Confusion()) {
|
||||||
|
BRepBuilderAPI_GTransform aTransform(aGT);
|
||||||
|
aTransform.Perform(face, Standard_True);
|
||||||
|
if (aTransform.IsDone()) {
|
||||||
|
if (aTransform.Shape().ShapeType() == TopAbs_FACE) {
|
||||||
|
face = TopoDS::Face(aTransform.Shape());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Standard_Real tmpVal = fabs(aMat.Value(1, 1) - 1.) + fabs(aMat.Value(1, 2)) + fabs(aMat.Value(1, 3)) +
|
||||||
|
fabs(aMat.Value(2, 1)) + fabs(aMat.Value(2, 2) - 1.) + fabs(aMat.Value(2, 3)) +
|
||||||
|
fabs(aMat.Value(3, 1)) + fabs(aMat.Value(3, 2)) + fabs(aMat.Value(3, 3) - 1.);
|
||||||
|
if ((tmpVal + aTrans.Modulus()) > Precision::Confusion()) {
|
||||||
|
// not Identity
|
||||||
|
gp_Trsf aT;
|
||||||
|
aT.SetValues(
|
||||||
|
aMat.Value(1, 1), aMat.Value(1, 2), aMat.Value(1, 3), aTrans.X(),
|
||||||
|
aMat.Value(2, 1), aMat.Value(2, 2), aMat.Value(2, 3), aTrans.Y(),
|
||||||
|
aMat.Value(3, 1), aMat.Value(3, 2), aMat.Value(3, 3), aTrans.Z());
|
||||||
|
TopLoc_Location aLoc(aT);
|
||||||
|
face.Move(aLoc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
BRepTools::Update ( face ); //:p4
|
BRepTools::Update ( face ); //:p4
|
||||||
//%16 pdn 08.04.99
|
//%16 pdn 08.04.99
|
||||||
return face;
|
return face;
|
||||||
|
41
tests/bugs/iges/bug29391
Normal file
41
tests/bugs/iges/bug29391
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
puts "========"
|
||||||
|
puts "OCC29391"
|
||||||
|
puts "========"
|
||||||
|
puts ""
|
||||||
|
##########################################################################
|
||||||
|
# transormations for few entities with type 144 are missing
|
||||||
|
##########################################################################
|
||||||
|
|
||||||
|
igesbrep [locate_data_file bug29391.igs] a *
|
||||||
|
|
||||||
|
explode a
|
||||||
|
|
||||||
|
set nbshapes_expected "
|
||||||
|
Number of shapes in shape
|
||||||
|
VERTEX : 37090
|
||||||
|
EDGE : 37571
|
||||||
|
WIRE : 6695
|
||||||
|
FACE : 6290
|
||||||
|
SHELL : 0
|
||||||
|
SOLID : 0
|
||||||
|
COMPSOLID : 0
|
||||||
|
COMPOUND : 1
|
||||||
|
SHAPE : 87647
|
||||||
|
"
|
||||||
|
checknbshapes a -ref ${nbshapes_expected} -t -m "importing file"
|
||||||
|
|
||||||
|
set sprops_s [sprops a_5284]
|
||||||
|
set CX -71.5
|
||||||
|
set CY 20.4285
|
||||||
|
set CZ 15.6103
|
||||||
|
|
||||||
|
regexp {X += +([-0-9.+eE]+)} $sprops_s full resCX
|
||||||
|
regexp {Y += +([-0-9.+eE]+)} $sprops_s full resCY
|
||||||
|
regexp {Z += +([-0-9.+eE]+)} $sprops_s full resCZ
|
||||||
|
|
||||||
|
if { ([expr abs($CX - $resCX)] > 1.e-7) ||
|
||||||
|
([expr abs($CY - $resCY)] > 1.e-7) ||
|
||||||
|
([expr abs($CZ - $resCZ)] > 1.e-7) } {
|
||||||
|
puts "Error: Tranfrormation problem - translation along X is wrong."
|
||||||
|
}
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user