diff --git a/src/STEPCAFControl/STEPCAFControl_Reader.cxx b/src/STEPCAFControl/STEPCAFControl_Reader.cxx index 11f9ce41e5..70d3988cdf 100644 --- a/src/STEPCAFControl/STEPCAFControl_Reader.cxx +++ b/src/STEPCAFControl/STEPCAFControl_Reader.cxx @@ -1948,7 +1948,6 @@ Standard_Boolean readAnnotationPlane(const Handle(StepVisual_AnnotationPlane) th { if (theAnnotationPlane.IsNull()) return Standard_False; - gp_Ax2 aPlaneAxes; Handle(StepRepr_RepresentationItem) aPlaneItem = theAnnotationPlane->Item(); if (aPlaneItem.IsNull()) return Standard_False; @@ -1965,23 +1964,11 @@ Standard_Boolean readAnnotationPlane(const Handle(StepVisual_AnnotationPlane) th if (aA2P3D.IsNull()) return Standard_False; - // build gp_Ax2 from axes - Handle(StepGeom_Direction) anAxis = aA2P3D->Axis(), - aRefDir = aA2P3D->RefDirection(); - if (anAxis.IsNull() || aRefDir.IsNull()) - return Standard_False; - - Handle(TColStd_HArray1OfReal) aCoords; - aCoords = anAxis->DirectionRatios(); - gp_Dir aXDir(aCoords->Value(1), aCoords->Value(2), aCoords->Value(3)); - aCoords = aRefDir->DirectionRatios(); - gp_Dir aYDir(aCoords->Value(1), aCoords->Value(2), aCoords->Value(3)); - aPlaneAxes.SetDirection(aXDir.Crossed(aYDir)); - aPlaneAxes.SetYDirection(aYDir); - //set location of the annotation plane - Handle(TColStd_HArray1OfReal) aLocCoords; - Handle(StepGeom_CartesianPoint) aLoc = aA2P3D->Location(); - gp_Pnt aLocPos(aLoc->CoordinatesValue(1) * theFact, aLoc->CoordinatesValue(2) * theFact, aLoc->CoordinatesValue(3) * theFact); + gp_Ax2 aPlaneAxes; + Handle(Geom_Axis2Placement) anAxis = StepToGeom::MakeAxis2Placement(aA2P3D); + aPlaneAxes = anAxis->Ax2(); + gp_XYZ aLocPos = aPlaneAxes.Location().XYZ(); + aLocPos *= theFact; aPlaneAxes.SetLocation(aLocPos); thePlane = aPlaneAxes; return Standard_True; diff --git a/tests/bugs/step/bug28449 b/tests/bugs/step/bug28449 new file mode 100644 index 0000000000..4470744fdc --- /dev/null +++ b/tests/bugs/step/bug28449 @@ -0,0 +1,26 @@ +puts "========" +puts "OCC28449" +puts "========" +puts "" +################################################# +# Wrong orientation of Annotation Plane in GD&T +################################################# + +ReadStep Doc [locate_data_file bug26689_nist_ctc_01_asme1_ap242.stp] + +set pos [XGetGDTPosition Doc 0:1:4:1] +regexp {normal: +([-0-9.+eE]+) ([-0-9.+eE]+) ([-0-9.+eE]+)} $pos full pos_x pos_y pos_z +regexp {x_direction: +([-0-9.+eE]+) ([-0-9.+eE]+) ([-0-9.+eE]+)} $pos full dir_x dir_y dir_z +set isOK 1 +set prec 1e-7 + +if {[expr abs($pos_x)] > $prec || [expr abs($pos_y + 1)] > $prec || [expr abs($pos_z)] > $prec} { + set isOK 0 +} +if {[expr abs($dir_x - 1)] > $prec || [expr abs($dir_y)] > $prec || [expr abs($dir_z)] > $prec} { + set isOK 0 +} + +if {$isOK == 0} { + puts "Error: wrong Annotation plane" +} diff --git a/tests/gdt/dimensions/A8 b/tests/gdt/dimensions/A8 index fffe3f7b51..33b5f78198 100644 --- a/tests/gdt/dimensions/A8 +++ b/tests/gdt/dimensions/A8 @@ -32,7 +32,7 @@ if {$isOK} { set c_value "10" set c_type "Size_CurveLength" set c_pos {position: -5 0 7 -normal: -1 0 0 -x_direction: 0 1 0 +normal: 0 1 0 +x_direction: 0 0 -1 } }