1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-03 17:56:21 +03:00

0032096: Data Exchange - Extension for XCAFDimTolObjects_DimensionQualifier

Added XCAFDimTolObjects_AngularQualifier for angles. And added field and methods for dimensions.
This commit is contained in:
ichesnok 2021-10-28 11:22:12 +03:00 committed by inv
parent e77bcb6b57
commit 62874fa199
10 changed files with 96 additions and 16 deletions

View File

@ -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)

View File

@ -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;
}

View File

@ -28,5 +28,6 @@ XCAFDimTolObjects_DimensionObjectSequence.hxx
XCAFDimTolObjects_GeomToleranceObjectSequence.hxx
XCAFDimTolObjects_DataMapOfToleranceDatum.hxx
XCAFDimTolObjects_ToleranceZoneAffectedPlane.hxx
XCAFDimTolObjects_AngularQualifier.hxx

View File

@ -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

View File

@ -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 :

View File

@ -40,6 +40,7 @@
#include <TCollection_HAsciiString.hxx>
#include <NCollection_Vector.hxx>
#include <TColStd_HArray1OfExtendedString.hxx>
#include <XCAFDimTolObjects_AngularQualifier.hxx>
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;

View File

@ -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)

View File

@ -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;

View File

@ -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

View File

@ -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" )