mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-10 18:51:21 +03:00
Revert "0026314: Method SetShape working not correctly."
This reverts commit e2df45413ea1d506d911c6f29dacf42c80ca8a35.
This commit is contained in:
parent
43da5ab603
commit
9baa853415
@ -402,32 +402,26 @@ TDF_Label XCAFDoc_ShapeTool::NewShape() const
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
void XCAFDoc_ShapeTool::SetShape (const TDF_Label& L, const TopoDS_Shape& S)
|
void XCAFDoc_ShapeTool::SetShape (const TDF_Label& L, const TopoDS_Shape& S)
|
||||||
{
|
{
|
||||||
if(IsReference(L) || !IsTopLevel(L) || /*IsAssembly(L) ||*/ !S.Location().IsIdentity())
|
|
||||||
return;
|
|
||||||
|
|
||||||
TDF_LabelSequence aSubShapes;
|
|
||||||
GetSubShapes(L, aSubShapes);
|
|
||||||
|
|
||||||
TNaming_Builder tnBuild(L);
|
TNaming_Builder tnBuild(L);
|
||||||
tnBuild.Generated(S);
|
tnBuild.Generated(S);
|
||||||
Handle(XCAFDoc_ShapeMapTool) A = XCAFDoc_ShapeMapTool::Set(L);
|
Handle(XCAFDoc_ShapeMapTool) A = XCAFDoc_ShapeMapTool::Set(L);
|
||||||
|
// if ( ! L.FindAttribute(XCAFDoc_ShapeMapTool::GetID(), A) ) {
|
||||||
|
// A = XCAFDoc_ShapeMapTool::Set(L);
|
||||||
|
// L.AddAttribute(A);
|
||||||
|
// }
|
||||||
A->SetShape(S);
|
A->SetShape(S);
|
||||||
|
|
||||||
for(Standard_Integer i = 1; i<=aSubShapes.Length(); i++)
|
|
||||||
{
|
|
||||||
TDF_Label aSubLabel = aSubShapes(i);
|
|
||||||
if (!IsSubShape(L, GetShape(aSubLabel)))
|
|
||||||
{
|
|
||||||
aSubLabel.ForgetAllAttributes();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!myShapeLabels.IsBound(S)) {
|
if(!myShapeLabels.IsBound(S)) {
|
||||||
myShapeLabels.Bind(S,L);
|
myShapeLabels.Bind(S,L);
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdateAssociatedAssembly(L);
|
//:abv 31.10.01: update assemblies that refer a shape
|
||||||
|
TDF_LabelSequence Labels;
|
||||||
|
if ( GetUsers ( L, Labels, Standard_True ) ) {
|
||||||
|
for ( Standard_Integer i=Labels.Length(); i >=1; i-- )
|
||||||
|
UpdateAssembly ( Labels(i) );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@ -998,26 +992,6 @@ void XCAFDoc_ShapeTool::RemoveComponent (const TDF_Label& comp) const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : UpdateAssociatedAssembly
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void XCAFDoc_ShapeTool::UpdateAssociatedAssembly (const TDF_Label& L) const
|
|
||||||
{
|
|
||||||
TDF_LabelSequence Labels;
|
|
||||||
if ( GetUsers ( L, Labels ) ) {
|
|
||||||
for ( Standard_Integer i=Labels.Length(); i >=1; i-- )
|
|
||||||
{
|
|
||||||
TDF_Label anAssemblyLabel = Labels(i).Father();
|
|
||||||
if(!anAssemblyLabel.IsNull())
|
|
||||||
{
|
|
||||||
UpdateAssembly(anAssemblyLabel);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : UpdateAssembly
|
//function : UpdateAssembly
|
||||||
//purpose :
|
//purpose :
|
||||||
@ -1027,38 +1001,19 @@ void XCAFDoc_ShapeTool::UpdateAssembly (const TDF_Label& L) const
|
|||||||
{
|
{
|
||||||
if ( ! IsAssembly(L) ) return;
|
if ( ! IsAssembly(L) ) return;
|
||||||
|
|
||||||
|
TopoDS_Compound newassembly;
|
||||||
BRep_Builder b;
|
BRep_Builder b;
|
||||||
TopoDS_Shape aShape = GetShape(L);
|
b.MakeCompound(newassembly);
|
||||||
Standard_Boolean isFree = aShape.Free();
|
|
||||||
if (!isFree)
|
|
||||||
aShape.Free(Standard_True);
|
|
||||||
|
|
||||||
TopTools_SequenceOfShape aSubShapeSeq;
|
|
||||||
TopoDS_Iterator Iterator(aShape);
|
|
||||||
for (; Iterator.More(); Iterator.Next())
|
|
||||||
aSubShapeSeq.Append(Iterator.Value());
|
|
||||||
|
|
||||||
for (Standard_Integer i = 1; i <= aSubShapeSeq.Length(); i++)
|
|
||||||
b.Remove(aShape, aSubShapeSeq.Value(i));
|
|
||||||
|
|
||||||
TDF_ChildIterator chldLabIt(L);
|
TDF_ChildIterator chldLabIt(L);
|
||||||
for (; chldLabIt.More(); chldLabIt.Next() ) {
|
for (; chldLabIt.More(); chldLabIt.Next() ) {
|
||||||
TDF_Label subLabel = chldLabIt.Value();
|
TDF_Label subLabel = chldLabIt.Value();
|
||||||
if ( IsComponent ( subLabel ) ) {
|
if ( IsComponent ( subLabel ) ) {
|
||||||
b.Add(aShape, GetShape(subLabel));
|
b.Add(newassembly, GetShape(subLabel));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isFree)
|
|
||||||
aShape.Free(Standard_False);
|
|
||||||
|
|
||||||
TNaming_Builder tnBuild(L);
|
TNaming_Builder tnBuild(L);
|
||||||
tnBuild.Generated(aShape);
|
tnBuild.Generated(newassembly);
|
||||||
|
|
||||||
Handle(XCAFDoc_ShapeMapTool) A = XCAFDoc_ShapeMapTool::Set(L);
|
|
||||||
A->SetShape(aShape);
|
|
||||||
|
|
||||||
UpdateAssociatedAssembly(L);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@ -1951,4 +1906,4 @@ void XCAFDoc_ShapeTool::makeSubShape (const TDF_Label& Part, const TopoDS_Shape&
|
|||||||
}
|
}
|
||||||
makeSubShape(Part, aChildShape);
|
makeSubShape(Part, aChildShape);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -203,11 +203,6 @@ public:
|
|||||||
Standard_EXPORT TDF_Label NewShape() const;
|
Standard_EXPORT TDF_Label NewShape() const;
|
||||||
|
|
||||||
//! Sets representation (TopoDS_Shape) for top-level shape.
|
//! Sets representation (TopoDS_Shape) for top-level shape.
|
||||||
//! If S has location(location.IsIdentity() is false),
|
|
||||||
//! command will be skipped. Sub-shapes of S which is
|
|
||||||
//! subshape of old shape, will be stored ( all atributes will be stored).
|
|
||||||
//! If a sub-label of L is not a sub-shape of the new shape,
|
|
||||||
//! it will be removed.
|
|
||||||
Standard_EXPORT void SetShape (const TDF_Label& L, const TopoDS_Shape& S);
|
Standard_EXPORT void SetShape (const TDF_Label& L, const TopoDS_Shape& S);
|
||||||
|
|
||||||
//! Adds a new top-level (creates and returns a new label)
|
//! Adds a new top-level (creates and returns a new label)
|
||||||
@ -291,9 +286,6 @@ public:
|
|||||||
//! Removes a component from its assembly
|
//! Removes a component from its assembly
|
||||||
Standard_EXPORT void RemoveComponent (const TDF_Label& comp) const;
|
Standard_EXPORT void RemoveComponent (const TDF_Label& comp) const;
|
||||||
|
|
||||||
//! Update labels associated with Label <L>
|
|
||||||
Standard_EXPORT void UpdateAssociatedAssembly (const TDF_Label& L) const;
|
|
||||||
|
|
||||||
//! Update an assembly at label <L>
|
//! Update an assembly at label <L>
|
||||||
Standard_EXPORT void UpdateAssembly (const TDF_Label& L) const;
|
Standard_EXPORT void UpdateAssembly (const TDF_Label& L) const;
|
||||||
|
|
||||||
|
@ -102,8 +102,7 @@ static Standard_Integer setShape (Draw_Interpretor& di, Standard_Integer argc, c
|
|||||||
// XCAFDoc_ShapeTool myAssembly;
|
// XCAFDoc_ShapeTool myAssembly;
|
||||||
// myAssembly.Init(Doc);
|
// myAssembly.Init(Doc);
|
||||||
Handle(XCAFDoc_ShapeTool) myAssembly = XCAFDoc_DocumentTool::ShapeTool(Doc->Main());
|
Handle(XCAFDoc_ShapeTool) myAssembly = XCAFDoc_DocumentTool::ShapeTool(Doc->Main());
|
||||||
if( !myAssembly->IsAssembly(aLabel))
|
myAssembly->SetShape(aLabel, aShape);
|
||||||
myAssembly->SetShape(aLabel, aShape);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ puts ""
|
|||||||
#######################################################################
|
#######################################################################
|
||||||
|
|
||||||
set BugNumber OCC22962
|
set BugNumber OCC22962
|
||||||
set check_value 96
|
set check_value 94
|
||||||
pload DCAF
|
pload DCAF
|
||||||
|
|
||||||
ReadStep D1 [locate_data_file OCC22962-dm1-oc-214.stp]
|
ReadStep D1 [locate_data_file OCC22962-dm1-oc-214.stp]
|
||||||
|
@ -1,22 +0,0 @@
|
|||||||
puts "========"
|
|
||||||
puts "OCC25441"
|
|
||||||
puts "========"
|
|
||||||
puts ""
|
|
||||||
###########################################################################
|
|
||||||
# XCAFDoc_ShapeTool::UpdateAssembly() does not update the back-references
|
|
||||||
###########################################################################
|
|
||||||
|
|
||||||
pload OCAFKERNEL
|
|
||||||
|
|
||||||
box b 0 0 0 1 1 1
|
|
||||||
psphere b1 10
|
|
||||||
NewDocument d
|
|
||||||
compound b c
|
|
||||||
compound c c1
|
|
||||||
XAddShape d c1 1
|
|
||||||
XShow d
|
|
||||||
XSetShape d 0:1:1:3 b1
|
|
||||||
XShow d
|
|
||||||
vfit
|
|
||||||
|
|
||||||
checkview -screenshot -3d -path ${imagedir}/${test_image}.png
|
|
@ -1,23 +0,0 @@
|
|||||||
puts "========"
|
|
||||||
puts "OCC26314"
|
|
||||||
puts "========"
|
|
||||||
puts ""
|
|
||||||
############################################################
|
|
||||||
# Method XCAFDoc_ShapeTool::SetShape() works not correctly
|
|
||||||
############################################################
|
|
||||||
|
|
||||||
pload OCAFKERNEL
|
|
||||||
|
|
||||||
box b 0 0 0 1 1 1
|
|
||||||
box b1 -10 -10 -10 10 10 10
|
|
||||||
box b2 1 1 1 10 10 10
|
|
||||||
NewDocument d
|
|
||||||
compound b1 c1
|
|
||||||
XAddShape d b 1
|
|
||||||
XAddShape d c1 1
|
|
||||||
XShow d
|
|
||||||
XSetShape d 0:1:1:3 b2
|
|
||||||
XShow d
|
|
||||||
vfit
|
|
||||||
|
|
||||||
checkview -screenshot -3d -path ${imagedir}/${test_image}.png
|
|
Loading…
x
Reference in New Issue
Block a user