MantisBT
Mantis Bug Tracker Workflow

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0029699Open CASCADE[OCCT] OCCT:Application Frameworkpublic2018-04-17 12:442018-04-23 10:26
Reporterssv 
Assigned Tompv 
PrioritynormalSeverityminor 
StatusacknowledgedResolutionopen 
PlatformWindowsOSVC++ 2013OS Version64 bit
Product Version 
Target Version[OCCT] 7.4.0*Fixed in Version 
Summary0029699: OCAF ignores orientation of shape in TNaming
DescriptionThe programmatic scenario is given in "Steps To Reproduce" section. Here is the overview:

Imagine you store a FORWARD face in OCAF using TNaming_Builder. Then imagine you reverse this face and store it again in the same attribute. Here is a bug: OCAF ignores the attempt to store the REVERSED face and keeps storing the FORWARD one.

I can imagine that TNaming_Builder::Generated() is not probably the best way to set shapes in OCAF (is there an alternative?). On the other hand, this problem is not reproduced for shapes with different TShape pointers (that is probably why we do not have this bug in parametric modelers).
Steps To Reproduce// Take any label, where doc is TDocStd_Document.
TDF_Label aDataLab = doc->Main();

// Create just any face.
TopoDS_Shape
  face = BRepBuilderAPI_MakeFace( gp_Pln( gp::Origin(), gp::DZ() ) );

// Orientation is FORWARD initially.
std::cout << "Expected orientation: "
          << ( (face.Orientation() == TopAbs_FORWARD) ? "forward" : "reversed" ) << std::endl;

// Set shape.
doc->NewCommand();
{
  TNaming_Builder aNBuilder(aDataLab);
  aNBuilder.Generated(face);
}
doc->CommitCommand();

// Get shape to check its orientation.
Handle(TNaming_NamedShape) aShapeAttr;
aDataLab.FindAttribute(TNaming_NamedShape::GetID(), aShapeAttr);
face = aShapeAttr->Get();

// Orientation is forward (OK).
std::cout << "Orientation in OCAF: "
          << ( (face.Orientation() == TopAbs_FORWARD) ? "forward" : "reversed" ) << std::endl;

// Reverse shape before storing.
face.Reverse();

// Orientation is now REVERSED.
std::cout << "Expected orientation: "
          << ( (face.Orientation() == TopAbs_FORWARD) ? "forward" : "reversed" ) << std::endl;

// Set reversed shape.
doc->NewCommand();
{
  TNaming_Builder aNBuilder(aDataLab);
  aNBuilder.Generated(face);
}
doc->CommitCommand();

// Get shape to check orientation.
aDataLab.FindAttribute(TNaming_NamedShape::GetID(), aShapeAttr);
face = aShapeAttr->Get();

// BUG: Orientation is still forward, while it should be reversed (NOK).
std::cout << "Orientation in OCAF: "
          << ( (face.Orientation() == TopAbs_FORWARD) ? "forward" : "reversed" ) << std::endl;
TagsNo tags attached.
Test case number
Attached Files

- Relationships

-  Notes
(0075594)
mpv (developer)
2018-04-23 10:26

This is known and norma behavior of the NamedShapeAttribute, since it keep all the shapes in the UsedShapes attribute, which contains the not-oriented shapes of map.
Ther naming mechanism never works with orientation of shapes and trying to make this map oriented map of shapes will casue huge number of regressions in the naming and in application that uses it.

So, I may only propose to use additional flag (or integer if FORWARD/REVERSED is not enough) attribute to keep the orientation of the shape, or create a new attribute, which will have no relation to the topological naming.

- Issue History
Date Modified Username Field Change
2018-04-17 12:44 ssv New Issue
2018-04-17 12:44 ssv Assigned To => mpv
2018-04-23 10:26 mpv Note Added: 0075594
2018-04-23 10:26 mpv Status new => acknowledged


Copyright © 2000 - 2018 MantisBT Team
Powered by Mantis Bugtracker