mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-03 17:56:21 +03:00
0033484: Data Exchange, Step Import - Pretessellated geometry is translated incompletely
Added proper translation for TessellatedCurveSet and ComplexTriangulatedSurfaceSet.
This commit is contained in:
parent
06f2625c35
commit
2b5ee7c791
@ -27,6 +27,7 @@
|
||||
#include <Standard_Real.hxx>
|
||||
#include <TColStd_HArray1OfInteger.hxx>
|
||||
#include <TColStd_HArray2OfInteger.hxx>
|
||||
#include <TColStd_HArray1OfTransient.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : RWStepVisual_RWComplexTriangulatedSurfaceSet
|
||||
@ -106,15 +107,16 @@ void RWStepVisual_RWComplexTriangulatedSurfaceSet::ReadStep(
|
||||
}
|
||||
}
|
||||
|
||||
Handle(TColStd_HArray2OfInteger) aTriangleStrips;
|
||||
Handle(TColStd_HArray1OfTransient) aTriangleStrips;
|
||||
Standard_Integer sub6 = 0;
|
||||
if (theData->ReadSubList(theNum, 6, "triangle_strips", theCheck, sub6))
|
||||
{
|
||||
Standard_Integer nb0 = theData->NbParams(sub6);
|
||||
Standard_Integer nbj0 = theData->NbParams(theData->ParamNumber(sub6,1));
|
||||
aTriangleStrips = new TColStd_HArray2OfInteger(1, nb0, 1, nbj0);
|
||||
aTriangleStrips = new TColStd_HArray1OfTransient(1, nb0);
|
||||
for (Standard_Integer i0 = 1; i0 <= nb0; i0++)
|
||||
{
|
||||
Standard_Integer nbj0 = theData->NbParams(theData->ParamNumber(sub6, i0));
|
||||
Handle(TColStd_HArray1OfInteger) aSingleTriangleStrip = new TColStd_HArray1OfInteger(1, nbj0);
|
||||
Standard_Integer subj6 = 0;
|
||||
if ( theData->ReadSubList (sub6, i0, "sub-part(triangle_strips)", theCheck, subj6) ) {
|
||||
Standard_Integer num4 = subj6;
|
||||
@ -122,21 +124,23 @@ void RWStepVisual_RWComplexTriangulatedSurfaceSet::ReadStep(
|
||||
{
|
||||
Standard_Integer anIt0;
|
||||
theData->ReadInteger(num4, j0, "integer", theCheck, anIt0);
|
||||
aTriangleStrips->SetValue(i0,j0, anIt0);
|
||||
aSingleTriangleStrip->SetValue(j0, anIt0);
|
||||
}
|
||||
aTriangleStrips->SetValue(i0, aSingleTriangleStrip);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Handle(TColStd_HArray2OfInteger) aTriangleFans;
|
||||
Handle(TColStd_HArray1OfTransient) aTriangleFans;
|
||||
Standard_Integer sub7 = 0;
|
||||
if (theData->ReadSubList(theNum, 7, "triangle_fans", theCheck, sub7))
|
||||
{
|
||||
Standard_Integer nb0 = theData->NbParams(sub7);
|
||||
Standard_Integer nbj0 = theData->NbParams(theData->ParamNumber(sub7,1));
|
||||
aTriangleFans = new TColStd_HArray2OfInteger(1, nb0, 1, nbj0);
|
||||
aTriangleFans = new TColStd_HArray1OfTransient(1, nb0);
|
||||
for (Standard_Integer i0 = 1; i0 <= nb0; i0++)
|
||||
{
|
||||
Standard_Integer nbj0 = theData->NbParams(theData->ParamNumber(sub7, i0));
|
||||
Handle(TColStd_HArray1OfInteger) aSingleTriangleFan = new TColStd_HArray1OfInteger(1, nbj0);
|
||||
Standard_Integer subj7 = 0;
|
||||
if ( theData->ReadSubList (sub7, i0, "sub-part(triangle_fans)", theCheck, subj7) ) {
|
||||
Standard_Integer num4 = subj7;
|
||||
@ -144,8 +148,9 @@ void RWStepVisual_RWComplexTriangulatedSurfaceSet::ReadStep(
|
||||
{
|
||||
Standard_Integer anIt0;
|
||||
theData->ReadInteger(num4, j0, "integer", theCheck, anIt0);
|
||||
aTriangleFans->SetValue(i0,j0, anIt0);
|
||||
aSingleTriangleFan->SetValue(j0, anIt0);
|
||||
}
|
||||
aTriangleFans->SetValue(i0, aSingleTriangleFan);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -199,13 +204,14 @@ void RWStepVisual_RWComplexTriangulatedSurfaceSet::WriteStep(
|
||||
theSW.CloseSub();
|
||||
|
||||
theSW.OpenSub();
|
||||
for (Standard_Integer i5 = 1; i5 <= theEnt->TriangleStrips()->RowLength(); i5++)
|
||||
for (Standard_Integer i5 = 1; i5 <= theEnt->NbTriangleStrips(); i5++)
|
||||
{
|
||||
theSW.NewLine(Standard_False);
|
||||
theSW.OpenSub();
|
||||
for (Standard_Integer j5 = 1; j5 <= theEnt->TriangleStrips()->ColLength(); j5++)
|
||||
Handle(TColStd_HArray1OfInteger) aTriangleStrip = Handle(TColStd_HArray1OfInteger)::DownCast(theEnt->TriangleStrips()->Value(i5));
|
||||
for (Standard_Integer j5 = 1; j5 <= aTriangleStrip->Length(); j5++)
|
||||
{
|
||||
Standard_Integer Var0 = theEnt->TriangleStrips()->Value(i5,j5);
|
||||
Standard_Integer Var0 = aTriangleStrip->Value(j5);
|
||||
theSW.Send(Var0);
|
||||
}
|
||||
theSW.CloseSub();
|
||||
@ -213,13 +219,14 @@ void RWStepVisual_RWComplexTriangulatedSurfaceSet::WriteStep(
|
||||
theSW.CloseSub();
|
||||
|
||||
theSW.OpenSub();
|
||||
for (Standard_Integer i6 = 1; i6 <= theEnt->TriangleFans()->RowLength(); i6++)
|
||||
for (Standard_Integer i6 = 1; i6 <= theEnt->NbTriangleFans(); i6++)
|
||||
{
|
||||
theSW.NewLine(Standard_False);
|
||||
theSW.OpenSub();
|
||||
for (Standard_Integer j6 = 1; j6 <= theEnt->TriangleFans()->ColLength(); j6++)
|
||||
Handle(TColStd_HArray1OfInteger) aTriangleFan = Handle(TColStd_HArray1OfInteger)::DownCast(theEnt->TriangleFans()->Value(i6));
|
||||
for (Standard_Integer j6 = 1; j6 <= aTriangleFan->Length(); j6++)
|
||||
{
|
||||
Standard_Integer Var0 = theEnt->TriangleFans()->Value(i6,j6);
|
||||
Standard_Integer Var0 = aTriangleFan->Value(j6);
|
||||
theSW.Send(Var0);
|
||||
}
|
||||
theSW.CloseSub();
|
||||
|
@ -1309,6 +1309,7 @@ Handle(TCollection_HAsciiString) STEPCAFControl_GDTProperty::GetTolValueType(con
|
||||
//=======================================================================
|
||||
Handle(StepVisual_TessellatedGeometricSet) STEPCAFControl_GDTProperty::GetTessellation(const TopoDS_Shape& theShape)
|
||||
{
|
||||
Handle(StepVisual_TessellatedGeometricSet) aGeomSet;
|
||||
// Build coordinate list and curves
|
||||
NCollection_Handle<StepVisual_VectorOfHSequenceOfInteger> aCurves = new StepVisual_VectorOfHSequenceOfInteger;
|
||||
NCollection_Vector<gp_XYZ> aCoords;
|
||||
@ -1342,6 +1343,11 @@ Handle(StepVisual_TessellatedGeometricSet) STEPCAFControl_GDTProperty::GetTessel
|
||||
aCurves->Append(aCurve);
|
||||
}
|
||||
|
||||
if (!aCoords.Length())
|
||||
{
|
||||
return aGeomSet;
|
||||
}
|
||||
|
||||
Handle(TColgp_HArray1OfXYZ) aPoints = new TColgp_HArray1OfXYZ(1, aCoords.Length());
|
||||
for (Standard_Integer i = 1; i <= aPoints->Length(); i++) {
|
||||
aPoints->SetValue(i, aCoords.Value(i - 1));
|
||||
@ -1353,7 +1359,7 @@ Handle(StepVisual_TessellatedGeometricSet) STEPCAFControl_GDTProperty::GetTessel
|
||||
aCurveSet->Init(new TCollection_HAsciiString(), aCoordList, aCurves);
|
||||
NCollection_Handle<StepVisual_Array1OfTessellatedItem> aTessItems = new StepVisual_Array1OfTessellatedItem(1, 1);
|
||||
aTessItems->SetValue(1, aCurveSet);
|
||||
Handle(StepVisual_TessellatedGeometricSet) aGeomSet = new StepVisual_TessellatedGeometricSet();
|
||||
aGeomSet = new StepVisual_TessellatedGeometricSet();
|
||||
aGeomSet->Init(new TCollection_HAsciiString(), aTessItems);
|
||||
return aGeomSet;
|
||||
}
|
||||
|
@ -219,6 +219,7 @@
|
||||
#include <StepVisual_TessellatedAnnotationOccurrence.hxx>
|
||||
#include <StepVisual_TessellatedGeometricSet.hxx>
|
||||
#include <StepVisual_TessellatedCurveSet.hxx>
|
||||
#include <StepVisual_ComplexTriangulatedSurfaceSet.hxx>
|
||||
#include <StepVisual_CoordinatesList.hxx>
|
||||
#include <NCollection_Vector.hxx>
|
||||
#include <StepVisual_OverRidingStyledItem.hxx>
|
||||
@ -1935,28 +1936,145 @@ static Standard_Boolean GetMassConversionFactor(Handle(StepBasic_NamedUnit)& NU,
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// Method : createMesh
|
||||
// Purpose : creates a Poly_Triangulation from ComplexTriangulatedSurfaceSet
|
||||
// ============================================================================
|
||||
|
||||
Handle(Poly_Triangulation) createMesh(const Handle(StepVisual_ComplexTriangulatedSurfaceSet)& theTriangulatedSufaceSet,
|
||||
const Standard_Real theFact)
|
||||
{
|
||||
Handle(StepVisual_CoordinatesList) aCoords = theTriangulatedSufaceSet->Coordinates();
|
||||
Handle(TColgp_HArray1OfXYZ) aNodes = aCoords->Points();
|
||||
Handle(TColStd_HArray1OfTransient) aTriaStrips = theTriangulatedSufaceSet->TriangleStrips();
|
||||
Handle(TColStd_HArray1OfTransient) aTriaFans = theTriangulatedSufaceSet->TriangleFans();
|
||||
const Standard_Boolean aHasUVNodes = Standard_False;
|
||||
const Standard_Integer aNbNormals = theTriangulatedSufaceSet->NbNormals();
|
||||
// Number of pairs (Point, Normal). It is possible for one point to have multiple normals. This is
|
||||
// useful when the underlying surface is not C1 continuous.
|
||||
const Standard_Integer aNbPairs = aNbNormals > 1 ? theTriangulatedSufaceSet->NbPnindex() : aNodes->Length();
|
||||
const Standard_Boolean aHasNormals = aNbNormals > 0;
|
||||
|
||||
// Counting number of triangles in the triangle strips list.
|
||||
// A triangle strip is a list of 3 or more points defining a set of connected triangles.
|
||||
Standard_Integer aNbTriaStrips = 0;
|
||||
for (Standard_Integer i = 1; i <= theTriangulatedSufaceSet->NbTriangleStrips(); ++i)
|
||||
{
|
||||
Handle(TColStd_HArray1OfInteger) aTriangleStrip = Handle(TColStd_HArray1OfInteger)::DownCast(aTriaStrips->Value(i));
|
||||
aNbTriaStrips += aTriangleStrip->Length() - 2;
|
||||
}
|
||||
|
||||
// Counting number of triangles in the triangle fans list.
|
||||
// A triangle fan is a set of 3 or more points defining a set of connected triangles sharing a common vertex.
|
||||
Standard_Integer aNbTriaFans = 0;
|
||||
for (Standard_Integer i = 1; i <= theTriangulatedSufaceSet->NbTriangleFans(); ++i)
|
||||
{
|
||||
Handle(TColStd_HArray1OfInteger) aTriangleFan = Handle(TColStd_HArray1OfInteger)::DownCast(aTriaFans->Value(i));
|
||||
aNbTriaFans += aTriangleFan->Length() - 2;
|
||||
}
|
||||
|
||||
Handle(Poly_Triangulation) aMesh = new Poly_Triangulation(aNbPairs, aNbTriaStrips + aNbTriaFans, aHasUVNodes, aHasNormals);
|
||||
|
||||
for (Standard_Integer j = 1; j <= aNbPairs; ++j)
|
||||
{
|
||||
const gp_XYZ& aPoint = aNodes->Value(aNbNormals > 1 ? theTriangulatedSufaceSet->PnindexValue(j) : j);
|
||||
aMesh->SetNode(j, theFact * aPoint);
|
||||
}
|
||||
|
||||
// Creating triangles from triangle strips. Processing is split in two parts to
|
||||
// path through nodes in the same direction.
|
||||
Standard_Integer k = 1;
|
||||
for (Standard_Integer i = 1; i <= theTriangulatedSufaceSet->NbTriangleStrips(); ++i)
|
||||
{
|
||||
Handle(TColStd_HArray1OfInteger) aTriangleStrip = Handle(TColStd_HArray1OfInteger)::DownCast(aTriaStrips->Value(i));
|
||||
for (Standard_Integer j = 3; j <= aTriangleStrip->Length(); j += 2)
|
||||
{
|
||||
if (aTriangleStrip->Value(j) != aTriangleStrip->Value(j - 2) &&
|
||||
aTriangleStrip->Value(j) != aTriangleStrip->Value(j - 1))
|
||||
{
|
||||
aMesh->SetTriangle(k++, Poly_Triangle(aTriangleStrip->Value(j - 2),
|
||||
aTriangleStrip->Value(j),
|
||||
aTriangleStrip->Value(j - 1)));
|
||||
}
|
||||
}
|
||||
for (Standard_Integer j = 4; j <= aTriangleStrip->Length(); j += 2)
|
||||
{
|
||||
if (aTriangleStrip->Value(j) != aTriangleStrip->Value(j - 2) &&
|
||||
aTriangleStrip->Value(j) != aTriangleStrip->Value(j - 1))
|
||||
{
|
||||
aMesh->SetTriangle(k++, Poly_Triangle(aTriangleStrip->Value(j - 2),
|
||||
aTriangleStrip->Value(j - 1),
|
||||
aTriangleStrip->Value(j)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Creating triangles from triangle strips.
|
||||
for (Standard_Integer i = 1; i <= theTriangulatedSufaceSet->NbTriangleFans(); ++i)
|
||||
{
|
||||
Handle(TColStd_HArray1OfInteger) aTriangleFan = Handle(TColStd_HArray1OfInteger)::DownCast(aTriaFans->Value(i));
|
||||
for (Standard_Integer j = 3; j <= aTriangleFan->Length(); ++j)
|
||||
{
|
||||
aMesh->SetTriangle(k++, Poly_Triangle(aTriangleFan->Value(1),
|
||||
aTriangleFan->Value(j - 1),
|
||||
aTriangleFan->Value(j)));
|
||||
}
|
||||
}
|
||||
|
||||
if (aHasNormals)
|
||||
{
|
||||
Handle(TColStd_HArray2OfReal) aNormals = theTriangulatedSufaceSet->Normals();
|
||||
gp_XYZ aNorm;
|
||||
if (theTriangulatedSufaceSet->NbNormals() == 1)
|
||||
{
|
||||
aNorm.SetX(aNormals->Value(1, 1));
|
||||
aNorm.SetY(aNormals->Value(1, 2));
|
||||
aNorm.SetZ(aNormals->Value(1, 3));
|
||||
for (Standard_Integer i = 1; i <= aNbPairs; ++i)
|
||||
{
|
||||
aMesh->SetNormal(i, aNorm);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (Standard_Integer i = 1; i <= aNbPairs; ++i)
|
||||
{
|
||||
aNorm.SetX(aNormals->Value(i, 1));
|
||||
aNorm.SetY(aNormals->Value(i, 2));
|
||||
aNorm.SetZ(aNormals->Value(i, 3));
|
||||
aMesh->SetNormal(i, aNorm);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return aMesh;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : readPMIPresentation
|
||||
//purpose : read polyline or tessellated presentation for
|
||||
// (Annotation_Curve_Occurrence or Draughting_Callout)
|
||||
//=======================================================================
|
||||
Standard_Boolean readPMIPresentation(const Handle(Standard_Transient)& thePresentEntity,
|
||||
const Handle(XSControl_TransferReader)& theTR,
|
||||
const Standard_Real theFact,
|
||||
TopoDS_Shape& thePresentation,
|
||||
Handle(TCollection_HAsciiString)& thePresentName,
|
||||
Bnd_Box& theBox,
|
||||
const StepData_Factors& theLocalFactors)
|
||||
const Handle(XSControl_TransferReader)& theTR,
|
||||
const Standard_Real theFact,
|
||||
TopoDS_Shape& thePresentation,
|
||||
Handle(TCollection_HAsciiString)& thePresentName,
|
||||
Bnd_Box& theBox,
|
||||
const StepData_Factors& theLocalFactors)
|
||||
{
|
||||
if (thePresentEntity.IsNull())
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
Handle(Transfer_TransientProcess) aTP = theTR->TransientProcess();
|
||||
Handle(StepVisual_AnnotationOccurrence) anAO;
|
||||
NCollection_Vector<Handle(StepVisual_StyledItem)> anAnnotations;
|
||||
if (thePresentEntity->IsKind(STANDARD_TYPE(StepVisual_AnnotationOccurrence)))
|
||||
{
|
||||
anAO = Handle(StepVisual_AnnotationOccurrence)::DownCast(thePresentEntity);
|
||||
if (!anAO.IsNull()) {
|
||||
if (!anAO.IsNull())
|
||||
{
|
||||
thePresentName = anAO->Name();
|
||||
anAnnotations.Append(anAO);
|
||||
}
|
||||
@ -1981,17 +2099,17 @@ Standard_Boolean readPMIPresentation(const Handle(Standard_Transient)& thePresen
|
||||
}
|
||||
|
||||
if (!anAnnotations.Length())
|
||||
{
|
||||
return Standard_False;
|
||||
|
||||
}
|
||||
|
||||
BRep_Builder aB;
|
||||
TopoDS_Compound aResAnnotation;
|
||||
aB.MakeCompound(aResAnnotation);
|
||||
|
||||
Standard_Integer i = 0;
|
||||
Bnd_Box aBox;
|
||||
Standard_Integer nbShapes = 0;
|
||||
for (; i < anAnnotations.Length(); i++)
|
||||
Standard_Integer aNbShapes = 0;
|
||||
for (Standard_Integer i = 0; i < anAnnotations.Length(); i++)
|
||||
{
|
||||
Handle(StepVisual_StyledItem) anItem = anAnnotations(i);
|
||||
anAO = Handle(StepVisual_AnnotationOccurrence)::DownCast(anItem);
|
||||
@ -2002,19 +2120,19 @@ Standard_Boolean readPMIPresentation(const Handle(Standard_Transient)& thePresen
|
||||
anAnnotationShape = STEPConstruct::FindShape(aTP, aCurveItem);
|
||||
if (anAnnotationShape.IsNull())
|
||||
{
|
||||
Handle(Transfer_Binder) binder = theTR->Actor()->Transfer(aCurveItem, aTP);
|
||||
if (!binder.IsNull() && binder->HasResult()) {
|
||||
anAnnotationShape = TransferBRep::ShapeResult(aTP, binder);
|
||||
Handle(Transfer_Binder) aBinder = theTR->Actor()->Transfer(aCurveItem, aTP);
|
||||
if (!aBinder.IsNull() && aBinder->HasResult()) {
|
||||
anAnnotationShape = TransferBRep::ShapeResult(aTP, aBinder);
|
||||
}
|
||||
}
|
||||
}
|
||||
//case of tessellated entities
|
||||
else
|
||||
{
|
||||
Handle(StepRepr_RepresentationItem) aTessItem = anItem->Item();
|
||||
if (aTessItem.IsNull())
|
||||
Handle(StepRepr_RepresentationItem) aRepresentationItem = anItem->Item();
|
||||
if (aRepresentationItem.IsNull())
|
||||
continue;
|
||||
Handle(StepVisual_TessellatedGeometricSet) aTessSet = Handle(StepVisual_TessellatedGeometricSet)::DownCast(aTessItem);
|
||||
Handle(StepVisual_TessellatedGeometricSet) aTessSet = Handle(StepVisual_TessellatedGeometricSet)::DownCast(aRepresentationItem);
|
||||
if (aTessSet.IsNull())
|
||||
continue;
|
||||
gp_Trsf aTransf;
|
||||
@ -2037,55 +2155,75 @@ Standard_Boolean readPMIPresentation(const Handle(Standard_Transient)& thePresen
|
||||
}
|
||||
}
|
||||
NCollection_Handle<StepVisual_Array1OfTessellatedItem> aListItems = aTessSet->Items();
|
||||
Standard_Integer nb = aListItems.IsNull() ? 0 : aListItems->Length();
|
||||
Handle(StepVisual_TessellatedCurveSet) aTessCurve;
|
||||
for (Standard_Integer n = 1; n <= nb && aTessCurve.IsNull(); n++)
|
||||
{
|
||||
aTessCurve = Handle(StepVisual_TessellatedCurveSet)::DownCast(aListItems->Value(n));
|
||||
}
|
||||
if (aTessCurve.IsNull())
|
||||
continue;
|
||||
Handle(StepVisual_CoordinatesList) aCoordList = aTessCurve->CoordList();
|
||||
if (aCoordList.IsNull())
|
||||
continue;
|
||||
Handle(TColgp_HArray1OfXYZ) aPoints = aCoordList->Points();
|
||||
|
||||
if (aPoints.IsNull() || aPoints->Length() == 0)
|
||||
continue;
|
||||
NCollection_Handle<StepVisual_VectorOfHSequenceOfInteger> aCurves = aTessCurve->Curves();
|
||||
Standard_Integer aNbC = (aCurves.IsNull() ? 0 : aCurves->Length());
|
||||
Standard_Integer aNbItems = aListItems.IsNull() ? 0 : aListItems->Length();
|
||||
TopoDS_Compound aComp;
|
||||
aB.MakeCompound(aComp);
|
||||
|
||||
Standard_Integer k = 0;
|
||||
for (; k < aNbC; k++)
|
||||
for (Standard_Integer j = 1; j <= aNbItems; j++)
|
||||
{
|
||||
Handle(TColStd_HSequenceOfInteger) anIndexes = aCurves->Value(k);
|
||||
TopoDS_Wire aCurW;
|
||||
aB.MakeWire(aCurW);
|
||||
|
||||
for (Standard_Integer n = 1; n < anIndexes->Length(); n++)
|
||||
Handle(StepVisual_TessellatedItem) aTessItem = aListItems->Value(j);
|
||||
if (aTessItem.IsNull())
|
||||
{
|
||||
Standard_Integer ind = anIndexes->Value(n);
|
||||
Standard_Integer indnext = anIndexes->Value(n + 1);
|
||||
if (ind > aPoints->Length() || indnext > aPoints->Length())
|
||||
continue;
|
||||
gp_Pnt aP1(aPoints->Value(ind) * theFact);
|
||||
gp_Pnt aP2(aPoints->Value(indnext) * theFact);
|
||||
BRepBuilderAPI_MakeEdge aMaker(aP1, aP2);
|
||||
if (aMaker.IsDone())
|
||||
continue;
|
||||
}
|
||||
if (aTessItem->IsKind(STANDARD_TYPE(StepVisual_TessellatedCurveSet)))
|
||||
{
|
||||
Handle(StepVisual_TessellatedCurveSet) aTessCurve = Handle(StepVisual_TessellatedCurveSet)::DownCast(aTessItem);
|
||||
Handle(StepVisual_CoordinatesList) aCoordList = aTessCurve->CoordList();
|
||||
if (aCoordList.IsNull())
|
||||
{
|
||||
TopoDS_Edge aCurE = aMaker.Edge();
|
||||
aB.Add(aCurW, aCurE);
|
||||
continue;
|
||||
}
|
||||
|
||||
Handle(TColgp_HArray1OfXYZ) aPoints = aCoordList->Points();
|
||||
if (aPoints.IsNull() || aPoints->Length() == 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
NCollection_Handle<StepVisual_VectorOfHSequenceOfInteger> aCurves = aTessCurve->Curves();
|
||||
Standard_Integer aNbCurves = (aCurves.IsNull() ? 0 : aCurves->Length());
|
||||
for (Standard_Integer k = 0; k < aNbCurves; k++)
|
||||
{
|
||||
Handle(TColStd_HSequenceOfInteger) anIndexes = aCurves->Value(k);
|
||||
TopoDS_Wire aCurW;
|
||||
aB.MakeWire(aCurW);
|
||||
for (Standard_Integer n = 1; n < anIndexes->Length(); n++)
|
||||
{
|
||||
Standard_Integer anIndex = anIndexes->Value(n);
|
||||
Standard_Integer aNextIndex = anIndexes->Value(n + 1);
|
||||
if (anIndex > aPoints->Length() || aNextIndex > aPoints->Length())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
gp_Pnt aP1(aPoints->Value(anIndex) * theFact);
|
||||
gp_Pnt aP2(aPoints->Value(aNextIndex) * theFact);
|
||||
BRepBuilderAPI_MakeEdge aMaker(aP1, aP2);
|
||||
if (aMaker.IsDone())
|
||||
{
|
||||
TopoDS_Edge aCurE = aMaker.Edge();
|
||||
aB.Add(aCurW, aCurE);
|
||||
}
|
||||
}
|
||||
aB.Add(aComp, aCurW);
|
||||
}
|
||||
}
|
||||
aB.Add(aComp, aCurW);
|
||||
else if (aTessItem->IsKind(STANDARD_TYPE(StepVisual_ComplexTriangulatedSurfaceSet)))
|
||||
{
|
||||
Handle(StepVisual_ComplexTriangulatedSurfaceSet) aTessSurfSet = Handle(StepVisual_ComplexTriangulatedSurfaceSet)::DownCast(aTessItem);
|
||||
Handle(Poly_Triangulation) aSurfSetMesh = createMesh(aTessSurfSet, theFact);
|
||||
TopoDS_Face aFace;
|
||||
aB.MakeFace(aFace, aSurfSetMesh);
|
||||
aB.Add(aComp, aFace);
|
||||
}
|
||||
}
|
||||
if (!aComp.IsNull())
|
||||
{
|
||||
anAnnotationShape = aComp.Moved(aTransf);
|
||||
}
|
||||
anAnnotationShape = aComp.Moved(aTransf);
|
||||
}
|
||||
if (!anAnnotationShape.IsNull())
|
||||
{
|
||||
nbShapes++;
|
||||
aNbShapes++;
|
||||
aB.Add(aResAnnotation, anAnnotationShape);
|
||||
if (i == anAnnotations.Length() - 1)
|
||||
BRepBndLib::AddClose(anAnnotationShape, aBox);
|
||||
@ -2094,7 +2232,7 @@ Standard_Boolean readPMIPresentation(const Handle(Standard_Transient)& thePresen
|
||||
|
||||
thePresentation = aResAnnotation;
|
||||
theBox = aBox;
|
||||
return (nbShapes > 0);
|
||||
return (aNbShapes > 0);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
|
@ -2473,6 +2473,10 @@ void STEPCAFControl_Writer::writePresentation(const Handle(XSControl_WorkSession
|
||||
|
||||
// Presentation
|
||||
Handle(StepVisual_TessellatedGeometricSet) aGeomSet = STEPCAFControl_GDTProperty::GetTessellation(thePresentation);
|
||||
if (aGeomSet.IsNull())
|
||||
{
|
||||
return;
|
||||
}
|
||||
Handle(StepVisual_TessellatedAnnotationOccurrence) aTAO = new StepVisual_TessellatedAnnotationOccurrence();
|
||||
aTAO->Init(new TCollection_HAsciiString(), myGDTPrsCurveStyle, aGeomSet);
|
||||
StepVisual_DraughtingCalloutElement aDCElement;
|
||||
|
@ -37,8 +37,8 @@ void StepVisual_ComplexTriangulatedSurfaceSet::Init (const Handle(TCollection_HA
|
||||
const Standard_Integer theTessellatedSurfaceSet_Pnmax,
|
||||
const Handle(TColStd_HArray2OfReal)& theTessellatedSurfaceSet_Normals,
|
||||
const Handle(TColStd_HArray1OfInteger)& thePnindex,
|
||||
const Handle(TColStd_HArray2OfInteger)& theTriangleStrips,
|
||||
const Handle(TColStd_HArray2OfInteger)& theTriangleFans)
|
||||
const Handle(TColStd_HArray1OfTransient)& theTriangleStrips,
|
||||
const Handle(TColStd_HArray1OfTransient)& theTriangleFans)
|
||||
{
|
||||
StepVisual_TessellatedSurfaceSet::Init(theRepresentationItem_Name,
|
||||
theTessellatedSurfaceSet_Coordinates,
|
||||
@ -103,7 +103,7 @@ Standard_Integer StepVisual_ComplexTriangulatedSurfaceSet::PnindexValue(const St
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(TColStd_HArray2OfInteger) StepVisual_ComplexTriangulatedSurfaceSet::TriangleStrips () const
|
||||
Handle(TColStd_HArray1OfTransient) StepVisual_ComplexTriangulatedSurfaceSet::TriangleStrips () const
|
||||
{
|
||||
return myTriangleStrips;
|
||||
}
|
||||
@ -113,7 +113,7 @@ Handle(TColStd_HArray2OfInteger) StepVisual_ComplexTriangulatedSurfaceSet::Trian
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void StepVisual_ComplexTriangulatedSurfaceSet::SetTriangleStrips(const Handle(TColStd_HArray2OfInteger)& theTriangleStrips)
|
||||
void StepVisual_ComplexTriangulatedSurfaceSet::SetTriangleStrips(const Handle(TColStd_HArray1OfTransient)& theTriangleStrips)
|
||||
{
|
||||
myTriangleStrips = theTriangleStrips;
|
||||
}
|
||||
@ -129,7 +129,7 @@ Standard_Integer StepVisual_ComplexTriangulatedSurfaceSet::NbTriangleStrips() co
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return myTriangleStrips->ColLength();
|
||||
return myTriangleStrips->Length();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@ -137,7 +137,7 @@ Standard_Integer StepVisual_ComplexTriangulatedSurfaceSet::NbTriangleStrips() co
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(TColStd_HArray2OfInteger) StepVisual_ComplexTriangulatedSurfaceSet::TriangleFans () const
|
||||
Handle(TColStd_HArray1OfTransient) StepVisual_ComplexTriangulatedSurfaceSet::TriangleFans () const
|
||||
{
|
||||
return myTriangleFans;
|
||||
}
|
||||
@ -147,7 +147,7 @@ Handle(TColStd_HArray2OfInteger) StepVisual_ComplexTriangulatedSurfaceSet::Trian
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void StepVisual_ComplexTriangulatedSurfaceSet::SetTriangleFans(const Handle(TColStd_HArray2OfInteger)& theTriangleFans)
|
||||
void StepVisual_ComplexTriangulatedSurfaceSet::SetTriangleFans(const Handle(TColStd_HArray1OfTransient)& theTriangleFans)
|
||||
{
|
||||
myTriangleFans = theTriangleFans;
|
||||
}
|
||||
@ -163,5 +163,5 @@ Standard_Integer StepVisual_ComplexTriangulatedSurfaceSet::NbTriangleFans() cons
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return myTriangleFans->ColLength();
|
||||
return myTriangleFans->Length();
|
||||
}
|
||||
|
@ -22,7 +22,7 @@
|
||||
#include <StepVisual_TessellatedSurfaceSet.hxx>
|
||||
|
||||
#include <TColStd_HArray1OfInteger.hxx>
|
||||
#include <TColStd_HArray2OfInteger.hxx>
|
||||
#include <TColStd_HArray1OfTransient.hxx>
|
||||
|
||||
DEFINE_STANDARD_HANDLE(StepVisual_ComplexTriangulatedSurfaceSet, StepVisual_TessellatedSurfaceSet)
|
||||
|
||||
@ -41,8 +41,8 @@ public :
|
||||
const Standard_Integer theTessellatedSurfaceSet_Pnmax,
|
||||
const Handle(TColStd_HArray2OfReal)& theTessellatedSurfaceSet_Normals,
|
||||
const Handle(TColStd_HArray1OfInteger)& thePnindex,
|
||||
const Handle(TColStd_HArray2OfInteger)& theTriangleStrips,
|
||||
const Handle(TColStd_HArray2OfInteger)& theTriangleFans);
|
||||
const Handle(TColStd_HArray1OfTransient)& theTriangleStrips,
|
||||
const Handle(TColStd_HArray1OfTransient)& theTriangleFans);
|
||||
|
||||
//! Returns field Pnindex
|
||||
Standard_EXPORT Handle(TColStd_HArray1OfInteger) Pnindex() const;
|
||||
@ -57,19 +57,19 @@ public :
|
||||
Standard_EXPORT Standard_Integer PnindexValue(const Standard_Integer theNum) const;
|
||||
|
||||
//! Returns field TriangleStrips
|
||||
Standard_EXPORT Handle(TColStd_HArray2OfInteger) TriangleStrips() const;
|
||||
Standard_EXPORT Handle(TColStd_HArray1OfTransient) TriangleStrips() const;
|
||||
|
||||
//! Sets field TriangleStrips
|
||||
Standard_EXPORT void SetTriangleStrips (const Handle(TColStd_HArray2OfInteger)& theTriangleStrips);
|
||||
Standard_EXPORT void SetTriangleStrips (const Handle(TColStd_HArray1OfTransient)& theTriangleStrips);
|
||||
|
||||
//! Returns number of TriangleStrips
|
||||
Standard_EXPORT Standard_Integer NbTriangleStrips() const;
|
||||
|
||||
//! Returns field TriangleFans
|
||||
Standard_EXPORT Handle(TColStd_HArray2OfInteger) TriangleFans() const;
|
||||
Standard_EXPORT Handle(TColStd_HArray1OfTransient) TriangleFans() const;
|
||||
|
||||
//! Sets field TriangleFans
|
||||
Standard_EXPORT void SetTriangleFans (const Handle(TColStd_HArray2OfInteger)& theTriangleFans);
|
||||
Standard_EXPORT void SetTriangleFans (const Handle(TColStd_HArray1OfTransient)& theTriangleFans);
|
||||
|
||||
//! Returns number of TriangleFans
|
||||
Standard_EXPORT Standard_Integer NbTriangleFans() const;
|
||||
@ -79,8 +79,8 @@ public :
|
||||
private:
|
||||
|
||||
Handle(TColStd_HArray1OfInteger) myPnindex;
|
||||
Handle(TColStd_HArray2OfInteger) myTriangleStrips;
|
||||
Handle(TColStd_HArray2OfInteger) myTriangleFans;
|
||||
Handle(TColStd_HArray1OfTransient) myTriangleStrips;
|
||||
Handle(TColStd_HArray1OfTransient) myTriangleFans;
|
||||
|
||||
};
|
||||
|
||||
|
@ -14,12 +14,12 @@ checkshape res f
|
||||
set dump [XDumpNbDGTs D f]
|
||||
set info "
|
||||
|
||||
NbOfDimensions : 14
|
||||
NbOfDimensions : 15
|
||||
NbOfDimensionalSize : 7
|
||||
NbOfDimensionalLocation: 0
|
||||
NbOfAngular : 0
|
||||
NbOfWithPath : 0
|
||||
NbOfCommonLabels : 0
|
||||
NbOfCommonLabels : 1
|
||||
NbOfTolerances : 22
|
||||
NbOfGTWithModifiers : 4
|
||||
NbOfGTWithMaxTolerance : 0
|
||||
|
16
tests/gdt/presentation/C2
Normal file
16
tests/gdt/presentation/C2
Normal file
@ -0,0 +1,16 @@
|
||||
# !!!! This file is generated automatically, do not edit manually! See end script
|
||||
puts "TODO CR11111 ALL: Error on writing file"
|
||||
|
||||
set filename bug33484.stp
|
||||
|
||||
set ref_data {
|
||||
Centre of mass: 9.0027001005108751 9.2917129312715954 -5.5470782136393613
|
||||
Mass: 8176.9848537285679
|
||||
|
||||
}
|
||||
|
||||
set ref_data_write {
|
||||
Centre of mass: 9.4672345259051625 8.9728431848515342 -5.6865065278091702
|
||||
Mass: 8083.3051701204768
|
||||
|
||||
}
|
@ -108,39 +108,61 @@ if { $dump_file == 1 } {
|
||||
puts $fd_stream "set ref_data \{"
|
||||
puts $fd_stream $result
|
||||
puts $fd_stream "\}"
|
||||
if (![string equal $xst $xst2]) {
|
||||
puts $fd_stream ""
|
||||
puts $fd_stream "set ref_data_write \{"
|
||||
puts $fd_stream $result2
|
||||
puts $fd_stream "\}"
|
||||
}
|
||||
}
|
||||
close $fd_stream
|
||||
} elseif { $mist != 1 } {
|
||||
puts "========================== Comparison with reference data ========"
|
||||
puts ""
|
||||
# Comparison of reference data with obtained result
|
||||
# Variable ref_data is used to check values on the first read.
|
||||
# If after writing and reading file again values differ, variable
|
||||
# ref_data_write should be used for the new reference data. In
|
||||
# case if it is not set, ref_data will be used to check the result again.
|
||||
set x_Ref 0; set y_Ref 0; set z_Ref 0;
|
||||
set x_Ref_write 0; set y_Ref_write 0; set z_Ref_write 0;
|
||||
set mass_Ref 0;
|
||||
set mass_Ref_write 0;
|
||||
regexp {Centre of mass+: +([-0-9.+eE]+) +([-0-9.+eE]+) +([-0-9.+eE]+)} $ref_data full x_Ref y_Ref z_Ref
|
||||
regexp {Mass+: +([-0-9.+eE]+)} $ref_data full mass_Ref
|
||||
|
||||
if {[expr abs($x_Ref - $x_First)] > 1e-4 || [expr abs($x_Ref - $x_Second)] > 1e-4} {
|
||||
if { [info exists ref_data_write] } {
|
||||
regexp {Centre of mass+: +([-0-9.+eE]+) +([-0-9.+eE]+) +([-0-9.+eE]+)} $ref_data_write full x_Ref_write y_Ref_write z_Ref_write
|
||||
regexp {Mass+: +([-0-9.+eE]+)} $ref_data_write full mass_Ref_write
|
||||
} else {
|
||||
set x_Ref_write $x_Ref;
|
||||
set y_Ref_write $y_Ref;
|
||||
set z_Ref_write $z_Ref;
|
||||
set mass_Ref_write $mass_Ref;
|
||||
}
|
||||
|
||||
if {[expr abs($x_Ref - $x_First)] > 1e-4 || [expr abs($x_Ref_write - $x_Second)] > 1e-4} {
|
||||
incr ref_Compare
|
||||
append err_compare_ref " Reference data - $x_Ref\n"
|
||||
append err_compare_ref " Reference data - $x_Ref_write ($x_Ref)\n"
|
||||
append err_compare_ref " Current data - $x_Second ($x_First)\n"
|
||||
append err_compare_ref "--------------------------------------------------------------------\n"
|
||||
}
|
||||
|
||||
if {[expr abs($y_Ref - $y_First)] > 1e-4 || [expr abs($y_Ref - $y_Second)] > 1e-4} {
|
||||
if {[expr abs($y_Ref - $y_First)] > 1e-4 || [expr abs($y_Ref_write - $y_Second)] > 1e-4} {
|
||||
incr ref_Compare
|
||||
append err_compare_ref " Reference data - $y_Ref\n"
|
||||
append err_compare_ref " Reference data - $y_Ref_write ($y_Ref)\n"
|
||||
append err_compare_ref " Current data - $y_Second ($y_First)\n"
|
||||
append err_compare_ref "--------------------------------------------------------------------\n"
|
||||
}
|
||||
if {[expr abs($z_Ref - $z_First)] > 1e-4 || [expr abs($z_Ref - $z_Second)] > 1e-4} {
|
||||
if {[expr abs($z_Ref - $z_First)] > 1e-4 || [expr abs($z_Ref_write - $z_Second)] > 1e-4} {
|
||||
incr ref_Compare
|
||||
append err_compare_ref " Reference data - $z_Ref\n"
|
||||
append err_compare_ref " Reference data - $z_Ref_write ($z_Ref)\n"
|
||||
append err_compare_ref " Current data - $z_Second ($z_First)\n"
|
||||
append err_compare_ref "--------------------------------------------------------------------\n"
|
||||
}
|
||||
if {[expr abs($mass_Ref - $mass_First)] > 1e-4 || [expr abs($mass_Ref - $mass_Second)] > 1e-4} {
|
||||
if {[expr abs($mass_Ref - $mass_First)] > 1e-4 || [expr abs($mass_Ref_write - $mass_Second)] > 1e-4} {
|
||||
incr ref_Compare
|
||||
append err_compare_ref " Reference data - $mass_Ref\n"
|
||||
append err_compare_ref " Reference data - $mass_Ref_write ($mass_Ref)\n"
|
||||
append err_compare_ref " Current data - $mass_Second ($mass_First)\n"
|
||||
append err_compare_ref "--------------------------------------------------------------------\n"
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user