{
if (theAnnotationPlane.IsNull())
return Standard_False;
- gp_Ax2 aPlaneAxes;
Handle(StepRepr_RepresentationItem) aPlaneItem = theAnnotationPlane->Item();
if (aPlaneItem.IsNull())
return Standard_False;
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;
--- /dev/null
+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"
+}