mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-21 10:13:43 +03:00
0029854: XCAF GD&T: Clear contents of reserved labels only
Clear attributes from reserved child labels only
This commit is contained in:
parent
34c407eb34
commit
e01ce0cd52
@ -33,7 +33,8 @@ IMPLEMENT_STANDARD_RTTIEXT(XCAFDoc_Datum,TDF_Attribute)
|
|||||||
|
|
||||||
enum ChildLab
|
enum ChildLab
|
||||||
{
|
{
|
||||||
ChildLab_Name = 1,
|
ChildLab_Begin = 1,
|
||||||
|
ChildLab_Name = ChildLab_Begin,
|
||||||
ChildLab_Position,
|
ChildLab_Position,
|
||||||
ChildLab_Modifiers,
|
ChildLab_Modifiers,
|
||||||
ChildLab_ModifierWithValue,
|
ChildLab_ModifierWithValue,
|
||||||
@ -51,7 +52,8 @@ enum ChildLab
|
|||||||
ChildLab_PlaneRef,
|
ChildLab_PlaneRef,
|
||||||
ChildLab_Pnt,
|
ChildLab_Pnt,
|
||||||
ChildLab_PntText,
|
ChildLab_PntText,
|
||||||
ChildLab_Presentation
|
ChildLab_Presentation,
|
||||||
|
ChildLab_End
|
||||||
};
|
};
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@ -176,10 +178,9 @@ void XCAFDoc_Datum::SetObject(const Handle(XCAFDimTolObjects_DatumObject)& theOb
|
|||||||
TDataStd_Name::Set(Label(), str);
|
TDataStd_Name::Set(Label(), str);
|
||||||
}
|
}
|
||||||
|
|
||||||
TDF_ChildIterator anIter(Label());
|
for (int aChild = ChildLab_Begin; aChild < ChildLab_End; aChild++)
|
||||||
for(;anIter.More(); anIter.Next())
|
|
||||||
{
|
{
|
||||||
anIter.Value().ForgetAllAttributes();
|
Label().FindChild(aChild).ForgetAllAttributes();
|
||||||
}
|
}
|
||||||
if (!theObject->GetName().IsNull() && !theObject->GetName()->IsEmpty())
|
if (!theObject->GetName().IsNull() && !theObject->GetName()->IsEmpty())
|
||||||
Handle(TDataStd_AsciiString) anAttName = TDataStd_AsciiString::Set(Label().FindChild(ChildLab_Name),
|
Handle(TDataStd_AsciiString) anAttName = TDataStd_AsciiString::Set(Label().FindChild(ChildLab_Name),
|
||||||
|
@ -33,7 +33,8 @@
|
|||||||
IMPLEMENT_DERIVED_ATTRIBUTE(XCAFDoc_Dimension,TDataStd_GenericEmpty)
|
IMPLEMENT_DERIVED_ATTRIBUTE(XCAFDoc_Dimension,TDataStd_GenericEmpty)
|
||||||
enum ChildLab
|
enum ChildLab
|
||||||
{
|
{
|
||||||
ChildLab_Type = 1,
|
ChildLab_Begin = 1,
|
||||||
|
ChildLab_Type = ChildLab_Begin,
|
||||||
ChildLab_Value,
|
ChildLab_Value,
|
||||||
ChildLab_Qualifier,
|
ChildLab_Qualifier,
|
||||||
ChildLab_AngularQualifier,
|
ChildLab_AngularQualifier,
|
||||||
@ -50,7 +51,8 @@ enum ChildLab
|
|||||||
ChildLab_PntText,
|
ChildLab_PntText,
|
||||||
ChildLab_Presentation,
|
ChildLab_Presentation,
|
||||||
ChildLab_Descriptions,
|
ChildLab_Descriptions,
|
||||||
ChildLab_DescriptionNames
|
ChildLab_DescriptionNames,
|
||||||
|
ChildLab_End
|
||||||
};
|
};
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@ -104,10 +106,9 @@ void XCAFDoc_Dimension::SetObject (const Handle(XCAFDimTolObjects_DimensionObjec
|
|||||||
TDataStd_Name::Set(Label(), str);
|
TDataStd_Name::Set(Label(), str);
|
||||||
}
|
}
|
||||||
|
|
||||||
TDF_ChildIterator anIter(Label());
|
for (int aChild = ChildLab_Begin; aChild < ChildLab_End; aChild++)
|
||||||
for(;anIter.More(); anIter.Next())
|
|
||||||
{
|
{
|
||||||
anIter.Value().ForgetAllAttributes();
|
Label().FindChild(aChild).ForgetAllAttributes();
|
||||||
}
|
}
|
||||||
Handle(TDataStd_Integer) aType = TDataStd_Integer::Set(Label().FindChild(ChildLab_Type), theObject->GetType());
|
Handle(TDataStd_Integer) aType = TDataStd_Integer::Set(Label().FindChild(ChildLab_Type), theObject->GetType());
|
||||||
|
|
||||||
|
@ -32,7 +32,8 @@ IMPLEMENT_DERIVED_ATTRIBUTE(XCAFDoc_GeomTolerance,TDataStd_GenericEmpty)
|
|||||||
|
|
||||||
enum ChildLab
|
enum ChildLab
|
||||||
{
|
{
|
||||||
ChildLab_Type = 1,
|
ChildLab_Begin = 1,
|
||||||
|
ChildLab_Type = ChildLab_Begin,
|
||||||
ChildLab_TypeOfValue,
|
ChildLab_TypeOfValue,
|
||||||
ChildLab_Value,
|
ChildLab_Value,
|
||||||
ChildLab_MatReqModif,
|
ChildLab_MatReqModif,
|
||||||
@ -49,7 +50,8 @@ enum ChildLab
|
|||||||
ChildLab_Pnt,
|
ChildLab_Pnt,
|
||||||
ChildLab_PntText,
|
ChildLab_PntText,
|
||||||
ChildLab_Presentation,
|
ChildLab_Presentation,
|
||||||
ChildLab_AffectedPlane
|
ChildLab_AffectedPlane,
|
||||||
|
ChildLab_End
|
||||||
};
|
};
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@ -105,10 +107,9 @@ void XCAFDoc_GeomTolerance::SetObject (const Handle(XCAFDimTolObjects_GeomTolera
|
|||||||
TDataStd_Name::Set(Label(), str);
|
TDataStd_Name::Set(Label(), str);
|
||||||
}
|
}
|
||||||
|
|
||||||
TDF_ChildIterator anIter(Label());
|
for (int aChild = ChildLab_Begin; aChild < ChildLab_End; aChild++)
|
||||||
for(;anIter.More(); anIter.Next())
|
|
||||||
{
|
{
|
||||||
anIter.Value().ForgetAllAttributes();
|
Label().FindChild(aChild).ForgetAllAttributes();
|
||||||
}
|
}
|
||||||
|
|
||||||
Handle(TDataStd_Integer) aType = TDataStd_Integer::Set(Label().FindChild(ChildLab_Type), theObject->GetType());
|
Handle(TDataStd_Integer) aType = TDataStd_Integer::Set(Label().FindChild(ChildLab_Type), theObject->GetType());
|
||||||
|
74
tests/bugs/xde/bug29854
Normal file
74
tests/bugs/xde/bug29854
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
puts "============"
|
||||||
|
puts "0029854: XCAF GD&T: Clear contents of reserved labels only"
|
||||||
|
puts "============"
|
||||||
|
puts ""
|
||||||
|
|
||||||
|
pload DCAF
|
||||||
|
|
||||||
|
box b 10 10 10
|
||||||
|
|
||||||
|
# create document with object
|
||||||
|
NewDocument D
|
||||||
|
set L [XAddShape D b]
|
||||||
|
|
||||||
|
# create datum with reserved children
|
||||||
|
set datumL [XAddDatum D $L]
|
||||||
|
set aTagNumber 20
|
||||||
|
for {set i 1} {${i}<${aTagNumber}} {incr i} {
|
||||||
|
NewChild D $datumL
|
||||||
|
}
|
||||||
|
|
||||||
|
set val 100
|
||||||
|
|
||||||
|
# add datum child with attribute
|
||||||
|
set childL [NewChild D $datumL]
|
||||||
|
SetInteger D $childL $val
|
||||||
|
|
||||||
|
# call setObject func
|
||||||
|
XSetDatumPosition D $datumL 2
|
||||||
|
|
||||||
|
# check that the new child attribute exists and correct
|
||||||
|
set currVal [GetInteger D $childL]
|
||||||
|
if { ${val} != ${currVal} } {
|
||||||
|
puts "Error: TDataStd_Integer attribute value is not expected for datum child"
|
||||||
|
}
|
||||||
|
|
||||||
|
# create tolerance with reserved children
|
||||||
|
set TL [XAddGeomTolerance D $L]
|
||||||
|
set aTagNumber 19
|
||||||
|
for {set i 1} {${i}<${aTagNumber}} {incr i} {
|
||||||
|
NewChild D $TL
|
||||||
|
}
|
||||||
|
|
||||||
|
# add tolerance child with attribute
|
||||||
|
set childL [NewChild D $TL]
|
||||||
|
SetInteger D $childL $val
|
||||||
|
|
||||||
|
# call setObject func
|
||||||
|
XSetToleranceValue D $L 0.5
|
||||||
|
|
||||||
|
# check that the new child attribute exists and correct
|
||||||
|
set currVal [GetInteger D $childL]
|
||||||
|
if { ${val} != ${currVal} } {
|
||||||
|
puts "Error: TDataStd_Integer attribute value is not expected for tolerance child"
|
||||||
|
}
|
||||||
|
|
||||||
|
# create dimension with reserved children
|
||||||
|
set DL [XAddDimension D $L]
|
||||||
|
set aTagNumber 19
|
||||||
|
for {set i 1} {${i}<${aTagNumber}} {incr i} {
|
||||||
|
NewChild D $DL
|
||||||
|
}
|
||||||
|
|
||||||
|
# add dimension child with attribute
|
||||||
|
set childL [NewChild D $DL]
|
||||||
|
SetInteger D $childL $val
|
||||||
|
|
||||||
|
# call setObject func
|
||||||
|
XSetDimensionValue D $L 0.5
|
||||||
|
|
||||||
|
# check that the new child attribute exists and correct
|
||||||
|
set currVal [GetInteger D $childL]
|
||||||
|
if { ${val} != ${currVal} } {
|
||||||
|
puts "Error: TDataStd_Integer attribute value is not expected for dimension child"
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user