mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-04 18:06:22 +03:00
0029338: Data Exchange - Add Planes for Tolerance zones in Geometric tolerances
Add new poles to Geometric Tolerance objects Some code refactoring in GDT attributes Add Draw functions for affected plane
This commit is contained in:
parent
c2e47bdd8d
commit
b8bf959578
@ -27,5 +27,6 @@ XCAFDimTolObjects_DatumObjectSequence.hxx
|
||||
XCAFDimTolObjects_DimensionObjectSequence.hxx
|
||||
XCAFDimTolObjects_GeomToleranceObjectSequence.hxx
|
||||
XCAFDimTolObjects_DataMapOfToleranceDatum.hxx
|
||||
XCAFDimTolObjects_ToleranceZoneAffectedPlane.hxx
|
||||
|
||||
|
||||
|
@ -26,6 +26,7 @@ XCAFDimTolObjects_GeomToleranceObject::XCAFDimTolObjects_GeomToleranceObject()
|
||||
myHasPlane = Standard_False;
|
||||
myHasPnt = Standard_False;
|
||||
myHasPntText = Standard_False;
|
||||
myAffectedPlaneType = XCAFDimTolObjects_ToleranceZoneAffectedPlane_None;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@ -51,6 +52,8 @@ XCAFDimTolObjects_GeomToleranceObject::XCAFDimTolObjects_GeomToleranceObject(con
|
||||
myHasPlane = theObj->myHasPlane;
|
||||
myHasPnt = theObj->myHasPnt;
|
||||
myHasPntText = theObj->myHasPntText;
|
||||
myAffectedPlaneType = theObj->myAffectedPlaneType;
|
||||
myAffectedPlane = theObj->myAffectedPlane;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
|
@ -29,7 +29,9 @@
|
||||
#include <XCAFDimTolObjects_GeomToleranceModifiersSequence.hxx>
|
||||
#include <Standard_Transient.hxx>
|
||||
#include <XCAFDimTolObjects_GeomToleranceModif.hxx>
|
||||
#include <XCAFDimTolObjects_ToleranceZoneAffectedPlane.hxx>
|
||||
#include <gp_Ax2.hxx>
|
||||
#include <gp_Pln.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <TCollection_HAsciiString.hxx>
|
||||
|
||||
@ -168,6 +170,45 @@ public:
|
||||
return myPresentationName;
|
||||
}
|
||||
|
||||
// Returns true, if affected plane is specified.
|
||||
Standard_EXPORT bool HasAffectedPlane() const
|
||||
{
|
||||
return (myAffectedPlaneType != XCAFDimTolObjects_ToleranceZoneAffectedPlane_None);
|
||||
}
|
||||
|
||||
// Returns type of affected plane.
|
||||
Standard_EXPORT XCAFDimTolObjects_ToleranceZoneAffectedPlane GetAffectedPlaneType() const
|
||||
{
|
||||
return myAffectedPlaneType;
|
||||
}
|
||||
|
||||
// Sets affected plane type.
|
||||
Standard_EXPORT void SetAffectedPlaneType(const XCAFDimTolObjects_ToleranceZoneAffectedPlane theType)
|
||||
{
|
||||
myAffectedPlaneType = theType;
|
||||
}
|
||||
|
||||
//! Sets affected plane.
|
||||
void SetAffectedPlane(const gp_Pln& thePlane)
|
||||
{
|
||||
myAffectedPlane = thePlane;
|
||||
}
|
||||
|
||||
//! Sets affected plane.
|
||||
void SetAffectedPlane(const gp_Pln& thePlane,
|
||||
const XCAFDimTolObjects_ToleranceZoneAffectedPlane theType)
|
||||
{
|
||||
myAffectedPlaneType = theType;
|
||||
myAffectedPlane = thePlane;
|
||||
}
|
||||
|
||||
//! Returns affected plane.
|
||||
const gp_Pln& GetAffectedPlane() const
|
||||
{
|
||||
return myAffectedPlane;
|
||||
}
|
||||
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(XCAFDimTolObjects_GeomToleranceObject,Standard_Transient)
|
||||
|
||||
private:
|
||||
@ -190,6 +231,8 @@ private:
|
||||
Standard_Boolean myHasPntText;
|
||||
TopoDS_Shape myPresentation;
|
||||
Handle(TCollection_HAsciiString) myPresentationName;
|
||||
XCAFDimTolObjects_ToleranceZoneAffectedPlane myAffectedPlaneType;
|
||||
gp_Pln myAffectedPlane;
|
||||
|
||||
};
|
||||
|
||||
|
@ -0,0 +1,27 @@
|
||||
// Created on: 2017-11-21
|
||||
// Created by: Irina KRYLOVA
|
||||
// Copyright c 2017 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _XCAFDimTolObjects_ToleranceZoneAffectedPlane_HeaderFile
|
||||
#define _XCAFDimTolObjects_ToleranceZoneAffectedPlane_HeaderFile
|
||||
|
||||
//! Defines types of tolerance zone affected plane
|
||||
enum XCAFDimTolObjects_ToleranceZoneAffectedPlane
|
||||
{
|
||||
XCAFDimTolObjects_ToleranceZoneAffectedPlane_None,
|
||||
XCAFDimTolObjects_ToleranceZoneAffectedPlane_Intersection,
|
||||
XCAFDimTolObjects_ToleranceZoneAffectedPlane_Orientation
|
||||
};
|
||||
|
||||
#endif // _XCAFDimTolObjects_ToleranceZoneAffectedPlane_HeaderFile
|
@ -12,6 +12,7 @@
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
|
||||
#include <gp_Pln.hxx>
|
||||
#include <Standard_GUID.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
#include <TCollection_HAsciiString.hxx>
|
||||
@ -25,6 +26,9 @@
|
||||
#include <TDataStd_RealArray.hxx>
|
||||
#include <TDataStd_Integer.hxx>
|
||||
#include <TDataStd_Real.hxx>
|
||||
#include <TDataXtd_Geometry.hxx>
|
||||
#include <TDataXtd_Plane.hxx>
|
||||
#include <TDataXtd_Point.hxx>
|
||||
#include <TNaming_NamedShape.hxx>
|
||||
#include <TNaming_Builder.hxx>
|
||||
#include <TNaming_Tool.hxx>
|
||||
@ -42,16 +46,12 @@ enum ChildLab
|
||||
ChildLab_ModifierWithValue,
|
||||
ChildLab_IsDTarget,
|
||||
ChildLab_DTargetType,
|
||||
ChildLab_AxisLoc,
|
||||
ChildLab_AxisN,
|
||||
ChildLab_AxisRef,
|
||||
ChildLab_Axis,
|
||||
ChildLab_DTargetLength,
|
||||
ChildLab_DTargetWidth,
|
||||
ChildLab_DTargetNumber,
|
||||
ChildLab_DatumTarget,
|
||||
ChildLab_PlaneLoc,
|
||||
ChildLab_PlaneN,
|
||||
ChildLab_PlaneRef,
|
||||
ChildLab_Plane,
|
||||
ChildLab_Pnt,
|
||||
ChildLab_PntText,
|
||||
ChildLab_Presentation
|
||||
@ -226,27 +226,7 @@ void XCAFDoc_Datum::SetObject(const Handle(XCAFDimTolObjects_DatumObject)& theOb
|
||||
else if (theObject->HasDatumTargetParams())
|
||||
{
|
||||
gp_Ax2 anAx = theObject->GetDatumTargetAxis();
|
||||
|
||||
Handle(TColStd_HArray1OfReal) aLocArr = new TColStd_HArray1OfReal(1, 3);
|
||||
for (Standard_Integer i = 1; i <= 3; i++)
|
||||
aLocArr->SetValue(i, anAx.Location().Coord(i));
|
||||
Handle(TDataStd_RealArray) aLoc = TDataStd_RealArray::Set(Label().FindChild(ChildLab_AxisLoc), 1, 3);
|
||||
if(!aLoc.IsNull())
|
||||
aLoc->ChangeArray(aLocArr);
|
||||
|
||||
Handle(TColStd_HArray1OfReal) aNArr = new TColStd_HArray1OfReal(1, 3);
|
||||
for (Standard_Integer i = 1; i <= 3; i++)
|
||||
aNArr->SetValue(i, anAx.Direction().Coord(i));
|
||||
Handle(TDataStd_RealArray) aN = TDataStd_RealArray::Set(Label().FindChild(ChildLab_AxisN), 1, 3);
|
||||
if(!aN.IsNull())
|
||||
aN->ChangeArray(aNArr);
|
||||
|
||||
Handle(TColStd_HArray1OfReal) aRArr = new TColStd_HArray1OfReal(1, 3);
|
||||
for (Standard_Integer i = 1; i <= 3; i++)
|
||||
aRArr->SetValue(i, anAx.XDirection().Coord(i));
|
||||
Handle(TDataStd_RealArray) aR = TDataStd_RealArray::Set(Label().FindChild(ChildLab_AxisRef), 1, 3);
|
||||
if(!aR.IsNull())
|
||||
aR->ChangeArray(aRArr);
|
||||
TDataXtd_Plane::Set(Label().FindChild(ChildLab_Axis), gp_Pln(gp_Ax3(anAx)));
|
||||
|
||||
if(theObject->GetDatumTargetType() != XCAFDimTolObjects_DatumTargetType_Point)
|
||||
{
|
||||
@ -263,53 +243,19 @@ void XCAFDoc_Datum::SetObject(const Handle(XCAFDimTolObjects_DatumObject)& theOb
|
||||
|
||||
if (theObject->HasPlane())
|
||||
{
|
||||
gp_Ax2 anAx = theObject->GetPlane();
|
||||
|
||||
Handle(TColStd_HArray1OfReal) aLocArr = new TColStd_HArray1OfReal(1, 3);
|
||||
for (Standard_Integer i = 1; i <= 3; i++)
|
||||
aLocArr->SetValue(i, anAx.Location().Coord(i));
|
||||
Handle(TDataStd_RealArray) aLoc = TDataStd_RealArray::Set(Label().FindChild(ChildLab_PlaneLoc), 1, 3);
|
||||
if(!aLoc.IsNull())
|
||||
aLoc->ChangeArray(aLocArr);
|
||||
|
||||
Handle(TColStd_HArray1OfReal) aNArr = new TColStd_HArray1OfReal(1, 3);
|
||||
for (Standard_Integer i = 1; i <= 3; i++)
|
||||
aNArr->SetValue(i, anAx.Direction().Coord(i));
|
||||
Handle(TDataStd_RealArray) aN = TDataStd_RealArray::Set(Label().FindChild(ChildLab_PlaneN), 1, 3);
|
||||
if(!aN.IsNull())
|
||||
aN->ChangeArray(aNArr);
|
||||
|
||||
Handle(TColStd_HArray1OfReal) aRArr = new TColStd_HArray1OfReal(1, 3);
|
||||
for (Standard_Integer i = 1; i <= 3; i++)
|
||||
aRArr->SetValue(i, anAx.XDirection().Coord(i));
|
||||
Handle(TDataStd_RealArray) aR = TDataStd_RealArray::Set(Label().FindChild(ChildLab_PlaneRef), 1, 3);
|
||||
if(!aR.IsNull())
|
||||
aR->ChangeArray(aRArr);
|
||||
TDataXtd_Plane::Set(Label().FindChild(ChildLab_Plane), gp_Pln(gp_Ax3(theObject->GetPlane())));
|
||||
}
|
||||
|
||||
if (theObject->HasPoint())
|
||||
{
|
||||
gp_Pnt aPnt = theObject->GetPoint();
|
||||
|
||||
Handle(TColStd_HArray1OfReal) aLocArr = new TColStd_HArray1OfReal(1, 3);
|
||||
for (Standard_Integer i = 1; i <= 3; i++)
|
||||
aLocArr->SetValue(i, aPnt.Coord(i));
|
||||
Handle(TDataStd_RealArray) aLoc = TDataStd_RealArray::Set(Label().FindChild(ChildLab_Pnt), 1, 3);
|
||||
if(!aLoc.IsNull())
|
||||
aLoc->ChangeArray(aLocArr);
|
||||
TDataXtd_Point::Set(Label().FindChild(ChildLab_Pnt), theObject->GetPoint());
|
||||
}
|
||||
|
||||
if (theObject->HasPointText())
|
||||
{
|
||||
gp_Pnt aPntText = theObject->GetPointTextAttach();
|
||||
|
||||
Handle(TColStd_HArray1OfReal) aLocArr = new TColStd_HArray1OfReal(1, 3);
|
||||
for (Standard_Integer i = 1; i <= 3; i++)
|
||||
aLocArr->SetValue(i, aPntText.Coord(i));
|
||||
Handle(TDataStd_RealArray) aLoc = TDataStd_RealArray::Set(Label().FindChild(ChildLab_PntText), 1, 3);
|
||||
if(!aLoc.IsNull())
|
||||
aLoc->ChangeArray(aLocArr);
|
||||
TDataXtd_Point::Set(Label().FindChild(ChildLab_PntText), theObject->GetPointTextAttach());
|
||||
}
|
||||
|
||||
TopoDS_Shape aPresentation = theObject->GetPresentation();
|
||||
if( !aPresentation.IsNull())
|
||||
{
|
||||
@ -368,30 +314,29 @@ Handle(XCAFDimTolObjects_DatumObject) XCAFDoc_Datum::GetObject() const
|
||||
anObj->SetPosition(aPosition->Get());
|
||||
}
|
||||
|
||||
Handle(TDataStd_RealArray) aLoc, aN, aR;
|
||||
if(Label().FindChild(ChildLab_PlaneLoc).FindAttribute(TDataStd_RealArray::GetID(), aLoc) && aLoc->Length() == 3 &&
|
||||
Label().FindChild(ChildLab_PlaneN).FindAttribute(TDataStd_RealArray::GetID(), aN) && aN->Length() == 3 &&
|
||||
Label().FindChild(ChildLab_PlaneRef).FindAttribute(TDataStd_RealArray::GetID(), aR) && aR->Length() == 3 )
|
||||
Handle(TDataXtd_Plane) aPlaneAttr;
|
||||
if (Label().FindChild(ChildLab_Plane).FindAttribute(TDataXtd_Plane::GetID(), aPlaneAttr))
|
||||
{
|
||||
gp_Pnt aL(aLoc->Value(aLoc->Lower()), aLoc->Value(aLoc->Lower()+1), aLoc->Value(aLoc->Lower()+2));
|
||||
gp_Dir aD(aN->Value(aN->Lower()), aN->Value(aN->Lower()+1), aN->Value(aN->Lower()+2));
|
||||
gp_Dir aDR(aR->Value(aR->Lower()), aR->Value(aR->Lower()+1), aR->Value(aR->Lower()+2));
|
||||
gp_Ax2 anAx(aL, aD, aDR);
|
||||
gp_Pln aPlane;
|
||||
TDataXtd_Geometry::Plane(aPlaneAttr->Label(), aPlane);
|
||||
gp_Ax2 anAx(aPlane.Location(), aPlane.Axis().Direction(), aPlane.XAxis().Direction());
|
||||
anObj->SetPlane(anAx);
|
||||
}
|
||||
|
||||
Handle(TDataStd_RealArray) aPnt;
|
||||
if(Label().FindChild(ChildLab_Pnt).FindAttribute(TDataStd_RealArray::GetID(), aPnt) && aPnt->Length() == 3 )
|
||||
Handle(TDataXtd_Point) aPntAttr;
|
||||
if (Label().FindChild(ChildLab_Pnt).FindAttribute(TDataXtd_Point::GetID(), aPntAttr))
|
||||
{
|
||||
gp_Pnt aP(aLoc->Value(aPnt->Lower()), aPnt->Value(aPnt->Lower()+1), aPnt->Value(aPnt->Lower()+2));
|
||||
anObj->SetPoint(aP);
|
||||
gp_Pnt aPoint;
|
||||
TDataXtd_Geometry::Point(aPntAttr->Label(), aPoint);
|
||||
anObj->SetPoint(aPoint);
|
||||
}
|
||||
|
||||
Handle(TDataStd_RealArray) aPntText;
|
||||
if(Label().FindChild(ChildLab_PntText).FindAttribute(TDataStd_RealArray::GetID(), aPntText) && aPntText->Length() == 3 )
|
||||
Handle(TDataXtd_Point) aPntTextAttr;
|
||||
if (Label().FindChild(ChildLab_PntText).FindAttribute(TDataXtd_Point::GetID(), aPntTextAttr))
|
||||
{
|
||||
gp_Pnt aP (aPntText->Value(aPntText->Lower()), aPntText->Value(aPntText->Lower()+1), aPntText->Value(aPntText->Lower()+2));
|
||||
anObj->SetPointTextAttach(aP);
|
||||
gp_Pnt aPoint;
|
||||
TDataXtd_Geometry::Point(aPntTextAttr->Label(), aPoint);
|
||||
anObj->SetPointTextAttach(aPoint);
|
||||
}
|
||||
|
||||
Handle(TDataStd_Integer) aIsDTarget;
|
||||
@ -420,14 +365,12 @@ Handle(XCAFDimTolObjects_DatumObject) XCAFDoc_Datum::GetObject() const
|
||||
}
|
||||
else
|
||||
{
|
||||
if(Label().FindChild(ChildLab_AxisLoc).FindAttribute(TDataStd_RealArray::GetID(), aLoc) && aLoc->Length() == 3 &&
|
||||
Label().FindChild(ChildLab_AxisN).FindAttribute(TDataStd_RealArray::GetID(), aN) && aN->Length() == 3 &&
|
||||
Label().FindChild(ChildLab_AxisRef).FindAttribute(TDataStd_RealArray::GetID(), aR) && aR->Length() == 3 )
|
||||
Handle(TDataXtd_Plane) anAxisAttr;
|
||||
if (Label().FindChild(ChildLab_Axis).FindAttribute(TDataXtd_Plane::GetID(), anAxisAttr))
|
||||
{
|
||||
gp_Pnt aL(aLoc->Value(aLoc->Lower()), aLoc->Value(aLoc->Lower()+1), aLoc->Value(aLoc->Lower()+2));
|
||||
gp_Dir aD(aN->Value(aN->Lower()), aN->Value(aN->Lower()+1), aN->Value(aN->Lower()+2));
|
||||
gp_Dir aDR(aR->Value(aR->Lower()), aR->Value(aR->Lower()+1), aR->Value(aR->Lower()+2));
|
||||
gp_Ax2 anAx(aL, aD, aDR);
|
||||
gp_Pln aPlane;
|
||||
TDataXtd_Geometry::Plane(anAxisAttr->Label(), aPlane);
|
||||
gp_Ax2 anAx(aPlane.Location(), aPlane.Axis().Direction(), aPlane.XAxis().Direction());
|
||||
anObj->SetDatumTargetAxis(anAx);
|
||||
}
|
||||
|
||||
|
@ -13,6 +13,7 @@
|
||||
|
||||
#include <XCAFDoc_Dimension.hxx>
|
||||
|
||||
#include <gp_Pln.hxx>
|
||||
#include <TDF_RelocationTable.hxx>
|
||||
#include <TDF_ChildIterator.hxx>
|
||||
#include <XCAFDoc.hxx>
|
||||
@ -24,6 +25,10 @@
|
||||
#include <TDataStd_ExtStringArray.hxx>
|
||||
#include <TDataStd_Real.hxx>
|
||||
#include <TDataStd_RealArray.hxx>
|
||||
#include <TDataXtd_Axis.hxx>
|
||||
#include <TDataXtd_Geometry.hxx>
|
||||
#include <TDataXtd_Plane.hxx>
|
||||
#include <TDataXtd_Point.hxx>
|
||||
#include <TNaming_Builder.hxx>
|
||||
#include <TNaming_NamedShape.hxx>
|
||||
#include <TColStd_HArray1OfReal.hxx>
|
||||
@ -46,9 +51,7 @@ enum ChildLab
|
||||
ChildLab_Dir,
|
||||
ChildLab_Pnt1,
|
||||
ChildLab_Pnt2,
|
||||
ChildLab_PlaneLoc,
|
||||
ChildLab_PlaneN,
|
||||
ChildLab_PlaneRef,
|
||||
ChildLab_Plane,
|
||||
ChildLab_PntText,
|
||||
ChildLab_Presentation,
|
||||
ChildLab_Descriptions,
|
||||
@ -163,80 +166,31 @@ void XCAFDoc_Dimension::SetObject (const Handle(XCAFDimTolObjects_DimensionObjec
|
||||
tnBuild.Generated(theObject->GetPath());
|
||||
}
|
||||
|
||||
Handle(TColStd_HArray1OfReal) anArrR;
|
||||
if(theObject->GetType() == XCAFDimTolObjects_DimensionType_Location_Oriented)
|
||||
{
|
||||
gp_Dir aD;
|
||||
theObject->GetDirection(aD);
|
||||
anArrR = new TColStd_HArray1OfReal(1,3);
|
||||
anArrR->SetValue(1,aD.X());
|
||||
anArrR->SetValue(2,aD.Y());
|
||||
anArrR->SetValue(3,aD.Z());
|
||||
Handle(TDataStd_RealArray) aDir = TDataStd_RealArray::Set(Label().FindChild(ChildLab_Dir), 1, 3);
|
||||
if(!aDir.IsNull())
|
||||
aDir->ChangeArray(anArrR);
|
||||
TDataXtd_Axis::Set(Label().FindChild(ChildLab_Dir), gp_Lin(gp_Pnt(), aD));
|
||||
}
|
||||
|
||||
if (theObject->HasPoint())
|
||||
{
|
||||
gp_Pnt aPnt1 = theObject->GetPoint();
|
||||
|
||||
Handle(TColStd_HArray1OfReal) aPntArr = new TColStd_HArray1OfReal(1, 3);
|
||||
for (Standard_Integer i = 1; i <= 3; i++)
|
||||
aPntArr->SetValue(i, aPnt1.Coord(i));
|
||||
Handle(TDataStd_RealArray) aPnt = TDataStd_RealArray::Set(Label().FindChild(ChildLab_Pnt1), 1, 3);
|
||||
if(!aPnt.IsNull())
|
||||
aPnt->ChangeArray(aPntArr);
|
||||
TDataXtd_Point::Set(Label().FindChild(ChildLab_Pnt1), theObject->GetPoint());
|
||||
}
|
||||
|
||||
if (theObject->HasPoint2())
|
||||
{
|
||||
gp_Pnt aPnt2 = theObject->GetPoint2();
|
||||
|
||||
Handle(TColStd_HArray1OfReal) aPntArr = new TColStd_HArray1OfReal(1, 3);
|
||||
for (Standard_Integer i = 1; i <= 3; i++)
|
||||
aPntArr->SetValue(i, aPnt2.Coord(i));
|
||||
Handle(TDataStd_RealArray) aPnt = TDataStd_RealArray::Set(Label().FindChild(ChildLab_Pnt2), 1, 3);
|
||||
if(!aPnt.IsNull())
|
||||
aPnt->ChangeArray(aPntArr);
|
||||
TDataXtd_Point::Set(Label().FindChild(ChildLab_Pnt2), theObject->GetPoint2());
|
||||
}
|
||||
|
||||
if (theObject->HasPlane())
|
||||
{
|
||||
gp_Ax2 anAx = theObject->GetPlane();
|
||||
|
||||
Handle(TColStd_HArray1OfReal) aLocArr = new TColStd_HArray1OfReal(1, 3);
|
||||
for (Standard_Integer i = 1; i <= 3; i++)
|
||||
aLocArr->SetValue(i, anAx.Location().Coord(i));
|
||||
Handle(TDataStd_RealArray) aLoc = TDataStd_RealArray::Set(Label().FindChild(ChildLab_PlaneLoc), 1, 3);
|
||||
if(!aLoc.IsNull())
|
||||
aLoc->ChangeArray(aLocArr);
|
||||
|
||||
Handle(TColStd_HArray1OfReal) aNArr = new TColStd_HArray1OfReal(1, 3);
|
||||
for (Standard_Integer i = 1; i <= 3; i++)
|
||||
aNArr->SetValue(i, anAx.Direction().Coord(i));
|
||||
Handle(TDataStd_RealArray) aN = TDataStd_RealArray::Set(Label().FindChild(ChildLab_PlaneN), 1, 3);
|
||||
if(!aN.IsNull())
|
||||
aN->ChangeArray(aNArr);
|
||||
|
||||
Handle(TColStd_HArray1OfReal) aRArr = new TColStd_HArray1OfReal(1, 3);
|
||||
for (Standard_Integer i = 1; i <= 3; i++)
|
||||
aRArr->SetValue(i, anAx.XDirection().Coord(i));
|
||||
Handle(TDataStd_RealArray) aRAtt = TDataStd_RealArray::Set(Label().FindChild(ChildLab_PlaneRef), 1, 3);
|
||||
if(!aRAtt.IsNull())
|
||||
aRAtt->ChangeArray(aRArr);
|
||||
TDataXtd_Plane::Set(Label().FindChild(ChildLab_Plane), gp_Pln(gp_Ax3(theObject->GetPlane())));
|
||||
}
|
||||
|
||||
if (theObject->HasTextPoint())
|
||||
{
|
||||
gp_Pnt aPntText = theObject->GetPointTextAttach();
|
||||
|
||||
Handle(TColStd_HArray1OfReal) aLocArr = new TColStd_HArray1OfReal(1, 3);
|
||||
for (Standard_Integer i = 1; i <= 3; i++)
|
||||
aLocArr->SetValue(i, aPntText.Coord(i));
|
||||
Handle(TDataStd_RealArray) aLoc = TDataStd_RealArray::Set(Label().FindChild(ChildLab_PntText), 1, 3);
|
||||
if(!aLoc.IsNull())
|
||||
aLoc->ChangeArray(aLocArr);
|
||||
TDataXtd_Point::Set(Label().FindChild(ChildLab_PntText), theObject->GetPointTextAttach());
|
||||
}
|
||||
|
||||
TopoDS_Shape aPresentation = theObject->GetPresentation();
|
||||
@ -332,46 +286,46 @@ Handle(XCAFDimTolObjects_DimensionObject) XCAFDoc_Dimension::GetObject() const
|
||||
anObj->SetPath(TopoDS::Edge(aShape->Get()));
|
||||
}
|
||||
|
||||
|
||||
Handle(TDataStd_RealArray) aDir;
|
||||
if(Label().FindChild(ChildLab_Dir).FindAttribute(TDataStd_RealArray::GetID(), aDir)
|
||||
&& !aDir->Array().IsNull() && aDir->Array()->Length() > 0)
|
||||
Handle(TDataXtd_Axis) aDirAttr;
|
||||
if (Label().FindChild(ChildLab_Dir).FindAttribute(TDataXtd_Axis::GetID(), aDirAttr))
|
||||
{
|
||||
gp_Dir aD(aDir->Array()->Value(1), aDir->Array()->Value(2), aDir->Array()->Value(3));
|
||||
anObj->SetDirection(aD);
|
||||
gp_Ax1 aDir;
|
||||
TDataXtd_Geometry::Axis(aDirAttr->Label(), aDir);
|
||||
anObj->SetDirection(aDir.Direction());
|
||||
}
|
||||
|
||||
Handle(TDataStd_RealArray) aPnt1;
|
||||
if(Label().FindChild(ChildLab_Pnt1).FindAttribute(TDataStd_RealArray::GetID(), aPnt1) && aPnt1->Length() == 3 )
|
||||
Handle(TDataXtd_Point) aPnt1Attr;
|
||||
if (Label().FindChild(ChildLab_Pnt1).FindAttribute(TDataXtd_Point::GetID(), aPnt1Attr))
|
||||
{
|
||||
gp_Pnt aP(aPnt1->Value(aPnt1->Lower()), aPnt1->Value(aPnt1->Lower()+1), aPnt1->Value(aPnt1->Lower()+2));
|
||||
anObj->SetPoint(aP);
|
||||
gp_Pnt aPoint;
|
||||
TDataXtd_Geometry::Point(aPnt1Attr->Label(), aPoint);
|
||||
anObj->SetPoint(aPoint);
|
||||
}
|
||||
|
||||
Handle(TDataStd_RealArray) aPnt2;
|
||||
if(Label().FindChild(ChildLab_Pnt2).FindAttribute(TDataStd_RealArray::GetID(), aPnt2) && aPnt2->Length() == 3 )
|
||||
Handle(TDataXtd_Point) aPnt2Attr;
|
||||
if (Label().FindChild(ChildLab_Pnt2).FindAttribute(TDataXtd_Point::GetID(), aPnt2Attr))
|
||||
{
|
||||
gp_Pnt aP(aPnt2->Value(aPnt2->Lower()), aPnt2->Value(aPnt2->Lower()+1), aPnt2->Value(aPnt2->Lower()+2));
|
||||
anObj->SetPoint2(aP);
|
||||
gp_Pnt aPoint;
|
||||
TDataXtd_Geometry::Point(aPnt2Attr->Label(), aPoint);
|
||||
anObj->SetPoint2(aPoint);
|
||||
}
|
||||
|
||||
Handle(TDataStd_RealArray) aLoc, aN, aR;
|
||||
if(Label().FindChild(ChildLab_PlaneLoc).FindAttribute(TDataStd_RealArray::GetID(), aLoc) && aLoc->Length() == 3 &&
|
||||
Label().FindChild(ChildLab_PlaneN).FindAttribute(TDataStd_RealArray::GetID(), aN) && aN->Length() == 3 &&
|
||||
Label().FindChild(ChildLab_PlaneRef).FindAttribute(TDataStd_RealArray::GetID(), aR) && aR->Length() == 3 )
|
||||
|
||||
Handle(TDataXtd_Plane) aPlaneAttr;
|
||||
if (Label().FindChild(ChildLab_Plane).FindAttribute(TDataXtd_Plane::GetID(), aPlaneAttr))
|
||||
{
|
||||
gp_Pnt aL(aLoc->Value(aLoc->Lower()), aLoc->Value(aLoc->Lower()+1), aLoc->Value(aLoc->Lower()+2));
|
||||
gp_Dir aD(aN->Value(aN->Lower()), aN->Value(aN->Lower()+1), aN->Value(aN->Lower()+2));
|
||||
gp_Dir aDR(aR->Value(aR->Lower()), aR->Value(aR->Lower()+1), aR->Value(aR->Lower()+2));
|
||||
gp_Ax2 anAx(aL, aD, aDR);
|
||||
gp_Pln aPlane;
|
||||
TDataXtd_Geometry::Plane(aPlaneAttr->Label(), aPlane);
|
||||
gp_Ax2 anAx(aPlane.Location(), aPlane.Axis().Direction(), aPlane.XAxis().Direction());
|
||||
anObj->SetPlane(anAx);
|
||||
}
|
||||
|
||||
Handle(TDataStd_RealArray) aPntText;
|
||||
if(Label().FindChild(ChildLab_PntText).FindAttribute(TDataStd_RealArray::GetID(), aPntText) && aPntText->Length() == 3 )
|
||||
Handle(TDataXtd_Point) aPntTextAttr;
|
||||
if (Label().FindChild(ChildLab_PntText).FindAttribute(TDataXtd_Point::GetID(), aPntTextAttr))
|
||||
{
|
||||
gp_Pnt aP(aPntText->Value(aPntText->Lower()), aPntText->Value(aPntText->Lower()+1), aPntText->Value(aPntText->Lower()+2));
|
||||
anObj->SetPointTextAttach(aP);
|
||||
gp_Pnt aPoint;
|
||||
TDataXtd_Geometry::Point(aPntTextAttr->Label(), aPoint);
|
||||
anObj->SetPointTextAttach(aPoint);
|
||||
}
|
||||
|
||||
Handle(TNaming_NamedShape) aNS;
|
||||
|
@ -21,6 +21,9 @@
|
||||
#include <TDataStd_IntegerArray.hxx>
|
||||
#include <TDataStd_RealArray.hxx>
|
||||
#include <TDataStd_Real.hxx>
|
||||
#include <TDataXtd_Geometry.hxx>
|
||||
#include <TDataXtd_Plane.hxx>
|
||||
#include <TDataXtd_Point.hxx>
|
||||
#include <XCAFDimTolObjects_GeomToleranceObject.hxx>
|
||||
#include <TNaming_Tool.hxx>
|
||||
#include <TNaming_Builder.hxx>
|
||||
@ -39,15 +42,12 @@ enum ChildLab
|
||||
ChildLab_ValueOfZoneModif,
|
||||
ChildLab_Modifiers,
|
||||
ChildLab_aMaxValueModif,
|
||||
ChildLab_AxisLoc,
|
||||
ChildLab_AxisN,
|
||||
ChildLab_AxisRef,
|
||||
ChildLab_PlaneLoc,
|
||||
ChildLab_PlaneN,
|
||||
ChildLab_PlaneRef,
|
||||
ChildLab_Axis,
|
||||
ChildLab_Plane,
|
||||
ChildLab_Pnt,
|
||||
ChildLab_PntText,
|
||||
ChildLab_Presentation
|
||||
ChildLab_Presentation,
|
||||
ChildLab_AffectedPlane
|
||||
};
|
||||
|
||||
//=======================================================================
|
||||
@ -140,80 +140,24 @@ void XCAFDoc_GeomTolerance::SetObject (const Handle(XCAFDimTolObjects_GeomTolera
|
||||
Handle(TDataStd_Real) aMaxValueModif = TDataStd_Real::Set(Label().FindChild(ChildLab_aMaxValueModif),
|
||||
theObject->GetMaxValueModifier());
|
||||
|
||||
if(theObject->HasAxis())
|
||||
if (theObject->HasAxis())
|
||||
{
|
||||
gp_Ax2 anAx = theObject->GetAxis();
|
||||
|
||||
Handle(TColStd_HArray1OfReal) aLocArr = new TColStd_HArray1OfReal(1, 3);
|
||||
for (Standard_Integer i = 1; i <= 3; i++)
|
||||
aLocArr->SetValue(i, anAx.Location().Coord(i));
|
||||
Handle(TDataStd_RealArray) aLoc = TDataStd_RealArray::Set(Label().FindChild(ChildLab_AxisLoc), 1, 3);
|
||||
if(!aLoc.IsNull())
|
||||
aLoc->ChangeArray(aLocArr);
|
||||
|
||||
Handle(TColStd_HArray1OfReal) aNArr = new TColStd_HArray1OfReal(1, 3);
|
||||
for (Standard_Integer i = 1; i <= 3; i++)
|
||||
aNArr->SetValue(i, anAx.Direction().Coord(i));
|
||||
Handle(TDataStd_RealArray) aN = TDataStd_RealArray::Set(Label().FindChild(ChildLab_AxisN), 1, 3);
|
||||
if(!aN.IsNull())
|
||||
aN->ChangeArray(aNArr);
|
||||
|
||||
Handle(TColStd_HArray1OfReal) aRArr = new TColStd_HArray1OfReal(1, 3);
|
||||
for (Standard_Integer i = 1; i <= 3; i++)
|
||||
aRArr->SetValue(i, anAx.XDirection().Coord(i));
|
||||
Handle(TDataStd_RealArray) aR = TDataStd_RealArray::Set(Label().FindChild(ChildLab_AxisRef), 1, 3);
|
||||
if(!aR.IsNull())
|
||||
aR->ChangeArray(aRArr);
|
||||
TDataXtd_Plane::Set(Label().FindChild(ChildLab_Axis), gp_Pln(gp_Ax3(theObject->GetPlane())));
|
||||
}
|
||||
|
||||
if (theObject->HasPlane())
|
||||
{
|
||||
gp_Ax2 anAx = theObject->GetPlane();
|
||||
|
||||
Handle(TColStd_HArray1OfReal) aLocArr = new TColStd_HArray1OfReal(1, 3);
|
||||
for (Standard_Integer i = 1; i <= 3; i++)
|
||||
aLocArr->SetValue(i, anAx.Location().Coord(i));
|
||||
Handle(TDataStd_RealArray) aLoc = TDataStd_RealArray::Set(Label().FindChild(ChildLab_PlaneLoc), 1, 3);
|
||||
if(!aLoc.IsNull())
|
||||
aLoc->ChangeArray(aLocArr);
|
||||
|
||||
Handle(TColStd_HArray1OfReal) aNArr = new TColStd_HArray1OfReal(1, 3);
|
||||
for (Standard_Integer i = 1; i <= 3; i++)
|
||||
aNArr->SetValue(i, anAx.Direction().Coord(i));
|
||||
Handle(TDataStd_RealArray) aN = TDataStd_RealArray::Set(Label().FindChild(ChildLab_PlaneN), 1, 3);
|
||||
if(!aN.IsNull())
|
||||
aN->ChangeArray(aNArr);
|
||||
|
||||
Handle(TColStd_HArray1OfReal) aRArr = new TColStd_HArray1OfReal(1, 3);
|
||||
for (Standard_Integer i = 1; i <= 3; i++)
|
||||
aRArr->SetValue(i, anAx.XDirection().Coord(i));
|
||||
Handle(TDataStd_RealArray) aR = TDataStd_RealArray::Set(Label().FindChild(ChildLab_PlaneRef), 1, 3);
|
||||
if(!aR.IsNull())
|
||||
aR->ChangeArray(aRArr);
|
||||
TDataXtd_Plane::Set(Label().FindChild(ChildLab_Plane), gp_Pln(gp_Ax3(theObject->GetPlane())));
|
||||
}
|
||||
|
||||
if (theObject->HasPoint())
|
||||
{
|
||||
gp_Pnt aPnt = theObject->GetPoint();
|
||||
|
||||
Handle(TColStd_HArray1OfReal) aLocArr = new TColStd_HArray1OfReal(1, 3);
|
||||
for (Standard_Integer i = 1; i <= 3; i++)
|
||||
aLocArr->SetValue(i, aPnt.Coord(i));
|
||||
Handle(TDataStd_RealArray) aLoc = TDataStd_RealArray::Set(Label().FindChild(ChildLab_Pnt), 1, 3);
|
||||
if(!aLoc.IsNull())
|
||||
aLoc->ChangeArray(aLocArr);
|
||||
TDataXtd_Point::Set(Label().FindChild(ChildLab_Pnt), theObject->GetPoint());
|
||||
}
|
||||
|
||||
if (theObject->HasPointText())
|
||||
{
|
||||
gp_Pnt aPntText = theObject->GetPointTextAttach();
|
||||
|
||||
Handle(TColStd_HArray1OfReal) aLocArr = new TColStd_HArray1OfReal(1, 3);
|
||||
for (Standard_Integer i = 1; i <= 3; i++)
|
||||
aLocArr->SetValue(i, aPntText.Coord(i));
|
||||
Handle(TDataStd_RealArray) aLoc = TDataStd_RealArray::Set(Label().FindChild(ChildLab_PntText), 1, 3);
|
||||
if(!aLoc.IsNull())
|
||||
aLoc->ChangeArray(aLocArr);
|
||||
TDataXtd_Point::Set(Label().FindChild(ChildLab_PntText), theObject->GetPointTextAttach());
|
||||
}
|
||||
|
||||
TopoDS_Shape aPresentation = theObject->GetPresentation();
|
||||
@ -229,7 +173,13 @@ void XCAFDoc_GeomTolerance::SetObject (const Handle(XCAFDimTolObjects_GeomTolera
|
||||
TDataStd_Name::Set ( aLPres, str );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (theObject->HasAffectedPlane())
|
||||
{
|
||||
TDF_Label aLAffectedPlane = Label().FindChild(ChildLab_AffectedPlane);
|
||||
TDataStd_Integer::Set(aLAffectedPlane, (Standard_Integer)theObject->GetAffectedPlaneType());
|
||||
TDataXtd_Plane::Set(aLAffectedPlane, theObject->GetAffectedPlane());
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@ -293,43 +243,38 @@ Handle(XCAFDimTolObjects_GeomToleranceObject) XCAFDoc_GeomTolerance::GetObject()
|
||||
anObj->SetMaxValueModifier(aMaxValueModif->Get());
|
||||
}
|
||||
|
||||
Handle(TDataStd_RealArray) aLoc;
|
||||
Handle(TDataStd_RealArray) aN;
|
||||
Handle(TDataStd_RealArray) aR;
|
||||
if(Label().FindChild(ChildLab_AxisLoc).FindAttribute(TDataStd_RealArray::GetID(), aLoc) && aLoc->Length() == 3 &&
|
||||
Label().FindChild(ChildLab_AxisN).FindAttribute(TDataStd_RealArray::GetID(), aN) && aN->Length() == 3 &&
|
||||
Label().FindChild(ChildLab_AxisRef).FindAttribute(TDataStd_RealArray::GetID(), aR) && aR->Length() == 3 )
|
||||
Handle(TDataXtd_Plane) anAxisAttr;
|
||||
if (Label().FindChild(ChildLab_Axis).FindAttribute(TDataXtd_Plane::GetID(), anAxisAttr))
|
||||
{
|
||||
gp_Pnt aL(aLoc->Value(aLoc->Lower()), aLoc->Value(aLoc->Lower()+1), aLoc->Value(aLoc->Lower()+2));
|
||||
gp_Dir aD(aN->Value(aN->Lower()), aN->Value(aN->Lower()+1), aN->Value(aN->Lower()+2));
|
||||
gp_Dir aDR(aR->Value(aR->Lower()), aR->Value(aR->Lower()+1), aR->Value(aR->Lower()+2));
|
||||
gp_Ax2 anAx(aL, aD, aDR);
|
||||
gp_Pln aPlane;
|
||||
TDataXtd_Geometry::Plane(anAxisAttr->Label(), aPlane);
|
||||
gp_Ax2 anAx(aPlane.Location(), aPlane.Axis().Direction(), aPlane.XAxis().Direction());
|
||||
anObj->SetAxis(anAx);
|
||||
}
|
||||
|
||||
if(Label().FindChild(ChildLab_PlaneLoc).FindAttribute(TDataStd_RealArray::GetID(), aLoc) && aLoc->Length() == 3 &&
|
||||
Label().FindChild(ChildLab_PlaneN).FindAttribute(TDataStd_RealArray::GetID(), aN) && aN->Length() == 3 &&
|
||||
Label().FindChild(ChildLab_PlaneRef).FindAttribute(TDataStd_RealArray::GetID(), aR) && aR->Length() == 3 )
|
||||
Handle(TDataXtd_Plane) aPlaneAttr;
|
||||
if (Label().FindChild(ChildLab_Plane).FindAttribute(TDataXtd_Plane::GetID(), aPlaneAttr))
|
||||
{
|
||||
gp_Pnt aL(aLoc->Value(aLoc->Lower()), aLoc->Value(aLoc->Lower()+1), aLoc->Value(aLoc->Lower()+2));
|
||||
gp_Dir aD(aN->Value(aN->Lower()), aN->Value(aN->Lower()+1), aN->Value(aN->Lower()+2));
|
||||
gp_Dir aDR(aR->Value(aR->Lower()), aR->Value(aR->Lower()+1), aR->Value(aR->Lower()+2));
|
||||
gp_Ax2 anAx(aL, aD, aDR);
|
||||
gp_Pln aPlane;
|
||||
TDataXtd_Geometry::Plane(aPlaneAttr->Label(), aPlane);
|
||||
gp_Ax2 anAx(aPlane.Location(), aPlane.Axis().Direction(), aPlane.XAxis().Direction());
|
||||
anObj->SetPlane(anAx);
|
||||
}
|
||||
|
||||
Handle(TDataStd_RealArray) aPnt;
|
||||
if(Label().FindChild(ChildLab_Pnt).FindAttribute(TDataStd_RealArray::GetID(), aPnt) && aPnt->Length() == 3 )
|
||||
Handle(TDataXtd_Point) aPntAttr;
|
||||
if (Label().FindChild(ChildLab_Pnt).FindAttribute(TDataXtd_Point::GetID(), aPntAttr))
|
||||
{
|
||||
gp_Pnt aP(aLoc->Value(aPnt->Lower()), aPnt->Value(aPnt->Lower()+1), aPnt->Value(aPnt->Lower()+2));
|
||||
anObj->SetPoint(aP);
|
||||
gp_Pnt aPoint;
|
||||
TDataXtd_Geometry::Point(aPntAttr->Label(), aPoint);
|
||||
anObj->SetPoint(aPoint);
|
||||
}
|
||||
|
||||
Handle(TDataStd_RealArray) aPntText;
|
||||
if(Label().FindChild(ChildLab_PntText).FindAttribute(TDataStd_RealArray::GetID(), aPntText) && aPntText->Length() == 3 )
|
||||
Handle(TDataXtd_Point) aPntTextAttr;
|
||||
if (Label().FindChild(ChildLab_PntText).FindAttribute(TDataXtd_Point::GetID(), aPntTextAttr))
|
||||
{
|
||||
gp_Pnt aP(aPntText->Value(aPntText->Lower()), aPntText->Value(aPntText->Lower()+1), aPntText->Value(aPntText->Lower()+2));
|
||||
anObj->SetPointTextAttach(aP);
|
||||
gp_Pnt aPoint;
|
||||
TDataXtd_Geometry::Point(aPntTextAttr->Label(), aPoint);
|
||||
anObj->SetPointTextAttach(aPoint);
|
||||
}
|
||||
|
||||
Handle(TNaming_NamedShape) aNS;
|
||||
@ -354,6 +299,16 @@ Handle(XCAFDimTolObjects_GeomToleranceObject) XCAFDoc_GeomTolerance::GetObject()
|
||||
}
|
||||
}
|
||||
|
||||
Handle(TDataXtd_Plane) anAffectedPlaneAttr;
|
||||
if (Label().FindChild(ChildLab_AffectedPlane).FindAttribute(TDataXtd_Plane::GetID(), anAffectedPlaneAttr))
|
||||
{
|
||||
gp_Pln aPlane;
|
||||
TDataXtd_Geometry::Plane(anAffectedPlaneAttr->Label(), aPlane);
|
||||
Handle(TDataStd_Integer) aTypeAttr;
|
||||
Label().FindChild(ChildLab_AffectedPlane).FindAttribute(TDataStd_Integer::GetID(), aTypeAttr);
|
||||
anObj->SetAffectedPlane(aPlane, (XCAFDimTolObjects_ToleranceZoneAffectedPlane)aTypeAttr->Get());
|
||||
}
|
||||
|
||||
return anObj;
|
||||
}
|
||||
|
||||
|
@ -18,6 +18,8 @@
|
||||
#include <Draw.hxx>
|
||||
#include <DBRep.hxx>
|
||||
#include <DDocStd.hxx>
|
||||
#include <DrawTrSurf.hxx>
|
||||
#include <Geom_Plane.hxx>
|
||||
|
||||
#include <STEPCAFControl_GDTProperty.hxx>
|
||||
|
||||
@ -2506,6 +2508,89 @@ static Standard_Integer getGDTPresentation (Draw_Interpretor& di, Standard_Integ
|
||||
return 0;
|
||||
}
|
||||
|
||||
static Standard_Integer addGDTAffectedPlane(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
|
||||
{
|
||||
if (argc != 5) {
|
||||
di << "Use: XSetGDTAffectedPlane Doc GDT_Label plane type[1 - intersection/ 2 - orientation]\n";
|
||||
return 1;
|
||||
}
|
||||
Handle(TDocStd_Document) Doc;
|
||||
DDocStd::GetDocument(argv[1], Doc);
|
||||
if (Doc.IsNull()) { di << argv[1] << " is not a document\n"; return 1; }
|
||||
|
||||
TDF_Label aLabel;
|
||||
TDF_Tool::Label(Doc->GetData(), argv[2], aLabel);
|
||||
if (aLabel.IsNull())
|
||||
{
|
||||
di << "GDT " << argv[2] << " is absent in " << argv[1] << "\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
Handle(Geom_Surface) aSurf = DrawTrSurf::GetSurface(argv[3]);
|
||||
Handle(Geom_Plane) aPlane = Handle(Geom_Plane)::DownCast(aSurf);
|
||||
if (aPlane.IsNull())
|
||||
{
|
||||
di << "Invalid plane\n";
|
||||
return 1;
|
||||
}
|
||||
Standard_Integer aType = Draw::Atoi(argv[4]);
|
||||
|
||||
// Geometric Tolerance
|
||||
Handle(XCAFDoc_GeomTolerance) aGeomTolerance;
|
||||
if (!aLabel.FindAttribute(XCAFDoc_GeomTolerance::GetID(), aGeomTolerance))
|
||||
{
|
||||
di << "Geometric tolerance is abcent on label" << argv[2] << "\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
Handle(XCAFDimTolObjects_GeomToleranceObject) anObj = aGeomTolerance->GetObject();
|
||||
anObj->SetAffectedPlane(aPlane->Pln(), (XCAFDimTolObjects_ToleranceZoneAffectedPlane)aType);
|
||||
aGeomTolerance->SetObject(anObj);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static Standard_Integer getGDTAffectedPlane(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
|
||||
{
|
||||
if (argc != 4) {
|
||||
di << "Use: XGetGDTAffectedPlane Doc GDT_Label Plane\n";
|
||||
return 1;
|
||||
}
|
||||
Handle(TDocStd_Document) Doc;
|
||||
DDocStd::GetDocument(argv[1], Doc);
|
||||
if (Doc.IsNull()) { di << argv[1] << " is not a document\n"; return 1; }
|
||||
|
||||
TDF_Label aLabel;
|
||||
TDF_Tool::Label(Doc->GetData(), argv[2], aLabel);
|
||||
if (aLabel.IsNull())
|
||||
{
|
||||
di << "GDT " << argv[2] << " is absent in " << argv[1] << "\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Geometric Tolerance
|
||||
Handle(XCAFDoc_GeomTolerance) aGeomTolerance;
|
||||
Handle(Geom_Plane) aPlane;
|
||||
if (aLabel.FindAttribute(XCAFDoc_GeomTolerance::GetID(), aGeomTolerance))
|
||||
{
|
||||
Handle(XCAFDimTolObjects_GeomToleranceObject) anObj = aGeomTolerance->GetObject();
|
||||
if (anObj->GetAffectedPlaneType() == XCAFDimTolObjects_ToleranceZoneAffectedPlane_None)
|
||||
{
|
||||
di << "No affected plane\n";
|
||||
return 0;
|
||||
}
|
||||
gp_Pln aPln = anObj->GetAffectedPlane();
|
||||
aPlane = new Geom_Plane(aPln);
|
||||
if (anObj->GetAffectedPlaneType() == XCAFDimTolObjects_ToleranceZoneAffectedPlane_Intersection)
|
||||
di << "intersection plane\n";
|
||||
if (anObj->GetAffectedPlaneType() == XCAFDimTolObjects_ToleranceZoneAffectedPlane_Orientation)
|
||||
di << "orientation plane\n";
|
||||
DrawTrSurf::Set(argv[3], aPlane);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : InitCommands
|
||||
//purpose :
|
||||
@ -2876,4 +2961,12 @@ void XDEDRAW_GDTs::InitCommands(Draw_Interpretor& di)
|
||||
di.Add ("XGetGDTPresentation","XGetGDTPresentation Doc GDT_Label Shape"
|
||||
"Returns Presentation into Shape",
|
||||
__FILE__, getGDTPresentation, g);
|
||||
|
||||
di.Add("XSetGDTAffectedPlane", "XSetGDTAffectedPlane Doc GDT_Label Plane type[1 - intersection/ 2 - orientation]"
|
||||
"Set affectedP plane for geometric tolerance",
|
||||
__FILE__, addGDTAffectedPlane, g);
|
||||
|
||||
di.Add("XGetGDTAffectedPlane", "XGetGDTAffectedPlane Doc GDT_Label Plane"
|
||||
"Returns affected plane into Plane",
|
||||
__FILE__, getGDTAffectedPlane, g);
|
||||
}
|
||||
|
46
tests/bugs/xde/bug29338
Normal file
46
tests/bugs/xde/bug29338
Normal file
@ -0,0 +1,46 @@
|
||||
puts "=========="
|
||||
puts "OCC29338"
|
||||
puts "=========="
|
||||
puts ""
|
||||
#########################################################
|
||||
# Add Planes for Tolerance zones in Geometric tolerances
|
||||
#########################################################
|
||||
pload ALL
|
||||
|
||||
box b 1 1 1
|
||||
XNewDoc D
|
||||
XAddShape D b
|
||||
explode b f
|
||||
XAddGeomTolerance D b_1
|
||||
plane p 1 2 3 0 1 0
|
||||
XSetGDTAffectedPlane D 0:1:4:1 p 2
|
||||
SaveAs D ${imagedir}/bug29338.xbf
|
||||
Close D
|
||||
XOpen ${imagedir}/bug29338.xbf DD
|
||||
set type [XGetGDTAffectedPlane DD 0:1:4:1 plane]
|
||||
if {[lindex $type 0] != "orientation"} {
|
||||
puts "Error: wrong affected plane type"
|
||||
}
|
||||
|
||||
set res [dump plane]
|
||||
set check [split $res {:, }]
|
||||
if {[lindex $check 8] != 1} {
|
||||
puts "Error: wrong affected plane"
|
||||
}
|
||||
if {[lindex $check 10] != 2} {
|
||||
puts "Error: wrong affected plane"
|
||||
}
|
||||
if {[lindex $check 12] != 3} {
|
||||
puts "Error: wrong affected plane"
|
||||
}
|
||||
if {[lindex $check 19] != 0} {
|
||||
puts "Error: wrong affected plane"
|
||||
}
|
||||
if {[lindex $check 21] != 1} {
|
||||
puts "Error: wrong affected plane"
|
||||
}
|
||||
if {[lindex $check 23] != 0} {
|
||||
puts "Error: wrong affected plane"
|
||||
}
|
||||
Close DD
|
||||
file delete ${imagedir}/bug29338.xbf
|
@ -19,4 +19,4 @@ XSetDimensionDir D 0:1:4:1 1 1 0
|
||||
set c_value "6"
|
||||
set c_type "Location_Oriented"
|
||||
set c_plusminus "lower -0.001 upper 0.002"
|
||||
set c_dir "0.70710678118654757;0.70710678118654757;0"
|
||||
set c_dir "0.70710678118654746;0.70710678118654746;0"
|
||||
|
Loading…
x
Reference in New Issue
Block a user