diff --git a/src/STEPCAFControl/STEPCAFControl_Reader.cxx b/src/STEPCAFControl/STEPCAFControl_Reader.cxx index 93a952e404..fedf03721b 100644 --- a/src/STEPCAFControl/STEPCAFControl_Reader.cxx +++ b/src/STEPCAFControl/STEPCAFControl_Reader.cxx @@ -3541,11 +3541,11 @@ static void setDimObjectToXCAF(const Handle(Standard_Transient)& theEnt, //get qualifier for angular value aType = XCAFDimTolObjects_DimensionType_Size_Angular; if (anAngSize->AngleSelection() == StepShape_Equal) - aDimObj->SetQualifier(XCAFDimTolObjects_DimensionQualifier_Avg); + aDimObj->SetAngularQualifier(XCAFDimTolObjects_AngularQualifier_Equal); else if (anAngSize->AngleSelection() == StepShape_Large) - aDimObj->SetQualifier(XCAFDimTolObjects_DimensionQualifier_Max); + aDimObj->SetAngularQualifier(XCAFDimTolObjects_AngularQualifier_Large); else if (anAngSize->AngleSelection() == StepShape_Small) - aDimObj->SetQualifier(XCAFDimTolObjects_DimensionQualifier_Min); + aDimObj->SetAngularQualifier(XCAFDimTolObjects_AngularQualifier_Small); } } else @@ -3557,11 +3557,11 @@ static void setDimObjectToXCAF(const Handle(Standard_Transient)& theEnt, //get qualifier for angular value aType = XCAFDimTolObjects_DimensionType_Location_Angular; if (anAngLoc->AngleSelection() == StepShape_Equal) - aDimObj->SetQualifier(XCAFDimTolObjects_DimensionQualifier_Avg); + aDimObj->SetAngularQualifier(XCAFDimTolObjects_AngularQualifier_Equal); else if (anAngLoc->AngleSelection() == StepShape_Large) - aDimObj->SetQualifier(XCAFDimTolObjects_DimensionQualifier_Max); + aDimObj->SetAngularQualifier(XCAFDimTolObjects_AngularQualifier_Large); else if (anAngLoc->AngleSelection() == StepShape_Small) - aDimObj->SetQualifier(XCAFDimTolObjects_DimensionQualifier_Min); + aDimObj->SetAngularQualifier(XCAFDimTolObjects_AngularQualifier_Small); } } if (aType == XCAFDimTolObjects_DimensionType_Location_None) diff --git a/src/STEPCAFControl/STEPCAFControl_Writer.cxx b/src/STEPCAFControl/STEPCAFControl_Writer.cxx index 22d46ca905..fa9b2069d9 100644 --- a/src/STEPCAFControl/STEPCAFControl_Writer.cxx +++ b/src/STEPCAFControl/STEPCAFControl_Writer.cxx @@ -3939,11 +3939,11 @@ Standard_Boolean STEPCAFControl_Writer::WriteDGTsAP242 (const Handle(XSControl_W Handle(StepShape_AngularLocation) aDim = new StepShape_AngularLocation(); StepShape_AngleRelator aRelator = StepShape_Equal; if (anObject->HasQualifier()) { - XCAFDimTolObjects_DimensionQualifier aQualifier = anObject->GetQualifier(); + XCAFDimTolObjects_AngularQualifier aQualifier = anObject->GetAngularQualifier(); switch (aQualifier) { - case XCAFDimTolObjects_DimensionQualifier_Min: aRelator = StepShape_Small; + case XCAFDimTolObjects_AngularQualifier_Small : aRelator = StepShape_Small; break; - case XCAFDimTolObjects_DimensionQualifier_Max: aRelator = StepShape_Large; + case XCAFDimTolObjects_AngularQualifier_Large : aRelator = StepShape_Large; break; default: aRelator = StepShape_Equal; } @@ -3969,11 +3969,11 @@ Standard_Boolean STEPCAFControl_Writer::WriteDGTsAP242 (const Handle(XSControl_W Handle(StepShape_AngularSize) aDim = new StepShape_AngularSize(); StepShape_AngleRelator aRelator = StepShape_Equal; if (anObject->HasQualifier()) { - XCAFDimTolObjects_DimensionQualifier aQualifier = anObject->GetQualifier(); + XCAFDimTolObjects_AngularQualifier aQualifier = anObject->GetAngularQualifier(); switch (aQualifier) { - case XCAFDimTolObjects_DimensionQualifier_Min: aRelator = StepShape_Small; + case XCAFDimTolObjects_AngularQualifier_Small: aRelator = StepShape_Small; break; - case XCAFDimTolObjects_DimensionQualifier_Max: aRelator = StepShape_Large; + case XCAFDimTolObjects_AngularQualifier_Large: aRelator = StepShape_Large; break; default: aRelator = StepShape_Equal; } diff --git a/src/XCAFDimTolObjects/FILES b/src/XCAFDimTolObjects/FILES index 69ceaa34e6..0bbce85f4a 100644 --- a/src/XCAFDimTolObjects/FILES +++ b/src/XCAFDimTolObjects/FILES @@ -28,5 +28,6 @@ XCAFDimTolObjects_DimensionObjectSequence.hxx XCAFDimTolObjects_GeomToleranceObjectSequence.hxx XCAFDimTolObjects_DataMapOfToleranceDatum.hxx XCAFDimTolObjects_ToleranceZoneAffectedPlane.hxx +XCAFDimTolObjects_AngularQualifier.hxx diff --git a/src/XCAFDimTolObjects/XCAFDimTolObjects_AngularQualifier.hxx b/src/XCAFDimTolObjects/XCAFDimTolObjects_AngularQualifier.hxx new file mode 100644 index 0000000000..a9aaec7409 --- /dev/null +++ b/src/XCAFDimTolObjects/XCAFDimTolObjects_AngularQualifier.hxx @@ -0,0 +1,29 @@ +// Created on: 2021-10-25 +// Created by: Irina Chesnokova +// Copyright (c) 2021 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_AngularQualifier_HeaderFile +#define _XCAFDimTolObjects_AngularQualifier_HeaderFile + +//! Defines types of qualifier for angular dimensions +enum XCAFDimTolObjects_AngularQualifier +{ +XCAFDimTolObjects_AngularQualifier_None, +XCAFDimTolObjects_AngularQualifier_Small, +XCAFDimTolObjects_AngularQualifier_Large, +XCAFDimTolObjects_AngularQualifier_Equal +}; + +#endif // _XCAFDimTolObjects_AngularQualifier_HeaderFile diff --git a/src/XCAFDimTolObjects/XCAFDimTolObjects_DimensionObject.cxx b/src/XCAFDimTolObjects/XCAFDimTolObjects_DimensionObject.cxx index bcbc8d6d68..9de6d4acd6 100644 --- a/src/XCAFDimTolObjects/XCAFDimTolObjects_DimensionObject.cxx +++ b/src/XCAFDimTolObjects/XCAFDimTolObjects_DimensionObject.cxx @@ -41,6 +41,7 @@ XCAFDimTolObjects_DimensionObject::XCAFDimTolObjects_DimensionObject(const Handl myType = theObj->myType; myVal = theObj->myVal; myQualifier = theObj->myQualifier; + myAngularQualifier = theObj->myAngularQualifier; myIsHole = theObj->myIsHole; myFormVariance = theObj->myFormVariance; myGrade = theObj->myGrade; @@ -117,6 +118,33 @@ Standard_Boolean XCAFDimTolObjects_DimensionObject::HasQualifier() const return (myQualifier != XCAFDimTolObjects_DimensionQualifier_None); } +//======================================================================= +//function : SetAngularQualifier +//purpose : +//======================================================================= +void XCAFDimTolObjects_DimensionObject::SetAngularQualifier(const XCAFDimTolObjects_AngularQualifier theAngularQualifier) +{ + myAngularQualifier = theAngularQualifier; +} + +//======================================================================= +//function : GetAngularQualifier +//purpose : +//======================================================================= +XCAFDimTolObjects_AngularQualifier XCAFDimTolObjects_DimensionObject::GetAngularQualifier() const +{ + return myAngularQualifier; +} + +//======================================================================= +//function : HasAngularQualifier +//purpose : +//======================================================================= +Standard_Boolean XCAFDimTolObjects_DimensionObject::HasAngularQualifier() const +{ + return (myAngularQualifier != XCAFDimTolObjects_AngularQualifier_None); +} + //======================================================================= //function : SetType //purpose : diff --git a/src/XCAFDimTolObjects/XCAFDimTolObjects_DimensionObject.hxx b/src/XCAFDimTolObjects/XCAFDimTolObjects_DimensionObject.hxx index 58e1806df8..e9783f7b05 100644 --- a/src/XCAFDimTolObjects/XCAFDimTolObjects_DimensionObject.hxx +++ b/src/XCAFDimTolObjects/XCAFDimTolObjects_DimensionObject.hxx @@ -40,6 +40,7 @@ #include #include #include +#include class XCAFDimTolObjects_DimensionObject; DEFINE_STANDARD_HANDLE(XCAFDimTolObjects_DimensionObject, Standard_Transient) @@ -68,6 +69,15 @@ public: //! Returns True if the object has dimension qualifier. Standard_EXPORT Standard_Boolean HasQualifier() const; + + //! Sets angular qualifier as small, large or equal. + Standard_EXPORT void SetAngularQualifier(const XCAFDimTolObjects_AngularQualifier theAngularQualifier); + + //! Returns angular qualifier. + Standard_EXPORT XCAFDimTolObjects_AngularQualifier GetAngularQualifier() const; + + //! Returns True if the object has angular qualifier. + Standard_EXPORT Standard_Boolean HasAngularQualifier() const; //! Sets a specific type of dimension. Standard_EXPORT void SetType (const XCAFDimTolObjects_DimensionType theTyupe); @@ -302,6 +312,7 @@ private: XCAFDimTolObjects_DimensionType myType; Handle(TColStd_HArray1OfReal) myVal; XCAFDimTolObjects_DimensionQualifier myQualifier; + XCAFDimTolObjects_AngularQualifier myAngularQualifier; Standard_Boolean myIsHole; XCAFDimTolObjects_DimensionFormVariance myFormVariance; XCAFDimTolObjects_DimensionGrade myGrade; diff --git a/src/XCAFDoc/XCAFDoc_Dimension.cxx b/src/XCAFDoc/XCAFDoc_Dimension.cxx index 664b99242f..2f73076a6e 100644 --- a/src/XCAFDoc/XCAFDoc_Dimension.cxx +++ b/src/XCAFDoc/XCAFDoc_Dimension.cxx @@ -38,6 +38,7 @@ enum ChildLab ChildLab_Type = 1, ChildLab_Value, ChildLab_Qualifier, + ChildLab_AngularQualifier, ChildLab_Class, ChildLab_Dec, ChildLab_Modifiers, @@ -121,6 +122,8 @@ void XCAFDoc_Dimension::SetObject (const Handle(XCAFDimTolObjects_DimensionObjec } Handle(TDataStd_Integer) aQualifier = TDataStd_Integer::Set(Label().FindChild(ChildLab_Qualifier), theObject->GetQualifier()); + + Handle(TDataStd_Integer) anAngularQualifier = TDataStd_Integer::Set(Label().FindChild(ChildLab_AngularQualifier), theObject->GetAngularQualifier()); Standard_Boolean aH; XCAFDimTolObjects_DimensionFormVariance aF; @@ -314,6 +317,12 @@ Handle(XCAFDimTolObjects_DimensionObject) XCAFDoc_Dimension::GetObject() const { anObj->SetQualifier((XCAFDimTolObjects_DimensionQualifier)aQualifier->Get()); } + + Handle(TDataStd_Integer) anAngularQualifier; + if (Label().FindChild(ChildLab_AngularQualifier).FindAttribute(TDataStd_Integer::GetID(), anAngularQualifier)) + { + anObj->SetAngularQualifier((XCAFDimTolObjects_AngularQualifier)anAngularQualifier->Get()); + } Handle(TDataStd_IntegerArray) aClass; if(Label().FindChild(ChildLab_Class).FindAttribute(TDataStd_IntegerArray::GetID(), aClass) diff --git a/src/XDEDRAW/XDEDRAW_GDTs.cxx b/src/XDEDRAW/XDEDRAW_GDTs.cxx index 4a55a65400..ccb5cdf64c 100644 --- a/src/XDEDRAW/XDEDRAW_GDTs.cxx +++ b/src/XDEDRAW/XDEDRAW_GDTs.cxx @@ -168,6 +168,8 @@ static Standard_Integer DumpDGTs (Draw_Interpretor& di, Standard_Integer argc, c } if (aDimTolObj->HasQualifier()) di << ", Q " << aDimTolObj->GetQualifier(); + if (aDimTolObj->HasAngularQualifier()) + di << ", AQ " << aDimTolObj->GetAngularQualifier(); if (aDimTolObj->GetType() == XCAFDimTolObjects_DimensionType_Location_Oriented) { gp_Dir aD; diff --git a/tests/gdt/import/A1 b/tests/gdt/import/A1 index 61dc23cb14..41cf870dd5 100644 --- a/tests/gdt/import/A1 +++ b/tests/gdt/import/A1 @@ -79,9 +79,9 @@ set ref_data { 0:1:1:1:22 Shape.23 0:1:4:21 Dimension.23.1 ( N "diameter" T 15, V 20, VL 0.050000000000000003, VU 0.10000000000000001, P 0 ) 0:1:1:1:23 Shape.24 - 0:1:4:22 Dimension.24.1 ( N "angle" T 11, V 60, VL 0.5, VU 0.5, Q 3, P 0 ) + 0:1:4:22 Dimension.24.1 ( N "angle" T 11, V 60, VL 0.5, VU 0.5, AQ 3, P 0 ) 0:1:1:1:24 Shape.25 - 0:1:4:22 Dimension.25.1 ( N "angle" T 11, V 60, VL 0.5, VU 0.5, Q 3, P 0 ) + 0:1:4:22 Dimension.25.1 ( N "angle" T 11, V 60, VL 0.5, VU 0.5, AQ 3, P 0 ) 0:1:1:1:25 Shape.26 0:1:4:23 Dimension.26.1 ( N "diameter" T 15, LB 34.799999999999997, UB 35.200000000000003, P 0 ) 0:1:1:1:26 Shape.27 diff --git a/tests/gdt/import/A4 b/tests/gdt/import/A4 index 8dff90ed4f..d40802f95c 100644 --- a/tests/gdt/import/A4 +++ b/tests/gdt/import/A4 @@ -414,9 +414,9 @@ set ref_data { 0:1:1:2:157 Shape.160 0:1:4:32 Dimension.160.1 ( N "diameter" T 15, V 20, VL 0.29999999999999999, VU 0.29999999999999999, P 0 ) 0:1:1:2:158 Shape.161 - 0:1:4:33 Dimension.161.1 ( N "angle" T 11, V 90, VL 1, VU 1, Q 3, P 0 ) + 0:1:4:33 Dimension.161.1 ( N "angle" T 11, V 90, VL 1, VU 1, AQ 3, P 0 ) 0:1:1:2:159 Shape.162 - 0:1:4:33 Dimension.162.1 ( N "angle" T 11, V 90, VL 1, VU 1, Q 3, P 0 ) + 0:1:4:33 Dimension.162.1 ( N "angle" T 11, V 90, VL 1, VU 1, AQ 3, P 0 ) 0:1:1:3:1 Shape.163 0:1:4:19 GeomTolerance.163.1 ( N "Position surface profile.4" T 12 TV 0, V 0.5 ) 0:1:4:20 Datum.163.1.1 ( N "Position surface profile.4" )