n VrmlConverter
n VrmlData
n XCAFApp
+n XCAFDimTolObjects
n XCAFDoc
n XCAFPrs
n XSAlgo
Standard_Integer i;
for(i=1; i<=DGTLabels.Length(); i++) {
TDF_Label DatumL = DGTLabels.Value(i);
- TDF_Label ShapeL;
+ TDF_LabelSequence ShapeL;
if(!DGTTool->GetRefShapeLabel(DatumL,ShapeL)) continue;
// find target shape
- TopoDS_Shape aShape = XCAFDoc_ShapeTool::GetShape(ShapeL);
+ TopoDS_Shape aShape = XCAFDoc_ShapeTool::GetShape(ShapeL.Value(1));
TopLoc_Location Loc;
TColStd_SequenceOfTransient seqRI;
FindEntities( FP, aShape, Loc, seqRI );
if(DGTLabels.Length()<=0) return Standard_False;
for(i=1; i<=DGTLabels.Length(); i++) {
TDF_Label DimTolL = DGTLabels.Value(i);
- TDF_Label ShapeL;
+ TDF_LabelSequence ShapeL;
if(!DGTTool->GetRefShapeLabel(DimTolL,ShapeL)) continue;
// find target shape
- TopoDS_Shape aShape = XCAFDoc_ShapeTool::GetShape(ShapeL);
+ TopoDS_Shape aShape = XCAFDoc_ShapeTool::GetShape(ShapeL.Value(1));
TopLoc_Location Loc;
TColStd_SequenceOfTransient seqRI;
FindEntities( FP, aShape, Loc, seqRI );
else if(kind<50) { //tolerance
if(kind<35) { // tolerance with datum system
TDF_LabelSequence DatumLabels;
- DGTTool->GetDatumTolerLabels(DimTolL,DatumLabels);
+ DGTTool->GetDatumOfTolerLabels(DimTolL,DatumLabels);
Standard_Integer NbDR = DatumLabels.Length();
Handle(StepDimTol_HArray1OfDatumReference) HADR = new StepDimTol_HArray1OfDatumReference(1,NbDR);
for(Standard_Integer j=1; j<=NbDR; j++) {
set (TOOLKIT_MODULES
XCAFApp
+ XCAFDimTolObjects
XCAFDoc
XCAFPrs
)
XCAFApp
+XCAFDimTolObjects
XCAFDoc
XCAFPrs
--- /dev/null
+FILES
+XCAFDimTolObjects_DatumObject.cxx
+XCAFDimTolObjects_DatumObject.hxx
+XCAFDimTolObjects_DimensionObject.cxx
+XCAFDimTolObjects_DimensionObject.hxx
+XCAFDimTolObjects_GeomToleranceObject.cxx
+XCAFDimTolObjects_GeomToleranceObject.hxx
+XCAFDimTolObjects_Tool.cxx
+XCAFDimTolObjects_Tool.hxx
+XCAFDimTolObjects_DatumModifWithValue.hxx
+XCAFDimTolObjects_DatumSingleModif.hxx
+XCAFDimTolObjects_DimensionModif.hxx
+XCAFDimTolObjects_DimensionFormVariance.hxx
+XCAFDimTolObjects_DimensionGrade.hxx
+XCAFDimTolObjects_DimensionQualifier.hxx
+XCAFDimTolObjects_DimensionType.hxx
+XCAFDimTolObjects_GeomToleranceModif.hxx
+XCAFDimTolObjects_GeomToleranceType.hxx
+XCAFDimTolObjects_GeomToleranceTypeValue.hxx
+XCAFDimTolObjects_GeomToleranceMatReqModif.hxx
+XCAFDimTolObjects_GeomToleranceZoneModif.hxx
+XCAFDimTolObjects_DimensionModifiersSequence.hxx
+XCAFDimTolObjects_GeomToleranceModifiersSequence.hxx
+XCAFDimTolObjects_DatumModifiersSequence.hxx
+XCAFDimTolObjects_DatumObjectSequence.hxx
+XCAFDimTolObjects_DimensionObjectSequence.hxx
+XCAFDimTolObjects_GeomToleranceObjectSequence.hxx
+XCAFDimTolObjects_DataMapOfToleranceDatum.hxx
+
+
--- /dev/null
+// Created on: 2015-08-06
+// Created by: Ilya Novikov
+// Copyright (c) 2004-2014 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_DataMapOfToleranceDatum_HeaderFile
+#define XCAFDimTolObjects_DataMapOfToleranceDatum_HeaderFile
+
+#include <NCollection_DataMap.hxx>
+#include <XCAFDimTolObjects_GeomToleranceObject.hxx>
+#include <XCAFDimTolObjects_DatumObject.hxx>
+#include <TColStd_MapTransientHasher.hxx>
+
+typedef NCollection_DataMap<Handle(XCAFDimTolObjects_GeomToleranceObject),Handle(XCAFDimTolObjects_DatumObject),TColStd_MapTransientHasher> XCAFDimTolObjects_DataMapOfToleranceDatum;
+
+#endif
\ No newline at end of file
--- /dev/null
+// Created on: 2015-08-06
+// Created by: Ilya Novikov
+// Copyright (c) 2004-2014 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_DatumModifWithValue_HeaderFile
+#define _XCAFDimTolObjects_DatumModifWithValue_HeaderFile
+
+//! Defines modifirs
+enum XCAFDimTolObjects_DatumModifWithValue
+{
+XCAFDimTolObjects_DatumModifWithValue_None,
+XCAFDimTolObjects_DatumModifWithValue_CircularOrCylindrical,
+XCAFDimTolObjects_DatumModifWithValue_Distance,
+XCAFDimTolObjects_DatumModifWithValue_Projected,
+XCAFDimTolObjects_DatumModifWithValue_Spherical
+};
+
+#endif // _XCAFDimTolObjects_DatumModifWithValue_HeaderFile
--- /dev/null
+// Created on: 2015-08-06
+// Created by: Ilya Novikov
+// Copyright (c) 2004-2014 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_DatumModifiersSequence_HeaderFile
+#define XCAFDimTolObjects_DatumModifiersSequence_HeaderFile
+
+#include <NCollection_Sequence.hxx>
+#include <XCAFDimTolObjects_DatumSingleModif.hxx>
+
+typedef NCollection_Sequence<XCAFDimTolObjects_DatumSingleModif> XCAFDimTolObjects_DatumModifiersSequence;
+
+#endif
--- /dev/null
+// Copyright (c) 1999-2014 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.
+
+#include <XCAFDimTolObjects_DatumObject.hxx>
+
+
+//=======================================================================
+//function : XCAFDimTolObjects_DatumObject
+//purpose :
+//=======================================================================
+
+XCAFDimTolObjects_DatumObject::XCAFDimTolObjects_DatumObject()
+{
+}
+
+//=======================================================================
+//function : XCAFDimTolObjects_DatumObject
+//purpose :
+//=======================================================================
+
+XCAFDimTolObjects_DatumObject::XCAFDimTolObjects_DatumObject(const Handle(XCAFDimTolObjects_DatumObject)& theObj)
+{
+ myName = theObj->myName;
+ myModifiers = theObj->myModifiers;
+ myModifierWithValue = theObj->myModifierWithValue;
+ myValueOfModifier = theObj->myValueOfModifier;
+ myDatumTarget = theObj->myDatumTarget;
+}
+
+//=======================================================================
+//function : GetName
+//purpose :
+//=======================================================================
+
+Handle(TCollection_HAsciiString) XCAFDimTolObjects_DatumObject::GetName() const
+{
+ if(myName.IsNull())
+ return new TCollection_HAsciiString();
+ return myName;
+}
+
+//=======================================================================
+//function : SetName
+//purpose :
+//=======================================================================
+
+void XCAFDimTolObjects_DatumObject::SetName(const Handle(TCollection_HAsciiString)& theName)
+{
+ myName = theName;
+}
+
+//=======================================================================
+//function : GetModifiers
+//purpose :
+//=======================================================================
+
+XCAFDimTolObjects_DatumModifiersSequence XCAFDimTolObjects_DatumObject::GetModifiers() const
+{
+ return myModifiers;
+}
+
+//=======================================================================
+//function : SetModifiers
+//purpose :
+//=======================================================================
+
+void XCAFDimTolObjects_DatumObject::SetModifiers(const XCAFDimTolObjects_DatumModifiersSequence& theModifiers)
+{
+ myModifiers = theModifiers;
+}
+
+//=======================================================================
+//function : SetModifierWithValue
+//purpose :
+//=======================================================================
+
+void XCAFDimTolObjects_DatumObject::SetModifierWithValue(const XCAFDimTolObjects_DatumModifWithValue theModifier, const Standard_Real theValue)
+{
+ myModifierWithValue = theModifier;
+ myValueOfModifier = theValue;
+}
+
+//=======================================================================
+//function : GetModifierWithValue
+//purpose :
+//=======================================================================
+
+void XCAFDimTolObjects_DatumObject::GetModifierWithValue(XCAFDimTolObjects_DatumModifWithValue& theModifier, Standard_Real& theValue) const
+{
+ theModifier = myModifierWithValue;
+ theValue = myValueOfModifier;
+}
+
+//=======================================================================
+//function : AddModifier
+//purpose :
+//=======================================================================
+
+void XCAFDimTolObjects_DatumObject::AddModifier(const XCAFDimTolObjects_DatumSingleModif theModifier)
+{
+ myModifiers.Append(theModifier);
+}
+
+//=======================================================================
+//function : GetDatumTarget
+//purpose :
+//=======================================================================
+
+TopoDS_Shape XCAFDimTolObjects_DatumObject::GetDatumTarget() const
+{
+ return myDatumTarget;
+}
+
+//=======================================================================
+//function : SetDatumTarget
+//purpose :
+//=======================================================================
+
+void XCAFDimTolObjects_DatumObject::SetDatumTarget (const TopoDS_Shape& theShape)
+{
+ myDatumTarget = theShape;
+}
+
+//=======================================================================
+//function : IsDatumTarget
+//purpose :
+//=======================================================================
+
+Standard_Boolean XCAFDimTolObjects_DatumObject::IsDatumTarget() const
+{
+ return !myDatumTarget.IsNull();
+}
--- /dev/null
+// Created on: 2015-08-06
+// Created by: Ilya Novikov
+// Copyright (c) 2004-2014 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_DatumObject_HeaderFile
+#define _XCAFDimTolObjects_DatumObject_HeaderFile
+
+#include <Standard.hxx>
+#include <Standard_Type.hxx>
+
+#include <XCAFDimTolObjects_DatumObjectSequence.hxx>
+#include <TCollection_HAsciiString.hxx>
+#include <XCAFDimTolObjects_DatumModifiersSequence.hxx>
+#include <XCAFDimTolObjects_DatumModifWithValue.hxx>
+#include <Standard_Real.hxx>
+#include <TopoDS_Shape.hxx>
+#include <Standard_Transient.hxx>
+#include <XCAFDimTolObjects_DatumSingleModif.hxx>
+#include <Standard_Boolean.hxx>
+
+class XCAFDimTolObjects_DatumObject;
+DEFINE_STANDARD_HANDLE(XCAFDimTolObjects_DatumObject, Standard_Transient)
+
+//! object to store datum
+class XCAFDimTolObjects_DatumObject : public Standard_Transient
+{
+
+public:
+
+ Standard_EXPORT XCAFDimTolObjects_DatumObject();
+
+ Standard_EXPORT XCAFDimTolObjects_DatumObject(const Handle(XCAFDimTolObjects_DatumObject)& theObj);
+
+ Standard_EXPORT Handle(TCollection_HAsciiString) GetName() const;
+
+ Standard_EXPORT void SetName (const Handle(TCollection_HAsciiString)& theTag);
+
+ Standard_EXPORT XCAFDimTolObjects_DatumModifiersSequence GetModifiers() const;
+
+ Standard_EXPORT void SetModifiers (const XCAFDimTolObjects_DatumModifiersSequence& theModifiers);
+
+ Standard_EXPORT void GetModifierWithValue (XCAFDimTolObjects_DatumModifWithValue& theModifier, Standard_Real& theValue) const;
+
+ Standard_EXPORT void SetModifierWithValue (const XCAFDimTolObjects_DatumModifWithValue theModifier, const Standard_Real theValue);
+
+ Standard_EXPORT void AddModifier (const XCAFDimTolObjects_DatumSingleModif theModifier);
+
+ Standard_EXPORT TopoDS_Shape GetDatumTarget() const;
+
+ Standard_EXPORT void SetDatumTarget (const TopoDS_Shape& theShape);
+
+ Standard_EXPORT Standard_Boolean IsDatumTarget() const;
+
+
+ DEFINE_STANDARD_RTTI(XCAFDimTolObjects_DatumObject,Standard_Transient)
+
+private:
+
+ Handle(TCollection_HAsciiString) myName;
+ XCAFDimTolObjects_DatumModifiersSequence myModifiers;
+ XCAFDimTolObjects_DatumModifWithValue myModifierWithValue;
+ Standard_Real myValueOfModifier;
+ TopoDS_Shape myDatumTarget;
+
+};
+
+#endif // _XCAFDimTolObjects_DatumObject_HeaderFile
--- /dev/null
+// Created on: 2015-08-06
+// Created by: Ilya Novikov
+// Copyright (c) 2004-2014 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_DatumObjectSequence_HeaderFile
+#define XCAFDimTolObjects_DatumObjectSequence_HeaderFile
+
+#include <NCollection_Sequence.hxx>
+
+class XCAFDimTolObjects_DatumObject;
+typedef NCollection_Sequence<Handle(XCAFDimTolObjects_DatumObject)> XCAFDimTolObjects_DatumObjectSequence;
+
+#endif
+
--- /dev/null
+// Created on: 2015-08-06
+// Created by: Ilya Novikov
+// Copyright (c) 2004-2014 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_DatumSingleModif_HeaderFile
+#define _XCAFDimTolObjects_DatumSingleModif_HeaderFile
+
+//! Defines modifirs
+enum XCAFDimTolObjects_DatumSingleModif
+{
+XCAFDimTolObjects_DatumSingleModif_AnyCrossSection,
+XCAFDimTolObjects_DatumSingleModif_Any_LongitudinalSection,
+XCAFDimTolObjects_DatumSingleModif_Basic,
+XCAFDimTolObjects_DatumSingleModif_ContactingFeature,
+XCAFDimTolObjects_DatumSingleModif_DegreeOfFreedomConstraintU,
+XCAFDimTolObjects_DatumSingleModif_DegreeOfFreedomConstraintV,
+XCAFDimTolObjects_DatumSingleModif_DegreeOfFreedomConstraintW,
+XCAFDimTolObjects_DatumSingleModif_DegreeOfFreedomConstraintX,
+XCAFDimTolObjects_DatumSingleModif_DegreeOfFreedomConstraintY,
+XCAFDimTolObjects_DatumSingleModif_DegreeOfFreedomConstraintZ,
+XCAFDimTolObjects_DatumSingleModif_DistanceVariable,
+XCAFDimTolObjects_DatumSingleModif_FreeState,
+XCAFDimTolObjects_DatumSingleModif_LeastMaterialRequirement,
+XCAFDimTolObjects_DatumSingleModif_Line,
+XCAFDimTolObjects_DatumSingleModif_MajorDiameter,
+XCAFDimTolObjects_DatumSingleModif_MaximumMaterialRequirement,
+XCAFDimTolObjects_DatumSingleModif_MinorDiameter,
+XCAFDimTolObjects_DatumSingleModif_Orientation,
+XCAFDimTolObjects_DatumSingleModif_PitchDiameter,
+XCAFDimTolObjects_DatumSingleModif_Plane,
+XCAFDimTolObjects_DatumSingleModif_Point,
+XCAFDimTolObjects_DatumSingleModif_Translation
+};
+
+#endif // _XCAFDimTolObjects_DatumSingleModif_HeaderFile
--- /dev/null
+// Created on: 2015-08-06
+// Created by: Ilya Novikov
+// Copyright (c) 2004-2014 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_DimensionFormVariance_HeaderFile
+#define _XCAFDimTolObjects_DimensionFormVariance_HeaderFile
+
+//! Defines value of form variance
+enum XCAFDimTolObjects_DimensionFormVariance
+{
+XCAFDimTolObjects_DimensionFormVariance_None,
+XCAFDimTolObjects_DimensionFormVariance_A,
+XCAFDimTolObjects_DimensionFormVariance_B,
+XCAFDimTolObjects_DimensionFormVariance_C,
+XCAFDimTolObjects_DimensionFormVariance_CD,
+XCAFDimTolObjects_DimensionFormVariance_D,
+XCAFDimTolObjects_DimensionFormVariance_E,
+XCAFDimTolObjects_DimensionFormVariance_EF,
+XCAFDimTolObjects_DimensionFormVariance_F,
+XCAFDimTolObjects_DimensionFormVariance_FG,
+XCAFDimTolObjects_DimensionFormVariance_G,
+XCAFDimTolObjects_DimensionFormVariance_H,
+XCAFDimTolObjects_DimensionFormVariance_JS,
+XCAFDimTolObjects_DimensionFormVariance_J,
+XCAFDimTolObjects_DimensionFormVariance_K,
+XCAFDimTolObjects_DimensionFormVariance_M,
+XCAFDimTolObjects_DimensionFormVariance_N,
+XCAFDimTolObjects_DimensionFormVariance_P,
+XCAFDimTolObjects_DimensionFormVariance_R,
+XCAFDimTolObjects_DimensionFormVariance_S,
+XCAFDimTolObjects_DimensionFormVariance_T,
+XCAFDimTolObjects_DimensionFormVariance_U,
+XCAFDimTolObjects_DimensionFormVariance_V,
+XCAFDimTolObjects_DimensionFormVariance_X,
+XCAFDimTolObjects_DimensionFormVariance_Y,
+XCAFDimTolObjects_DimensionFormVariance_Z,
+XCAFDimTolObjects_DimensionFormVariance_ZA,
+XCAFDimTolObjects_DimensionFormVariance_ZB,
+XCAFDimTolObjects_DimensionFormVariance_ZC
+};
+
+#endif // _XCAFDimTolObjects_DimensionFormVariance_HeaderFile
--- /dev/null
+// Created on: 2015-08-06
+// Created by: Ilya Novikov
+// Copyright (c) 2004-2014 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_DimensionGrade_HeaderFile
+#define _XCAFDimTolObjects_DimensionGrade_HeaderFile
+
+//! Defines value of grade
+enum XCAFDimTolObjects_DimensionGrade
+{
+XCAFDimTolObjects_DimensionGrade_IT01,
+XCAFDimTolObjects_DimensionGrade_IT0,
+XCAFDimTolObjects_DimensionGrade_IT1,
+XCAFDimTolObjects_DimensionGrade_IT2,
+XCAFDimTolObjects_DimensionGrade_IT3,
+XCAFDimTolObjects_DimensionGrade_IT4,
+XCAFDimTolObjects_DimensionGrade_IT5,
+XCAFDimTolObjects_DimensionGrade_IT6,
+XCAFDimTolObjects_DimensionGrade_IT7,
+XCAFDimTolObjects_DimensionGrade_IT8,
+XCAFDimTolObjects_DimensionGrade_IT9,
+XCAFDimTolObjects_DimensionGrade_IT10,
+XCAFDimTolObjects_DimensionGrade_IT11,
+XCAFDimTolObjects_DimensionGrade_IT12,
+XCAFDimTolObjects_DimensionGrade_IT13,
+XCAFDimTolObjects_DimensionGrade_IT14,
+XCAFDimTolObjects_DimensionGrade_IT15,
+XCAFDimTolObjects_DimensionGrade_IT16,
+XCAFDimTolObjects_DimensionGrade_IT17,
+XCAFDimTolObjects_DimensionGrade_IT18
+};
+
+#endif // _XCAFDimTolObjects_DimensionGrade_HeaderFile
--- /dev/null
+// Created on: 2015-08-06
+// Created by: Ilya Novikov
+// Copyright (c) 2004-2014 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_DimensionModif_HeaderFile
+#define _XCAFDimTolObjects_DimensionModif_HeaderFile
+
+//! Defines modifirs
+enum XCAFDimTolObjects_DimensionModif
+{
+XCAFDimTolObjects_DimensionModif_ControlledRadius,
+XCAFDimTolObjects_DimensionModif_Square,
+XCAFDimTolObjects_DimensionModif_StatisticalTolerance,
+XCAFDimTolObjects_DimensionModif_ContinuousFeature,
+XCAFDimTolObjects_DimensionModif_TwoPointSize,
+XCAFDimTolObjects_DimensionModif_LocalSizeDefinedBySphere,
+XCAFDimTolObjects_DimensionModif_LeastSquaresAssociationCriterion,
+XCAFDimTolObjects_DimensionModif_MaximumInscribedAssociation,
+XCAFDimTolObjects_DimensionModif_MinimumCircumscribedAssociation,
+XCAFDimTolObjects_DimensionModif_CircumferenceDiameter,
+XCAFDimTolObjects_DimensionModif_AreaDiameter,
+XCAFDimTolObjects_DimensionModif_VolumeDiameter,
+XCAFDimTolObjects_DimensionModif_MaximumSize,
+XCAFDimTolObjects_DimensionModif_MinimumSize,
+XCAFDimTolObjects_DimensionModif_AverageSize,
+XCAFDimTolObjects_DimensionModif_MedianSize,
+XCAFDimTolObjects_DimensionModif_MidRangeSize,
+XCAFDimTolObjects_DimensionModif_RangeOfSizes,
+XCAFDimTolObjects_DimensionModif_AnyRestrictedPortionOfFeature,
+XCAFDimTolObjects_DimensionModif_AnyCrossSection,
+XCAFDimTolObjects_DimensionModif_SpecificFixedCrossSection,
+XCAFDimTolObjects_DimensionModif_CommonTolerance,
+XCAFDimTolObjects_DimensionModif_FreeStateCondition,
+XCAFDimTolObjects_DimensionModif_Between
+};
+
+#endif // _XCAFDimTolObjects_DimensionModif_HeaderFile
--- /dev/null
+// Created on: 2015-08-06
+// Created by: Ilya Novikov
+// Copyright (c) 2004-2014 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_DimensionModifiersSequence_HeaderFile
+#define XCAFDimTolObjects_DimensionModifiersSequence_HeaderFile
+
+#include <NCollection_Sequence.hxx>
+#include <XCAFDimTolObjects_DimensionModif.hxx>
+
+typedef NCollection_Sequence<XCAFDimTolObjects_DimensionModif> XCAFDimTolObjects_DimensionModifiersSequence;
+
+#endif
+
--- /dev/null
+// Copyright (c) 1999-2014 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.
+
+#include <XCAFDimTolObjects_DimensionObject.hxx>
+
+#include <Precision.hxx>
+#include <TColgp_HArray1OfPnt.hxx>
+
+
+//=======================================================================
+//function : XCAFDimTolObjects_DimensionObject
+//purpose :
+//=======================================================================
+
+XCAFDimTolObjects_DimensionObject::XCAFDimTolObjects_DimensionObject()
+{
+}
+
+//=======================================================================
+//function :
+//purpose :
+//=======================================================================
+
+XCAFDimTolObjects_DimensionObject::XCAFDimTolObjects_DimensionObject(const Handle(XCAFDimTolObjects_DimensionObject)& theObj)
+{
+ myType = theObj->myType;
+ myVal = theObj->myVal;
+ myQualifier = theObj->myQualifier;
+ myIsHole = theObj->myIsHole;
+ myFormVariance = theObj->myFormVariance;
+ myGrade = theObj->myGrade;
+ myL = theObj->myL;
+ myR = theObj->myR;
+ myModifiers = theObj->myModifiers;
+ myPath = theObj->myPath;
+ myDir = theObj->myDir;
+ myPnts = theObj->myPnts;
+}
+
+//=======================================================================
+//function : SetQualifier
+//purpose :
+//=======================================================================
+void XCAFDimTolObjects_DimensionObject::SetQualifier (const XCAFDimTolObjects_DimensionQualifier theQualifier)
+{
+ myQualifier = theQualifier;
+}
+
+//=======================================================================
+//function : GetQualifier
+//purpose :
+//=======================================================================
+XCAFDimTolObjects_DimensionQualifier XCAFDimTolObjects_DimensionObject::GetQualifier() const
+{
+ return myQualifier;
+}
+
+//=======================================================================
+//function : HasQualifier
+//purpose :
+//=======================================================================
+Standard_Boolean XCAFDimTolObjects_DimensionObject::HasQualifier() const
+{
+ return (myQualifier != XCAFDimTolObjects_DimensionQualifier_None);
+}
+
+//=======================================================================
+//function : SetType
+//purpose :
+//=======================================================================
+void XCAFDimTolObjects_DimensionObject::SetType (const XCAFDimTolObjects_DimensionType theType)
+{
+ myType = theType;
+}
+
+//=======================================================================
+//function : GetType
+//purpose :
+//=======================================================================
+XCAFDimTolObjects_DimensionType XCAFDimTolObjects_DimensionObject::GetType() const
+{
+ return myType;
+}
+
+//=======================================================================
+//function : GetValue
+//purpose :
+//=======================================================================
+Standard_Real XCAFDimTolObjects_DimensionObject::GetValue () const
+{
+ if(!myVal.IsNull() && (myVal->Length() == 1 || myVal->Length() == 3))
+ {
+ return myVal->Value(1);
+ }
+ return 0;
+}
+
+//=======================================================================
+//function : GetValues
+//purpose :
+//=======================================================================
+Handle(TColStd_HArray1OfReal) XCAFDimTolObjects_DimensionObject::GetValues () const
+{
+ return myVal;
+}
+
+//=======================================================================
+//function : SetValue
+//purpose :
+//=======================================================================
+void XCAFDimTolObjects_DimensionObject::SetValue (const Standard_Real theValue)
+{
+ myVal = new TColStd_HArray1OfReal(1, 1);
+ myVal->SetValue(1,theValue);
+}
+
+//=======================================================================
+//function : SetValues
+//purpose :
+//=======================================================================
+void XCAFDimTolObjects_DimensionObject::SetValues (const Handle(TColStd_HArray1OfReal)& theValue)
+{
+ myVal = theValue;
+}
+
+//=======================================================================
+//function : IsDimWithRange
+//purpose :
+//=======================================================================
+Standard_Boolean XCAFDimTolObjects_DimensionObject::IsDimWithRange() const
+{
+ if (!myVal.IsNull() && myVal->Length() == 2)
+ return Standard_True;
+ return Standard_False;
+}
+
+//=======================================================================
+//function : SetUpperBound
+//purpose :
+//=======================================================================
+void XCAFDimTolObjects_DimensionObject::SetUpperBound (const Standard_Real theUpperBound)
+{
+ if(!myVal.IsNull() && myVal->Length() > 1)
+ myVal->SetValue(2, theUpperBound);
+ else
+ {
+ myVal = new TColStd_HArray1OfReal(1, 2);
+ myVal->SetValue(1, theUpperBound);
+ myVal->SetValue(2, theUpperBound);
+ }
+}
+
+//=======================================================================
+//function : SetLowerBound
+//purpose :
+//=======================================================================
+void XCAFDimTolObjects_DimensionObject::SetLowerBound (const Standard_Real theLowerBound)
+{
+ if(!myVal.IsNull() && myVal->Length() > 1)
+ myVal->SetValue(1, theLowerBound);
+ else
+ {
+ myVal = new TColStd_HArray1OfReal(1, 2);
+ myVal->SetValue(2, theLowerBound);
+ myVal->SetValue(1, theLowerBound);
+ }
+}
+
+//=======================================================================
+//function : GetUpperBound
+//purpose :
+//=======================================================================
+Standard_Real XCAFDimTolObjects_DimensionObject::GetUpperBound () const
+{
+ if(!myVal.IsNull() && myVal->Length() == 2)
+ {
+ return myVal->Value(2);
+ }
+ return 0;
+}
+
+//=======================================================================
+//function : GetLowerBound
+//purpose :
+//=======================================================================
+Standard_Real XCAFDimTolObjects_DimensionObject::GetLowerBound () const
+{
+ if(!myVal.IsNull() && myVal->Length() == 2)
+ {
+ return myVal->Value(1);
+ }
+ return 0;
+}
+
+//=======================================================================
+//function : IsDimWithPlusMinusTolerance
+//purpose :
+//=======================================================================
+Standard_Boolean XCAFDimTolObjects_DimensionObject::IsDimWithPlusMinusTolerance() const
+{
+ return (!myVal.IsNull() && myVal->Length() == 3);
+}
+
+//=======================================================================
+//function : SetUpperTolValue
+//purpose :
+//=======================================================================
+Standard_Boolean XCAFDimTolObjects_DimensionObject::SetUpperTolValue (const Standard_Real theUperTolValue)
+{
+ if(!myVal.IsNull() && myVal->Length() == 3)
+ {
+ myVal->SetValue(3, theUperTolValue);
+ return Standard_True;
+ }
+ else if(!myVal.IsNull() && myVal->Length() == 1)
+ {
+ Standard_Real v = myVal->Value(1);
+ myVal = new TColStd_HArray1OfReal(1, 3);
+ myVal->SetValue(1, v);
+ myVal->SetValue(2, theUperTolValue);
+ myVal->SetValue(3, theUperTolValue);
+ return Standard_True;
+ }
+ return Standard_False;
+}
+
+//=======================================================================
+//function : SetLowerTolValue
+//purpose :
+//=======================================================================
+Standard_Boolean XCAFDimTolObjects_DimensionObject::SetLowerTolValue (const Standard_Real theLowerTolValue)
+{
+ if(!myVal.IsNull() && myVal->Length() == 3)
+ {
+ myVal->SetValue(2, theLowerTolValue);
+ return Standard_True;
+ }
+ else if(!myVal.IsNull() && myVal->Length() == 1)
+ {
+ Standard_Real v = myVal->Value(1);
+ myVal = new TColStd_HArray1OfReal(1, 3);
+ myVal->SetValue(1, v);
+ myVal->SetValue(2, theLowerTolValue);
+ myVal->SetValue(3, theLowerTolValue);
+ return Standard_True;
+ }
+ return Standard_False;
+}
+
+//=======================================================================
+//function : GetUpperTolValue
+//purpose :
+//=======================================================================
+Standard_Real XCAFDimTolObjects_DimensionObject::GetUpperTolValue () const
+{
+ if(!myVal.IsNull() && myVal->Length() == 3)
+ {
+ return myVal->Value(3);
+ }
+ return 0;
+}
+
+//=======================================================================
+//function : GetLowerTolValue
+//purpose :
+//=======================================================================
+Standard_Real XCAFDimTolObjects_DimensionObject::GetLowerTolValue () const
+{
+ if(!myVal.IsNull() && myVal->Length() == 3)
+ {
+ return myVal->Value(2);
+ }
+ return 0;
+}
+
+//=======================================================================
+//function : IsDimWithClassOfTolerance
+//purpose :
+//=======================================================================
+Standard_Boolean XCAFDimTolObjects_DimensionObject::IsDimWithClassOfTolerance() const
+{
+ return (myFormVariance != XCAFDimTolObjects_DimensionFormVariance_None);
+}
+
+//=======================================================================
+//function : SetClassOfTolerance
+//purpose :
+//=======================================================================
+void XCAFDimTolObjects_DimensionObject::SetClassOfTolerance (const Standard_Boolean theHole,
+ const XCAFDimTolObjects_DimensionFormVariance theFormVariance,
+ const XCAFDimTolObjects_DimensionGrade theGrade)
+{
+ myIsHole = theHole;
+ myFormVariance = theFormVariance;
+ myGrade = theGrade;
+}
+
+//=======================================================================
+//function : GetClassOfTolerance
+//purpose :
+//=======================================================================
+Standard_Boolean XCAFDimTolObjects_DimensionObject::GetClassOfTolerance (Standard_Boolean& theHole,
+ XCAFDimTolObjects_DimensionFormVariance& theFormVariance,
+ XCAFDimTolObjects_DimensionGrade& theGrade) const
+{
+ if(myFormVariance != XCAFDimTolObjects_DimensionFormVariance_None)
+ {
+ theHole = myIsHole;
+ theFormVariance = myFormVariance;
+ theGrade = myGrade;
+ return Standard_True;
+ }
+ return Standard_False;
+}
+
+//=======================================================================
+//function : SetNbOfDecimalPlaces
+//purpose :
+//=======================================================================
+void XCAFDimTolObjects_DimensionObject::SetNbOfDecimalPlaces (const Standard_Integer theL, const Standard_Integer theR)
+{
+ myL = theL;
+ myR = theR;
+}
+
+//=======================================================================
+//function : GetNbOfDecimalPlaces
+//purpose :
+//=======================================================================
+void XCAFDimTolObjects_DimensionObject::GetNbOfDecimalPlaces (Standard_Integer& theL, Standard_Integer& theR) const
+{
+ theL = myL;
+ theR = myR;
+}
+
+//=======================================================================
+//function : GetModifiers
+//purpose :
+//=======================================================================
+XCAFDimTolObjects_DimensionModifiersSequence XCAFDimTolObjects_DimensionObject::GetModifiers () const
+{
+ return myModifiers;
+}
+
+//=======================================================================
+//function : SetModifiers
+//purpose :
+//=======================================================================
+void XCAFDimTolObjects_DimensionObject::SetModifiers (const XCAFDimTolObjects_DimensionModifiersSequence& theModifiers)
+{
+ myModifiers = theModifiers;
+}
+
+//=======================================================================
+//function : AddModifier
+//purpose :
+//=======================================================================
+void XCAFDimTolObjects_DimensionObject::AddModifier (const XCAFDimTolObjects_DimensionModif theModifier)
+{
+ myModifiers.Append(theModifier);
+}
+
+//=======================================================================
+//function : GetPath
+//purpose :
+//=======================================================================
+TopoDS_Edge XCAFDimTolObjects_DimensionObject::GetPath () const
+{
+ return myPath;
+}
+
+//=======================================================================
+//function : SetPath
+//purpose :
+//=======================================================================
+void XCAFDimTolObjects_DimensionObject::SetPath (const TopoDS_Edge& thePath)
+{
+ if(!thePath.IsNull())
+ {
+ myPath = thePath;
+ }
+}
+
+//=======================================================================
+//function : GetDirection
+//purpose :
+//=======================================================================
+Standard_Boolean XCAFDimTolObjects_DimensionObject::GetDirection (gp_Dir& theDir) const
+{
+ theDir = myDir;
+ return Standard_True;
+}
+
+//=======================================================================
+//function : SetDirection
+//purpose :
+//=======================================================================
+Standard_Boolean XCAFDimTolObjects_DimensionObject::SetDirection (const gp_Dir& theDir)
+{
+ myDir = theDir;
+ return Standard_True;
+}
+
+//=======================================================================
+//function : GetPoints
+//purpose :
+//=======================================================================
+Handle(TColgp_HArray1OfPnt) XCAFDimTolObjects_DimensionObject::GetPoints () const
+{
+ return myPnts;
+}
+
+//=======================================================================
+//function : SetPoints
+//purpose :
+//=======================================================================
+void XCAFDimTolObjects_DimensionObject::SetPoints (const Handle(TColgp_HArray1OfPnt)& thePnts)
+{
+ myPnts = thePnts;
+}
--- /dev/null
+
+// Created on: 2015-08-06
+// Created by: Ilya Novikov
+// Copyright (c) 2004-2014 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_DimensionObject_HeaderFile
+#define _XCAFDimTolObjects_DimensionObject_HeaderFile
+
+#include <Standard.hxx>
+#include <Standard_Type.hxx>
+
+#include <XCAFDimTolObjects_DimensionObjectSequence.hxx>
+#include <XCAFDimTolObjects_DimensionType.hxx>
+#include <TColStd_HArray1OfReal.hxx>
+#include <XCAFDimTolObjects_DimensionQualifier.hxx>
+#include <Standard_Boolean.hxx>
+#include <XCAFDimTolObjects_DimensionFormVariance.hxx>
+#include <XCAFDimTolObjects_DimensionGrade.hxx>
+#include <Standard_Integer.hxx>
+#include <XCAFDimTolObjects_DimensionModifiersSequence.hxx>
+#include <TopoDS_Edge.hxx>
+#include <gp_Dir.hxx>
+#include <TColgp_HArray1OfPnt.hxx>
+#include <Standard_Transient.hxx>
+#include <Standard_Real.hxx>
+#include <XCAFDimTolObjects_DimensionModif.hxx>
+
+class XCAFDimTolObjects_DimensionObject;
+DEFINE_STANDARD_HANDLE(XCAFDimTolObjects_DimensionObject, Standard_Transient)
+
+//! object to store dimension
+class XCAFDimTolObjects_DimensionObject : public Standard_Transient
+{
+
+public:
+
+ Standard_EXPORT XCAFDimTolObjects_DimensionObject();
+
+ Standard_EXPORT XCAFDimTolObjects_DimensionObject(const Handle(XCAFDimTolObjects_DimensionObject)& theObj);
+
+ Standard_EXPORT void SetQualifier (const XCAFDimTolObjects_DimensionQualifier theQualifier);
+
+ Standard_EXPORT XCAFDimTolObjects_DimensionQualifier GetQualifier() const;
+
+ Standard_EXPORT Standard_Boolean HasQualifier() const;
+
+ Standard_EXPORT void SetType (const XCAFDimTolObjects_DimensionType theTyupe);
+
+ Standard_EXPORT XCAFDimTolObjects_DimensionType GetType() const;
+
+ Standard_EXPORT Standard_Real GetValue() const;
+
+ Standard_EXPORT Handle(TColStd_HArray1OfReal) GetValues() const;
+
+ Standard_EXPORT void SetValue (const Standard_Real theValue);
+
+ Standard_EXPORT void SetValues (const Handle(TColStd_HArray1OfReal)& theValue);
+
+ Standard_EXPORT Standard_Boolean IsDimWithRange() const;
+
+ Standard_EXPORT void SetUpperBound (const Standard_Real theUpperBound);
+
+ Standard_EXPORT void SetLowerBound (const Standard_Real theLowerBound);
+
+ Standard_EXPORT Standard_Real GetUpperBound() const;
+
+ Standard_EXPORT Standard_Real GetLowerBound() const;
+
+ Standard_EXPORT Standard_Boolean IsDimWithPlusMinusTolerance() const;
+
+ Standard_EXPORT Standard_Boolean SetUpperTolValue (const Standard_Real theUperTolValue);
+
+ Standard_EXPORT Standard_Boolean SetLowerTolValue (const Standard_Real theLowerTolValue);
+
+ Standard_EXPORT Standard_Real GetUpperTolValue() const;
+
+ Standard_EXPORT Standard_Real GetLowerTolValue() const;
+
+ Standard_EXPORT Standard_Boolean IsDimWithClassOfTolerance() const;
+
+ Standard_EXPORT void SetClassOfTolerance (const Standard_Boolean theHole, const XCAFDimTolObjects_DimensionFormVariance theFormVariance, const XCAFDimTolObjects_DimensionGrade theGrade);
+
+ Standard_EXPORT Standard_Boolean GetClassOfTolerance (Standard_Boolean& theHole, XCAFDimTolObjects_DimensionFormVariance& theFormVariance, XCAFDimTolObjects_DimensionGrade& theGrade) const;
+
+ Standard_EXPORT void SetNbOfDecimalPlaces (const Standard_Integer theL, const Standard_Integer theR);
+
+ Standard_EXPORT void GetNbOfDecimalPlaces (Standard_Integer& theL, Standard_Integer& theR) const;
+
+ Standard_EXPORT XCAFDimTolObjects_DimensionModifiersSequence GetModifiers() const;
+
+ Standard_EXPORT void SetModifiers (const XCAFDimTolObjects_DimensionModifiersSequence& theModifiers);
+
+ Standard_EXPORT void AddModifier (const XCAFDimTolObjects_DimensionModif theModifier);
+
+ Standard_EXPORT TopoDS_Edge GetPath() const;
+
+ Standard_EXPORT void SetPath (const TopoDS_Edge& thePath);
+
+ Standard_EXPORT Standard_Boolean GetDirection (gp_Dir& theDir) const;
+
+ Standard_EXPORT Standard_Boolean SetDirection (const gp_Dir& theDir);
+
+ Standard_EXPORT Handle(TColgp_HArray1OfPnt) GetPoints() const;
+
+ Standard_EXPORT void SetPoints (const Handle(TColgp_HArray1OfPnt)& thePnts);
+
+
+ DEFINE_STANDARD_RTTI(XCAFDimTolObjects_DimensionObject,Standard_Transient)
+
+private:
+
+ XCAFDimTolObjects_DimensionType myType;
+ Handle(TColStd_HArray1OfReal) myVal;
+ XCAFDimTolObjects_DimensionQualifier myQualifier;
+ Standard_Boolean myIsHole;
+ XCAFDimTolObjects_DimensionFormVariance myFormVariance;
+ XCAFDimTolObjects_DimensionGrade myGrade;
+ Standard_Integer myL;
+ Standard_Integer myR;
+ XCAFDimTolObjects_DimensionModifiersSequence myModifiers;
+ TopoDS_Edge myPath;
+ gp_Dir myDir;
+ Handle(TColgp_HArray1OfPnt) myPnts;
+
+};
+
+#endif // _XCAFDimTolObjects_DimensionObject_HeaderFile
--- /dev/null
+// Created on: 2015-08-06
+// Created by: Ilya Novikov
+// Copyright (c) 2004-2014 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_DimensionObjectSequence_HeaderFile
+#define XCAFDimTolObjects_DimensionObjectSequence_HeaderFile
+
+#include <NCollection_Sequence.hxx>
+
+class XCAFDimTolObjects_DimensionObject;
+typedef NCollection_Sequence<Handle(XCAFDimTolObjects_DimensionObject)> XCAFDimTolObjects_DimensionObjectSequence;
+
+#endif
--- /dev/null
+// Created on: 2015-08-06
+// Created by: Ilya Novikov
+// Copyright (c) 2004-2014 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_DimensionQualifier_HeaderFile
+#define _XCAFDimTolObjects_DimensionQualifier_HeaderFile
+
+//! Defines types of qualifier
+enum XCAFDimTolObjects_DimensionQualifier
+{
+XCAFDimTolObjects_DimensionQualifier_None,
+XCAFDimTolObjects_DimensionQualifier_Min,
+XCAFDimTolObjects_DimensionQualifier_Max,
+XCAFDimTolObjects_DimensionQualifier_Avg
+};
+
+#endif // _XCAFDimTolObjects_DimensionQualifier_HeaderFile
--- /dev/null
+// Created on: 2015-08-06
+// Created by: Ilya Novikov
+// Copyright (c) 2004-2014 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_DimensionType_HeaderFile
+#define _XCAFDimTolObjects_DimensionType_HeaderFile
+
+//! Defines types of dimension
+enum XCAFDimTolObjects_DimensionType
+{
+XCAFDimTolObjects_DimensionType_Location_None,
+XCAFDimTolObjects_DimensionType_Location_CurvedDistance,
+XCAFDimTolObjects_DimensionType_Location_LinearDistance,
+XCAFDimTolObjects_DimensionType_Location_LinearDistance_FromCenterToOuter,
+XCAFDimTolObjects_DimensionType_Location_LinearDistance_FromCenterToInner,
+XCAFDimTolObjects_DimensionType_Location_LinearDistance_FromOuterToCenter,
+XCAFDimTolObjects_DimensionType_Location_LinearDistance_FromOuterToOuter,
+XCAFDimTolObjects_DimensionType_Location_LinearDistance_FromOuterToInner,
+XCAFDimTolObjects_DimensionType_Location_LinearDistance_FromInnerToCenter,
+XCAFDimTolObjects_DimensionType_Location_LinearDistance_FromInnerToOuter,
+XCAFDimTolObjects_DimensionType_Location_LinearDistance_FromInnerToInner,
+XCAFDimTolObjects_DimensionType_Location_Angular,
+XCAFDimTolObjects_DimensionType_Location_Oriented,
+XCAFDimTolObjects_DimensionType_Location_WithPath,
+XCAFDimTolObjects_DimensionType_Size_CurveLength,
+XCAFDimTolObjects_DimensionType_Size_Diameter,
+XCAFDimTolObjects_DimensionType_Size_SphericalDiameter,
+XCAFDimTolObjects_DimensionType_Size_Radius,
+XCAFDimTolObjects_DimensionType_Size_SphericalRadius,
+XCAFDimTolObjects_DimensionType_Size_ToroidalMinorDiameter,
+XCAFDimTolObjects_DimensionType_Size_ToroidalMajorDiameter,
+XCAFDimTolObjects_DimensionType_Size_ToroidalMinorRadius,
+XCAFDimTolObjects_DimensionType_Size_ToroidalMajorRadius,
+XCAFDimTolObjects_DimensionType_Size_ToroidalHighMajorDiameter,
+XCAFDimTolObjects_DimensionType_Size_ToroidalLowMajorDiameter,
+XCAFDimTolObjects_DimensionType_Size_ToroidalHighMajorRadius,
+XCAFDimTolObjects_DimensionType_Size_ToroidalLowMajorRadius,
+XCAFDimTolObjects_DimensionType_Size_Thickness,
+XCAFDimTolObjects_DimensionType_Size_Angular,
+XCAFDimTolObjects_DimensionType_Size_WithPath
+};
+
+#endif // _XCAFDimTolObjects_DimensionType_HeaderFile
--- /dev/null
+// Created on: 2015-08-06
+// Created by: Ilya Novikov
+// Copyright (c) 2004-2014 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_GeomToleranceMatReqModif_HeaderFile
+#define _XCAFDimTolObjects_GeomToleranceMatReqModif_HeaderFile
+
+//! Defines types of material requirement
+enum XCAFDimTolObjects_GeomToleranceMatReqModif
+{
+XCAFDimTolObjects_GeomToleranceMatReqModif_None,
+XCAFDimTolObjects_GeomToleranceMatReqModif_M,
+XCAFDimTolObjects_GeomToleranceMatReqModif_L
+};
+
+#endif // _XCAFDimTolObjects_GeomToleranceMatReqModif_HeaderFile
--- /dev/null
+// Created on: 2015-08-06
+// Created by: Ilya Novikov
+// Copyright (c) 2004-2014 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_GeomToleranceModif_HeaderFile
+#define _XCAFDimTolObjects_GeomToleranceModif_HeaderFile
+
+//! Defines modifirs
+enum XCAFDimTolObjects_GeomToleranceModif
+{
+XCAFDimTolObjects_GeomToleranceModif_Any_Cross_Section,
+XCAFDimTolObjects_GeomToleranceModif_Common_Zone,
+XCAFDimTolObjects_GeomToleranceModif_Each_Radial_Element,
+XCAFDimTolObjects_GeomToleranceModif_Free_State,
+XCAFDimTolObjects_GeomToleranceModif_Least_Material_Requirement,
+XCAFDimTolObjects_GeomToleranceModif_Line_Element,
+XCAFDimTolObjects_GeomToleranceModif_Major_Diameter,
+XCAFDimTolObjects_GeomToleranceModif_Maximum_Material_Requirement,
+XCAFDimTolObjects_GeomToleranceModif_Minor_Diameter,
+XCAFDimTolObjects_GeomToleranceModif_Not_Convex,
+XCAFDimTolObjects_GeomToleranceModif_Pitch_Diameter,
+XCAFDimTolObjects_GeomToleranceModif_Reciprocity_Requirement,
+XCAFDimTolObjects_GeomToleranceModif_Separate_Requirement,
+XCAFDimTolObjects_GeomToleranceModif_Statistical_Tolerance,
+XCAFDimTolObjects_GeomToleranceModif_Tangent_Plane
+};
+
+#endif // _XCAFDimTolObjects_GeomToleranceModif_HeaderFile
--- /dev/null
+// Created on: 2015-08-06
+// Created by: Ilya Novikov
+// Copyright (c) 2004-2014 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_GeomToleranceModifiersSequence_HeaderFile
+#define XCAFDimTolObjects_GeomToleranceModifiersSequence_HeaderFile
+
+#include <NCollection_Sequence.hxx>
+#include <XCAFDimTolObjects_GeomToleranceModif.hxx>
+
+typedef NCollection_Sequence<XCAFDimTolObjects_GeomToleranceModif> XCAFDimTolObjects_GeomToleranceModifiersSequence;
+
+#endif
--- /dev/null
+// Copyright (c) 1999-2014 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.
+
+#include <XCAFDimTolObjects_GeomToleranceObject.hxx>
+
+//=======================================================================
+//function : XCAFDimTolObjects_GeomTolerance
+//purpose :
+//=======================================================================
+
+XCAFDimTolObjects_GeomToleranceObject::XCAFDimTolObjects_GeomToleranceObject()
+{
+}
+
+//=======================================================================
+//function : XCAFDimTolObjects_GeomTolerance
+//purpose :
+//=======================================================================
+
+XCAFDimTolObjects_GeomToleranceObject::XCAFDimTolObjects_GeomToleranceObject(const Handle(XCAFDimTolObjects_GeomToleranceObject)& theObj)
+{
+ myType = theObj->myType;
+ myTypeOfValue = theObj->myTypeOfValue;
+ myValue = theObj->myValue;
+ myMatReqModif = theObj->myMatReqModif;
+ myZoneModif = theObj->myZoneModif;
+ myValueOfZoneModif = theObj->myValueOfZoneModif;
+ myModifiers = theObj->myModifiers;
+ myMaxValueModif = theObj->myMaxValueModif;
+}
+
+//=======================================================================
+//function :
+//purpose :
+//=======================================================================
+
+void XCAFDimTolObjects_GeomToleranceObject::SetType (const XCAFDimTolObjects_GeomToleranceType theType)
+{
+ myType = theType;
+}
+
+//=======================================================================
+//function :
+//purpose :
+//=======================================================================
+
+XCAFDimTolObjects_GeomToleranceType XCAFDimTolObjects_GeomToleranceObject::GetType() const
+{
+ return myType;
+}
+
+//=======================================================================
+//function :
+//purpose :
+//=======================================================================
+
+void XCAFDimTolObjects_GeomToleranceObject::SetTypeOfValue (const XCAFDimTolObjects_GeomToleranceTypeValue theTypeOfValue)
+{
+ myTypeOfValue = theTypeOfValue;
+}
+
+//=======================================================================
+//function :
+//purpose :
+//=======================================================================
+
+XCAFDimTolObjects_GeomToleranceTypeValue XCAFDimTolObjects_GeomToleranceObject::GetTypeOfValue() const
+{
+ return myTypeOfValue;
+}
+
+//=======================================================================
+//function :
+//purpose :
+//=======================================================================
+
+void XCAFDimTolObjects_GeomToleranceObject::SetValue (const Standard_Real theValue)
+{
+ myValue = theValue;
+}
+
+//=======================================================================
+//function :
+//purpose :
+//=======================================================================
+
+Standard_Real XCAFDimTolObjects_GeomToleranceObject::GetValue() const
+{
+ return myValue;
+}
+
+//=======================================================================
+//function :
+//purpose :
+//=======================================================================
+
+void XCAFDimTolObjects_GeomToleranceObject::SetMaterialRequirementModifier (const XCAFDimTolObjects_GeomToleranceMatReqModif theMatReqModif)
+{
+ myMatReqModif = theMatReqModif;
+}
+
+//=======================================================================
+//function :
+//purpose :
+//=======================================================================
+
+XCAFDimTolObjects_GeomToleranceMatReqModif XCAFDimTolObjects_GeomToleranceObject::GetMaterialRequirementModifier() const
+{
+ return myMatReqModif;
+}
+
+//=======================================================================
+//function :
+//purpose :
+//=======================================================================
+
+void XCAFDimTolObjects_GeomToleranceObject::SetZoneModifier (const XCAFDimTolObjects_GeomToleranceZoneModif theZoneModif)
+{
+ myZoneModif = theZoneModif;
+}
+
+//=======================================================================
+//function :
+//purpose :
+//=======================================================================
+
+XCAFDimTolObjects_GeomToleranceZoneModif XCAFDimTolObjects_GeomToleranceObject::GetZoneModifier() const
+{
+ return myZoneModif;
+}
+
+//=======================================================================
+//function :
+//purpose :
+//=======================================================================
+
+void XCAFDimTolObjects_GeomToleranceObject::SetValueOfZoneModifier (const Standard_Real theValue)
+{
+ myValueOfZoneModif = theValue;
+}
+
+//=======================================================================
+//function :
+//purpose :
+//=======================================================================
+
+Standard_Real XCAFDimTolObjects_GeomToleranceObject::GetValueOfZoneModifier() const
+{
+ return myValueOfZoneModif;
+}
+
+//=======================================================================
+//function :
+//purpose :
+//=======================================================================
+
+void XCAFDimTolObjects_GeomToleranceObject::SetModifiers (const XCAFDimTolObjects_GeomToleranceModifiersSequence& theModifiers)
+{
+ myModifiers = theModifiers;
+}
+
+//=======================================================================
+//function :
+//purpose :
+//=======================================================================
+
+void XCAFDimTolObjects_GeomToleranceObject::AddModifier (const XCAFDimTolObjects_GeomToleranceModif theModifier)
+{
+ myModifiers.Append(theModifier);
+}
+
+//=======================================================================
+//function :
+//purpose :
+//=======================================================================
+
+XCAFDimTolObjects_GeomToleranceModifiersSequence XCAFDimTolObjects_GeomToleranceObject::GetModifiers() const
+{
+ return myModifiers;
+}
+
+//=======================================================================
+//function :
+//purpose :
+//=======================================================================
+
+void XCAFDimTolObjects_GeomToleranceObject::SetMaxValueModifier (const Standard_Real theModifier)
+{
+ myMaxValueModif = theModifier;
+}
+
+//=======================================================================
+//function :
+//purpose :
+//=======================================================================
+
+Standard_Real XCAFDimTolObjects_GeomToleranceObject::GetMaxValueModifier() const
+{
+ return myMaxValueModif;
+}
--- /dev/null
+// Created on: 2015-08-06
+// Created by: Ilya Novikov
+// Copyright (c) 2004-2014 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_GeomToleranceObject_HeaderFile
+#define _XCAFDimTolObjects_GeomToleranceObject_HeaderFile
+
+#include <Standard.hxx>
+#include <Standard_Type.hxx>
+
+#include <XCAFDimTolObjects_GeomToleranceObjectSequence.hxx>
+#include <XCAFDimTolObjects_GeomToleranceType.hxx>
+#include <XCAFDimTolObjects_GeomToleranceTypeValue.hxx>
+#include <Standard_Real.hxx>
+#include <XCAFDimTolObjects_GeomToleranceMatReqModif.hxx>
+#include <XCAFDimTolObjects_GeomToleranceZoneModif.hxx>
+#include <XCAFDimTolObjects_GeomToleranceModifiersSequence.hxx>
+#include <Standard_Transient.hxx>
+#include <XCAFDimTolObjects_GeomToleranceModif.hxx>
+
+class XCAFDimTolObjects_GeomToleranceObject;
+DEFINE_STANDARD_HANDLE(XCAFDimTolObjects_GeomToleranceObject, Standard_Transient)
+
+//! attribute to store dimension and tolerance
+class XCAFDimTolObjects_GeomToleranceObject : public Standard_Transient
+{
+
+public:
+
+ Standard_EXPORT XCAFDimTolObjects_GeomToleranceObject();
+
+ Standard_EXPORT XCAFDimTolObjects_GeomToleranceObject(const Handle(XCAFDimTolObjects_GeomToleranceObject)& theObj);
+
+ Standard_EXPORT void SetType (const XCAFDimTolObjects_GeomToleranceType theType);
+
+ Standard_EXPORT XCAFDimTolObjects_GeomToleranceType GetType() const;
+
+ Standard_EXPORT void SetTypeOfValue (const XCAFDimTolObjects_GeomToleranceTypeValue theTypeOfValue);
+
+ Standard_EXPORT XCAFDimTolObjects_GeomToleranceTypeValue GetTypeOfValue() const;
+
+ Standard_EXPORT void SetValue (const Standard_Real theValue);
+
+ Standard_EXPORT Standard_Real GetValue() const;
+
+ Standard_EXPORT void SetMaterialRequirementModifier (const XCAFDimTolObjects_GeomToleranceMatReqModif theMatReqModif);
+
+ Standard_EXPORT XCAFDimTolObjects_GeomToleranceMatReqModif GetMaterialRequirementModifier() const;
+
+ Standard_EXPORT void SetZoneModifier (const XCAFDimTolObjects_GeomToleranceZoneModif theZoneModif);
+
+ Standard_EXPORT XCAFDimTolObjects_GeomToleranceZoneModif GetZoneModifier() const;
+
+ Standard_EXPORT void SetValueOfZoneModifier (const Standard_Real theValue);
+
+ Standard_EXPORT Standard_Real GetValueOfZoneModifier() const;
+
+ Standard_EXPORT void SetModifiers (const XCAFDimTolObjects_GeomToleranceModifiersSequence& theModifiers);
+
+ Standard_EXPORT void AddModifier (const XCAFDimTolObjects_GeomToleranceModif theModifier);
+
+ Standard_EXPORT XCAFDimTolObjects_GeomToleranceModifiersSequence GetModifiers() const;
+
+ Standard_EXPORT void SetMaxValueModifier (const Standard_Real theModifier);
+
+ Standard_EXPORT Standard_Real GetMaxValueModifier() const;
+
+ DEFINE_STANDARD_RTTI(XCAFDimTolObjects_GeomToleranceObject,Standard_Transient)
+
+private:
+
+ XCAFDimTolObjects_GeomToleranceType myType;
+ XCAFDimTolObjects_GeomToleranceTypeValue myTypeOfValue;
+ Standard_Real myValue;
+ XCAFDimTolObjects_GeomToleranceMatReqModif myMatReqModif;
+ XCAFDimTolObjects_GeomToleranceZoneModif myZoneModif;
+ Standard_Real myValueOfZoneModif;
+ XCAFDimTolObjects_GeomToleranceModifiersSequence myModifiers;
+ Standard_Real myMaxValueModif;
+
+
+};
+
+
+
+
+
+
+
+#endif // _XCAFDimTolObjects_GeomToleranceObject_HeaderFile
--- /dev/null
+// Created on: 2015-08-06
+// Created by: Ilya Novikov
+// Copyright (c) 2004-2014 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_GeomToleranceObjectSequence_HeaderFile
+#define XCAFDimTolObjects_GeomToleranceObjectSequence_HeaderFile
+
+#include <NCollection_Sequence.hxx>
+
+class XCAFDimTolObjects_GeomToleranceObject;
+typedef NCollection_Sequence<Handle(XCAFDimTolObjects_GeomToleranceObject)> XCAFDimTolObjects_GeomToleranceObjectSequence;
+
+#endif
--- /dev/null
+// Created on: 2015-08-06
+// Created by: Ilya Novikov
+// Copyright (c) 2004-2014 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_GeomToleranceType_HeaderFile
+#define _XCAFDimTolObjects_GeomToleranceType_HeaderFile
+
+//! Defines types of geom tolerance
+enum XCAFDimTolObjects_GeomToleranceType
+{
+XCAFDimTolObjects_GeomToleranceType_None,
+XCAFDimTolObjects_GeomToleranceType_Angularity,
+XCAFDimTolObjects_GeomToleranceType_CircularRunout,
+XCAFDimTolObjects_GeomToleranceType_CircularityOrRoundness,
+XCAFDimTolObjects_GeomToleranceType_Coaxiality,
+XCAFDimTolObjects_GeomToleranceType_Concentricity,
+XCAFDimTolObjects_GeomToleranceType_Cylindricity,
+XCAFDimTolObjects_GeomToleranceType_Flatness,
+XCAFDimTolObjects_GeomToleranceType_Parallelism,
+XCAFDimTolObjects_GeomToleranceType_Perpendicularity,
+XCAFDimTolObjects_GeomToleranceType_Position,
+XCAFDimTolObjects_GeomToleranceType_ProfileOfLine,
+XCAFDimTolObjects_GeomToleranceType_ProfileOfSurface,
+XCAFDimTolObjects_GeomToleranceType_Straightness,
+XCAFDimTolObjects_GeomToleranceType_Symmetry,
+XCAFDimTolObjects_GeomToleranceType_TotalRunout
+};
+
+#endif // _XCAFDimTolObjects_GeomToleranceType_HeaderFile
--- /dev/null
+// Created on: 2015-08-06
+// Created by: Ilya Novikov
+// Copyright (c) 2004-2014 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_GeomToleranceTypeValue_HeaderFile
+#define _XCAFDimTolObjects_GeomToleranceTypeValue_HeaderFile
+
+//! Defines types of value of tolerane
+enum XCAFDimTolObjects_GeomToleranceTypeValue
+{
+XCAFDimTolObjects_GeomToleranceTypeValue_None,
+XCAFDimTolObjects_GeomToleranceTypeValue_Diameter,
+XCAFDimTolObjects_GeomToleranceTypeValue_SphericalDiameter
+};
+
+#endif // _XCAFDimTolObjects_GeomToleranceTypeValue_HeaderFile
--- /dev/null
+// Created on: 2015-08-06
+// Created by: Ilya Novikov
+// Copyright (c) 2004-2014 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_GeomToleranceZoneModif_HeaderFile
+#define _XCAFDimTolObjects_GeomToleranceZoneModif_HeaderFile
+
+//! Defines types of zone
+enum XCAFDimTolObjects_GeomToleranceZoneModif
+{
+XCAFDimTolObjects_GeomToleranceZoneModif_None,
+XCAFDimTolObjects_GeomToleranceZoneModif_P,
+XCAFDimTolObjects_GeomToleranceZoneModif_NonUniform
+};
+
+#endif // _XCAFDimTolObjects_GeomToleranceZoneModif_HeaderFile
--- /dev/null
+// Copyright (c) 1999-2014 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.
+
+#include <XCAFDimTolObjects_Tool.hxx>
+#include <XCAFDimTolObjects_DimensionObjectSequence.hxx>
+#include <TDF_ChildIterator.hxx>
+#include <XCAFDoc_DimTolTool.hxx>
+#include <XCAFDoc_Dimension.hxx>
+#include <XCAFDimTolObjects_GeomToleranceObjectSequence.hxx>
+#include <XCAFDoc_GeomTolerance.hxx>
+#include <XCAFDimTolObjects_DatumObjectSequence.hxx>
+#include <XCAFDoc_Datum.hxx>
+#include <XCAFDoc_ShapeTool.hxx>
+#include <XCAFDoc_Datum.hxx>
+#include <TDF_Label.hxx>
+#include <TDF_LabelSequence.hxx>
+#include <XCAFDoc_DocumentTool.hxx>
+#include <TDocStd_Document.hxx>
+#include <NCollection_DataMap.hxx>
+#include <XCAFDimTolObjects_DataMapOfToleranceDatum.hxx>
+
+//=======================================================================
+//function : XCAFDimTolObjects_Tool
+//purpose :
+//=======================================================================
+
+XCAFDimTolObjects_Tool::XCAFDimTolObjects_Tool(const Handle(TDocStd_Document)& theDoc)
+{
+ myDimTolTool = XCAFDoc_DocumentTool::DimTolTool(theDoc->Main());
+}
+
+//=======================================================================
+//function : GetDimensions
+//purpose :
+//=======================================================================
+
+void XCAFDimTolObjects_Tool::GetDimensions(XCAFDimTolObjects_DimensionObjectSequence& theDimensionObjectSequence) const
+{
+ theDimensionObjectSequence.Clear();
+ TDF_ChildIterator aChildIterator( myDimTolTool->Label() );
+ for (; aChildIterator.More(); aChildIterator.Next()) {
+ TDF_Label aL = aChildIterator.Value();
+ Handle(XCAFDoc_Dimension) aDimension;
+ if(aL.FindAttribute(XCAFDoc_Dimension::GetID(),aDimension)) {
+ theDimensionObjectSequence.Append(aDimension->GetObject());
+ }
+ }
+}
+
+//=======================================================================
+//function : GetGeomTolerances
+//purpose :
+//=======================================================================
+
+void XCAFDimTolObjects_Tool::GetGeomTolerances(XCAFDimTolObjects_GeomToleranceObjectSequence& theGeomToleranceObjectSequence,
+ XCAFDimTolObjects_DatumObjectSequence& theDatumSequence,
+ XCAFDimTolObjects_DataMapOfToleranceDatum& theMap) const
+{
+ theGeomToleranceObjectSequence.Clear();
+ TDF_ChildIterator aChildIterator( myDimTolTool->Label() );
+ for (; aChildIterator.More(); aChildIterator.Next()) {
+ TDF_Label aL = aChildIterator.Value();
+ Handle(XCAFDoc_GeomTolerance) aGeomTolerance;
+ if(aL.FindAttribute(XCAFDoc_GeomTolerance::GetID(),aGeomTolerance)) {
+ theGeomToleranceObjectSequence.Append(aGeomTolerance->GetObject());
+ TDF_LabelSequence aSeq;
+ if(myDimTolTool->GetDatumOfTolerLabels(aGeomTolerance->Label(), aSeq))
+ {
+ for(Standard_Integer i = 1; i <= aSeq.Length(); i++)
+ {
+ Handle(XCAFDoc_Datum) aDatum;
+ if(aSeq.Value(i).FindAttribute(XCAFDoc_Datum::GetID(), aDatum))
+ {
+ theDatumSequence.Append(aDatum->GetObject());
+ theMap.Bind(theGeomToleranceObjectSequence.Last(), theDatumSequence.Last());
+ }
+ }
+ }
+ }
+ }
+}
+
+//=======================================================================
+//function : GetRefDimensions
+//purpose :
+//=======================================================================
+
+Standard_Boolean XCAFDimTolObjects_Tool::GetRefDimensions(const TopoDS_Shape& theShape,
+ XCAFDimTolObjects_DimensionObjectSequence& theDimensionObjectSequence) const
+{
+ theDimensionObjectSequence.Clear();
+ TDF_Label aShapeL;
+ myDimTolTool->ShapeTool()->Search(theShape, aShapeL);
+ if(!aShapeL.IsNull())
+ {
+ TDF_LabelSequence aSeq;
+ if( myDimTolTool->GetRefDimensionLabels(aShapeL, aSeq) ) {
+ for(Standard_Integer i = 1; i <= aSeq.Length(); i++)
+ {
+ Handle(XCAFDoc_Dimension) aDimension;
+ if( aSeq.Value(i).FindAttribute(XCAFDoc_Dimension::GetID(),aDimension))
+ theDimensionObjectSequence.Append(aDimension->GetObject());
+ }
+ return Standard_True;
+ }
+ }
+ return Standard_False;
+}
+
+//=======================================================================
+//function : GetRefGeomTolerances
+//purpose :
+//=======================================================================
+
+Standard_Boolean XCAFDimTolObjects_Tool::GetRefGeomTolerances(const TopoDS_Shape& theShape,
+ XCAFDimTolObjects_GeomToleranceObjectSequence& theGeomToleranceObjectSequence,
+ XCAFDimTolObjects_DatumObjectSequence& theDatumSequence,
+ XCAFDimTolObjects_DataMapOfToleranceDatum& theMap) const
+{
+ theGeomToleranceObjectSequence.Clear();
+ TDF_Label aShapeL;
+ myDimTolTool->ShapeTool()->Search(theShape, aShapeL);
+ if(!aShapeL.IsNull())
+ {
+ TDF_LabelSequence aSeq;
+ if( myDimTolTool->GetRefGeomToleranceLabels(aShapeL, aSeq) ) {
+ for(Standard_Integer i = 1; i <= aSeq.Length(); i++)
+ {
+ Handle(XCAFDoc_GeomTolerance) aGeomTolerance;
+ if( aSeq.Value(i).FindAttribute(XCAFDoc_GeomTolerance::GetID(),aGeomTolerance))
+ {
+ theGeomToleranceObjectSequence.Append(aGeomTolerance->GetObject());
+ TDF_LabelSequence aSeq;
+ if(myDimTolTool->GetDatumOfTolerLabels(aGeomTolerance->Label(), aSeq))
+ {
+ for(Standard_Integer i = 1; i <= aSeq.Length(); i++)
+ {
+ Handle(XCAFDoc_Datum) aDatum;
+ if(aSeq.Value(i).FindAttribute(XCAFDoc_Datum::GetID(), aDatum))
+ {
+ theDatumSequence.Append(aDatum->GetObject());
+ theMap.Bind(theGeomToleranceObjectSequence.Last(), theDatumSequence.Last());
+ }
+ }
+ }
+ }
+ }
+ return Standard_True;
+ }
+ }
+ return Standard_False;
+}
+
+//=======================================================================
+//function : GetRefDatum
+//purpose :
+//=======================================================================
+
+Standard_Boolean XCAFDimTolObjects_Tool::GetRefDatum(const TopoDS_Shape& theShape,
+ Handle(XCAFDimTolObjects_DatumObject)& theDatumObject) const
+{
+ TDF_Label aShapeL;
+ myDimTolTool->ShapeTool()->Search(theShape, aShapeL);
+ if(!aShapeL.IsNull())
+ {
+ TDF_Label aDatumL;
+ if(myDimTolTool->GetRefDatumLabel(aShapeL, aDatumL))
+ {
+ Handle(XCAFDoc_Datum) aDatum;
+ if( aDatumL.FindAttribute(XCAFDoc_Datum::GetID(),aDatum)){
+ theDatumObject = aDatum->GetObject();
+ return Standard_True;
+ }
+ }
+ }
+ return Standard_False;
+}
--- /dev/null
+// Created on: 2015-08-06
+// Created by: Ilya Novikov
+// Copyright (c) 2004-2014 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_Tool_HeaderFile
+#define _XCAFDimTolObjects_Tool_HeaderFile
+
+#include <Standard.hxx>
+#include <Standard_Type.hxx>
+
+#include <XCAFDoc_DimTolTool.hxx>
+#include <TDocStd_Document.hxx>
+#include <Standard_Boolean.hxx>
+#include <XCAFDimTolObjects_DimensionObjectSequence.hxx>
+#include <XCAFDimTolObjects_GeomToleranceObjectSequence.hxx>
+#include <XCAFDimTolObjects_DatumObjectSequence.hxx>
+#include <XCAFDimTolObjects_DataMapOfToleranceDatum.hxx>
+#include <XCAFDimTolObjects_DatumObject.hxx>
+class TDocStd_Document;
+class TopoDS_Shape;
+
+
+class XCAFDimTolObjects_Tool
+{
+public:
+
+ DEFINE_STANDARD_ALLOC
+
+
+ Standard_EXPORT XCAFDimTolObjects_Tool(const Handle(TDocStd_Document)& theDoc);
+
+ //! Returns a sequence of Dimensions currently stored
+ //! in the DGTtable
+ Standard_EXPORT void GetDimensions (XCAFDimTolObjects_DimensionObjectSequence& theDimensionObjectSequence) const;
+
+ //! Returns all Dimensions defined for Shape
+ Standard_EXPORT Standard_Boolean GetRefDimensions (const TopoDS_Shape& theShape, XCAFDimTolObjects_DimensionObjectSequence& theDimensions) const;
+
+ //! Returns a sequence of Tolerancess currently stored
+ //! in the DGTtable
+ Standard_EXPORT void GetGeomTolerances (XCAFDimTolObjects_GeomToleranceObjectSequence& theGeomToleranceObjectSequence, XCAFDimTolObjects_DatumObjectSequence& theDatumObjectSequence, XCAFDimTolObjects_DataMapOfToleranceDatum& theMap) const;
+
+ //! Returns all GeomTolerances defined for Shape
+ Standard_EXPORT Standard_Boolean GetRefGeomTolerances (const TopoDS_Shape& theShape, XCAFDimTolObjects_GeomToleranceObjectSequence& theGeomToleranceObjectSequence, XCAFDimTolObjects_DatumObjectSequence& theDatumObjectSequence, XCAFDimTolObjects_DataMapOfToleranceDatum& theMap) const;
+
+ //! Returns DatumObject defined for Shape
+ Standard_EXPORT Standard_Boolean GetRefDatum (const TopoDS_Shape& theShape, Handle(XCAFDimTolObjects_DatumObject)& theDatum) const;
+
+private:
+
+ Handle(XCAFDoc_DimTolTool) myDimTolTool;
+
+};
+
+#endif // _XCAFDimTolObjects_Tool_HeaderFile
XCAFDoc_DataMapOfShapeLabel.hxx
XCAFDoc_Datum.cxx
XCAFDoc_Datum.hxx
+XCAFDoc_Dimension.cxx
+XCAFDoc_Dimension.hxx
+XCAFDoc_GeomTolerance.cxx
+XCAFDoc_GeomTolerance.hxx
XCAFDoc_DimTol.cxx
XCAFDoc_DimTol.hxx
XCAFDoc_DimTolTool.cxx
return ID;
}
+//=======================================================================
+//function : DimensionRefGUID
+//purpose :
+//=======================================================================
+
+Standard_GUID XCAFDoc::DimensionRefGUID()
+{
+ static Standard_GUID ID("efd212e3-6dfd-11d4-b9c8-0060b0ee281b");
+ return ID;
+}
+
+//=======================================================================
+//function : GeomToleranceRefGUID
+//purpose :
+//=======================================================================
+
+Standard_GUID XCAFDoc::GeomToleranceRefGUID()
+{
+ static Standard_GUID ID("efd213e3-6dfd-11d4-b9c8-0060b0ee281b");
+ return ID;
+}
//=======================================================================
//function : DatumRefGUID
class XCAFDoc_Location;
class XCAFDoc_Color;
class XCAFDoc_DimTol;
+class XCAFDoc_Dimension;
+class XCAFDoc_GeomTolerance;
class XCAFDoc_Datum;
class XCAFDoc_Material;
class XCAFDoc_Volume;
//! Return GUIDs for TreeNode representing specified types of DGT
Standard_EXPORT static Standard_GUID DimTolRefGUID();
+
+ //! Return GUIDs for TreeNode representing specified types of Dimension
+ Standard_EXPORT static Standard_GUID DimensionRefGUID() ;
+
+ //! Return GUIDs for TreeNode representing specified types of GeomTolerance
+ Standard_EXPORT static Standard_GUID GeomToleranceRefGUID() ;
//! Return GUIDs for TreeNode representing specified types of datum
Standard_EXPORT static Standard_GUID DatumRefGUID();
#include <TDF_Label.hxx>
#include <TDF_RelocationTable.hxx>
#include <XCAFDoc_Datum.hxx>
+#include <TDataStd_AsciiString.hxx>
+#include <TDataStd_IntegerArray.hxx>
+#include <TDataStd_Integer.hxx>
+#include <TDataStd_Real.hxx>
+#include <TNaming_NamedShape.hxx>
+#include <TNaming_Builder.hxx>
+
+
+#include <XCAFDimTolObjects_DatumObject.hxx>
+
+enum ChildLab
+{
+ ChildLab_Name = 1,
+ ChildLab_Modifiers,
+ ChildLab_ModifierWithValue,
+ ChildLab_DatumTarget
+};
//=======================================================================
//function : XCAFDoc_Datum
//purpose :
//=======================================================================
-Handle(XCAFDoc_Datum) XCAFDoc_Datum::Set(const TDF_Label& label,
- const Handle(TCollection_HAsciiString)& aName,
- const Handle(TCollection_HAsciiString)& aDescription,
- const Handle(TCollection_HAsciiString)& anIdentification)
+Handle(XCAFDoc_Datum) XCAFDoc_Datum::Set(const TDF_Label& theLabel,
+ const Handle(TCollection_HAsciiString)& theName,
+ const Handle(TCollection_HAsciiString)& theDescription,
+ const Handle(TCollection_HAsciiString)& theIdentification)
+{
+ Handle(XCAFDoc_Datum) aDatum;
+ if (!theLabel.FindAttribute(XCAFDoc_Datum::GetID(), aDatum)) {
+ aDatum = new XCAFDoc_Datum();
+ theLabel.AddAttribute(aDatum);
+ }
+ aDatum->Set(theName,theDescription,theIdentification);
+ return aDatum;
+}
+
+//=======================================================================
+//function : Set
+//purpose :
+//=======================================================================
+
+Handle(XCAFDoc_Datum) XCAFDoc_Datum::Set(const TDF_Label& theLabel)
{
- Handle(XCAFDoc_Datum) A;
- if (!label.FindAttribute(XCAFDoc_Datum::GetID(), A)) {
- A = new XCAFDoc_Datum();
- label.AddAttribute(A);
+ Handle(XCAFDoc_Datum) aDatum;
+ if (!theLabel.FindAttribute(XCAFDoc_Datum::GetID(), aDatum)) {
+ aDatum = new XCAFDoc_Datum();
+ theLabel.AddAttribute(aDatum);
}
- A->Set(aName,aDescription,anIdentification);
- return A;
+ return aDatum;
}
//purpose :
//=======================================================================
-void XCAFDoc_Datum::Set(const Handle(TCollection_HAsciiString)& aName,
- const Handle(TCollection_HAsciiString)& aDescription,
- const Handle(TCollection_HAsciiString)& anIdentification)
+void XCAFDoc_Datum::Set(const Handle(TCollection_HAsciiString)& theName,
+ const Handle(TCollection_HAsciiString)& theDescription,
+ const Handle(TCollection_HAsciiString)& theIdentification)
{
- myName = aName;
- myDescription = aDescription;
- myIdentification = anIdentification;
+ Backup();
+ myName = theName;
+ myDescription = theDescription;
+ myIdentification = theIdentification;
}
Handle(TCollection_HAsciiString) XCAFDoc_Datum::GetName() const
{
+ if(myName.IsNull())
+ return new TCollection_HAsciiString();
return myName;
}
-
//=======================================================================
-//function : GetDescription
+//function : GetDescriptio7n
//purpose :
//=======================================================================
return myIdentification;
}
+//=======================================================================
+//function : SetObject
+//purpose :
+//=======================================================================
+
+void XCAFDoc_Datum::SetObject(const Handle(XCAFDimTolObjects_DatumObject)& theObject)
+{
+ Backup();
+ if (!theObject->GetName().IsNull())
+ {
+ Handle(TDataStd_AsciiString) anAttName;
+ if(!Label().FindChild(ChildLab_Name).FindAttribute(TDataStd_AsciiString::GetID(), anAttName))
+ {
+ anAttName = new TDataStd_AsciiString();
+ Label().FindChild(ChildLab_Name).AddAttribute(anAttName);
+ }
+ anAttName->Set(theObject->GetName()->String());
+ }
+ else
+ {
+ Label().FindChild(ChildLab_Name).ForgetAllAttributes();
+ }
+
+ if(theObject->GetModifiers().Length() == 0)
+ {
+ Label().FindChild(ChildLab_Modifiers).ForgetAllAttributes();
+ }
+ else
+ {
+ Handle(TDataStd_IntegerArray) aModifiers;
+ if(!Label().FindChild(ChildLab_Modifiers).FindAttribute(TDataStd_IntegerArray::GetID(), aModifiers))
+ {
+ aModifiers = new TDataStd_IntegerArray();
+ Label().FindChild(ChildLab_Modifiers).AddAttribute(aModifiers);
+ }
+ Handle(TColStd_HArray1OfInteger) anArr = new TColStd_HArray1OfInteger(1,theObject->GetModifiers().Length());
+ for(Standard_Integer i = 1; i <= theObject->GetModifiers().Length(); i++)
+ anArr->SetValue(i,theObject->GetModifiers().Value(i));
+ aModifiers->ChangeArray(anArr);
+ }
+
+ XCAFDimTolObjects_DatumModifWithValue aM;
+ Standard_Real aV;
+ theObject->GetModifierWithValue(aM, aV);
+ if(aM != XCAFDimTolObjects_DatumModifWithValue_None)
+ {
+ Handle(TDataStd_Integer) aModifierWithValueM;
+ if(!Label().FindChild(ChildLab_ModifierWithValue).FindAttribute(TDataStd_Integer::GetID(), aModifierWithValueM))
+ {
+ aModifierWithValueM = new TDataStd_Integer();
+ Label().FindChild(ChildLab_ModifierWithValue).AddAttribute(aModifierWithValueM);
+ }
+ Handle(TDataStd_Real) aModifierWithValueV;
+ if(!Label().FindChild(ChildLab_ModifierWithValue).FindAttribute(TDataStd_Real::GetID(), aModifierWithValueV))
+ {
+ aModifierWithValueV = new TDataStd_Real();
+ Label().FindChild(ChildLab_ModifierWithValue).AddAttribute(aModifierWithValueV);
+ }
+ aModifierWithValueM->Set(aM);
+ aModifierWithValueV->Set(aV);
+ }
+ else
+ {
+ Label().FindChild(ChildLab_ModifierWithValue).ForgetAllAttributes();
+ }
+
+ if(!theObject->GetDatumTarget().IsNull())
+ {
+ TNaming_Builder tnBuild(Label().FindChild(ChildLab_DatumTarget));
+ tnBuild.Generated(theObject->GetDatumTarget());
+ }
+ else
+ {
+ Label().FindChild(ChildLab_DatumTarget).ForgetAllAttributes();
+ }
+}
+
+//=======================================================================
+//function : GetObject
+//purpose :
+//=======================================================================
+
+Handle(XCAFDimTolObjects_DatumObject) XCAFDoc_Datum::GetObject() const
+{
+ Handle(XCAFDimTolObjects_DatumObject) anObj = new XCAFDimTolObjects_DatumObject();
+
+ Handle(TDataStd_AsciiString) anAttName;
+ if(Label().FindChild(ChildLab_Name).FindAttribute(TDataStd_AsciiString::GetID(), anAttName))
+ {
+ Handle(TCollection_HAsciiString) aStr = new TCollection_HAsciiString(anAttName->Get());
+ anObj->SetName(aStr);
+ }
+
+ Handle(TDataStd_IntegerArray) anArr;
+ if(Label().FindChild(ChildLab_Modifiers).FindAttribute(TDataStd_IntegerArray::GetID(), anArr)
+ && !anArr->Array().IsNull())
+ {
+ XCAFDimTolObjects_DatumModifiersSequence aModifiers;
+ for(Standard_Integer i = 1; i <= anArr->Length(); i++)
+ aModifiers.Append((XCAFDimTolObjects_DatumSingleModif)anArr->Value(i));
+ anObj->SetModifiers(aModifiers);
+ }
+
+ Handle(TDataStd_Integer) aModifierWithValueM;
+ if(Label().FindChild(ChildLab_ModifierWithValue).FindAttribute(TDataStd_Integer::GetID(), aModifierWithValueM))
+ {
+ Handle(TDataStd_Real) aModifierWithValueV;
+ if(Label().FindChild(ChildLab_ModifierWithValue).FindAttribute(TDataStd_Real::GetID(), aModifierWithValueV))
+ {
+ anObj->SetModifierWithValue((XCAFDimTolObjects_DatumModifWithValue)aModifierWithValueM->Get(),aModifierWithValueV->Get());
+ }
+ }
+
+ Handle(TNaming_NamedShape) aDatumTarget;
+ if(Label().FindChild(ChildLab_DatumTarget).FindAttribute(TNaming_NamedShape::GetID(), aDatumTarget))
+ {
+ anObj->SetDatumTarget(aDatumTarget->Get());
+ }
+
+ return anObj;
+}
//=======================================================================
//function : ID
//purpose :
//=======================================================================
-void XCAFDoc_Datum::Restore(const Handle(TDF_Attribute)& With)
+void XCAFDoc_Datum::Restore(const Handle(TDF_Attribute)& theWith)
{
- myName = Handle(XCAFDoc_Datum)::DownCast(With)->GetName();
- myDescription = Handle(XCAFDoc_Datum)::DownCast(With)->GetDescription();
- myIdentification = Handle(XCAFDoc_Datum)::DownCast(With)->GetIdentification();
+ myName = Handle(XCAFDoc_Datum)::DownCast(theWith)->GetName();
+ myDescription = Handle(XCAFDoc_Datum)::DownCast(theWith)->GetDescription();
+ myIdentification = Handle(XCAFDoc_Datum)::DownCast(theWith)->GetIdentification();
}
//purpose :
//=======================================================================
-void XCAFDoc_Datum::Paste(const Handle(TDF_Attribute)& Into,
+void XCAFDoc_Datum::Paste(const Handle(TDF_Attribute)& theInto,
const Handle(TDF_RelocationTable)& /*RT*/) const
{
- Handle(XCAFDoc_Datum)::DownCast(Into)->Set(myName,myDescription,myIdentification);
+ Handle(XCAFDoc_Datum)::DownCast(theInto)->Set(myName,myDescription,myIdentification);
}
class TDF_Label;
class TDF_Attribute;
class TDF_RelocationTable;
+class XCAFDimTolObjects_DatumObject;
class XCAFDoc_Datum;
Standard_EXPORT static const Standard_GUID& GetID();
Standard_EXPORT static Handle(XCAFDoc_Datum) Set (const TDF_Label& label, const Handle(TCollection_HAsciiString)& aName, const Handle(TCollection_HAsciiString)& aDescription, const Handle(TCollection_HAsciiString)& anIdentification);
+
+ Standard_EXPORT static Handle(XCAFDoc_Datum) Set (const TDF_Label& theLabel);
Standard_EXPORT void Set (const Handle(TCollection_HAsciiString)& aName, const Handle(TCollection_HAsciiString)& aDescription, const Handle(TCollection_HAsciiString)& anIdentification);
Standard_EXPORT Handle(TCollection_HAsciiString) GetIdentification() const;
+ Standard_EXPORT Handle(XCAFDimTolObjects_DatumObject) GetObject() const;
+
+ Standard_EXPORT void SetObject (const Handle(XCAFDimTolObjects_DatumObject)& theObject);
+
Standard_EXPORT const Standard_GUID& ID() const;
Standard_EXPORT void Restore (const Handle(TDF_Attribute)& With);
const Handle(TCollection_HAsciiString)& aName,
const Handle(TCollection_HAsciiString)& aDescription)
{
+ Backup();
myKind = kind;
myVal = aVal;
myName = aName;
#include <TDF_Label.hxx>
#include <TDF_RelocationTable.hxx>
#include <XCAFDoc.hxx>
+#include <XCAFDoc_Dimension.hxx>
+#include <XCAFDoc_GeomTolerance.hxx>
#include <XCAFDoc_Datum.hxx>
#include <XCAFDoc_DimTol.hxx>
#include <XCAFDoc_DimTolTool.hxx>
//purpose :
//=======================================================================
-Standard_Boolean XCAFDoc_DimTolTool::IsDimTol(const TDF_Label& DimTolL) const
+Standard_Boolean XCAFDoc_DimTolTool::IsDimTol(const TDF_Label& theDimTolL) const
{
- Handle(XCAFDoc_DimTol) DimTolAttr;
- if(DimTolL.FindAttribute(XCAFDoc_DimTol::GetID(),DimTolAttr)) {
+ Handle(XCAFDoc_DimTol) aDimTolAttr;
+ if(theDimTolL.FindAttribute(XCAFDoc_DimTol::GetID(),aDimTolAttr)) {
return Standard_True;
}
return Standard_False;
}
+//=======================================================================
+//function : IsDimension
+//purpose :
+//=======================================================================
+
+Standard_Boolean XCAFDoc_DimTolTool::IsDimension(const TDF_Label& theDimTolL) const
+{
+ Handle(XCAFDoc_Dimension) aDimTolAttr;
+ if(theDimTolL.FindAttribute(XCAFDoc_Dimension::GetID(),aDimTolAttr)) {
+ return Standard_True;
+ }
+ return Standard_False;
+}
+
+//=======================================================================
+//function : IsGeomTolerance
+//purpose :
+//=======================================================================
+
+Standard_Boolean XCAFDoc_DimTolTool::IsGeomTolerance(const TDF_Label& theDimTolL) const
+{
+ Handle(XCAFDoc_GeomTolerance) aDimTolAttr;
+ if(theDimTolL.FindAttribute(XCAFDoc_GeomTolerance::GetID(),aDimTolAttr)) {
+ return Standard_True;
+ }
+ return Standard_False;
+}
//=======================================================================
//function : GetDimTolLabels
//purpose :
//=======================================================================
-void XCAFDoc_DimTolTool::GetDimTolLabels(TDF_LabelSequence& Labels) const
+void XCAFDoc_DimTolTool::GetDimTolLabels(TDF_LabelSequence& theLabels) const
{
- Labels.Clear();
- TDF_ChildIterator ChildIterator( Label() );
- for (; ChildIterator.More(); ChildIterator.Next()) {
- TDF_Label L = ChildIterator.Value();
- if ( IsDimTol(L)) Labels.Append(L);
+ theLabels.Clear();
+ TDF_ChildIterator aChildIterator( Label() );
+ for (; aChildIterator.More(); aChildIterator.Next()) {
+ TDF_Label aL = aChildIterator.Value();
+ if ( IsDimTol(aL)) theLabels.Append(aL);
}
}
+//=======================================================================
+//function : GetDimensionLabels
+//purpose :
+//=======================================================================
+
+void XCAFDoc_DimTolTool::GetDimensionLabels(TDF_LabelSequence& theLabels) const
+{
+ theLabels.Clear();
+ TDF_ChildIterator aChildIterator( Label() );
+ for (; aChildIterator.More(); aChildIterator.Next()) {
+ TDF_Label aL = aChildIterator.Value();
+ if ( IsDimension(aL)) theLabels.Append(aL);
+ }
+}
+
+//=======================================================================
+//function : GetGeomToleranceLabels
+//purpose :
+//=======================================================================
+
+void XCAFDoc_DimTolTool::GetGeomToleranceLabels(TDF_LabelSequence& theLabels) const
+{
+ theLabels.Clear();
+ TDF_ChildIterator aChildIterator( Label() );
+ for (; aChildIterator.More(); aChildIterator.Next()) {
+ TDF_Label aL = aChildIterator.Value();
+ if ( IsGeomTolerance(aL)) theLabels.Append(aL);
+ }
+}
//=======================================================================
//function : FindDimTol
return DimTolL;
}
+//=======================================================================
+//function : AddDimension
+//purpose :
+//=======================================================================
+
+TDF_Label XCAFDoc_DimTolTool::AddDimension()
+{
+ TDF_Label aDimTolL;
+ TDF_TagSource aTag;
+ aDimTolL = aTag.NewChild ( Label() );
+ Handle(XCAFDoc_Dimension) aDim = XCAFDoc_Dimension::Set(aDimTolL);
+ TCollection_AsciiString aStr = "DGT:Dimension";
+ TDataStd_Name::Set(aDimTolL,aStr);
+ return aDimTolL;
+}
+
+//=======================================================================
+//function : AddGeomTolerance
+//purpose :
+//=======================================================================
+
+TDF_Label XCAFDoc_DimTolTool::AddGeomTolerance()
+{
+ TDF_Label aDimTolL;
+ TDF_TagSource aTag;
+ aDimTolL = aTag.NewChild ( Label() );
+ Handle(XCAFDoc_GeomTolerance) aTol = XCAFDoc_GeomTolerance::Set(aDimTolL);
+ TCollection_AsciiString aStr = "DGT:Tolerance";
+ TDataStd_Name::Set(aDimTolL,aStr);
+ return aDimTolL;
+}
+
+//=======================================================================
+//function : SetDimension
+//purpose :
+//=======================================================================
+
+void XCAFDoc_DimTolTool::SetDimension(const TDF_Label& theL,
+ const TDF_Label& theDimTolL) const
+{
+ TDF_Label nullLab;
+ SetDimension(theL, nullLab, theDimTolL);
+}
+
+//=======================================================================
+//function : SetDimension
+//purpose :
+//=======================================================================
+
+void XCAFDoc_DimTolTool::SetDimension(const TDF_Label& theFirstL,
+ const TDF_Label& theSecondL,
+ const TDF_Label& theDimTolL) const
+{
+ Handle(XCAFDoc_GraphNode) aChGNode;
+ Handle(XCAFDoc_GraphNode) aFGNode;
+ Handle(XCAFDoc_GraphNode) aSecondFGNode;
+
+ //Handle(XCAFDoc_GraphNode) ChGNode, FGNode;
+ if ( theDimTolL.FindAttribute (XCAFDoc::DimensionRefGUID(), aChGNode) ) {
+ while (aChGNode->NbFathers() > 0) {
+ aFGNode = aChGNode->GetFather(1);
+ aFGNode->UnSetChild(aChGNode);
+ }
+ theDimTolL.ForgetAttribute ( XCAFDoc::DimTolRefGUID() );
+ }
+
+ if(!IsDimension(theDimTolL))
+ {
+ return;
+ }
+
+ if (!theDimTolL.FindAttribute(XCAFDoc::DimensionRefGUID(), aChGNode) ) {
+ aChGNode = new XCAFDoc_GraphNode;
+ aChGNode = XCAFDoc_GraphNode::Set(theDimTolL);
+ }
+ if (!theFirstL.FindAttribute(XCAFDoc::DimensionRefGUID(), aFGNode) ) {
+ aFGNode = new XCAFDoc_GraphNode;
+ aFGNode = XCAFDoc_GraphNode::Set(theFirstL);
+ }
+ aFGNode->SetGraphID(XCAFDoc::DimensionRefGUID());
+ aChGNode->SetGraphID(XCAFDoc::DimensionRefGUID());
+ aFGNode->SetChild(aChGNode);
+ aChGNode->SetFather(aFGNode);
+
+ if (!theSecondL.IsNull()){
+ if(!theSecondL.FindAttribute(XCAFDoc::DimensionRefGUID(), aSecondFGNode) ) {
+ aSecondFGNode = new XCAFDoc_GraphNode;
+ aSecondFGNode = XCAFDoc_GraphNode::Set(theSecondL);
+ }
+ aSecondFGNode->SetGraphID(XCAFDoc::DimensionRefGUID());
+ aSecondFGNode->SetChild(aChGNode);
+ aChGNode->SetFather(aSecondFGNode);
+ }
+}
+
+//=======================================================================
+//function : SetGeomTolerance
+//purpose :
+//=======================================================================
+
+void XCAFDoc_DimTolTool::SetGeomTolerance(const TDF_Label& theL,
+ const TDF_Label& theDimTolL) const
+{
+ // set reference
+ Handle(TDataStd_TreeNode) refNode, mainNode;
+ refNode = TDataStd_TreeNode::Set ( theDimTolL, XCAFDoc::GeomToleranceRefGUID() );
+ mainNode = TDataStd_TreeNode::Set ( theL, XCAFDoc::GeomToleranceRefGUID() );
+ refNode->Remove(); // abv: fix against bug in TreeNode::Append()
+ mainNode->Append(refNode);
+}
//=======================================================================
//function : SetDimTol
//purpose :
//=======================================================================
-void XCAFDoc_DimTolTool::SetDimTol(const TDF_Label& L,
- const TDF_Label& DimTolL) const
+void XCAFDoc_DimTolTool::SetDimTol(const TDF_Label& theL,
+ const TDF_Label& theDimTolL) const
{
// set reference
Handle(TDataStd_TreeNode) refNode, mainNode;
-// mainNode = TDataStd_TreeNode::Set ( DimTolL, XCAFDoc::DimTolRefGUID() );
-// refNode = TDataStd_TreeNode::Set ( L, XCAFDoc::DimTolRefGUID() );
- refNode = TDataStd_TreeNode::Set ( DimTolL, XCAFDoc::DimTolRefGUID() );
- mainNode = TDataStd_TreeNode::Set ( L, XCAFDoc::DimTolRefGUID() );
+ refNode = TDataStd_TreeNode::Set ( theDimTolL, XCAFDoc::DimTolRefGUID() );
+ mainNode = TDataStd_TreeNode::Set (theL, XCAFDoc::DimTolRefGUID() );
refNode->Remove(); // abv: fix against bug in TreeNode::Append()
mainNode->Append(refNode);
}
//purpose :
//=======================================================================
-Standard_Boolean XCAFDoc_DimTolTool::GetRefShapeLabel(const TDF_Label& L,
- TDF_Label& ShapeL) const
+Standard_Boolean XCAFDoc_DimTolTool::GetRefShapeLabel(const TDF_Label& theL,
+ TDF_LabelSequence& theShapeL) const
{
- Handle(TDataStd_TreeNode) Node;
- if( !L.FindAttribute(XCAFDoc::DimTolRefGUID(),Node) || !Node->HasFather() ) {
- if( !L.FindAttribute(XCAFDoc::DatumRefGUID(),Node) || !Node->HasFather() ) {
- return Standard_False;
+ theShapeL.Clear();
+ Handle(TDataStd_TreeNode) aNode;
+ if( !theL.FindAttribute(XCAFDoc::DimTolRefGUID(),aNode) || !aNode->HasFather() ) {
+ if( !theL.FindAttribute(XCAFDoc::DatumRefGUID(),aNode) || !aNode->HasFather() ) {
+ if( !theL.FindAttribute(XCAFDoc::GeomToleranceRefGUID(),aNode) || !aNode->HasFather() ) {
+ Handle(XCAFDoc_GraphNode) aGNode;
+ if( theL.FindAttribute(XCAFDoc::DimensionRefGUID(),aGNode) && aGNode->NbFathers() > 0 ) {
+ for(Standard_Integer i = 1; i <= aGNode->NbFathers(); i++)
+ {
+ theShapeL.Append(aGNode->GetFather(i)->Label());
+ }
+ return Standard_True;
+ }
+ return Standard_False;
+ }
}
}
- ShapeL = Node->Father()->Label();
+ theShapeL.Append(aNode->Father()->Label());
return Standard_True;
}
+//=======================================================================
+//function : GetRefDimensionLabels
+//purpose :
+//=======================================================================
+
+Standard_Boolean XCAFDoc_DimTolTool::GetRefDimensionLabels(const TDF_Label& theShapeL,
+ TDF_LabelSequence& theDimTols) const
+{
+ Handle(XCAFDoc_GraphNode) aGNode;
+ if( theShapeL.FindAttribute(XCAFDoc::DimensionRefGUID(),aGNode) && aGNode->NbChildren() > 0 ) {
+ for(Standard_Integer i = 1; i <= aGNode->NbChildren(); i++)
+ {
+ theDimTols.Append(aGNode->GetChild(i)->Label());
+ }
+ return Standard_True;
+ }
+ return Standard_False;
+}
//=======================================================================
-//function : GetRefDGTLabels
+//function : GetRefGeomToleranceLabels
//purpose :
//=======================================================================
-Standard_Boolean XCAFDoc_DimTolTool::GetRefDGTLabels(const TDF_Label& ShapeL,
- TDF_LabelSequence &DimTols) const
+Standard_Boolean XCAFDoc_DimTolTool::GetRefGeomToleranceLabels(const TDF_Label& theShapeL,
+ TDF_LabelSequence& theDimTols) const
{
- Handle(TDataStd_TreeNode) Node;
- if( !ShapeL.FindAttribute(XCAFDoc::DimTolRefGUID(),Node) ||
- !Node->HasFirst() ) {
+ Handle(TDataStd_TreeNode) aNode;
+ if( !theShapeL.FindAttribute(XCAFDoc::GeomToleranceRefGUID(),aNode) ||
+ !aNode->HasFirst() ) {
return Standard_False;
}
- Handle(TDataStd_TreeNode) Last = Node->First();
- DimTols.Append(Last->Label());
- while(Last->HasNext()) {
- Last = Last->Next();
- DimTols.Append(Last->Label());
+ Handle(TDataStd_TreeNode) aLast = aNode->First();
+ theDimTols.Append(aLast->Label());
+ while(aLast->HasNext()) {
+ aLast = aLast->Next();
+ theDimTols.Append(aLast->Label());
}
return Standard_True;
}
+//=======================================================================
+//function : GetRefDatumLabel
+//purpose :
+//=======================================================================
+
+Standard_Boolean XCAFDoc_DimTolTool::GetRefDatumLabel(const TDF_Label& theShapeL,
+ TDF_Label& theDatum) const
+{
+ Handle(TDataStd_TreeNode) aNode;
+ if( !theShapeL.FindAttribute(XCAFDoc::DatumRefGUID(),aNode) ||
+ !aNode->HasFirst() ) {
+ return Standard_False;
+ }
+ Handle(TDataStd_TreeNode) aLast = aNode->First();
+ theDatum = aLast->Label();
+ return Standard_True;
+}
//=======================================================================
//function : GetDimTol
//purpose :
//=======================================================================
-Standard_Boolean XCAFDoc_DimTolTool::IsDatum(const TDF_Label& DimTolL) const
+Standard_Boolean XCAFDoc_DimTolTool::IsDatum(const TDF_Label& theDimTolL) const
{
- Handle(XCAFDoc_Datum) DatumAttr;
- if(DimTolL.FindAttribute(XCAFDoc_Datum::GetID(),DatumAttr)) {
+ Handle(XCAFDoc_Datum) aDatumAttr;
+ if(theDimTolL.FindAttribute(XCAFDoc_Datum::GetID(),aDatumAttr)) {
return Standard_True;
}
return Standard_False;
//purpose :
//=======================================================================
-void XCAFDoc_DimTolTool::GetDatumLabels(TDF_LabelSequence& Labels) const
+void XCAFDoc_DimTolTool::GetDatumLabels(TDF_LabelSequence& theLabels) const
{
- Labels.Clear();
- TDF_ChildIterator ChildIterator( Label() );
- for (; ChildIterator.More(); ChildIterator.Next()) {
- TDF_Label L = ChildIterator.Value();
- if ( IsDatum(L)) Labels.Append(L);
+ theLabels.Clear();
+ TDF_ChildIterator aChildIterator( Label() );
+ for (; aChildIterator.More(); aChildIterator.Next()) {
+ TDF_Label L = aChildIterator.Value();
+ if ( IsDatum(L)) theLabels.Append(L);
}
}
-
//=======================================================================
//function : FindDatum
//purpose :
return DatumL;
}
+//=======================================================================
+//function : AddDatum
+//purpose :
+//=======================================================================
+
+TDF_Label XCAFDoc_DimTolTool::AddDatum()
+{
+ TDF_Label aDatumL;
+ TDF_TagSource aTag;
+ aDatumL = aTag.NewChild ( Label() );
+ Handle(XCAFDoc_Datum) aDat = XCAFDoc_Datum::Set(aDatumL);
+ TDataStd_Name::Set(aDatumL,"DGT:Datum");
+ return aDatumL;
+}
//=======================================================================
//function : SetDatum
//purpose :
//=======================================================================
-void XCAFDoc_DimTolTool::SetDatum(const TDF_Label& L,
- const TDF_Label& DatumL) const
+void XCAFDoc_DimTolTool::SetDatum(const TDF_Label& theL,
+ const TDF_Label& theDatumL) const
{
// set reference
Handle(TDataStd_TreeNode) refNode, mainNode;
- refNode = TDataStd_TreeNode::Set ( DatumL, XCAFDoc::DatumRefGUID() );
- mainNode = TDataStd_TreeNode::Set ( L, XCAFDoc::DatumRefGUID() );
+ refNode = TDataStd_TreeNode::Set ( theDatumL, XCAFDoc::DatumRefGUID() );
+ mainNode = TDataStd_TreeNode::Set ( theL, XCAFDoc::DatumRefGUID() );
refNode->Remove();
mainNode->Append(refNode);
}
-
//=======================================================================
//function : SetDatum
//purpose :
ChGNode->SetFather(FGNode);
}
+//=======================================================================
+//function : SetDatumToGeomTol
+//purpose :
+//=======================================================================
+
+void XCAFDoc_DimTolTool::SetDatumToGeomTol(const TDF_Label& theDatumL,
+ const TDF_Label& theTolerL) const
+{
+ // set reference
+ Handle(XCAFDoc_GraphNode) aFGNode;
+ Handle(XCAFDoc_GraphNode) aChGNode;
+ if (! theTolerL.FindAttribute( XCAFDoc::DatumTolRefGUID(), aFGNode) ) {
+ aFGNode = new XCAFDoc_GraphNode;
+ aFGNode = XCAFDoc_GraphNode::Set(theTolerL);
+ }
+ if (! theDatumL.FindAttribute( XCAFDoc::DatumTolRefGUID(), aChGNode) ) {
+ aChGNode = new XCAFDoc_GraphNode;
+ aChGNode = XCAFDoc_GraphNode::Set(theDatumL);
+ }
+ aFGNode->SetGraphID( XCAFDoc::DatumTolRefGUID() );
+ aChGNode->SetGraphID( XCAFDoc::DatumTolRefGUID() );
+ aFGNode->SetChild(aChGNode);
+ aChGNode->SetFather(aFGNode);
+}
+
//=======================================================================
//function : GetDatum
//purpose :
//purpose :
//=======================================================================
-Standard_Boolean XCAFDoc_DimTolTool::GetDatumTolerLabels(const TDF_Label& DimTolL,
- TDF_LabelSequence &Datums) const
+Standard_Boolean XCAFDoc_DimTolTool::GetDatumOfTolerLabels(const TDF_Label& theDimTolL,
+ TDF_LabelSequence& theDatums) const
+{
+ Handle(XCAFDoc_GraphNode) aNode;
+ if( !theDimTolL.FindAttribute(XCAFDoc::DatumTolRefGUID(),aNode) )
+ return Standard_False;
+ for(Standard_Integer i=1; i<=aNode->NbChildren(); i++) {
+ Handle(XCAFDoc_GraphNode) aDatumNode = aNode->GetChild(i);
+ theDatums.Append(aDatumNode->Label());
+ }
+ return Standard_True;
+}
+
+//=======================================================================
+//function : GetTolerDatumLabels
+//purpose :
+//=======================================================================
+
+Standard_Boolean XCAFDoc_DimTolTool::GetTolerOfDatumLabels(const TDF_Label& theDatumL,
+ TDF_LabelSequence& theTols) const
{
- Handle(XCAFDoc_GraphNode) Node;
- if( !DimTolL.FindAttribute(XCAFDoc::DatumTolRefGUID(),Node) )
+ Handle(XCAFDoc_GraphNode) aNode;
+ if( !theDatumL.FindAttribute(XCAFDoc::DatumTolRefGUID(),aNode) )
return Standard_False;
- for(Standard_Integer i=1; i<=Node->NbChildren(); i++) {
- Handle(XCAFDoc_GraphNode) DatumNode = Node->GetChild(i);
- Datums.Append(DatumNode->Label());
+ for(Standard_Integer i=1; i<=aNode->NbFathers(); i++) {
+ Handle(XCAFDoc_GraphNode) aDatumNode = aNode->GetFather(i);
+ theTols.Append(aDatumNode->Label());
}
return Standard_True;
}
//! Returns internal XCAFDoc_ShapeTool tool
Standard_EXPORT const Handle(XCAFDoc_ShapeTool)& ShapeTool();
+
+ //! Returns True if label belongs to a dimtoltable and
+ //! is a Dimension definition
+ Standard_EXPORT Standard_Boolean IsDimension (const TDF_Label& theLab) const;
+
+ //! Returns a sequence of Dimensions labels currently stored
+ //! in the DGTtable
+ Standard_EXPORT void GetDimensionLabels (TDF_LabelSequence& theLabels) const;
+
+ //! Sets a link with GUID
+ Standard_EXPORT void SetDimension (const TDF_Label& theFirstL, const TDF_Label& theSecondL, const TDF_Label& theDimTolL) const;
+
+ //! Sets a link with GUID
+ Standard_EXPORT void SetDimension (const TDF_Label& theL, const TDF_Label& theDimTolL) const;
+
+ //! Returns all Dimension labels defined for label ShapeL
+ Standard_EXPORT Standard_Boolean GetRefDimensionLabels (const TDF_Label& theShapeL, TDF_LabelSequence& theDimensions) const;
+
+ //! Adds a dimension definition to a DGTtable and returns its label
+ Standard_EXPORT TDF_Label AddDimension() ;
+
+ //! Returns True if label belongs to a dimtoltable and
+ //! is a DimTol definition
+ Standard_EXPORT Standard_Boolean IsGeomTolerance (const TDF_Label& theLab) const;
+
+ //! Returns a sequence of Tolerance labels currently stored
+ //! in the DGTtable
+ Standard_EXPORT void GetGeomToleranceLabels (TDF_LabelSequence& theLabels) const;
+
+ //! Sets a link with GUID
+ Standard_EXPORT void SetGeomTolerance (const TDF_Label& theL, const TDF_Label& theDimTolL) const;
+
+ //! Returns all GeomTolerance labels defined for label ShapeL
+ Standard_EXPORT Standard_Boolean GetRefGeomToleranceLabels (const TDF_Label& theShapeL, TDF_LabelSequence& theDimTols) const;
+
+ //! Adds a GeomTolerance definition to a DGTtable and returns its label
+ Standard_EXPORT TDF_Label AddGeomTolerance();
//! Returns True if label belongs to a dimtoltable and
//! is a DimTol definition
//! Returns ShapeL defined for label DimTolL
//! Returns False if the DimTolL is not in DGTtable
- Standard_EXPORT Standard_Boolean GetRefShapeLabel (const TDF_Label& DimTolL, TDF_Label& ShapeL) const;
+ Standard_EXPORT Standard_Boolean GetRefShapeLabel (const TDF_Label& DimTolL, TDF_LabelSequence& ShapeL) const;
//! Returns all DimTol labels defined for label ShapeL
Standard_EXPORT Standard_Boolean GetRefDGTLabels (const TDF_Label& ShapeL, TDF_LabelSequence& DimTols) const;
//! Adds a datum definition to a DGTtable and returns its label
Standard_EXPORT TDF_Label AddDatum (const Handle(TCollection_HAsciiString)& aName, const Handle(TCollection_HAsciiString)& aDescription, const Handle(TCollection_HAsciiString)& anIdentification) const;
+
+ //! Adds a datum definition to a DGTtable and returns its label
+ Standard_EXPORT TDF_Label AddDatum() ;
//! Sets a link with GUID
Standard_EXPORT void SetDatum (const TDF_Label& L, const TDF_Label& DatumL) const;
+
+ //! Sets a link with GUID for Datum
+ //! Sets connection between Datum and Tolerance
+ Standard_EXPORT void SetDatumToGeomTol (const TDF_Label& theL, const TDF_Label& theTolerL) const;
//! Sets a link with GUID for Datum
//! Adds a Datum as necessary
Standard_EXPORT Standard_Boolean GetDatum (const TDF_Label& DatumL, Handle(TCollection_HAsciiString)& aName, Handle(TCollection_HAsciiString)& aDescription, Handle(TCollection_HAsciiString)& anIdentification) const;
//! Returns all Datum labels defined for label DimTolL
- Standard_EXPORT Standard_Boolean GetDatumTolerLabels (const TDF_Label& DimTolL, TDF_LabelSequence& Datums) const;
+ Standard_EXPORT Standard_Boolean GetDatumOfTolerLabels (const TDF_Label& DimTolL, TDF_LabelSequence& Datums) const;
+
+ //! Returns all GeomToleranses labels defined for label DatumL
+ Standard_EXPORT Standard_Boolean GetTolerOfDatumLabels (const TDF_Label& theDatumL, TDF_LabelSequence& theTols) const;
+
+ //! Returns Datum label defined for label ShapeL
+ Standard_EXPORT Standard_Boolean GetRefDatumLabel (const TDF_Label& theShapeL, TDF_Label& theDatum) const;
Standard_EXPORT const Standard_GUID& ID() const;
--- /dev/null
+// Copyright (c) 1999-2014 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.
+
+#include <XCAFDoc_Dimension.hxx>
+
+#include <TDF_RelocationTable.hxx>
+#include <XCAFDoc.hxx>
+#include <TDataStd_TreeNode.hxx>
+#include <Precision.hxx>
+#include <TColgp_HArray1OfPnt.hxx>
+#include <TDataStd_Integer.hxx>
+#include <TDataStd_IntegerArray.hxx>
+#include <TDataStd_Real.hxx>
+#include <TDataStd_RealArray.hxx>
+#include <TNaming_Builder.hxx>
+#include <TNaming_NamedShape.hxx>
+#include <TColStd_HArray1OfReal.hxx>
+#include <TopoDS.hxx>
+#include <XCAFDimTolObjects_DimensionObject.hxx>
+
+enum ChildLab
+{
+ ChildLab_Type = 1,
+ ChildLab_Value,
+ ChildLab_Qualifier,
+ ChildLab_Class,
+ ChildLab_Dec,
+ ChildLab_Modifiers,
+ ChildLab_Path,
+ ChildLab_Dir,
+ ChildLab_Pnts
+};
+
+//=======================================================================
+//function : XCAFDoc_Dimension
+//purpose :
+//=======================================================================
+
+XCAFDoc_Dimension::XCAFDoc_Dimension()
+{
+}
+
+
+//=======================================================================
+//function : GetID
+//purpose :
+//=======================================================================
+
+const Standard_GUID& XCAFDoc_Dimension::GetID()
+{
+ static Standard_GUID DGTID ("58ed092c-44de-11d8-8776-001083004c77");
+ //static Standard_GUID ID("efd212e9-6dfd-11d4-b9c8-0060b0ee281b");
+ return DGTID;
+ //return ID;
+}
+
+//=======================================================================
+//function : Set
+//purpose :
+//=======================================================================
+Handle(XCAFDoc_Dimension) XCAFDoc_Dimension::Set(const TDF_Label& theLabel)
+{
+ Handle(XCAFDoc_Dimension) A;
+ if (!theLabel.FindAttribute(XCAFDoc_Dimension::GetID(), A)) {
+ A = new XCAFDoc_Dimension();
+ theLabel.AddAttribute(A);
+ }
+ return A;
+}
+
+//=======================================================================
+//function : SetObject
+//purpose :
+//=======================================================================
+void XCAFDoc_Dimension::SetObject (const Handle(XCAFDimTolObjects_DimensionObject)& theObject)
+{
+ Backup();
+
+ Handle(TDataStd_Integer) aType;
+ if(!Label().FindChild(ChildLab_Type).FindAttribute(TDataStd_Integer::GetID(), aType))
+ {
+ aType = new TDataStd_Integer();
+ Label().FindChild(ChildLab_Type).AddAttribute(aType);
+ }
+ aType->Set(theObject->GetType());
+
+ if(theObject->GetValues().IsNull())
+ {
+ Label().FindChild(ChildLab_Value).ForgetAllAttributes();
+ }
+ else
+ {
+ Handle(TDataStd_RealArray) aVal;
+ if(!Label().FindChild(ChildLab_Value).FindAttribute(TDataStd_RealArray::GetID(), aVal))
+ {
+ aVal = new TDataStd_RealArray();
+ Label().FindChild(ChildLab_Value).AddAttribute(aVal);
+ }
+ aVal->ChangeArray(theObject->GetValues());
+ }
+
+ Handle(TDataStd_Integer) aQualifier;
+ if(!Label().FindChild(ChildLab_Qualifier).FindAttribute(TDataStd_Integer::GetID(), aQualifier))
+ {
+ aQualifier = new TDataStd_Integer();
+ Label().FindChild(ChildLab_Qualifier).AddAttribute(aQualifier);
+ }
+ aQualifier->Set(theObject->GetQualifier());
+
+ Standard_Boolean aH;
+ XCAFDimTolObjects_DimensionFormVariance aF;
+ XCAFDimTolObjects_DimensionGrade aG;
+ theObject->GetClassOfTolerance(aH,aF,aG);
+ Handle(TDataStd_IntegerArray) aClass;
+ if(!Label().FindChild(ChildLab_Class).FindAttribute(TDataStd_IntegerArray::GetID(), aClass))
+ {
+ aClass = new TDataStd_IntegerArray();
+ Label().FindChild(ChildLab_Class).AddAttribute(aClass);
+ }
+ Handle(TColStd_HArray1OfInteger) anArrI = new TColStd_HArray1OfInteger(1,3);
+ anArrI->SetValue(1,aH);
+ anArrI->SetValue(2,aF);
+ anArrI->SetValue(3,aG);
+ aClass->ChangeArray(anArrI);
+
+ Standard_Integer aL, aR;
+ theObject->GetNbOfDecimalPlaces(aL, aR);
+ Handle(TDataStd_IntegerArray) aDec;
+ if(!Label().FindChild(ChildLab_Dec).FindAttribute(TDataStd_IntegerArray::GetID(), aDec))
+ {
+ aDec = new TDataStd_IntegerArray();
+ Label().FindChild(ChildLab_Dec).AddAttribute(aDec);
+ }
+ anArrI = new TColStd_HArray1OfInteger(1,2);
+ anArrI->SetValue(1,aL);
+ anArrI->SetValue(2,aR);
+ aDec->ChangeArray(anArrI);
+
+ if(theObject->GetModifiers().Length() == 0)
+ {
+ Label().FindChild(ChildLab_Modifiers).ForgetAllAttributes();
+ }
+ else
+ {
+ Handle(TDataStd_IntegerArray) aModifiers;
+ if(!Label().FindChild(ChildLab_Modifiers).FindAttribute(TDataStd_IntegerArray::GetID(), aModifiers))
+ {
+ aModifiers = new TDataStd_IntegerArray();
+ Label().FindChild(ChildLab_Modifiers).AddAttribute(aModifiers);
+ }
+ anArrI = new TColStd_HArray1OfInteger(1,theObject->GetModifiers().Length());
+ for(Standard_Integer i = 1; i <= theObject->GetModifiers().Length(); i++)
+ anArrI->SetValue(i,theObject->GetModifiers().Value(i));
+ aModifiers->ChangeArray(anArrI);
+ }
+
+ if(!theObject->GetPath().IsNull())
+ {
+ TNaming_Builder tnBuild(Label().FindChild(ChildLab_Path));
+ tnBuild.Generated(theObject->GetPath());
+ }
+ else
+ {
+ Label().FindChild(ChildLab_Path).ForgetAllAttributes();
+ }
+
+ Handle(TDataStd_RealArray) aDir;
+ if(!Label().FindChild(ChildLab_Dir).FindAttribute(TDataStd_RealArray::GetID(), aDir))
+ {
+ aDir = new TDataStd_RealArray();
+ Label().FindChild(ChildLab_Dir).AddAttribute(aDir);
+ }
+ gp_Dir aD;
+ theObject->GetDirection(aD);
+ Handle(TColStd_HArray1OfReal) anArrR = new TColStd_HArray1OfReal(1,3);
+ anArrR->SetValue(1,aD.X());
+ anArrR->SetValue(2,aD.Y());
+ anArrR->SetValue(3,aD.Z());
+ aDir->ChangeArray(anArrR);
+
+ Handle(TDataStd_RealArray) aPnts;
+ if(!Label().FindChild(ChildLab_Pnts).FindAttribute(TDataStd_RealArray::GetID(), aPnts))
+ {
+ aPnts = new TDataStd_RealArray();
+ Label().FindChild(ChildLab_Pnts).AddAttribute(aPnts);
+ }
+ Handle(TColgp_HArray1OfPnt) aP = theObject->GetPoints();
+ if(!aP.IsNull() && aP->Length() > 0)
+ {
+ anArrR = new TColStd_HArray1OfReal(1,6);
+ anArrR->SetValue(1,aP->Value(1).X());
+ anArrR->SetValue(2,aP->Value(1).Y());
+ anArrR->SetValue(3,aP->Value(1).Z());
+ anArrR->SetValue(4,aP->Value(2).X());
+ anArrR->SetValue(5,aP->Value(2).Y());
+ anArrR->SetValue(6,aP->Value(2).Z());
+ aPnts->ChangeArray(anArrR);
+ }
+}
+
+//=======================================================================
+//function : GetObject
+//purpose :
+//=======================================================================
+Handle(XCAFDimTolObjects_DimensionObject) XCAFDoc_Dimension::GetObject() const
+{
+ Handle(XCAFDimTolObjects_DimensionObject) anObj = new XCAFDimTolObjects_DimensionObject();
+
+ Handle(TDataStd_Integer) aType;
+ if(Label().FindChild(ChildLab_Type).FindAttribute(TDataStd_Integer::GetID(), aType))
+ {
+ anObj->SetType((XCAFDimTolObjects_DimensionType)aType->Get());
+ }
+
+ Handle(TDataStd_RealArray) aVal;
+ if(Label().FindChild(ChildLab_Value).FindAttribute(TDataStd_RealArray::GetID(), aVal)
+ && !aVal->Array().IsNull())
+ {
+ anObj->SetValues(aVal->Array());
+ }
+
+ Handle(TDataStd_Integer) aQualifier;
+ if(Label().FindChild(ChildLab_Qualifier).FindAttribute(TDataStd_Integer::GetID(), aQualifier))
+ {
+ anObj->SetQualifier((XCAFDimTolObjects_DimensionQualifier)aQualifier->Get());
+ }
+
+ Handle(TDataStd_IntegerArray) aClass;
+ if(Label().FindChild(ChildLab_Class).FindAttribute(TDataStd_IntegerArray::GetID(), aClass)
+ && !aClass->Array().IsNull() && aClass->Array()->Length() > 0)
+ {
+ anObj->SetClassOfTolerance(aClass->Array()->Value(1), (XCAFDimTolObjects_DimensionFormVariance)aClass->Array()->Value(2), (XCAFDimTolObjects_DimensionGrade)aClass->Array()->Value(3));
+ }
+
+ Handle(TDataStd_IntegerArray) aDec;
+ if(Label().FindChild(ChildLab_Dec).FindAttribute(TDataStd_IntegerArray::GetID(), aDec)
+ && !aDec->Array().IsNull() && aDec->Array()->Length() > 0)
+ {
+ anObj->SetNbOfDecimalPlaces(aDec->Array()->Value(1), aDec->Array()->Value(2));
+ }
+
+ Handle(TDataStd_IntegerArray) aModifiers;
+ if(Label().FindChild(ChildLab_Modifiers).FindAttribute(TDataStd_IntegerArray::GetID(), aModifiers)
+ && !aModifiers->Array().IsNull())
+ {
+ XCAFDimTolObjects_DimensionModifiersSequence aM;
+ for(Standard_Integer i = 1; i <= aModifiers->Array()->Length(); i++)
+ aM.Append((XCAFDimTolObjects_DimensionModif)aModifiers->Array()->Value(i));
+ anObj->SetModifiers(aM);
+ }
+
+ Handle(TNaming_NamedShape) aShape;
+ if(Label().FindChild(ChildLab_Path).FindAttribute(TNaming_NamedShape::GetID(), aShape)
+ && !aShape.IsNull())
+ {
+ 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)
+ {
+ gp_Dir aD(aDir->Array()->Value(1), aDir->Array()->Value(2), aDir->Array()->Value(3));
+ anObj->SetDirection(aD);
+ }
+
+ Handle(TDataStd_RealArray) aPnts;
+ if(Label().FindChild(ChildLab_Pnts).FindAttribute(TDataStd_RealArray::GetID(), aPnts)
+ && !aPnts->Array().IsNull() && aPnts->Array()->Length() > 0)
+ {
+ Handle(TColgp_HArray1OfPnt) aP = new TColgp_HArray1OfPnt(1,2);
+ aP->SetValue(1, gp_Pnt(aPnts->Array()->Value(1), aPnts->Array()->Value(2), aPnts->Array()->Value(3)));
+ aP->SetValue(2, gp_Pnt(aPnts->Array()->Value(4), aPnts->Array()->Value(5), aPnts->Array()->Value(6)));
+ anObj->SetPoints(aP);
+ }
+
+ return anObj;
+}
+
+//=======================================================================
+//function : ID
+//purpose :
+//=======================================================================
+
+const Standard_GUID& XCAFDoc_Dimension::ID() const
+{
+ return GetID();
+}
+
+//=======================================================================
+//function : Restore
+//purpose :
+//=======================================================================
+
+void XCAFDoc_Dimension::Restore(const Handle(TDF_Attribute)& /*With*/)
+{
+}
+
+
+//=======================================================================
+//function : NewEmpty
+//purpose :
+//=======================================================================
+
+Handle(TDF_Attribute) XCAFDoc_Dimension::NewEmpty() const
+{
+ return new XCAFDoc_Dimension();
+}
+
+
+//=======================================================================
+//function : Paste
+//purpose :
+//=======================================================================
+
+void XCAFDoc_Dimension::Paste(const Handle(TDF_Attribute)& /*Into*/,
+ const Handle(TDF_RelocationTable)& /*RT*/) const
+{
+}
--- /dev/null
+// Created on: 2015-08-06
+// Created by: Ilya Novikov
+// Copyright (c) 2004-2014 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 _XCAFDoc_Dimension_HeaderFile
+#define _XCAFDoc_Dimension_HeaderFile
+
+#include <Standard.hxx>
+#include <Standard_Type.hxx>
+
+#include <TDF_Attribute.hxx>
+class Standard_GUID;
+class TDF_Label;
+class TDF_Attribute;
+class TDF_RelocationTable;
+class XCAFDimTolObjects_DimensionObject;
+
+
+class XCAFDoc_Dimension;
+DEFINE_STANDARD_HANDLE(XCAFDoc_Dimension, TDF_Attribute)
+
+//! attribute to store dimension
+class XCAFDoc_Dimension : public TDF_Attribute
+{
+
+public:
+
+ Standard_EXPORT XCAFDoc_Dimension();
+
+ Standard_EXPORT static const Standard_GUID& GetID();
+
+ Standard_EXPORT static Handle(XCAFDoc_Dimension) Set (const TDF_Label& theLabel);
+
+ Standard_EXPORT const Standard_GUID& ID() const;
+
+ Standard_EXPORT void Restore (const Handle(TDF_Attribute)& With);
+
+ Standard_EXPORT Handle(TDF_Attribute) NewEmpty() const;
+
+ Standard_EXPORT void Paste (const Handle(TDF_Attribute)& Into, const Handle(TDF_RelocationTable)& RT) const;
+
+ Standard_EXPORT void SetObject (const Handle(XCAFDimTolObjects_DimensionObject)& theDimensionObject);
+
+ Standard_EXPORT Handle(XCAFDimTolObjects_DimensionObject) GetObject() const;
+
+ DEFINE_STANDARD_RTTI(XCAFDoc_Dimension,TDF_Attribute)
+
+};
+
+#endif
--- /dev/null
+// Copyright (c) 1999-2014 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.
+
+#include <XCAFDoc_GeomTolerance.hxx>
+
+#include <TDF_RelocationTable.hxx>
+#include <XCAFDoc.hxx>
+#include <TDataStd_TreeNode.hxx>
+#include <TDataStd_Integer.hxx>
+#include <TDataStd_IntegerArray.hxx>
+#include <TDataStd_Real.hxx>
+#include <XCAFDimTolObjects_GeomToleranceObject.hxx>
+
+enum ChildLab
+{
+ ChildLab_Type = 1,
+ ChildLab_TypeOfValue,
+ ChildLab_Value,
+ ChildLab_MatReqModif,
+ ChildLab_ZoneModif,
+ ChildLab_ValueOfZoneModif,
+ ChildLab_Modifiers,
+ ChildLab_aMaxValueModif
+};
+
+//=======================================================================
+//function : XCAFDoc_GeomTolerance
+//purpose :
+//=======================================================================
+
+XCAFDoc_GeomTolerance::XCAFDoc_GeomTolerance()
+{
+}
+
+
+//=======================================================================
+//function : GetID
+//purpose :
+//=======================================================================
+
+const Standard_GUID& XCAFDoc_GeomTolerance::GetID()
+{
+ static Standard_GUID DGTID ("58ed092f-44de-11d8-8776-001083004c77");
+ //static Standard_GUID ID("efd212e9-6dfd-11d4-b9c8-0060b0ee281b");
+ return DGTID;
+ //return ID;
+}
+
+//=======================================================================
+//function :
+//purpose :
+//=======================================================================
+
+Handle(XCAFDoc_GeomTolerance) XCAFDoc_GeomTolerance::Set (const TDF_Label& theLabel)
+{
+ Handle(XCAFDoc_GeomTolerance) A;
+ if (!theLabel.FindAttribute(XCAFDoc_GeomTolerance::GetID(), A)) {
+ A = new XCAFDoc_GeomTolerance();
+ theLabel.AddAttribute(A);
+ }
+ return A;
+}
+
+//=======================================================================
+//function : SetObject
+//purpose :
+//=======================================================================
+
+void XCAFDoc_GeomTolerance::SetObject (const Handle(XCAFDimTolObjects_GeomToleranceObject)& theObject)
+{
+ Backup();
+
+ Handle(TDataStd_Integer) aType;
+ if(!Label().FindChild(ChildLab_Type).FindAttribute(TDataStd_Integer::GetID(), aType))
+ {
+ aType = new TDataStd_Integer();
+ Label().FindChild(ChildLab_Type).AddAttribute(aType);
+ }
+ aType->Set(theObject->GetType());
+
+ Handle(TDataStd_Integer) aTypeOfValue;
+ if(!Label().FindChild(ChildLab_TypeOfValue).FindAttribute(TDataStd_Integer::GetID(), aTypeOfValue))
+ {
+ aTypeOfValue = new TDataStd_Integer();
+ Label().FindChild(ChildLab_TypeOfValue).AddAttribute(aTypeOfValue);
+ }
+ aTypeOfValue->Set(theObject->GetTypeOfValue());
+
+ Handle(TDataStd_Real) aValue;
+ if(!Label().FindChild(ChildLab_Value).FindAttribute(TDataStd_Real::GetID(), aValue))
+ {
+ aValue = new TDataStd_Real();
+ Label().FindChild(ChildLab_Value).AddAttribute(aValue);
+ }
+ aValue->Set(theObject->GetValue());
+
+ Handle(TDataStd_Integer) aMatReqModif;
+ if(!Label().FindChild(ChildLab_MatReqModif).FindAttribute(TDataStd_Integer::GetID(), aMatReqModif))
+ {
+ aMatReqModif = new TDataStd_Integer();
+ Label().FindChild(ChildLab_MatReqModif).AddAttribute(aMatReqModif);
+ }
+ aMatReqModif->Set(theObject->GetMaterialRequirementModifier());
+
+ Handle(TDataStd_Integer) aZoneModif;
+ if(!Label().FindChild(ChildLab_ZoneModif).FindAttribute(TDataStd_Integer::GetID(), aZoneModif))
+ {
+ aZoneModif = new TDataStd_Integer();
+ Label().FindChild(ChildLab_ZoneModif).AddAttribute(aZoneModif);
+ }
+ aZoneModif->Set(theObject->GetZoneModifier());
+
+ Handle(TDataStd_Real) aValueOfZoneModif;
+ if(!Label().FindChild(ChildLab_ValueOfZoneModif).FindAttribute(TDataStd_Real::GetID(), aValueOfZoneModif))
+ {
+ aValueOfZoneModif = new TDataStd_Real();
+ Label().FindChild(ChildLab_ValueOfZoneModif).AddAttribute(aValueOfZoneModif);
+ }
+ aValueOfZoneModif->Set(theObject->GetValueOfZoneModifier());
+
+ if(theObject->GetModifiers().Length() == 0)
+ {
+ Label().FindChild(ChildLab_Modifiers).ForgetAllAttributes();
+ }
+ else
+ {
+ Handle(TDataStd_IntegerArray) aModifiers;
+ if(!Label().FindChild(ChildLab_Modifiers).FindAttribute(TDataStd_IntegerArray::GetID(), aModifiers)
+ || theObject->GetModifiers().Length() == 0)
+ {
+ aModifiers = new TDataStd_IntegerArray();
+ Label().FindChild(ChildLab_Modifiers).AddAttribute(aModifiers);
+ }
+ Handle(TColStd_HArray1OfInteger) anArr = new TColStd_HArray1OfInteger(1,theObject->GetModifiers().Length());
+ for(Standard_Integer i = 1; i <= theObject->GetModifiers().Length(); i++)
+ anArr->SetValue(i,theObject->GetModifiers().Value(i));
+ aModifiers->ChangeArray(anArr);
+ }
+
+ Handle(TDataStd_Real) aMaxValueModif;
+ if(!Label().FindChild(ChildLab_aMaxValueModif).FindAttribute(TDataStd_Real::GetID(), aMaxValueModif))
+ {
+ aMaxValueModif = new TDataStd_Real();
+ Label().FindChild(ChildLab_aMaxValueModif).AddAttribute(aMaxValueModif);
+ }
+ aMaxValueModif->Set(theObject->GetMaxValueModifier());
+}
+
+//=======================================================================
+//function :GetObject
+//purpose :
+//=======================================================================
+
+Handle(XCAFDimTolObjects_GeomToleranceObject) XCAFDoc_GeomTolerance::GetObject() const
+{
+ Handle(XCAFDimTolObjects_GeomToleranceObject) anObj = new XCAFDimTolObjects_GeomToleranceObject();
+
+ Handle(TDataStd_Integer) aType;
+ if(Label().FindChild(ChildLab_Type).FindAttribute(TDataStd_Integer::GetID(), aType))
+ {
+ anObj->SetType((XCAFDimTolObjects_GeomToleranceType)aType->Get());
+ }
+
+ Handle(TDataStd_Integer) aTypeOfValue;
+ if(Label().FindChild(ChildLab_TypeOfValue).FindAttribute(TDataStd_Integer::GetID(), aTypeOfValue))
+ {
+ anObj->SetTypeOfValue((XCAFDimTolObjects_GeomToleranceTypeValue)aTypeOfValue->Get());
+ }
+
+ Handle(TDataStd_Real) aValue;
+ if(Label().FindChild(ChildLab_Value).FindAttribute(TDataStd_Real::GetID(), aValue))
+ {
+ anObj->SetValue(aValue->Get());
+ }
+
+ Handle(TDataStd_Integer) aMatReqModif;
+ if(Label().FindChild(ChildLab_MatReqModif).FindAttribute(TDataStd_Integer::GetID(), aMatReqModif))
+ {
+ anObj->SetMaterialRequirementModifier((XCAFDimTolObjects_GeomToleranceMatReqModif)aMatReqModif->Get());
+ }
+
+ Handle(TDataStd_Integer) aZoneModif;
+ if(Label().FindChild(ChildLab_ZoneModif).FindAttribute(TDataStd_Integer::GetID(), aZoneModif))
+ {
+ anObj->SetZoneModifier((XCAFDimTolObjects_GeomToleranceZoneModif)aZoneModif->Get());
+ }
+
+ Handle(TDataStd_Real) aValueOfZoneModif;
+ if(Label().FindChild(ChildLab_ValueOfZoneModif).FindAttribute(TDataStd_Real::GetID(), aValueOfZoneModif))
+ {
+ anObj->SetValueOfZoneModifier(aValueOfZoneModif->Get());
+ }
+
+ Handle(TDataStd_IntegerArray) anArr;
+ if(Label().FindChild(ChildLab_Modifiers).FindAttribute(TDataStd_IntegerArray::GetID(), anArr)
+ && !anArr->Array().IsNull())
+ {
+ XCAFDimTolObjects_GeomToleranceModifiersSequence aModifiers;
+ for(Standard_Integer i = 1; i <= anArr->Length(); i++)
+ aModifiers.Append((XCAFDimTolObjects_GeomToleranceModif)anArr->Value(i));
+ anObj->SetModifiers(aModifiers);
+ }
+
+ Handle(TDataStd_Real) aMaxValueModif;
+ if(Label().FindChild(ChildLab_aMaxValueModif).FindAttribute(TDataStd_Real::GetID(), aMaxValueModif))
+ {
+ anObj->SetMaxValueModifier(aMaxValueModif->Get());
+ }
+
+ return anObj;
+}
+
+//=======================================================================
+//function : ID
+//purpose :
+//=======================================================================
+
+const Standard_GUID& XCAFDoc_GeomTolerance::ID() const
+{
+ return GetID();
+}
+
+//=======================================================================
+//function : Restore
+//purpose :
+//=======================================================================
+
+void XCAFDoc_GeomTolerance::Restore(const Handle(TDF_Attribute)& /*With*/)
+{
+}
+
+
+//=======================================================================
+//function : NewEmpty
+//purpose :
+//=======================================================================
+
+Handle(TDF_Attribute) XCAFDoc_GeomTolerance::NewEmpty() const
+{
+ return new XCAFDoc_GeomTolerance();
+}
+
+
+//=======================================================================
+//function : Paste
+//purpose :
+//=======================================================================
+
+void XCAFDoc_GeomTolerance::Paste(const Handle(TDF_Attribute)& /*Into*/,
+ const Handle(TDF_RelocationTable)& /*RT*/) const
+{
+}
--- /dev/null
+// Created on: 2015-08-06
+// Created by: Ilya Novikov
+// Copyright (c) 2004-2014 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 _XCAFDoc_GeomTolerance_HeaderFile
+#define _XCAFDoc_GeomTolerance_HeaderFile
+
+#include <Standard.hxx>
+#include <Standard_Type.hxx>
+
+#include <TDF_Attribute.hxx>
+class Standard_GUID;
+class TDF_Label;
+class TDF_Attribute;
+class TDF_RelocationTable;
+class XCAFDimTolObjects_GeomToleranceObject;
+
+
+class XCAFDoc_GeomTolerance;
+DEFINE_STANDARD_HANDLE(XCAFDoc_GeomTolerance, TDF_Attribute)
+
+//! attribute to store dimension and tolerance
+class XCAFDoc_GeomTolerance : public TDF_Attribute
+{
+
+public:
+
+
+ Standard_EXPORT XCAFDoc_GeomTolerance();
+
+ Standard_EXPORT XCAFDoc_GeomTolerance(const Handle(XCAFDoc_GeomTolerance)& theObj);
+
+ Standard_EXPORT static const Standard_GUID& GetID();
+
+ Standard_EXPORT static Handle(XCAFDoc_GeomTolerance) Set (const TDF_Label& theLabel);
+
+ Standard_EXPORT void SetObject (const Handle(XCAFDimTolObjects_GeomToleranceObject)& theObject);
+
+ Standard_EXPORT Handle(XCAFDimTolObjects_GeomToleranceObject) GetObject() const;
+
+ Standard_EXPORT const Standard_GUID& ID() const;
+
+ Standard_EXPORT void Restore (const Handle(TDF_Attribute)& With);
+
+ Standard_EXPORT Handle(TDF_Attribute) NewEmpty() const;
+
+ Standard_EXPORT void Paste (const Handle(TDF_Attribute)& Into, const Handle(TDF_RelocationTable)& RT) const;
+
+ DEFINE_STANDARD_RTTI(XCAFDoc_GeomTolerance,TDF_Attribute)
+
+};
+
+#endif
XDEDRAW_Layers.hxx
XDEDRAW_Props.cxx
XDEDRAW_Props.hxx
+XDEDRAW_GDTs.cxx
+XDEDRAW_GDTs.hxx
XDEDRAW_Shapes.cxx
XDEDRAW_Shapes.hxx
#include <XCAFDoc_Color.hxx>
#include <XCAFDoc_ColorTool.hxx>
#include <XCAFDoc_DimTol.hxx>
+#include <XCAFDoc_Dimension.hxx>
+#include <XCAFDoc_Datum.hxx>
+#include <XCAFDoc_GeomTolerance.hxx>
#include <XCAFDoc_DocumentTool.hxx>
#include <XCAFDoc_GraphNode.hxx>
#include <XCAFDoc_LayerTool.hxx>
#include <XDEDRAW_Layers.hxx>
#include <XDEDRAW_Props.hxx>
#include <XDEDRAW_Shapes.hxx>
+#include <XDEDRAW_GDTs.hxx>
#include <XSDRAW.hxx>
#include <XSDRAWIGES.hxx>
#include <XSDRAWSTEP.hxx>
else if ( att->ID() == XCAFDoc::ColorRefGUID(XCAFDoc_ColorSurf) ) type = "Surface Color Link";
else if ( att->ID() == XCAFDoc::ColorRefGUID(XCAFDoc_ColorCurv) ) type = "Curve Color Link";
else if ( att->ID() == XCAFDoc::DimTolRefGUID() ) type = "DGT Link";
+ else if ( att->ID() == XCAFDoc::GeomToleranceRefGUID() ) type = "GeomTolerance Link";
else if ( att->ID() == XCAFDoc::DatumRefGUID() ) type = "Datum Link";
else if ( att->ID() == XCAFDoc::MaterialRefGUID() ) type = "Material Link";
Handle(TDataStd_TreeNode) TN = Handle(TDataStd_TreeNode)::DownCast(att);
else if ( att->ID() == XCAFDoc::DatumTolRefGUID() ) {
type = "DatumToler Link";
}
+ else if ( att->ID() == XCAFDoc::DimensionRefGUID() ) {
+ type = "Dimension Link";
+ }
else return 0;
Handle(XCAFDoc_GraphNode) DETGN = Handle(XCAFDoc_GraphNode)::DownCast(att);
XDEDRAW_Colors::InitCommands ( di );
XDEDRAW_Layers::InitCommands ( di );
XDEDRAW_Props::InitCommands ( di );
+ XDEDRAW_GDTs::InitCommands ( di );
XDEDRAW_Common::InitCommands ( di );//moved from EXE
}
#include <Draw_Interpretor.hxx>
class XDEDRAW_Shapes;
+class XDEDRAW_GDTs;
class XDEDRAW_Colors;
class XDEDRAW_Layers;
class XDEDRAW_Props;
--- /dev/null
+// Created on: 2015-06-18
+// Created by: Ilya Novikov
+// Copyright (c) 2000-2015 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.
+
+#include <XDEDRAW_GDTs.hxx>
+
+#include <Draw.hxx>
+#include <DBRep.hxx>
+#include <DDocStd.hxx>
+
+#include <TDF_Tool.hxx>
+#include <TDF_Label.hxx>
+#include <TDF_LabelSequence.hxx>
+#include <TDocStd_Document.hxx>
+#include <XCAFDoc_GraphNode.hxx>
+
+#include <XCAFDoc.hxx>
+#include <XCAFDoc_DocumentTool.hxx>
+#include <XCAFDoc_ShapeTool.hxx>
+#include <XCAFDoc_DimTol.hxx>
+#include <XCAFDoc_Dimension.hxx>
+#include <XCAFDimTolObjects_DimensionObject.hxx>
+#include <XCAFDoc_Datum.hxx>
+#include <XCAFDimTolObjects_DatumObject.hxx>
+#include <XCAFDoc_GeomTolerance.hxx>
+#include <XCAFDimTolObjects_GeomToleranceObject.hxx>
+#include <XCAFDoc_DimTolTool.hxx>
+#include <XCAFDimTolObjects_DimensionObjectSequence.hxx>
+#include <XCAFDimTolObjects_DatumObjectSequence.hxx>
+#include <XCAFDimTolObjects_GeomToleranceObjectSequence.hxx>
+#include <XCAFDimTolObjects_DatumSingleModif.hxx>
+#include <XCAFDimTolObjects_DimensionModif.hxx>
+#include <XCAFDimTolObjects_GeomToleranceModif.hxx>
+#include <XCAFDimTolObjects_DatumModifiersSequence.hxx>
+#include <XCAFDimTolObjects_DatumObject.hxx>
+#include <XCAFDimTolObjects_Tool.hxx>
+
+#include <TCollection_AsciiString.hxx>
+#include <TCollection_HAsciiString.hxx>
+#include <TColStd_HArray1OfReal.hxx>
+#include <TColgp_HArray1OfPnt.hxx>
+
+#include <TopoDS.hxx>
+#include <TopoDS_Shape.hxx>
+#include <TopoDS_Edge.hxx>
+#include <TopoDS_Vertex.hxx>
+#include <BRep_Tool.hxx>
+
+
+
+static Standard_Integer DumpDGTs (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
+{
+ if (argc < 3) {
+ di<<"Use: "<<"XDumpDGTs Doc shape/label/all\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; }
+ Handle(XCAFDoc_DimTolTool) aDimTolTool= XCAFDoc_DocumentTool::DimTolTool(Doc->Main());
+ Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main());
+
+ TCollection_AsciiString name = argv[2];
+ TDF_LabelSequence aLabels;
+ if(name.IsEqual("all"))
+ {
+ aShapeTool->GetShapes(aLabels);
+ for ( Standard_Integer i=1; i <= aLabels.Length(); i++ )
+ {
+ aShapeTool->GetSubShapes(aLabels.Value(i), aLabels);
+ }
+ }
+ else
+ {
+ TDF_Label aLabel;
+ TDF_Tool::Label(Doc->GetData(), argv[2], aLabel);
+ if ( !aLabel.IsNull() ) {
+ aLabels.Append(aLabel);
+ aShapeTool->GetSubShapes(aLabel, aLabels);
+ }
+ else
+ {
+ TopoDS_Shape aShape= DBRep::Get(argv[2]);
+ if ( !aShape.IsNull() )
+ {
+ aShapeTool->Search(aShape, aLabel);
+ if ( !aLabel.IsNull() ) {
+ aLabels.Append(aLabel);
+ aShapeTool->GetSubShapes(aLabel, aLabels);
+ }
+ else
+ {
+ di<<"Shape "<<argv[2]<<" is absent in "<<argv[1]<<"\n";
+ return 1;
+ }
+ }
+ }
+ }
+
+ for ( Standard_Integer i=1; i <= aLabels.Length(); i++ )
+ {
+ Standard_Boolean flag = Standard_True;
+ TDF_LabelSequence aGDTs;
+ aDimTolTool->GetRefDimensionLabels(aLabels.Value(i), aGDTs);
+ for ( Standard_Integer j=1; j <= aGDTs.Length(); j++ )
+ {
+ Handle(XCAFDoc_Dimension) aDimTol;
+ if(aGDTs.Value(j).FindAttribute(XCAFDoc_Dimension::GetID(), aDimTol))
+ {
+ Handle(XCAFDimTolObjects_DimensionObject) aDimTolObj = aDimTol->GetObject();
+ if(flag)
+ {
+ TCollection_AsciiString Entry;
+ TDF_Tool::Entry(aLabels.Value(i), Entry);
+ di << "\n " << Entry;
+ flag = Standard_False;
+ }
+ TCollection_AsciiString Entry;
+ TDF_Tool::Entry(aGDTs.Value(j), Entry);
+ di << "\n \t " << Entry;
+ flag = Standard_False;
+
+ di << " Dimension";
+ }
+ }
+ aGDTs.Clear();
+ aDimTolTool->GetRefGeomToleranceLabels(aLabels.Value(i), aGDTs);
+ for ( Standard_Integer j=1; j <= aGDTs.Length(); j++ )
+ {
+ Handle(XCAFDoc_GeomTolerance) aDimTol;
+ if(aGDTs.Value(j).FindAttribute(XCAFDoc_GeomTolerance::GetID(), aDimTol))
+ {
+ Handle(XCAFDimTolObjects_GeomToleranceObject) aDimTolObj = aDimTol->GetObject();
+ if(flag)
+ {
+ TCollection_AsciiString Entry;
+ TDF_Tool::Entry(aLabels.Value(i), Entry);
+ di << "\n " << Entry;
+ flag = Standard_False;
+ }
+ TCollection_AsciiString Entry;
+ TDF_Tool::Entry(aGDTs.Value(j), Entry);
+ di << "\n \t " << Entry;
+ flag = Standard_False;
+
+ di << " GeomTolerance";
+ Handle(XCAFDoc_GraphNode) aNode;
+ if(aGDTs.Value(j).FindAttribute(XCAFDoc::DatumTolRefGUID(), aNode) && aNode->NbChildren() > 0)
+ {
+ for(Standard_Integer i = 1; i<=aNode->NbChildren(); i++)
+ {
+ Handle(XCAFDoc_Datum) aDatum;
+ if(aNode->GetChild(i)->Label().FindAttribute(XCAFDoc_Datum::GetID(), aDatum))
+ {
+ TCollection_AsciiString Entry;
+ TDF_Tool::Entry(aNode->GetChild(i)->Label(), Entry);
+ di << "\n \t \t " << Entry;
+ di << " Datum";
+ }
+ }
+ }
+ }
+ }
+ TDF_Label aDatumL;
+ if (aDimTolTool->GetRefDatumLabel(aLabels.Value(i), aDatumL))
+ {
+ Handle(XCAFDoc_Datum) aDatum;
+ if(aDatumL.FindAttribute(XCAFDoc_Datum::GetID(), aDatum))
+ {
+ if(flag)
+ {
+ TCollection_AsciiString Entry;
+ TDF_Tool::Entry(aLabels.Value(i), Entry);
+ di << "\n " << Entry;
+ flag = Standard_False;
+ }
+ TCollection_AsciiString Entry;
+ TDF_Tool::Entry(aDatumL, Entry);
+ di << "\n \t " << Entry;
+ flag = Standard_False;
+
+ di << " Datum";
+ }
+ }
+ }
+ return 0;
+}
+
+static Standard_Integer addDim (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
+{
+ if (argc < 3) {
+ di<<"Use: "<<"XAddDimension Doc shape/label [shape/label]\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; }
+ Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main());
+ Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main());
+
+ TDF_Label aLabel;
+ TDF_Tool::Label(Doc->GetData(), argv[2], aLabel);
+ if ( aLabel.IsNull() )
+ {
+ TopoDS_Shape aShape= DBRep::Get(argv[2]);
+ if ( !aShape.IsNull() )
+ {
+ aShapeTool->Search(aShape, aLabel);
+ if ( aLabel.IsNull() )
+ {
+ di<<"Shape "<<argv[2]<<" is absent in "<<argv[1]<<"\n";
+ return 1;
+ }
+ }
+ }
+ TDF_Label aLabel1;
+ if(argc == 4)
+ {
+ TDF_Tool::Label(Doc->GetData(), argv[3], aLabel1);
+ if ( aLabel1.IsNull() )
+ {
+ TopoDS_Shape aShape= DBRep::Get(argv[3]);
+ if ( !aShape.IsNull() )
+ {
+ aShapeTool->Search(aShape, aLabel1);
+ if ( aLabel1.IsNull() )
+ {
+ di<<"Shape "<<argv[3]<<" is absent in "<<argv[1]<<"\n";
+ return 1;
+ }
+ }
+ }
+ }
+
+ TDF_Label aDimL = aDimTolTool->AddDimension();
+ if(aLabel1.IsNull())
+ aDimTolTool->SetDimension(aLabel, aDimL);
+ else
+ aDimTolTool->SetDimension(aLabel, aLabel1, aDimL);
+ TCollection_AsciiString Entry;
+ TDF_Tool::Entry(aDimL, Entry);
+ di << Entry;
+ return 0;
+}
+
+static Standard_Integer addGTol (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
+{
+ if (argc < 3) {
+ di<<"Use: "<<"XAddGeomTolerance Doc shape/label\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; }
+ Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main());
+ Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main());
+
+ TDF_Label aLabel;
+ TDF_Tool::Label(Doc->GetData(), argv[2], aLabel);
+ if ( aLabel.IsNull() )
+ {
+ TopoDS_Shape aShape= DBRep::Get(argv[2]);
+ if ( !aShape.IsNull() )
+ {
+ aShapeTool->Search(aShape, aLabel);
+ if ( aLabel.IsNull() )
+ {
+ di<<"Shape "<<argv[2]<<" is absent in "<<argv[1]<<"\n";
+ return 1;
+ }
+ }
+ }
+
+ TDF_Label aTolL = aDimTolTool->AddGeomTolerance();
+ aDimTolTool->SetGeomTolerance(aLabel, aTolL);
+ TCollection_AsciiString Entry;
+ TDF_Tool::Entry(aTolL, Entry);
+ di << Entry;
+ return 0;
+}
+
+static Standard_Integer addDatum (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
+{
+ if (argc < 3) {
+ di<<"Use: "<<"XAddDatum Doc shape/label\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; }
+ Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main());
+ Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main());
+
+ TDF_Label aLabel;
+ TDF_Tool::Label(Doc->GetData(), argv[2], aLabel);
+ if ( aLabel.IsNull() )
+ {
+ TopoDS_Shape aShape= DBRep::Get(argv[2]);
+ if ( !aShape.IsNull() )
+ {
+ aShapeTool->Search(aShape, aLabel);
+ if ( aLabel.IsNull() )
+ {
+ di<<"Shape "<<argv[2]<<" is absent in "<<argv[1]<<"\n";
+ return 1;
+ }
+ }
+ }
+
+ TDF_Label aDatumL = aDimTolTool->AddDatum();
+ aDimTolTool->SetDatum(aLabel, aDatumL);
+ TCollection_AsciiString Entry;
+ TDF_Tool::Entry(aDatumL, Entry);
+ di << Entry;
+ return 0;
+}
+
+static Standard_Integer setDatum (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
+{
+ if (argc < 4) {
+ di<<"Use: "<<"XSetDatum Doc Datum_Label GeomTol_Label\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; }
+ Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main());
+ Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main());
+
+ TDF_Label aLabel;
+ TDF_Tool::Label(Doc->GetData(), argv[2], aLabel);
+ if ( aLabel.IsNull() )
+ {
+ di<<"Datum "<<argv[2]<<" is absent in "<<argv[1]<<"\n";
+ return 1;
+ }
+
+ TDF_Label aTol;
+ TDF_Tool::Label(Doc->GetData(), argv[3], aTol);
+ if ( aTol.IsNull() )
+ {
+ di<<"GeomTolerance "<<argv[3]<<" is absent in "<<argv[1]<<"\n";
+ return 1;
+ }
+
+ aDimTolTool->SetDatumToGeomTol(aLabel, aTol);
+ return 0;
+}
+
+static Standard_Integer getDatum (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
+{
+ if (argc < 3) {
+ di<<"Use: "<<"XGetDatum Doc GeomTol_Label/Shape_Label\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; }
+ Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main());
+ Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main());
+
+ TDF_Label aLabel;
+ TDF_Tool::Label(Doc->GetData(), argv[2], aLabel);
+ if ( aLabel.IsNull() )
+ {
+ di<<"Label "<<argv[2]<<" is absent in "<<argv[1]<<"\n";
+ return 1;
+ }
+
+ TDF_Label aD;
+ if(!aDimTolTool->GetRefDatumLabel(aLabel, aD))
+ {
+ TDF_LabelSequence aDS;
+ if(aDimTolTool->GetDatumOfTolerLabels(aLabel, aDS))
+ {
+ for(Standard_Integer i = 1; i<=aDS.Length();i++)
+ {
+ if(i>1) di<<", ";
+ TCollection_AsciiString Entry;
+ TDF_Tool::Entry(aDS.Value(i), Entry);
+ di<<Entry;
+ }
+ }
+ }
+ else
+ {
+ TCollection_AsciiString Entry;
+ TDF_Tool::Entry(aD, Entry);
+ di<<Entry;
+ }
+ return 0;
+}
+
+static Standard_Integer addDatumModif (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
+{
+ if (argc < 4) {
+ di<<"Use: "<<"XAddDatumModifier Doc Datum_Label mod1 mod2 ...\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; }
+ Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main());
+ Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main());
+
+ TDF_Label aLabel;
+ TDF_Tool::Label(Doc->GetData(), argv[2], aLabel);
+ if ( aLabel.IsNull() )
+ {
+ di<<"Datum "<<argv[2]<<" is absent in "<<argv[1]<<"\n";
+ return 1;
+ }
+ Handle(XCAFDoc_Datum) aDatum;
+ if(aLabel.FindAttribute(XCAFDoc_Datum::GetID(), aDatum))
+ {
+ for(Standard_Integer i = 3; i < argc; i++)
+ {
+ if(Draw::Atoi(argv[i]) < 22 && Draw::Atoi(argv[i]) > -1)
+ {
+ Handle(XCAFDimTolObjects_DatumObject) anObj = aDatum->GetObject();
+ anObj->AddModifier((XCAFDimTolObjects_DatumSingleModif)Draw::Atoi(argv[i]));
+ aDatum->SetObject(anObj);
+ }
+ }
+ }
+ return 0;
+}
+
+static Standard_Integer getDatumModif (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
+{
+ if (argc < 3) {
+ di<<"Use: "<<"XGetDatumModifiers Doc Datum_Label\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; }
+ Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main());
+ Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main());
+
+ TDF_Label aLabel;
+ TDF_Tool::Label(Doc->GetData(), argv[2], aLabel);
+ if ( aLabel.IsNull() )
+ {
+ di<<"Datum "<<argv[2]<<" is absent in "<<argv[1]<<"\n";
+ return 1;
+ }
+ Handle(XCAFDoc_Datum) aDatum;
+ if(aLabel.FindAttribute(XCAFDoc_Datum::GetID(), aDatum))
+ {
+ XCAFDimTolObjects_DatumModifiersSequence aS = aDatum->GetObject()->GetModifiers();
+ for(Standard_Integer i = 1; i<=aS.Length();i++)
+ {
+ if (i > 1) di<<", ";
+ switch(aS.Value(i)){
+ case 0 : di<<"AnyCrossSection"; break;
+ case 1 : di<<"AnyLongitudinalSection"; break;
+ case 2 : di<<"Basic"; break;
+ case 3 : di<<"ContactingFeature\n"; break;
+ case 4 : di<<"DegreeOfFreedomConstraintU"; break;
+ case 5 : di<<"DegreeOfFreedomConstraintV"; break;
+ case 6 : di<<"DegreeOfFreedomConstraintW"; break;
+ case 7 : di<<"DegreeOfFreedomConstraintX"; break;
+ case 8 : di<<"DegreeOfFreedomConstraintY"; break;
+ case 9 : di<<"DegreeOfFreedomConstraintZ"; break;
+ case 10 : di<<"DistanceVariable"; break;
+ case 11 : di<<"FreeState"; break;
+ case 12 : di<<"LeastMaterialRequirement"; break;
+ case 13 : di<<"Line"; break;
+ case 14 : di<<"MajorDiameter"; break;
+ case 15 : di<<"MaximumMaterialRequirement"; break;
+ case 16 : di<<"MinorDiameter"; break;
+ case 17 : di<<"Orientation"; break;
+ case 18 : di<<"PitchDiameter"; break;
+ case 19 : di<<"Plane"; break;
+ case 20 : di<<"Point"; break;
+ case 21 : di<<"Translation"; break;
+ default : break;
+ }
+ }
+ }
+ return 0;
+}
+
+static Standard_Integer setDatumName (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
+{
+ if (argc < 4) {
+ di<<"Use: "<<"XSetDatumName Doc Datum_Label name\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; }
+ Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main());
+ Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main());
+
+ TDF_Label aLabel;
+ TDF_Tool::Label(Doc->GetData(), argv[2], aLabel);
+ if ( aLabel.IsNull() )
+ {
+ di<<"Datum "<<argv[2]<<" is absent in "<<argv[1]<<"\n";
+ return 1;
+ }
+ Handle(XCAFDoc_Datum) aDatum;
+ if(aLabel.FindAttribute(XCAFDoc_Datum::GetID(), aDatum))
+ {
+ Handle(XCAFDimTolObjects_DatumObject) anObj = aDatum->GetObject();
+ anObj->SetName(new TCollection_HAsciiString(argv[3]));
+ aDatum->SetObject(anObj);
+ }
+ return 0;
+}
+
+static Standard_Integer getDatumName (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
+{
+ if (argc < 3) {
+ di<<"Use: "<<"XGetDatumName Doc Datum_Label\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; }
+ Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main());
+ Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main());
+
+ TDF_Label aLabel;
+ TDF_Tool::Label(Doc->GetData(), argv[2], aLabel);
+ if ( aLabel.IsNull() )
+ {
+ di<<"Datum "<<argv[2]<<" is absent in "<<argv[1]<<"\n";
+ return 1;
+ }
+ Handle(XCAFDoc_Datum) aDatum;
+ if(aLabel.FindAttribute(XCAFDoc_Datum::GetID(), aDatum))
+ {
+ di<<aDatum->GetObject()->GetName()->ToCString();
+ }
+ return 0;
+}
+
+static Standard_Integer setTypeOfTol (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
+{
+ if (argc < 4) {
+ di<<"Use: "<<"XSetTypeOfTolerance Doc GTol_Label type\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; }
+ Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main());
+ Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main());
+
+ TDF_Label aLabel;
+ TDF_Tool::Label(Doc->GetData(), argv[2], aLabel);
+ if ( aLabel.IsNull() )
+ {
+ di<<"GeomTolerance "<<argv[2]<<" is absent in "<<argv[1]<<"\n";
+ return 1;
+ }
+ Handle(XCAFDoc_GeomTolerance) aGeomTolerance;
+ if(aLabel.FindAttribute(XCAFDoc_GeomTolerance::GetID(), aGeomTolerance))
+ {
+ if(Draw::Atoi(argv[3]) > -1 && Draw::Atoi(argv[3]) < 16)
+ {
+ Handle(XCAFDimTolObjects_GeomToleranceObject) anObj = aGeomTolerance->GetObject();
+ anObj->SetType((XCAFDimTolObjects_GeomToleranceType)Draw::Atoi(argv[3]));
+ aGeomTolerance->SetObject(anObj);
+ }
+ }
+ return 0;
+}
+
+static Standard_Integer getTypeOfTol (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
+{
+ if (argc < 3) {
+ di<<"Use: "<<"XGetTypeOfTolerance Doc GTol_Label\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; }
+ Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main());
+ Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main());
+
+ TDF_Label aLabel;
+ TDF_Tool::Label(Doc->GetData(), argv[2], aLabel);
+ if ( aLabel.IsNull() )
+ {
+ di<<"GeomTolerance "<<argv[2]<<" is absent in "<<argv[1]<<"\n";
+ return 1;
+ }
+ Handle(XCAFDoc_GeomTolerance) aGeomTolerance;
+ if(aLabel.FindAttribute(XCAFDoc_GeomTolerance::GetID(), aGeomTolerance))
+ {
+ switch(aGeomTolerance->GetObject()->GetType()){
+ case 0 : di<<"type is absent"; break;
+ case 1 : di<<"Angularity"; break;
+ case 2 : di<<"CircularRunout"; break;
+ case 3 : di<<"CircularityOrRoundness"; break;
+ case 4 : di<<"Coaxiality"; break;
+ case 5 : di<<"Concentricity"; break;
+ case 6 : di<<"Cylindricity"; break;
+ case 7 : di<<"Flatness"; break;
+ case 8 : di<<"Parallelism"; break;
+ case 9 : di<<"Perpendicularity"; break;
+ case 10 : di<<"Position"; break;
+ case 11 : di<<"ProfileOfLine"; break;
+ case 12 : di<<"ProfileOfSurface"; break;
+ case 13 : di<<"Straightness"; break;
+ case 14 : di<<"Symmetry"; break;
+ case 15 : di<<"TotalRunout"; break;
+ default : break;
+ }
+ }
+ return 0;
+}
+
+static Standard_Integer setTypeOfTolVal (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
+{
+ if (argc < 4) {
+ di<<"Use: "<<"XSetTypeOfToleranceValue Doc GTol_Label type\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; }
+ Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main());
+ Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main());
+
+ TDF_Label aLabel;
+ TDF_Tool::Label(Doc->GetData(), argv[2], aLabel);
+ if ( aLabel.IsNull() )
+ {
+ di<<"GeomTolerance "<<argv[2]<<" is absent in "<<argv[1]<<"\n";
+ return 1;
+ }
+ Handle(XCAFDoc_GeomTolerance) aGeomTolerance;
+ if(aLabel.FindAttribute(XCAFDoc_GeomTolerance::GetID(), aGeomTolerance))
+ {
+ if(Draw::Atoi(argv[3]) > -1 && Draw::Atoi(argv[3]) < 3)
+ {
+ Handle(XCAFDimTolObjects_GeomToleranceObject) anObj = aGeomTolerance->GetObject();
+ anObj->SetTypeOfValue((XCAFDimTolObjects_GeomToleranceTypeValue)Draw::Atoi(argv[3]));
+ aGeomTolerance->SetObject(anObj);
+ }
+ }
+ return 0;
+}
+
+static Standard_Integer getTypeOfTolVal (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
+{
+ if (argc < 3) {
+ di<<"Use: "<<"XGetTypeOfToleranceValue Doc GTol_Label\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; }
+ Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main());
+ Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main());
+
+ TDF_Label aLabel;
+ TDF_Tool::Label(Doc->GetData(), argv[2], aLabel);
+ if ( aLabel.IsNull() )
+ {
+ di<<"GeomTolerance "<<argv[2]<<" is absent in "<<argv[1]<<"\n";
+ return 1;
+ }
+ Handle(XCAFDoc_GeomTolerance) aGeomTolerance;
+ if(aLabel.FindAttribute(XCAFDoc_GeomTolerance::GetID(), aGeomTolerance))
+ {
+ switch(aGeomTolerance->GetObject()->GetTypeOfValue()){
+ case 0 : di<<"type is absent"; break;
+ case 1 : di<<"Diameter"; break;
+ case 2 : di<<"SphericalDiameter"; break;
+ default : break;
+ }
+ }
+ return 0;
+}
+
+static Standard_Integer setTolVal (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
+{
+ if (argc < 4) {
+ di<<"Use: "<<"XSetToleranceValue Doc GTol_Label value\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; }
+ Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main());
+ Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main());
+
+ TDF_Label aLabel;
+ TDF_Tool::Label(Doc->GetData(), argv[2], aLabel);
+ if ( aLabel.IsNull() )
+ {
+ di<<"GeomTolerance "<<argv[2]<<" is absent in "<<argv[1]<<"\n";
+ return 1;
+ }
+ Handle(XCAFDoc_GeomTolerance) aGeomTolerance;
+ if(aLabel.FindAttribute(XCAFDoc_GeomTolerance::GetID(), aGeomTolerance))
+ {
+ Handle(XCAFDimTolObjects_GeomToleranceObject) anObj = aGeomTolerance->GetObject();
+ anObj->SetValue(Draw::Atof(argv[3]));
+ aGeomTolerance->SetObject(anObj);
+ }
+ return 0;
+}
+
+static Standard_Integer getTolVal (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
+{
+ if (argc < 3) {
+ di<<"Use: "<<"XGetToleranceValue Doc GTol_Label\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; }
+ Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main());
+ Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main());
+
+ TDF_Label aLabel;
+ TDF_Tool::Label(Doc->GetData(), argv[2], aLabel);
+ if ( aLabel.IsNull() )
+ {
+ di<<"GeomTolerance "<<argv[2]<<" is absent in "<<argv[1]<<"\n";
+ return 1;
+ }
+ Handle(XCAFDoc_GeomTolerance) aGeomTolerance;
+ if(aLabel.FindAttribute(XCAFDoc_GeomTolerance::GetID(), aGeomTolerance))
+ {
+ di << aGeomTolerance->GetObject()->GetValue();
+ }
+ return 0;
+}
+
+static Standard_Integer setMatReq (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
+{
+ if (argc < 4) {
+ di<<"Use: "<<"XSetTolMaterialReq Doc GTol_Label mod\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; }
+ Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main());
+ Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main());
+
+ TDF_Label aLabel;
+ TDF_Tool::Label(Doc->GetData(), argv[2], aLabel);
+ if ( aLabel.IsNull() )
+ {
+ di<<"GeomTolerance "<<argv[2]<<" is absent in "<<argv[1]<<"\n";
+ return 1;
+ }
+ Handle(XCAFDoc_GeomTolerance) aGeomTolerance;
+ if(aLabel.FindAttribute(XCAFDoc_GeomTolerance::GetID(), aGeomTolerance))
+ {
+ if(Draw::Atoi(argv[3]) > -1 && Draw::Atoi(argv[3]) < 3)
+ {
+ Handle(XCAFDimTolObjects_GeomToleranceObject) anObj = aGeomTolerance->GetObject();
+ anObj->SetMaterialRequirementModifier((XCAFDimTolObjects_GeomToleranceMatReqModif)Draw::Atoi(argv[3]));
+ aGeomTolerance->SetObject(anObj);
+ }
+ }
+ return 0;
+}
+
+static Standard_Integer getMatReq (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
+{
+ if (argc < 3) {
+ di<<"Use: "<<"XGetTolMaterialReq Doc GTol_Label\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; }
+ Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main());
+ Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main());
+
+ TDF_Label aLabel;
+ TDF_Tool::Label(Doc->GetData(), argv[2], aLabel);
+ if ( aLabel.IsNull() )
+ {
+ di<<"GeomTolerance "<<argv[2]<<" is absent in "<<argv[1]<<"\n";
+ return 1;
+ }
+ Handle(XCAFDoc_GeomTolerance) aGeomTolerance;
+ if(aLabel.FindAttribute(XCAFDoc_GeomTolerance::GetID(), aGeomTolerance))
+ {
+ switch(aGeomTolerance->GetObject()->GetMaterialRequirementModifier()){
+ case 0 : di<<"modifier is absent"; break;
+ case 1 : di<<"M"; break;
+ case 2 : di<<"L"; break;
+ default : break;
+ }
+ }
+ return 0;
+}
+
+static Standard_Integer setZoneMod (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
+{
+ if (argc < 4) {
+ di<<"Use: "<<"XSetTolZoneMod Doc GTol_Label mod\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; }
+ Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main());
+ Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main());
+
+ TDF_Label aLabel;
+ TDF_Tool::Label(Doc->GetData(), argv[2], aLabel);
+ if ( aLabel.IsNull() )
+ {
+ di<<"GeomTolerance "<<argv[2]<<" is absent in "<<argv[1]<<"\n";
+ return 1;
+ }
+ Handle(XCAFDoc_GeomTolerance) aGeomTolerance;
+ if(aLabel.FindAttribute(XCAFDoc_GeomTolerance::GetID(), aGeomTolerance))
+ {
+ if(Draw::Atoi(argv[3]) > -1 && Draw::Atoi(argv[3]) < 3)
+ {
+ Handle(XCAFDimTolObjects_GeomToleranceObject) anObj = aGeomTolerance->GetObject();
+ anObj->SetZoneModifier((XCAFDimTolObjects_GeomToleranceZoneModif)Draw::Atoi(argv[3]));
+ aGeomTolerance->SetObject(anObj);
+ }
+ }
+ return 0;
+}
+
+static Standard_Integer getZoneMod (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
+{
+ if (argc < 3) {
+ di<<"Use: "<<"XGetTolZoneMod Doc GTol_Label\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; }
+ Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main());
+ Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main());
+
+ TDF_Label aLabel;
+ TDF_Tool::Label(Doc->GetData(), argv[2], aLabel);
+ if ( aLabel.IsNull() )
+ {
+ di<<"GeomTolerance "<<argv[2]<<" is absent in "<<argv[1]<<"\n";
+ return 1;
+ }
+ Handle(XCAFDoc_GeomTolerance) aGeomTolerance;
+ if(aLabel.FindAttribute(XCAFDoc_GeomTolerance::GetID(), aGeomTolerance))
+ {
+ switch(aGeomTolerance->GetObject()->GetZoneModifier()){
+ case 0 : di<<"modifier is absent"; break;
+ case 1 : di<<"P"; break;
+ case 2 : di<<"NonUniform"; break;
+ default : break;
+ }
+ }
+ return 0;
+}
+
+static Standard_Integer setZoneModVal (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
+{
+ if (argc < 4) {
+ di<<"Use: "<<"XSetTolZoneModValue Doc GTol_Label val\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; }
+ Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main());
+ Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main());
+
+ TDF_Label aLabel;
+ TDF_Tool::Label(Doc->GetData(), argv[2], aLabel);
+ if ( aLabel.IsNull() )
+ {
+ di<<"GeomTolerance "<<argv[2]<<" is absent in "<<argv[1]<<"\n";
+ return 1;
+ }
+ Handle(XCAFDoc_GeomTolerance) aGeomTolerance;
+ if(aLabel.FindAttribute(XCAFDoc_GeomTolerance::GetID(), aGeomTolerance))
+ {
+ Handle(XCAFDimTolObjects_GeomToleranceObject) anObj = aGeomTolerance->GetObject();
+ anObj->SetValueOfZoneModifier(Draw::Atof(argv[3]));
+ aGeomTolerance->SetObject(anObj);
+ }
+ return 0;
+}
+
+static Standard_Integer getZoneModVal (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
+{
+ if (argc < 3) {
+ di<<"Use: "<<"XGetTolZoneModValue Doc GTol_Label\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; }
+ Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main());
+ Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main());
+
+ TDF_Label aLabel;
+ TDF_Tool::Label(Doc->GetData(), argv[2], aLabel);
+ if ( aLabel.IsNull() )
+ {
+ di<<"GeomTolerance "<<argv[2]<<" is absent in "<<argv[1]<<"\n";
+ return 1;
+ }
+ Handle(XCAFDoc_GeomTolerance) aGeomTolerance;
+ if(aLabel.FindAttribute(XCAFDoc_GeomTolerance::GetID(), aGeomTolerance))
+ {
+ di << aGeomTolerance->GetObject()->GetValueOfZoneModifier();
+ }
+ return 0;
+}
+
+static Standard_Integer addTolModif (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
+{
+ if (argc < 4) {
+ di<<"Use: "<<"XAddTolModifier Doc Tol_Label mod1 mod2 ...\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; }
+ Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main());
+ Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main());
+
+ TDF_Label aLabel;
+ TDF_Tool::Label(Doc->GetData(), argv[2], aLabel);
+ if ( aLabel.IsNull() )
+ {
+ di<<"GeomTolerance "<<argv[2]<<" is absent in "<<argv[1]<<"\n";
+ return 1;
+ }
+ Handle(XCAFDoc_GeomTolerance) aGeomTolerance;
+ if(aLabel.FindAttribute(XCAFDoc_GeomTolerance::GetID(), aGeomTolerance))
+ {
+ for(Standard_Integer i = 3; i < argc; i++)
+ {
+ if(Draw::Atoi(argv[i]) > -1 && Draw::Atoi(argv[i]) < 15)
+ {
+ Handle(XCAFDimTolObjects_GeomToleranceObject) anObj = aGeomTolerance->GetObject();
+ anObj->AddModifier((XCAFDimTolObjects_GeomToleranceModif)Draw::Atoi(argv[i]));
+ aGeomTolerance->SetObject(anObj);
+ }
+ }
+ }
+ return 0;
+}
+
+static Standard_Integer getTolModif (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
+{
+ if (argc < 3) {
+ di<<"Use: "<<"XGetTolModifiers Doc Tol_Label\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; }
+ Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main());
+ Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main());
+
+ TDF_Label aLabel;
+ TDF_Tool::Label(Doc->GetData(), argv[2], aLabel);
+ if ( aLabel.IsNull() )
+ {
+ di<<"GeomTolerance "<<argv[2]<<" is absent in "<<argv[1]<<"\n";
+ return 1;
+ }
+ Handle(XCAFDoc_GeomTolerance) aGeomTolerance;
+ if(aLabel.FindAttribute(XCAFDoc_GeomTolerance::GetID(), aGeomTolerance))
+ {
+ XCAFDimTolObjects_GeomToleranceModifiersSequence aS = aGeomTolerance->GetObject()->GetModifiers();
+ for(Standard_Integer i = 1; i <= aS.Length(); i++)
+ {
+ if (i > 1) di<<", ";
+ switch(aS.Value(i)){
+ case 0 : di<<"Any_Cross_Section"; break;
+ case 1 : di<<"Common_Zone"; break;
+ case 2 : di<<"Each_Radial_Element"; break;
+ case 3 : di<<"Free_State"; break;
+ case 4 : di<<"Least_Material_Requirement"; break;
+ case 5 : di<<"Line_Element"; break;
+ case 6 : di<<"Major_Diameter"; break;
+ case 7 : di<<"Maximum_Material_Requirement"; break;
+ case 8 : di<<"Minor_Diameter"; break;
+ case 9 : di<<"Not_Convex"; break;
+ case 10 : di<<"Pitch_Diameter"; break;
+ case 11 : di<<"Reciprocity_Requirement"; break;
+ case 12 : di<<"Separate_Requirement"; break;
+ case 13 : di<<"Statistical_Tolerance"; break;
+ case 14 : di<<"Tangent_Plane"; break;
+ default : break;
+ }
+ }
+ }
+ return 0;
+}
+
+static Standard_Integer setTolMaxVal (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
+{
+ if (argc < 4) {
+ di<<"Use: "<<"XSetTolMaxValue Doc Dim_Label val\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; }
+ Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main());
+ Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main());
+
+ TDF_Label aLabel;
+ TDF_Tool::Label(Doc->GetData(), argv[2], aLabel);
+ if ( aLabel.IsNull() )
+ {
+ di<<"GeomTolerance "<<argv[2]<<" is absent in "<<argv[1]<<"\n";
+ return 1;
+ }
+ Handle(XCAFDoc_GeomTolerance) aGeomTolerance;
+ if(aLabel.FindAttribute(XCAFDoc_GeomTolerance::GetID(), aGeomTolerance))
+ {
+ Handle(XCAFDimTolObjects_GeomToleranceObject) anObj = aGeomTolerance->GetObject();
+ anObj->SetMaxValueModifier(Draw::Atof(argv[3]));
+ aGeomTolerance->SetObject(anObj);
+ }
+ return 0;
+}
+
+static Standard_Integer getTolMaxVal (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
+{
+ if (argc < 3) {
+ di<<"Use: "<<"XGetTolMaxValue Doc Dim_Label\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; }
+ Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main());
+ Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main());
+
+ TDF_Label aLabel;
+ TDF_Tool::Label(Doc->GetData(), argv[2], aLabel);
+ if ( aLabel.IsNull() )
+ {
+ di<<"GeomTolerance "<<argv[2]<<" is absent in "<<argv[1]<<"\n";
+ return 1;
+ }
+ Handle(XCAFDoc_GeomTolerance) aGeomTolerance;
+ if(aLabel.FindAttribute(XCAFDoc_GeomTolerance::GetID(), aGeomTolerance))
+ {
+ di << aGeomTolerance->GetObject()->GetMaxValueModifier();
+ }
+ return 0;
+}
+
+static Standard_Integer setDimType (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
+{
+ if (argc < 4) {
+ di<<"Use: "<<"XSetDimensionType Doc Dim_Label type\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; }
+ Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main());
+ Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main());
+
+ TDF_Label aLabel;
+ TDF_Tool::Label(Doc->GetData(), argv[2], aLabel);
+ if ( aLabel.IsNull() )
+ {
+ di<<"Dimension "<<argv[2]<<" is absent in "<<argv[1]<<"\n";
+ return 1;
+ }
+ Handle(XCAFDoc_Dimension) aDimension;
+ if(aLabel.FindAttribute(XCAFDoc_Dimension::GetID(), aDimension))
+ {
+ if(Draw::Atoi(argv[3]) > -1 && Draw::Atoi(argv[3]) < 30)
+ {
+ Handle(XCAFDimTolObjects_DimensionObject) anObj = aDimension->GetObject();
+ anObj->SetType((XCAFDimTolObjects_DimensionType)Draw::Atoi(argv[3]));
+ aDimension->SetObject(anObj);
+ }
+ }
+ return 0;
+}
+
+static Standard_Integer getDimType (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
+{
+ if (argc < 3) {
+ di<<"Use: "<<"XGetDimensionType Doc Dim_Label\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; }
+ Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main());
+ Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main());
+
+ TDF_Label aLabel;
+ TDF_Tool::Label(Doc->GetData(), argv[2], aLabel);
+ if ( aLabel.IsNull() )
+ {
+ di<<"Dimension "<<argv[2]<<" is absent in "<<argv[1]<<"\n";
+ return 1;
+ }
+ Handle(XCAFDoc_Dimension) aDimension;
+ if(aLabel.FindAttribute(XCAFDoc_Dimension::GetID(), aDimension))
+ {
+ switch(aDimension->GetObject()->GetType()){
+ case 0 : di<<"type is absent"; break;
+ case 1 : di<<"Location_CurvedDistance"; break;
+ case 2 : di<<"Location_LinearDistance"; break;
+ case 3 : di<<"Location_LinearDistance_FromCenterToOuter"; break;
+ case 4 : di<<"Location_LinearDistance_FromCenterToInner"; break;
+ case 5 : di<<"Location_LinearDistance_FromOuterToCenter"; break;
+ case 6 : di<<"Location_LinearDistance_FromOuterToOuter"; break;
+ case 7 : di<<"Location_LinearDistance_FromOuterToInner"; break;
+ case 8 : di<<"Location_LinearDistance_FromInnerToCenter"; break;
+ case 9 : di<<"Location_LinearDistance_FromInnerToOuter"; break;
+ case 10 : di<<"Location_LinearDistance_FromInnerToInner"; break;
+ case 11 : di<<"Location_Angular"; break;
+ case 12 : di<<"Location_Oriented"; break;
+ case 13 : di<<"Location_WithPath"; break;
+ case 14 : di<<"Size_CurveLength"; break;
+ case 15 : di<<"Size_Diameter"; break;
+ case 16 : di<<"Size_SphericalDiameter"; break;
+ case 17 : di<<"Size_Radius"; break;
+ case 18 : di<<"Size_SphericalRadius"; break;
+ case 19 : di<<"Size_ToroidalMinorDiameter"; break;
+ case 20 : di<<"Size_ToroidalMajorDiameter"; break;
+ case 21 : di<<"Size_ToroidalMinorRadius"; break;
+ case 22 : di<<"Size_ToroidalMajorRadius"; break;
+ case 23 : di<<"Size_ToroidalHighMajorDiameter"; break;
+ case 24 : di<<"Size_ToroidalLowMajorDiameter"; break;
+ case 25 : di<<"Size_ToroidalHighMajorRadius"; break;
+ case 26 : di<<"Size_ToroidalLowMajorRadius"; break;
+ case 27 : di<<"Size_Thickness"; break;
+ case 28 : di<<"Size_Angular"; break;
+ case 29 : di<<"Size_WithPath"; break;
+ default : break;
+ }
+ }
+ return 0;
+}
+
+static Standard_Integer setDimVal (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
+{
+ if (argc < 4) {
+ di<<"Use: "<<"XSetDimensionValue Doc Dim_Label val\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; }
+ Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main());
+ Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main());
+
+ TDF_Label aLabel;
+ TDF_Tool::Label(Doc->GetData(), argv[2], aLabel);
+ if ( aLabel.IsNull() )
+ {
+ di<<"Dimension "<<argv[2]<<" is absent in "<<argv[1]<<"\n";
+ return 1;
+ }
+ Handle(XCAFDoc_Dimension) aDimension;
+ if(aLabel.FindAttribute(XCAFDoc_Dimension::GetID(), aDimension))
+ {
+ Handle(XCAFDimTolObjects_DimensionObject) anObj = aDimension->GetObject();
+ anObj->SetValue(Draw::Atof(argv[3]));
+ aDimension->SetObject(anObj);
+ }
+ return 0;
+}
+
+static Standard_Integer getDimVal (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
+{
+ if (argc < 3) {
+ di<<"Use: "<<"XGetDimensionValue Doc Dim_Label\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; }
+ Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main());
+ Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main());
+
+ TDF_Label aLabel;
+ TDF_Tool::Label(Doc->GetData(), argv[2], aLabel);
+ if ( aLabel.IsNull() )
+ {
+ di<<"Dimension "<<argv[2]<<" is absent in "<<argv[1]<<"\n";
+ return 1;
+ }
+ Handle(XCAFDoc_Dimension) aDimension;
+ if(aLabel.FindAttribute(XCAFDoc_Dimension::GetID(), aDimension))
+ {
+ di << aDimension->GetObject()->GetValue();
+ }
+ return 0;
+}
+
+static Standard_Integer setDimQalif (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
+{
+ if (argc < 4) {
+ di<<"Use: "<<"XSetDimensionQualifier Doc Dim_Label val\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; }
+ Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main());
+ Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main());
+
+ TDF_Label aLabel;
+ TDF_Tool::Label(Doc->GetData(), argv[2], aLabel);
+ if ( aLabel.IsNull() )
+ {
+ di<<"Dimension "<<argv[2]<<" is absent in "<<argv[1]<<"\n";
+ return 1;
+ }
+ Handle(XCAFDoc_Dimension) aDimension;
+ if(aLabel.FindAttribute(XCAFDoc_Dimension::GetID(), aDimension))
+ {
+ if(Draw::Atoi(argv[3]) > -1 && Draw::Atoi(argv[3]) < 4)
+ {
+ Handle(XCAFDimTolObjects_DimensionObject) anObj = aDimension->GetObject();
+ anObj->SetQualifier((XCAFDimTolObjects_DimensionQualifier)Draw::Atoi(argv[3]));
+ aDimension->SetObject(anObj);
+ }
+ }
+ return 0;
+}
+
+static Standard_Integer getDimQalif (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
+{
+ if (argc < 3) {
+ di<<"Use: "<<"XGetDimensionQualifier Doc Dim_Label\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; }
+ Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main());
+ Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main());
+
+ TDF_Label aLabel;
+ TDF_Tool::Label(Doc->GetData(), argv[2], aLabel);
+ if ( aLabel.IsNull() )
+ {
+ di<<"Dimension "<<argv[2]<<" is absent in "<<argv[1]<<"\n";
+ return 1;
+ }
+ Handle(XCAFDoc_Dimension) aDimension;
+ if(aLabel.FindAttribute(XCAFDoc_Dimension::GetID(), aDimension))
+ {
+
+ switch(aDimension->GetObject()->GetQualifier()){
+ case 0 : di<<"type is absent"; break;
+ case 1 : di<<"Min"; break;
+ case 2 : di<<"Max"; break;
+ case 3 : di<<"Avg"; break;
+ default : break;
+ }
+ }
+ return 0;
+}
+
+static Standard_Integer setDimRange (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
+{
+ if (argc < 5) {
+ di<<"Use: "<<"XSetDimensionRange Doc Dim_Label low_val up_val\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; }
+ Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main());
+ Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main());
+
+ TDF_Label aLabel;
+ TDF_Tool::Label(Doc->GetData(), argv[2], aLabel);
+ if ( aLabel.IsNull() )
+ {
+ di<<"Dimension "<<argv[2]<<" is absent in "<<argv[1]<<"\n";
+ return 1;
+ }
+ Handle(XCAFDoc_Dimension) aDimension;
+ if(aLabel.FindAttribute(XCAFDoc_Dimension::GetID(), aDimension))
+ {
+ if(Draw::Atof(argv[3]) < Draw::Atof(argv[4]))
+ {
+ Handle(XCAFDimTolObjects_DimensionObject) anObj = aDimension->GetObject();
+ anObj->SetLowerBound(Draw::Atof(argv[3]));
+ anObj->SetUpperBound(Draw::Atof(argv[4]));
+ aDimension->SetObject(anObj);
+ }
+ }
+ return 0;
+}
+
+static Standard_Integer getDimRange (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
+{
+ if (argc < 3) {
+ di<<"Use: "<<"XGetDimensionRange Doc Dim_Label\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; }
+ Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main());
+ Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main());
+
+ TDF_Label aLabel;
+ TDF_Tool::Label(Doc->GetData(), argv[2], aLabel);
+ if ( aLabel.IsNull() )
+ {
+ di<<"Dimension "<<argv[2]<<" is absent in "<<argv[1]<<"\n";
+ return 1;
+ }
+ Handle(XCAFDoc_Dimension) aDimension;
+ if(aLabel.FindAttribute(XCAFDoc_Dimension::GetID(), aDimension))
+ {
+ di << "lower " << aDimension->GetObject()->GetLowerBound();
+ di << " upper " << aDimension->GetObject()->GetUpperBound();
+ }
+ return 0;
+}
+
+static Standard_Integer setDimPlusMinusTol (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
+{
+ if (argc < 5) {
+ di<<"Use: "<<"XSetDimensionPlusMinusTol Doc Dim_Label low_val up_val\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; }
+ Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main());
+ Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main());
+
+ TDF_Label aLabel;
+ TDF_Tool::Label(Doc->GetData(), argv[2], aLabel);
+ if ( aLabel.IsNull() )
+ {
+ di<<"Dimension "<<argv[2]<<" is absent in "<<argv[1]<<"\n";
+ return 1;
+ }
+ Handle(XCAFDoc_Dimension) aDimension;
+ if(aLabel.FindAttribute(XCAFDoc_Dimension::GetID(), aDimension))
+ {
+ if(Draw::Atof(argv[3]) < Draw::Atof(argv[4]))
+ {
+ Handle(XCAFDimTolObjects_DimensionObject) anObj = aDimension->GetObject();
+ anObj->SetLowerTolValue(Draw::Atof(argv[3]));
+ anObj->SetUpperTolValue(Draw::Atof(argv[4]));
+ aDimension->SetObject(anObj);
+ }
+ }
+ return 0;
+}
+
+static Standard_Integer getDimPlusMinusTol (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
+{
+ if (argc < 3) {
+ di<<"Use: "<<"XGetDimensionPlusMinusTol Doc Dim_Label\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; }
+ Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main());
+ Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main());
+
+ TDF_Label aLabel;
+ TDF_Tool::Label(Doc->GetData(), argv[2], aLabel);
+ if ( aLabel.IsNull() )
+ {
+ di<<"Dimension "<<argv[2]<<" is absent in "<<argv[1]<<"\n";
+ return 1;
+ }
+ Handle(XCAFDoc_Dimension) aDimension;
+ if(aLabel.FindAttribute(XCAFDoc_Dimension::GetID(), aDimension))
+ {
+ di << "lower " << aDimension->GetObject()->GetLowerTolValue();
+ di << " upper " << aDimension->GetObject()->GetUpperTolValue();
+ }
+ return 0;
+}
+
+static Standard_Integer setDimClassTol (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
+{
+ if (argc < 6) {
+ di<<"Use: "<<"XSetDimensionClassOfTol Doc Dim_Label ishole[1/0] formVar grade\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; }
+ Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main());
+ Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main());
+
+ TDF_Label aLabel;
+ TDF_Tool::Label(Doc->GetData(), argv[2], aLabel);
+ if ( aLabel.IsNull() )
+ {
+ di<<"Dimension "<<argv[2]<<" is absent in "<<argv[1]<<"\n";
+ return 1;
+ }
+ Handle(XCAFDoc_Dimension) aDimension;
+ if(aLabel.FindAttribute(XCAFDoc_Dimension::GetID(), aDimension))
+ {
+ if(Draw::Atoi(argv[4]) > 0 && Draw::Atoi(argv[4]) < 29 && Draw::Atoi(argv[5]) > -1 && Draw::Atoi(argv[5]) < 20)
+ {
+ Handle(XCAFDimTolObjects_DimensionObject) anObj = aDimension->GetObject();
+ anObj->SetClassOfTolerance((Draw::Atoi(argv[3]) != 0), (XCAFDimTolObjects_DimensionFormVariance)Draw::Atoi(argv[4]), (XCAFDimTolObjects_DimensionGrade)Draw::Atoi(argv[5]));
+ aDimension->SetObject(anObj);
+ }
+ }
+ return 0;
+}
+
+static Standard_Integer getDimClassTol (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
+{
+ if (argc < 3) {
+ di<<"Use: "<<"XGetDimensionClassOfTol Doc Dim_Label\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; }
+ Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main());
+ Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main());
+
+ TDF_Label aLabel;
+ TDF_Tool::Label(Doc->GetData(), argv[2], aLabel);
+ if ( aLabel.IsNull() )
+ {
+ di<<"Dimension "<<argv[2]<<" is absent in "<<argv[1]<<"\n";
+ return 1;
+ }
+ Handle(XCAFDoc_Dimension) aDimension;
+ if(aLabel.FindAttribute(XCAFDoc_Dimension::GetID(), aDimension))
+ {
+ Standard_Boolean h;
+ XCAFDimTolObjects_DimensionFormVariance f;
+ XCAFDimTolObjects_DimensionGrade g;
+ if(aDimension->GetObject()->GetClassOfTolerance(h ,f, g))
+ {
+ if(h)
+ {
+ switch(f){
+ case 1 : di<<"a";break;
+ case 2 : di<<"b";break;
+ case 3 : di<<"c";break;
+ case 4 : di<<"cd";break;
+ case 5 : di<<"d";break;
+ case 6 : di<<"e";break;
+ case 7 : di<<"ef";break;
+ case 8 : di<<"f";break;
+ case 9 : di<<"fg";break;
+ case 10 : di<<"g";break;
+ case 11 : di<<"h";break;
+ case 12 : di<<"js";break;
+ case 13 : di<<"j";break;
+ case 14 : di<<"k";break;
+ case 15 : di<<"m";break;
+ case 16 : di<<"n";break;
+ case 17 : di<<"p";break;
+ case 18 : di<<"r";break;
+ case 19 : di<<"s";break;
+ case 20 : di<<"t";break;
+ case 21 : di<<"u";break;
+ case 22 : di<<"v";break;
+ case 23 : di<<"x";break;
+ case 24 : di<<"y";break;
+ case 25 : di<<"z";break;
+ case 26 : di<<"a";break;
+ case 27 : di<<"zb";break;
+ case 28 : di<<"zc";break;
+ default : break;
+ }
+ }
+ else
+ {
+ switch(f){
+ case 1 : di<<"A";break;
+ case 2 : di<<"B";break;
+ case 3 : di<<"C";break;
+ case 4 : di<<"CD";break;
+ case 5 : di<<"D";break;
+ case 6 : di<<"E";break;
+ case 7 : di<<"EF";break;
+ case 8 : di<<"F";break;
+ case 9 : di<<"FG";break;
+ case 10 : di<<"G";break;
+ case 11 : di<<"H";break;
+ case 12 : di<<"JS";break;
+ case 13 : di<<"J";break;
+ case 14 : di<<"K";break;
+ case 15 : di<<"M";break;
+ case 16 : di<<"N";break;
+ case 17 : di<<"P";break;
+ case 18 : di<<"R";break;
+ case 19 : di<<"S";break;
+ case 20 : di<<"T";break;
+ case 21 : di<<"U";break;
+ case 22 : di<<"V";break;
+ case 23 : di<<"X";break;
+ case 24 : di<<"Y";break;
+ case 25 : di<<"Z";break;
+ case 26 : di<<"ZA";break;
+ case 27 : di<<"ZB";break;
+ case 28 : di<<"ZC";break;
+ default : break;
+ }
+ }
+ switch(g){
+ case 0 : di<<"01"; break;
+ case 1 : di<<"0"; break;
+ case 2 : di<<"1"; break;
+ case 3 : di<<"2"; break;
+ case 4 : di<<"3"; break;
+ case 5 : di<<"4"; break;
+ case 6 : di<<"5"; break;
+ case 7 : di<<"6"; break;
+ case 8 : di<<"7"; break;
+ case 9 : di<<"8"; break;
+ case 10 : di<<"9"; break;
+ case 11 : di<<"10"; break;
+ case 12 : di<<"11"; break;
+ case 13 : di<<"12"; break;
+ case 14 : di<<"13"; break;
+ case 15 : di<<"14"; break;
+ case 16 : di<<"15"; break;
+ case 17 : di<<"16"; break;
+ case 18 : di<<"17"; break;
+ case 19 : di<<"18"; break;
+ default : break;
+ }
+ }
+ }
+ return 0;
+}
+
+static Standard_Integer setDimNbOfDecimalPlaces (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
+{
+ if (argc < 5) {
+ di<<"Use: "<<"XSetDimensionNbOfDecimalPlaces Doc Dim_Label l_val r_val\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; }
+ Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main());
+ Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main());
+
+ TDF_Label aLabel;
+ TDF_Tool::Label(Doc->GetData(), argv[2], aLabel);
+ if ( aLabel.IsNull() )
+ {
+ di<<"Dimension "<<argv[2]<<" is absent in "<<argv[1]<<"\n";
+ return 1;
+ }
+ Handle(XCAFDoc_Dimension) aDimension;
+ if(aLabel.FindAttribute(XCAFDoc_Dimension::GetID(), aDimension))
+ {
+ Handle(XCAFDimTolObjects_DimensionObject) anObj = aDimension->GetObject();
+ anObj->SetNbOfDecimalPlaces(Draw::Atoi(argv[3]), Draw::Atoi(argv[4]));
+ aDimension->SetObject(anObj);
+ }
+ return 0;
+}
+
+static Standard_Integer getDimNbOfDecimalPlaces (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
+{
+ if (argc < 3) {
+ di<<"Use: "<<"XGetDimensionNbOfDecimalPlaces Doc Dim_Label\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; }
+ Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main());
+ Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main());
+
+ TDF_Label aLabel;
+ TDF_Tool::Label(Doc->GetData(), argv[2], aLabel);
+ if ( aLabel.IsNull() )
+ {
+ di<<"Dimension "<<argv[2]<<" is absent in "<<argv[1]<<"\n";
+ return 1;
+ }
+ Handle(XCAFDoc_Dimension) aDimension;
+ if(aLabel.FindAttribute(XCAFDoc_Dimension::GetID(), aDimension))
+ {
+ Standard_Integer l, r;
+ aDimension->GetObject()->GetNbOfDecimalPlaces(l,r);
+ di << l << "." << r;
+ }
+ return 0;
+}
+
+static Standard_Integer addDimModifier (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
+{
+ if (argc < 4) {
+ di<<"Use: "<<"XAddDimensionModifiers Doc Dim_Label mod1 mod2 ...\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; }
+ Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main());
+ Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main());
+
+ TDF_Label aLabel;
+ TDF_Tool::Label(Doc->GetData(), argv[2], aLabel);
+ if ( aLabel.IsNull() )
+ {
+ di<<"Dimension "<<argv[2]<<" is absent in "<<argv[1]<<"\n";
+ return 1;
+ }
+ Handle(XCAFDoc_Dimension) aDimension;
+ if(aLabel.FindAttribute(XCAFDoc_Dimension::GetID(), aDimension))
+ {
+ for(Standard_Integer i = 3; i < argc; i++)
+ {
+ if(Draw::Atoi(argv[i]) > -1 && Draw::Atoi(argv[i]) < 24)
+ {
+ Handle(XCAFDimTolObjects_DimensionObject) anObj = aDimension->GetObject();
+ anObj->AddModifier((XCAFDimTolObjects_DimensionModif)Draw::Atoi(argv[i]));
+ aDimension->SetObject(anObj);
+ }
+ }
+ }
+ return 0;
+}
+
+static Standard_Integer getDimModifier (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
+{
+ if (argc < 3) {
+ di<<"Use: "<<"XGetDimensionModifiers Doc Dim_Label\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; }
+ Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main());
+ Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main());
+
+ TDF_Label aLabel;
+ TDF_Tool::Label(Doc->GetData(), argv[2], aLabel);
+ if ( aLabel.IsNull() )
+ {
+ di<<"Dimension "<<argv[2]<<" is absent in "<<argv[1]<<"\n";
+ return 1;
+ }
+ Handle(XCAFDoc_Dimension) aDimension;
+ if(aLabel.FindAttribute(XCAFDoc_Dimension::GetID(), aDimension))
+ {
+ XCAFDimTolObjects_DimensionModifiersSequence aS = aDimension->GetObject()->GetModifiers();
+ for(Standard_Integer i = 1; i <= aS.Length(); i++)
+ {
+ if (i > 1) di<<", ";
+ switch(aS.Value(i)){
+ case 0 : di<<"ControlledRadius"; break;
+ case 1 : di<<"Square"; break;
+ case 2 : di<<"StatisticalTolerance"; break;
+ case 3 : di<<"ContinuousFeature"; break;
+ case 4 : di<<"TwoPointSize"; break;
+ case 5 : di<<"LocalSizeDefinedBySphere"; break;
+ case 6 : di<<"LeastSquaresAssociationCriterion"; break;
+ case 7 : di<<"MaximumInscribedAssociation"; break;
+ case 8 : di<<"MinimumCircumscribedAssociation"; break;
+ case 9 : di<<"CircumferenceDiameter"; break;
+ case 10 : di<<"AreaDiameter"; break;
+ case 11 : di<<"VolumeDiameter"; break;
+ case 12 : di<<"MaximumSize"; break;
+ case 13 : di<<"MinimumSize"; break;
+ case 14 : di<<"AverageSize"; break;
+ case 15 : di<<"MedianSize"; break;
+ case 16 : di<<"MidRangeSize"; break;
+ case 17 : di<<"RangeOfSizes"; break;
+ case 18 : di<<"AnyRestrictedPortionOfFeature"; break;
+ case 19 : di<<"AnyCrossSection"; break;
+ case 20 : di<<"SpecificFixedCrossSection"; break;
+ case 21 : di<<"CommonTolerance"; break;
+ case 22 : di<<"FreeStateCondition"; break;
+ case 23 : di<<"Between"; break;
+ default : break;
+ }
+ }
+ }
+ return 0;
+}
+
+static Standard_Integer addDimPath (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
+{
+ if (argc < 4) {
+ di<<"Use: "<<"XSetDimensionPath Doc Dim_Label path(edge)\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; }
+ Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main());
+ Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main());
+
+ TDF_Label aLabel;
+ TDF_Tool::Label(Doc->GetData(), argv[2], aLabel);
+ if ( aLabel.IsNull() )
+ {
+ di<<"Dimension "<<argv[2]<<" is absent in "<<argv[1]<<"\n";
+ return 1;
+ }
+ Handle(XCAFDoc_Dimension) aDimension;
+ if(aLabel.FindAttribute(XCAFDoc_Dimension::GetID(), aDimension))
+ {
+ TopoDS_Edge aE = TopoDS::Edge(DBRep::Get(argv[3],TopAbs_EDGE));
+ if(!aE.IsNull())
+ {
+ Handle(XCAFDimTolObjects_DimensionObject) anObj = aDimension->GetObject();
+ anObj->SetPath(aE);
+ aDimension->SetObject(anObj);
+ }
+ }
+ return 0;
+}
+
+static Standard_Integer addDimPoints (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
+{
+ if (argc < 5) {
+ di<<"Use: "<<"XSetDimensionPoints Doc Dim_Label v1 v2\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; }
+ Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main());
+ Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main());
+
+ TDF_Label aLabel;
+ TDF_Tool::Label(Doc->GetData(), argv[2], aLabel);
+ if ( aLabel.IsNull() )
+ {
+ di<<"Dimension "<<argv[2]<<" is absent in "<<argv[1]<<"\n";
+ return 1;
+ }
+ Handle(XCAFDoc_Dimension) aDimension;
+ if(aLabel.FindAttribute(XCAFDoc_Dimension::GetID(), aDimension))
+ {
+ TopoDS_Vertex aV1 = TopoDS::Vertex(DBRep::Get(argv[3],TopAbs_VERTEX));
+ TopoDS_Vertex aV2 = TopoDS::Vertex(DBRep::Get(argv[4],TopAbs_VERTEX));
+ if(!aV1.IsNull() && !aV1.IsNull())
+ {
+ Handle(TColgp_HArray1OfPnt) arr = new TColgp_HArray1OfPnt(1,2);
+ arr->SetValue(1, BRep_Tool::Pnt(aV1));
+ arr->SetValue(2, BRep_Tool::Pnt(aV2));
+ Handle(XCAFDimTolObjects_DimensionObject) anObj = aDimension->GetObject();
+ anObj->SetPoints(arr);
+ aDimension->SetObject(anObj);
+ }
+ }
+ return 0;
+}
+
+static Standard_Integer getDimPoints (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
+{
+ if (argc < 3) {
+ di<<"Use: "<<"XGetDimensionPoints Doc Dim_Label\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; }
+ Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main());
+ Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main());
+
+ TDF_Label aLabel;
+ TDF_Tool::Label(Doc->GetData(), argv[2], aLabel);
+ if ( aLabel.IsNull() )
+ {
+ di<<"Dimension "<<argv[2]<<" is absent in "<<argv[1]<<"\n";
+ return 1;
+ }
+ Handle(XCAFDoc_Dimension) aDimension;
+ if(aLabel.FindAttribute(XCAFDoc_Dimension::GetID(), aDimension))
+ {
+ Handle(TColgp_HArray1OfPnt) pnts = aDimension->GetObject()->GetPoints();
+ if(!pnts.IsNull() && pnts->Length() == 2)
+ {
+ di << pnts->Value(1).X() << ";" << pnts->Value(1).Y() << ";" << pnts->Value(1).Z() << " ";
+ di << pnts->Value(2).X() << ";" << pnts->Value(2).Y() << ";" << pnts->Value(2).Z();
+ }
+ }
+ return 0;
+}
+
+static Standard_Integer addDimDir (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
+{
+ if (argc < 6) {
+ di<<"Use: "<<"XSetDimensionDir Doc Dim_Label x y z\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; }
+ Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main());
+ Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main());
+
+ TDF_Label aLabel;
+ TDF_Tool::Label(Doc->GetData(), argv[2], aLabel);
+ if ( aLabel.IsNull() )
+ {
+ di<<"Dimension "<<argv[2]<<" is absent in "<<argv[1]<<"\n";
+ return 1;
+ }
+ Handle(XCAFDoc_Dimension) aDimension;
+ if(aLabel.FindAttribute(XCAFDoc_Dimension::GetID(), aDimension))
+ {
+ Handle(XCAFDimTolObjects_DimensionObject) anObj = aDimension->GetObject();
+ anObj->SetDirection(gp_Dir(Draw::Atof(argv[3]),Draw::Atof(argv[4]),Draw::Atof(argv[5])));
+ aDimension->SetObject(anObj);
+ }
+ return 0;
+}
+
+static Standard_Integer getDimDir (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
+{
+ if (argc < 3) {
+ di<<"Use: "<<"XSetDimensionDir Doc Dim_Label\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; }
+ Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(Doc->Main());
+ Handle(XCAFDoc_ShapeTool) aShapeTool= XCAFDoc_DocumentTool::ShapeTool(Doc->Main());
+
+ TDF_Label aLabel;
+ TDF_Tool::Label(Doc->GetData(), argv[2], aLabel);
+ if ( aLabel.IsNull() )
+ {
+ di<<"Dimension "<<argv[2]<<" is absent in "<<argv[1]<<"\n";
+ return 1;
+ }
+ Handle(XCAFDoc_Dimension) aDimension;
+ if(aLabel.FindAttribute(XCAFDoc_Dimension::GetID(), aDimension))
+ {
+ gp_Dir dir;
+ if(aDimension->GetObject()->GetDirection(dir))
+ {
+ di << dir.X()<< ";"<< dir.Y()<< ";"<<dir.Z();
+ }
+ }
+ return 0;
+}
+
+//=======================================================================
+//function : InitCommands
+//purpose :
+//=======================================================================
+
+void XDEDRAW_GDTs::InitCommands(Draw_Interpretor& di)
+{
+
+ static Standard_Boolean initactor = Standard_False;
+ if (initactor) return; initactor = Standard_True;
+
+
+ Standard_CString g = "XDE G&DTs commands";
+
+ di.Add ("XDumpDGTs","XDumpDGTs Doc shape/label/all ",
+ __FILE__, DumpDGTs, g);
+
+ di.Add ("XAddDimension","XAddDimension Doc shape/label [shape/label]",
+ __FILE__, addDim, g);
+
+ di.Add ("XAddGeomTolerance","XAddGeomTolerance Doc shape/label",
+ __FILE__, addGTol, g);
+
+ di.Add ("XAddDatum","XAddDatum Doc shape/label",
+ __FILE__, addDatum, g);
+
+ di.Add ("XSetDatum","XSetDatum Doc Datum_Label GeomTol_Label",
+ __FILE__, setDatum, g);
+
+ di.Add ("XGetDatum","XGetDatum Doc GeomTol_Label/Shape_Label",
+ __FILE__, getDatum, g);
+
+ di.Add ("XAddDatumModifier","XAddDatumModifier Doc Datum_Label mod1 mod2 ...\n"
+ "Values:"
+ "\n 0 AnyCrossSection"
+ "\n 1 Any_LongitudinalSection"
+ "\n 2 Basic"
+ "\n 3 ContactingFeature"
+ "\n 4 DegreeOfFreedomConstraintU"
+ "\n 5 DegreeOfFreedomConstraintV"
+ "\n 6 DegreeOfFreedomConstraintW"
+ "\n 7 DegreeOfFreedomConstraintX"
+ "\n 8 DegreeOfFreedomConstraintY"
+ "\n 9 DegreeOfFreedomConstraintZ"
+ "\n 10 DistanceVariable"
+ "\n 11 FreeState"
+ "\n 12 LeastMaterialRequirement"
+ "\n 13 Line"
+ "\n 14 MajorDiameter"
+ "\n 15 MaximumMaterialRequirement"
+ "\n 16 MinorDiameter"
+ "\n 17 Orientation"
+ "\n 18 PitchDiameter"
+ "\n 19 Plane"
+ "\n 20 Point"
+ "\n 21 Translation",
+ __FILE__, addDatumModif, g);
+
+ di.Add ("XGetDatumModifiers","XGetDatumModifiers Doc Datum_Label",
+ __FILE__, getDatumModif, g);
+
+ di.Add ("XSetDatumName","XSetDatumName Doc Datum_Label name",
+ __FILE__, setDatumName, g);
+
+ di.Add ("XGetDatumName","XGetDatumName Doc Datum_Label",
+ __FILE__, getDatumName, g);
+
+ di.Add ("XSetTypeOfTolerance","XSetTypeOfTolerance Doc GTol_Label type"
+ "Values:\n"
+ "\t 0 type is absent\n"
+ "\t 1 Angularity\n"
+ "\t 2 CircularRunout\n"
+ "\t 3 CircularityOrRoundness\n"
+ "\t 4 Coaxiality\n"
+ "\t 5 Concentricity\n"
+ "\t 6 Cylindricity\n"
+ "\t 7 Flatness\n"
+ "\t 8 Parallelism\n"
+ "\t 9 Perpendicularity\n"
+ "\t 10 Position\n"
+ "\t 11 ProfileOfLine\n"
+ "\t 12 ProfileOfSurface\n"
+ "\t 13 Straightness\n"
+ "\t 14 Symmetry\n"
+ "\t 15 TotalRunout\n",
+ __FILE__, setTypeOfTol, g);
+
+ di.Add ("XGetTypeOfTolerance","XGetTypeOfTolerance Doc GTol_Label",
+ __FILE__, getTypeOfTol, g);
+
+ di.Add ("XSetTypeOfToleranceValue","XSetTypeOfToleranceValue Doc GTol_Label type"
+ "Values:"
+ "\n 0 none"
+ "\n 1 Diameter"
+ "\n 2 SphericalDiameter",
+ __FILE__, setTypeOfTolVal, g);
+
+ di.Add ("XGetTypeOfToleranceValue","XGetTypeOfToleranceValue Doc GTol_Label",
+ __FILE__, getTypeOfTolVal, g);
+
+ di.Add ("XSetToleranceValue","XSetToleranceValue Doc GTol_Label value",
+ __FILE__, setTolVal, g);
+
+ di.Add ("XGetToleranceValue","XGetToleranceValue Doc GTol_Label",
+ __FILE__, getTolVal, g);
+
+ di.Add ("XSetTolMaterialReq","XSetTolMaterialReq Doc GTol_Label mod"
+ "Values:"
+ "\n 0 none"
+ "\n 1 M"
+ "\n 2 L",
+ __FILE__, setMatReq, g);
+
+ di.Add ("XGetTolMaterialReq","XGetTolMaterialReq Doc GTol_Label",
+ __FILE__, getMatReq, g);
+
+ di.Add ("XSetTolZoneMod","XSetTolZoneMod Doc GTol_Label mod"
+ "Values:"
+ "\n 0 none"
+ "\n 1 P"
+ "\n 2 NonUniform",
+ __FILE__, setZoneMod, g);
+
+ di.Add ("XGetTolZoneMod","XGetTolZoneMod Doc GTol_Label",
+ __FILE__, getZoneMod, g);
+
+ di.Add ("XSetTolZoneModValue","XSetTolZoneModValue Doc GTol_Label val",
+ __FILE__, setZoneModVal, g);
+
+ di.Add ("XGetTolZoneModValue","XGetTolZoneModValue Doc GTol_Label",
+ __FILE__, getZoneModVal, g);
+
+ di.Add ("XAddTolModifier","XAddTolModifier Doc Tol_Label mod1 mod2 ..."
+ "Values:\n"
+ "\t 0 Any_Cross_Section\n"
+ "\t 1 Common_Zone\n"
+ "\t 2 Each_Radial_Element\n"
+ "\t 3 Free_State\n"
+ "\t 4 Least_Material_Requirement\n"
+ "\t 5 Line_Element\n"
+ "\t 6 Major_Diameter\n"
+ "\t 7 Maximum_Material_Requirement\n"
+ "\t 8 Minor_Diameter\n"
+ "\t 9 Not_Convex\n"
+ "\t 10 Pitch_Diameter\n"
+ "\t 11 Reciprocity_Requirement\n"
+ "\t 12 Separate_Requirement\n"
+ "\t 13 Statistical_Tolerance\n"
+ "\t 14 Tangent_Plane\n",
+ __FILE__, addTolModif, g);
+
+ di.Add ("XGetTolModifier","XGetTolModifier Doc Tol_Label",
+ __FILE__, getTolModif, g);
+
+ di.Add ("XSetTolMaxValue","XSetTolMaxValue Doc Dim_Label val",
+ __FILE__, setTolMaxVal, g);
+
+ di.Add ("XGetTolMaxValue","XGetTolMaxValue Doc Dim_Label val",
+ __FILE__, getTolMaxVal, g);
+
+ di.Add ("XSetDimensionType","XSetDimensionType Doc Dim_Label type"
+ "Values:"
+ "\t 0 type is absent\n"
+ "\t 1 Location_CurvedDistance\n"
+ "\t 2 Location_LinearDistance\n"
+ "\t 3 Location_LinearDistance_FromCenterToOuter\n"
+ "\t 4 Location_LinearDistance_FromCenterToInner\n"
+ "\t 5 Location_LinearDistance_FromOuterToCenter\n"
+ "\t 6 Location_LinearDistance_FromOuterToOuter\n"
+ "\t 7 Location_LinearDistance_FromOuterToInner\n"
+ "\t 8 Location_LinearDistance_FromInnerToCenter\n"
+ "\t 9 Location_LinearDistance_FromInnerToOuter\n"
+ "\t 10 Location_LinearDistance_FromInnerToInner\n"
+ "\t 11 Location_Angular\n"
+ "\t 12 Location_Oriented\n"
+ "\t 13 Location_WithPath\n"
+ "\t 14 Size_CurveLength\n"
+ "\t 15 Size_Diameter\n"
+ "\t 16 Size_SphericalDiameter\n"
+ "\t 17 Size_Radius\n"
+ "\t 18 Size_SphericalRadius\n"
+ "\t 19 Size_ToroidalMinorDiameter\n"
+ "\t 20 Size_ToroidalMajorDiameter\n"
+ "\t 21 Size_ToroidalMinorRadius\n"
+ "\t 22 Size_ToroidalMajorRadius\n"
+ "\t 23 Size_ToroidalHighMajorDiameter\n"
+ "\t 24 Size_ToroidalLowMajorDiameter\n"
+ "\t 25 Size_ToroidalHighMajorRadius\n"
+ "\t 26 Size_ToroidalLowMajorRadius\n"
+ "\t 27 Size_Thickness\n"
+ "\t 28 Size_Angular\n"
+ "\t 29 Size_WithPath\n",
+ __FILE__, setDimType, g);
+
+ di.Add ("XGetDimensionType","XGetDimensionType Doc Dim_Label",
+ __FILE__, getDimType, g);
+
+ di.Add ("XSetDimensionValue","XSetDimensionValue Doc Dim_Label val",
+ __FILE__, setDimVal, g);
+
+ di.Add ("XGetDimensionValue","XGetDimensionValue Doc Dim_Label",
+ __FILE__, getDimVal, g);
+
+ di.Add ("XSetDimensionQualifier","XSetDimensionQualifier Doc Dim_Label val"
+ "Values:"
+ "\n 0 none"
+ "\n 1 Min"
+ "\n 2 Max"
+ "\n 3 Avg",
+ __FILE__, setDimQalif, g);
+
+ di.Add ("XGetDimensionQualifier","XGetDimensionQualifier Doc Dim_Label",
+ __FILE__, getDimQalif, g);
+
+ di.Add ("XSetDimensionRange","XSetDimensionRange Doc Dim_Label low_val up_val",
+ __FILE__, setDimRange, g);
+
+ di.Add ("XGetDimensionRange","XGetDimensionRange Doc Dim_Label",
+ __FILE__, getDimRange, g);
+
+ di.Add ("XSetDimensionPlusMinusTol","XSetDimensionPlusMinusTol Doc Dim_Label low_val up_val",
+ __FILE__, setDimPlusMinusTol, g);
+
+ di.Add ("XGetDimensionPlusMinusTol","XGetDimensionPlusMinusTol Doc Dim_Label",
+ __FILE__, getDimPlusMinusTol, g);
+
+ di.Add ("XSetDimensionClassOfTol","XSetDimensionClassOfTol Doc Dim_Label ishole[1/0] formVar grade"
+ "Values of formVar:"
+ "\t 1 a\n"
+ "\t 2 b\n"
+ "\t 3 c\n"
+ "\t 4 cd\n"
+ "\t 5 d\n"
+ "\t 6 e\n"
+ "\t 7 ef\n"
+ "\t 8 f\n"
+ "\t 9 fg\n"
+ "\t10 g\n"
+ "\t11 h\n"
+ "\t12 js\n"
+ "\t13 j\n"
+ "\t14 k\n"
+ "\t15 m\n"
+ "\t16 n\n"
+ "\t17 p\n"
+ "\t18 r\n"
+ "\t19 s\n"
+ "\t20 t\n"
+ "\t21 u\n"
+ "\t22 v\n"
+ "\t23 x\n"
+ "\t24 y\n"
+ "\t25 z\n"
+ "\t26 za\n"
+ "\t27 zb\n"
+ "\t28 zc\n\n"
+ "Values of grade:"
+ "\t 0 01\n"
+ "\t 1 0\n"
+ "\t 2 1\n"
+ "\t 3 2d\n"
+ "\t 4 3\n"
+ "\t 5 4\n"
+ "\t 6 5f\n"
+ "\t 7 76\n"
+ "\t 8 7g\n"
+ "\t 9 8\n"
+ "\t10 9\n"
+ "\t11 10js\n"
+ "\t12 11j\n"
+ "\t13 12k\n"
+ "\t14 13m\n"
+ "\t15 14n\n"
+ "\t16 15p\n"
+ "\t17 16r\n"
+ "\t18 17s\n"
+ "\t19 18t\n",
+ __FILE__, setDimClassTol, g);
+
+ di.Add ("XGetDimensionClassOfTol","XGetDimensionClassOfTol Doc Dim_Label",
+ __FILE__, getDimClassTol, g);
+
+ di.Add ("XSetDimensionNbOfDecimalPlaces","XSetDimensionNbOfDecimalPlaces Doc Dim_Label l_val r_val",
+ __FILE__, setDimNbOfDecimalPlaces, g);
+
+ di.Add ("XGetDimensionNbOfDecimalPlaces","XGetDimensionNbOfDecimalPlaces Doc Dim_Label",
+ __FILE__, getDimNbOfDecimalPlaces, g);
+
+ di.Add ("XAddDimensionModifiers","XAddDimensionModifiers Doc Dim_Label mod1 mod2 ..."
+ "Values:"
+ "\t 0 ControlledRadius\n"
+ "\t 1 Square\n"
+ "\t 2 StatisticalTolerance\n"
+ "\t 3 ContinuousFeature\n"
+ "\t 4 TwoPointSize\n"
+ "\t 5 LocalSizeDefinedBySphere\n"
+ "\t 6 LeastSquaresAssociationCriterion\n"
+ "\t 7 MaximumInscribedAssociation\n"
+ "\t 8 MinimumCircumscribedAssociation\n"
+ "\t 9 CircumferenceDiameter\n"
+ "\t10 AreaDiameter\n"
+ "\t11 VolumeDiameter\n"
+ "\t12 MaximumSize\n"
+ "\t13 MinimumSize\n"
+ "\t14 AverageSize\n"
+ "\t15 MedianSize\n"
+ "\t16 MidRangeSize\n"
+ "\t17 RangeOfSizes\n"
+ "\t18 AnyRestrictedPortionOfFeature\n"
+ "\t19 AnyCrossSection\n"
+ "\t20 SpecificFixedCrossSection\n"
+ "\t21 CommonTolerance\n"
+ "\t22 FreeStateCondition\n"
+ "\t23 Between\n",
+ __FILE__, addDimModifier, g);
+
+ di.Add ("XGetDimensionModifiers","XGetDimensionModifiers Doc Dim_Label",
+ __FILE__, getDimModifier, g);
+
+ di.Add ("XSetDimensionPath","XSetDimensionPath Doc Dim_Label path(edge)",
+ __FILE__, addDimPath, g);
+
+ di.Add ("XSetDimensionPoints","XSetDimensionPoints Doc Dim_Label v1 v2",
+ __FILE__, addDimPoints, g);
+
+ di.Add ("XGetDimensionPoints","XGetDimensionPoints Doc Dim_Label",
+ __FILE__, getDimPoints, g);
+
+ di.Add ("XSetDimensionDir","XSetDimensionDir Doc Dim_Label x y z",
+ __FILE__, addDimDir, g);
+
+ di.Add ("XGetDimensionDir","XGetDimensionDir Doc Dim_Label",
+ __FILE__, getDimDir, g);
+}
--- /dev/null
+// Created on: 2015-08-06
+// Created by: Ilya Novikov
+// Copyright (c) 2000-2014 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 _XDEDRAW_GDTs_HeaderFile
+#define _XDEDRAW_GDTs_HeaderFile
+
+#include <Standard.hxx>
+#include <Standard_DefineAlloc.hxx>
+#include <Standard_Handle.hxx>
+
+#include <Draw_Interpretor.hxx>
+
+
+//! Contains commands to work with GDTs
+class XDEDRAW_GDTs
+{
+public:
+
+ DEFINE_STANDARD_ALLOC
+
+
+ Standard_EXPORT static void InitCommands (Draw_Interpretor& theCommands);
+
+
+
+
+protected:
+
+
+
+
+
+private:
+
+
+
+
+
+};
+
+#endif // _XDEDRAW_GDTs_HeaderFile
--- /dev/null
+cpulimit 1000
+pload ALL
\ No newline at end of file
--- /dev/null
+
+box b 10 10 10
+explode b
+explode b_1
+
+NewDocument D
+XAddShape D b
+XAddDimension D b_1_1
+#0:1:4:1
+XSetDimensionType D 0:1:4:1 14
+XSetDimensionValue D 0:1:4:1 1.5
+
+set c_value "1.5"
+set c_type "Size_CurveLength"
\ No newline at end of file
--- /dev/null
+
+box b 10 10 10
+explode b
+explode b_1
+
+NewDocument D
+XAddShape D b
+XAddDimension D b_1_1
+#0:1:4:1
+XSetDimensionType D 0:1:4:1 15
+XSetDimensionValue D 0:1:4:1 2.5
+XSetDimensionQualifier D 0:1:4:1 2
+
+set c_value "2.5"
+set c_type "Size_Diameter"
+set c_qalif "Max"
\ No newline at end of file
--- /dev/null
+
+box b 10 10 10
+explode b
+explode b_1
+
+NewDocument D
+XAddShape D b
+XAddDimension D b_1_1
+
+#0:1:4:1
+XSetDimensionType D 0:1:4:1 14
+XSetDimensionRange D 0:1:4:1 1.5 2.5
+
+set c_range "lower 1.5 upper 2.5"
+set c_type "Size_CurveLength"
\ No newline at end of file
--- /dev/null
+
+box b 10 10 10
+explode b
+explode b_1
+
+NewDocument D
+XAddShape D b
+XAddDimension D b_1_1
+#0:1:4:1
+XSetDimensionType D 0:1:4:1 15
+XSetDimensionValue D 0:1:4:1 2.5
+XSetDimensionClassOfTol D 0:1:4:1 1 8 7
+XSetDimensionNbOfDecimalPlaces D 0:1:4:1 3 3
+XAddDimensionModifiers D 0:1:4:1 14 0
+
+set c_value "2.5"
+set c_type "Size_Diameter"
+set c_class "f6"
+set c_d "3.3"
+set c_mod "AverageSize, ControlledRadius"
\ No newline at end of file
--- /dev/null
+
+box b 10 10 10
+box b1 20 20 20 30 30 30
+explode b
+explode b_1
+explode b1
+explode b1_1
+
+NewDocument D
+XAddShape D b
+XAddShape D b1
+XAddDimension D b_1_1 b1_1_1
+#0:1:4:1
+XSetDimensionType D 0:1:4:1 2
+XSetDimensionValue D 0:1:4:1 6
+XSetDimensionPlusMinusTol D 0:1:4:1 -0.001 0.002
+vertex v1 10 10 10
+vertex v2 20 20 20
+XSetDimensionPoints D 0:1:4:1 v1 v2
+
+set c_value "6"
+set c_type "Location_LinearDistance"
+set c_pnts "10;10;10 20;20;20"
+set c_plusminus "lower -0.001 upper 0.002"
\ No newline at end of file
--- /dev/null
+
+box b 10 10 10
+box b1 20 20 20 30 30 30
+explode b
+explode b_1
+explode b1
+explode b1_1
+
+NewDocument D
+XAddShape D b
+XAddShape D b1
+XAddDimension D b_1_1 b1_1_1
+#0:1:4:1
+XSetDimensionType D 0:1:4:1 2
+XSetDimensionValue D 0:1:4:1 6
+XSetDimensionPlusMinusTol D 0:1:4:1 -0.001 0.002
+XSetDimensionDir D 0:1:4:1 1 1 0
+
+set c_value "6"
+set c_type "Location_LinearDistance"
+set c_plusminus "lower -0.001 upper 0.002"
+set c_dir "0.70710678118654757;0.70710678118654757;0"
--- /dev/null
+set c_type 0
+set c_value 0
+set c_qalif 0
+set c_classtol 0
+set c_d 0
+set c_modif 0
+set c_dir 0
+set c_pnts 0
+set c_range 0
+set c_mod 0
+set c_plusminus 0
+set c_dump 0
\ No newline at end of file
--- /dev/null
+set value [XGetDimensionValue D 0:1:4:1]
+set type [XGetDimensionType D 0:1:4:1]
+set qualif [XGetDimensionQualifier D 0:1:4:1]
+set range [XGetDimensionRange D 0:1:4:1]
+set classtol [XGetDimensionClassOfTol D 0:1:4:1]
+set d [XGetDimensionNbOfDecimalPlaces D 0:1:4:1]
+set dir [XGetDimensionDir D 0:1:4:1]
+set pnts [XGetDimensionPoints D 0:1:4:1]
+set mod [XGetDimensionModifiers D 0:1:4:1]
+set plusminus [XGetDimensionPlusMinusTol D 0:1:4:1]
+set dump [XDumpDGTs D all]
+
+if { $c_value != 0 && $value != $c_value} {
+ puts "Error wrong value"
+} else {
+ if { $c_type != 0 && [string compare $type $c_type] != 0} {
+ puts "Error wrong type"
+ } else {
+ if { $c_qalif != 0 && [string compare $qualif $c_qalif] != 0} {
+ puts "Error wrong qualifier"
+ } else {
+ if { $c_classtol != 0 && $classtol != $c_classtol} {
+ puts "Error wrong class of tolerance"
+ } else {
+ if { $c_d != 0 && $d != $c_d} {
+ puts "Error wrong nbdigit"
+ } else {
+ if { $c_modif != 0 && [string compare $modif $c_modif] != 0} {
+ puts "Error wrong modifiers"
+ } else {
+ if { $c_dir != 0 && [string compare $dir $c_dir] != 0} {
+ puts "Error wrong direction"
+ } else {
+ if { $c_pnts != 0 && [string compare $pnts $c_pnts] != 0} {
+ puts "Error wrong points"
+ } else {
+ if { $c_range != 0 && [string compare $range $c_range] != 0} {
+ puts "Error wrong range"
+ } else {
+ if { $c_mod != 0 && [string compare $mod $c_mod] != 0} {
+ puts "Error wrong modifiers"
+ } else {
+ if { $c_plusminus != 0 && [string compare $plusminus $c_plusminus] != 0} {
+ puts "Error wrong modifiers"
+ } else {
+ puts "TEST COMPLETED"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
--- /dev/null
+001 dimensions
+002 tolerances
\ No newline at end of file
--- /dev/null
+
+box b 10 10 10
+explode b
+explode b_1
+
+NewDocument D
+XAddShape D b
+XAddGeomTolerance D b_1_1
+XAddDatum D b_1_2
+#0:1:4:1
+#0:1:4:2
+XSetDatumName D 0:1:4:2 A
+XAddDatumModifier D 0:1:4:2 10
+XSetDatum D 0:1:4:2 0:1:4:1
+XSetToleranceValue D 0:1:4:1 0.5
+XSetTypeOfTolerance D 0:1:4:1 1
+XSetTypeOfToleranceValue D 0:1:4:1 1
+XSetTolMaterialReq D 0:1:4:1 1
+XSetTolZoneMod D 0:1:4:1 1
+XSetTolZoneModValue D 0:1:4:1 1
+XAddTolModifier D 0:1:4:1 6 1
+XSetTolMaxValue D 0:1:4:1 1.5
+
+set c_dname "A"
+set c_dmod "DistanceVariable"
+set c_val "0.5"
+set c_type "Angularity"
+set c_typev "Diameter"
+set c_mat "M"
+set c_zone "P"
+set c_zonev "1"
+set c_mod "Major_Diameter, Common_Zone"
+set c_max "1.5"
+
--- /dev/null
+
+box b 10 10 10
+explode b
+explode b_1
+
+NewDocument D
+XAddShape D b
+XAddGeomTolerance D b_1_1
+XAddDatum D b_1_2
+XAddDatum D b_1_3
+#0:1:4:1
+#0:1:4:2
+#0:1:4:3
+XSetDatumName D 0:1:4:2 A
+XSetDatumName D 0:1:4:3 B
+XAddDatumModifier D 0:1:4:2 10
+XSetDatum D 0:1:4:2 0:1:4:1
+XSetDatum D 0:1:4:3 0:1:4:1
+XSetToleranceValue D 0:1:4:1 0.5
+
+
+set c_dname "A"
+set c_dmod "DistanceVariable"
+set c_val "0.5"
+
+
--- /dev/null
+set c_dmod 0
+set c_dname 0
+set c_val 0
+set c_type 0
+set c_typev 0
+set c_mat 0
+set c_zone 0
+set c_zonev 0
+set c_mod 0
+set c_max 0
+set c_dump 0
\ No newline at end of file
--- /dev/null
+set dmod [XGetDatumModifiers D 0:1:4:2]
+set dname [XGetDatumName D 0:1:4:2]
+set type [XGetTypeOfTolerance D 0:1:4:1]
+set typev [XGetTypeOfToleranceValue D 0:1:4:1]
+set val [XGetToleranceValue D 0:1:4:1]
+set mat [XGetTolMaterialReq D 0:1:4:1]
+set zone [XGetTolZoneMod D 0:1:4:1]
+set zonev [XGetTolZoneModValue D 0:1:4:1]
+set mod [XGetTolModifier D 0:1:4:1]
+set max [XGetTolMaxValue D 0:1:4:1]
+set dump [XDumpDGTs D all]
+
+ if { $c_dmod != 0 && [string compare $dmod $c_dmod] != 0} {
+ puts "Error wrong datum modif"
+ } else {
+ if { $c_dname != 0 && [string compare $dname $c_dname] != 0} {
+ puts "Error wrong datum name"
+ } else {
+ if { $c_type != 0 && [string compare $type $c_type] != 0} {
+ puts "Error wrong type"
+ } else {
+ if { $c_typev != 0 && [string compare $typev $c_typev] != 0} {
+ puts "Error wrong type of value"
+ } else {
+ if { $c_mat != 0 && [string compare $mat $c_mat] != 0} {
+ puts "Error wrong mat"
+ } else {
+ if { $c_zone != 0 && [string compare $zone $c_zone] != 0} {
+ puts "Error wrong zone"
+ } else {
+ if { $c_zonev != 0 && $zonev != $c_zonev } {
+ puts "Error wrong zome value"
+ } else {
+ if { $c_mod != 0 && [string compare $mod $c_mod] != 0} {
+ puts "Error wrong modifiers"
+ } else {
+ if { $c_max != 0 && $max != $c_max } {
+ puts "Error wrong maxvalue"
+ } else {
+ if { $c_val != 0 && $val != $c_val } {
+ puts "Error wrong value"
+ } else {
+ puts "TEST COMPLETED"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+