mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-16 10:08:36 +03:00
0029531: Exception on Redo
This commit is contained in:
parent
130eb11405
commit
f46c2b39e6
@ -2802,6 +2802,38 @@ static Standard_Integer OCC29430(Draw_Interpretor& theDI,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#include <STEPCAFControl_Reader.hxx>
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : OCC29531
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
static Standard_Integer OCC29531(Draw_Interpretor&, Standard_Integer, const char** theArgV)
|
||||||
|
{
|
||||||
|
Handle(TDocStd_Application) anApp = DDocStd::GetApplication();
|
||||||
|
Handle(TDocStd_Document) aDoc;
|
||||||
|
anApp->NewDocument("BinOcaf", aDoc);
|
||||||
|
aDoc->SetUndoLimit(1);
|
||||||
|
|
||||||
|
STEPCAFControl_Reader Reader;
|
||||||
|
Reader.ReadFile(theArgV[1]);
|
||||||
|
Reader.Transfer(aDoc);
|
||||||
|
TDF_Label aShL, aDL;
|
||||||
|
TDF_Tool::Label(aDoc->GetData(), "0:1:1:2:672", aShL);
|
||||||
|
TDF_Tool::Label(aDoc->GetData(), "0:1:4:10", aDL);
|
||||||
|
|
||||||
|
aDoc->OpenCommand();
|
||||||
|
|
||||||
|
Handle(XCAFDoc_DimTolTool) aDimTolTool = XCAFDoc_DocumentTool::DimTolTool(aDoc->Main());
|
||||||
|
aDimTolTool->SetDimension(aShL, aDL);
|
||||||
|
|
||||||
|
aDoc->CommitCommand();
|
||||||
|
|
||||||
|
aDoc->Undo();
|
||||||
|
aDoc->Redo();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
void QABugs::Commands_20(Draw_Interpretor& theCommands) {
|
void QABugs::Commands_20(Draw_Interpretor& theCommands) {
|
||||||
const char *group = "QABugs";
|
const char *group = "QABugs";
|
||||||
|
|
||||||
@ -2835,6 +2867,7 @@ void QABugs::Commands_20(Draw_Interpretor& theCommands) {
|
|||||||
theCommands.Add("OCC29430", "OCC29430 <result wire> "
|
theCommands.Add("OCC29430", "OCC29430 <result wire> "
|
||||||
"<result first point> <result last point>",
|
"<result first point> <result last point>",
|
||||||
__FILE__, OCC29430, group);
|
__FILE__, OCC29430, group);
|
||||||
|
theCommands.Add("OCC29531", "OCC29531 <step file name>", __FILE__, OCC29531, group);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -375,42 +375,25 @@ Standard_Boolean TDF_Data::IsApplicable
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
void TDF_Data::FixOrder(const Handle(TDF_Delta)& theDelta)
|
void TDF_Data::FixOrder(const Handle(TDF_Delta)& theDelta)
|
||||||
{
|
{
|
||||||
|
// make all OnRemoval (which will cause addition of the attribute) are in the end
|
||||||
|
// to do not put two attributes with the same GUID at one label during undo/redo
|
||||||
|
TDF_AttributeDeltaList anOrderedList;
|
||||||
|
|
||||||
const TDF_AttributeDeltaList& attList = theDelta->AttributeDeltas();
|
const TDF_AttributeDeltaList& attList = theDelta->AttributeDeltas();
|
||||||
Handle(TDF_AttributeDelta) attDelta;
|
TDF_ListIteratorOfAttributeDeltaList anIt(attList);
|
||||||
Handle(TDF_Attribute) att;
|
for (; anIt.More(); anIt.Next()) { // append not-removal
|
||||||
Standard_Integer i, indx1(0), indx2(0);
|
Handle(TDF_AttributeDelta) attDelta = anIt.Value();
|
||||||
Standard_GUID aGuid;
|
if (!attDelta->IsKind(STANDARD_TYPE(TDF_DeltaOnRemoval))) {
|
||||||
TDF_ListIteratorOfAttributeDeltaList itr(attList) ;
|
anOrderedList.Append(attDelta);
|
||||||
for (i=1; itr.More(); itr.Next(), i++) {
|
|
||||||
attDelta = itr.Value();
|
|
||||||
if(indx1) {
|
|
||||||
att = attDelta->Attribute();
|
|
||||||
if((att->ID() == aGuid) && (attDelta->IsKind(STANDARD_TYPE(TDF_DeltaOnAddition)))) {
|
|
||||||
indx2 = i;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
} else
|
}
|
||||||
|
for (anIt.Initialize(attList); anIt.More(); anIt.Next()) { // append removal
|
||||||
|
Handle(TDF_AttributeDelta) attDelta = anIt.Value();
|
||||||
if (attDelta->IsKind(STANDARD_TYPE(TDF_DeltaOnRemoval))) {
|
if (attDelta->IsKind(STANDARD_TYPE(TDF_DeltaOnRemoval))) {
|
||||||
att = attDelta->Attribute();
|
anOrderedList.Append(attDelta);
|
||||||
aGuid = att->ID();
|
|
||||||
indx1 = i;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(indx1 && indx2) {
|
theDelta->ReplaceDeltaList(anOrderedList);
|
||||||
TDF_Array1OfAttributeIDelta anArray(1, attList.Extent());
|
|
||||||
itr.Initialize(attList);
|
|
||||||
for (i=1; itr.More(); itr.Next(), i++)
|
|
||||||
anArray.SetValue(i, itr.Value());
|
|
||||||
Handle(TDF_AttributeDelta) attDelta1, attDelta2;
|
|
||||||
attDelta1 = anArray.Value(indx1);
|
|
||||||
attDelta2 = anArray.Value(indx2);
|
|
||||||
anArray.SetValue(indx1, attDelta2);
|
|
||||||
anArray.SetValue(indx2, attDelta1);
|
|
||||||
TDF_AttributeDeltaList attList2;
|
|
||||||
for(i=1; i<= anArray.Upper(); i++)
|
|
||||||
attList2.Append(anArray.Value(i));
|
|
||||||
theDelta->ReplaceDeltaList(attList2);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : Undo
|
//function : Undo
|
||||||
|
@ -147,7 +147,8 @@ protected:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
//! Fixes order of Attributes' Deltas
|
//! Fixes order of Attributes' Deltas to perform undo/redo without exceptions:
|
||||||
|
//! puts OnRemoval deltas to the end of the list.
|
||||||
void FixOrder(const Handle(TDF_Delta)& theDelta);
|
void FixOrder(const Handle(TDF_Delta)& theDelta);
|
||||||
|
|
||||||
//! Increments the transaction number and returns it.
|
//! Increments the transaction number and returns it.
|
||||||
|
7
tests/bugs/caf/bug29531
Normal file
7
tests/bugs/caf/bug29531
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
puts "==========="
|
||||||
|
puts "OCC29531"
|
||||||
|
puts "==========="
|
||||||
|
|
||||||
|
pload QAcommands
|
||||||
|
|
||||||
|
OCC29531 [locate_data_file bug29531_nist_ctc_02_asme1_ap242-2.stp]
|
Loading…
x
Reference in New Issue
Block a user