1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-24 13:50:49 +03:00

Compare commits

..

1 Commits

Author SHA1 Message Date
nmanchen
4ffb7e84b7 0033433: Shape Healing - Implement a new mode to keep initial types of curves
The implemented method modifies curves in wire so it becomes connected in vertices well with minor shifting of the curves
2023-08-14 15:21:39 +01:00
180 changed files with 1618 additions and 2536 deletions

View File

@@ -35,17 +35,13 @@ std::pair<Standard_Real, Standard_Real> BRepMesh_ConeRangeSplitter::GetSplitStep
Standard_Real aRadius = Max(Abs(aRefR + aRangeV.first * Sin(aSAng)), Standard_Real aRadius = Max(Abs(aRefR + aRangeV.first * Sin(aSAng)),
Abs(aRefR + aRangeV.second * Sin(aSAng))); Abs(aRefR + aRangeV.second * Sin(aSAng)));
//Face deflection used to determine circle subdivisions needs to match the one used previously
Standard_Real Dv, Du = GCPnts_TangentialDeflection::ArcAngularStep( Standard_Real Dv, Du = GCPnts_TangentialDeflection::ArcAngularStep(
aRadius, GetDFace()->GetDeflection()*0.5, aRadius, GetDFace()->GetDeflection(),
theParameters.Angle, theParameters.MinSize); theParameters.Angle, theParameters.MinSize);
const Standard_Real aDiffU = aRangeU.second - aRangeU.first; const Standard_Real aDiffU = aRangeU.second - aRangeU.first;
const Standard_Real aDiffV = aRangeV.second - aRangeV.first; const Standard_Real aDiffV = aRangeV.second - aRangeV.first;
//compute subdivision factor acounting for the difference between the bottom and top radius of the cone const Standard_Real aScale = (Du * aRadius);
const Standard_Real aTopRadius = aRefR > Precision::Confusion() ? aRefR : 1.0;
const Standard_Real aSubDivFactor = Max(theParameters.MinSize, Min(1.0, aTopRadius > aRadius ? aRadius / aTopRadius : aTopRadius / aRadius));
const Standard_Real aScale = (Du * aRadius * aSubDivFactor);
const Standard_Real aRatio = Max(1., Log(aDiffV / aScale)); const Standard_Real aRatio = Max(1., Log(aDiffV / aScale));
const Standard_Integer nbU = (Standard_Integer)(aDiffU / Du); const Standard_Integer nbU = (Standard_Integer)(aDiffU / Du);
const Standard_Integer nbV = (Standard_Integer)(aDiffV / aScale / aRatio); const Standard_Integer nbV = (Standard_Integer)(aDiffV / aScale / aRatio);

View File

@@ -1292,10 +1292,6 @@ BRepOffsetAPI_ThruSections::Generated(const TopoDS_Shape& S)
for (; itl.More(); itl.Next()) for (; itl.More(); itl.Next())
{ {
Standard_Integer IndOfFace = itl.Value(); Standard_Integer IndOfFace = itl.Value();
if (AllFaces.Size() < IndOfFace)
{
continue;
}
myGenerated.Append(AllFaces(IndOfFace)); myGenerated.Append(AllFaces(IndOfFace));
} }
@@ -1306,10 +1302,6 @@ BRepOffsetAPI_ThruSections::Generated(const TopoDS_Shape& S)
{ {
Standard_Integer IndOfFace = itl.Value(); Standard_Integer IndOfFace = itl.Value();
IndOfFace += (i-1)*myNbEdgesInSection; IndOfFace += (i-1)*myNbEdgesInSection;
if (AllFaces.Size() < IndOfFace)
{
continue;
}
myGenerated.Append(AllFaces(IndOfFace)); myGenerated.Append(AllFaces(IndOfFace));
} }
} }

View File

@@ -42,9 +42,12 @@
#include <Geom2d_Circle.hxx> #include <Geom2d_Circle.hxx>
#include <Geom2dAPI_Interpolate.hxx> #include <Geom2dAPI_Interpolate.hxx>
#include <Geom2d_TrimmedCurve.hxx> #include <Geom2d_TrimmedCurve.hxx>
#include <Message.hxx>
#include <TopoDS.hxx> #include <TopoDS.hxx>
#include <TopoDS_Shape.hxx> #include <TopoDS_Shape.hxx>
#include <TopoDS_Wire.hxx> #include <TopoDS_Wire.hxx>
#include <ShapeFix_Wire.hxx>
#include <ShapeFix_Edge.hxx>
#include <DBRep.hxx> #include <DBRep.hxx>
#include <DBRep_DrawableShape.hxx> #include <DBRep_DrawableShape.hxx>
@@ -271,6 +274,142 @@ static Standard_Integer wire(Draw_Interpretor& di, Standard_Integer n, const cha
return 0; return 0;
} }
//=======================================================================
// strongwire
//=======================================================================
static Standard_Integer strongwire(Draw_Interpretor& theDI, Standard_Integer theArgC, const char** theArgV)
{
enum StrongWireMode {
StrongWireMode_FixTolerance = 1,
StrongWireMode_Approximation = 2,
StrongWireMode_KeepCurveType = 3
};
BRep_Builder aB;
TopoDS_Wire aWire;
aB.MakeWire(aWire);
if (theArgC < 3)
return 1;
// Tolerance
double aTolerance = Precision::Confusion();
// mode
StrongWireMode aMode = StrongWireMode_KeepCurveType;
// add edges
for (Standard_Integer anArgIter = 2; anArgIter < theArgC; anArgIter++)
{
TCollection_AsciiString aParam(theArgV[anArgIter]);
if (aParam == "-t")
{
anArgIter++;
if (anArgIter < theArgC)
aTolerance = Draw::Atof(theArgV[anArgIter]);
}
else if (aParam == "-m")
{
anArgIter++;
if (anArgIter < theArgC)
{
if (aParam == "keepType" || Draw::Atoi(theArgV[anArgIter]) == 1)
{
aMode = StrongWireMode_KeepCurveType;
continue;
}
else if (aParam == "approx" || Draw::Atoi(theArgV[anArgIter]) == 2)
{
aMode = StrongWireMode_Approximation;
continue;
}
else if (aParam == "fixTol" || Draw::Atoi(theArgV[anArgIter]) == 3)
{
aMode = StrongWireMode_FixTolerance;
continue;
}
}
}
else
{
TopoDS_Shape aShape = DBRep::Get(theArgV[anArgIter]);
if (aShape.IsNull())
Standard_NullObject::Raise("Shape for wire construction is null");
if (aShape.ShapeType() == TopAbs_EDGE || aShape.ShapeType() == TopAbs_WIRE)
{
TopExp_Explorer anExp(aShape, TopAbs_EDGE);
for (; anExp.More(); anExp.Next())
aB.Add(aWire, TopoDS::Edge(anExp.Current()));
}
else
Standard_TypeMismatch::Raise("Shape for wire construction is neither an edge nor a wire");
}
}
// fix edges order
Handle(ShapeFix_Wire) aFW = new ShapeFix_Wire;
aFW->Load(aWire);
aFW->FixReorder();
if (aFW->StatusReorder(ShapeExtend_FAIL1))
{
Message::SendFail() << "Error: Wire construction failed: several loops detected";
return 1;
}
else if (aFW->StatusReorder(ShapeExtend_FAIL))
{
Message::SendFail() << "Wire construction failed";
return 1;
}
bool isClosed = false;
Handle(ShapeAnalysis_Wire) aSaw = aFW->Analyzer();
if (aSaw->CheckGap3d(1)) // between last and first edges
{
Standard_Real aDist = aSaw->MinDistance3d();
if (aDist < aTolerance)
isClosed = true;
}
aFW->ClosedWireMode() = isClosed;
aFW->FixConnected(aTolerance);
if (aMode == StrongWireMode_KeepCurveType)
aFW->FixCurves();
if (aFW->StatusConnected(ShapeExtend_FAIL))
{
Message::SendFail() << "Wire construction failed: cannot build connected wire";
return 1;
}
if (aFW->StatusConnected(ShapeExtend_DONE3))
{
if (aMode != StrongWireMode_Approximation)
aFW->SetPrecision(aTolerance);
aFW->FixGapsByRangesMode() = Standard_True;
if (aFW->FixGaps3d())
{
Handle(ShapeExtend_WireData) sbwd = aFW->WireData();
Handle(ShapeFix_Edge) aFe = new ShapeFix_Edge;
for (Standard_Integer anIdx = 1; anIdx <= sbwd->NbEdges(); anIdx++)
{
TopoDS_Edge aEdge = TopoDS::Edge(sbwd->Edge(anIdx));
aFe->FixVertexTolerance(aEdge);
aFe->FixSameParameter(aEdge);
}
}
else if (aFW->StatusGaps3d(ShapeExtend_FAIL))
{
Message::SendFail() << "Wire construction failed: cannot fix 3d gaps";
return 1;
}
}
aWire = aFW->WireAPIMake();
DBRep::Set(theArgV[1], aWire);
return 0;
}
//======================================================================= //=======================================================================
// mkedge // mkedge
//======================================================================= //=======================================================================
@@ -1997,6 +2136,10 @@ void BRepTest::CurveCommands(Draw_Interpretor& theCommands)
"wire wirename [-unsorted] e1/w1 [e2/w2 ...]",__FILE__, "wire wirename [-unsorted] e1/w1 [e2/w2 ...]",__FILE__,
wire,g); wire,g);
theCommands.Add("strongwire",
"strongwire wirename e1/w1 [e2/w2 ...] [-t tol] [-m mode(keepType/1 | approx/2 | fixTol/3)]", __FILE__,
strongwire, g);
theCommands.Add("profile", theCommands.Add("profile",
"profile, no args to get help",__FILE__, "profile, no args to get help",__FILE__,
profile,g); profile,g);

View File

@@ -308,15 +308,10 @@ Standard_Boolean BRepTools_GTrsfModification::NewTriangulation(const TopoDS_Face
// modify normals // modify normals
if (theTriangulation->HasNormals()) if (theTriangulation->HasNormals())
{ {
for (Standard_Integer anInd = 1; anInd <= theTriangulation->NbNodes(); ++anInd) for (Standard_Integer anInd = 1; anInd <= theTriangulation->NbTriangles(); ++anInd)
{ {
gp_Dir aNormal = theTriangulation->Normal(anInd); gp_Dir aNormal = theTriangulation->Normal(anInd);
gp_Mat aMat = aGTrsf.VectorialPart(); aNormal.Transform(aGTrsf.Trsf());
aMat.SetDiagonal(1., 1., 1.);
gp_Trsf aTrsf;
aTrsf.SetForm(gp_Rotation);
(gp_Mat&)aTrsf.HVectorialPart() = aMat;
aNormal.Transform(aTrsf);
theTriangulation->SetNormal(anInd, aNormal); theTriangulation->SetNormal(anInd, aNormal);
} }
} }

View File

@@ -126,68 +126,23 @@ static void readColor (const BinObjMgt_Persistent& theSource,
static void writeTexture (BinObjMgt_Persistent& theTarget, static void writeTexture (BinObjMgt_Persistent& theTarget,
const Handle(Image_Texture)& theImage) const Handle(Image_Texture)& theImage)
{ {
if (theImage.IsNull()) theTarget.PutAsciiString (!theImage.IsNull()
{ && !theImage->FilePath().IsEmpty()
theTarget.PutAsciiString(""); && theImage->FileOffset() == -1
return; ? theImage->FilePath()
} : "");
if (theImage->DataBuffer().IsNull())
{
theTarget.PutAsciiString(theImage->FilePath());
theTarget.PutBoolean(false);
if (theImage->FileOffset() == -1 || theImage->FileLength() == -1)
{
theTarget.PutBoolean(true);
return;
}
theTarget.PutBoolean(false);
theTarget.PutInteger(static_cast<int>(theImage->FileOffset()));
theTarget.PutInteger(static_cast<int>(theImage->FileLength()));
return;
}
theTarget.PutAsciiString(theImage->TextureId());
theTarget.PutBoolean(true);
theTarget.PutInteger(static_cast<int>(theImage->DataBuffer()->Size()));
theTarget.PutByteArray((Standard_Byte*)theImage->DataBuffer()->Data(),
static_cast<int>(theImage->DataBuffer()->Size()));
} }
//! Decode texture path. //! Decode texture path.
static void readTexture (const BinObjMgt_Persistent& theSource, static void readTexture (const BinObjMgt_Persistent& theSource,
Handle(Image_Texture)& theTexture) Handle(Image_Texture)& theTexture)
{ {
TCollection_AsciiString aStr; TCollection_AsciiString aPath;
theSource.GetAsciiString(aStr); theSource.GetAsciiString (aPath);
if (aStr.IsEmpty()) if (!aPath.IsEmpty())
{ {
return; theTexture = new Image_Texture (aPath);
} }
Standard_Boolean anUseBuffer;
if (!theSource.GetBoolean(anUseBuffer).IsOK())
{
theTexture = new Image_Texture(aStr);
return;
}
Standard_Integer anOffset = -1, aLength = -1;
if (!anUseBuffer)
{
Standard_Boolean isOnlyFilePath;
theSource.GetBoolean(isOnlyFilePath);
if (isOnlyFilePath)
{
theTexture = new Image_Texture(aStr);
return;
}
theSource.GetInteger(anOffset);
theSource.GetInteger(aLength);
theTexture = new Image_Texture(aStr, anOffset, aLength);
return;
}
theSource.GetInteger(aLength);
Handle(NCollection_Buffer) aBuff =
new NCollection_Buffer(NCollection_BaseAllocator::CommonBaseAllocator(), aLength);
theSource.GetByteArray(aBuff->ChangeData(), aLength);
theTexture = new Image_Texture(aBuff, aStr);
} }
//======================================================================= //=======================================================================

View File

@@ -597,7 +597,7 @@ TopoDS_Edge ChFi2d_FilletAlgo::Result(const gp_Pnt& thePoint, TopoDS_Edge& theEd
gp_Vec aCircleDir; gp_Vec aCircleDir;
aCircle->D1(aParam1, aPoint1, aCircleDir); aCircle->D1(aParam1, aPoint1, aCircleDir);
if ((aCircleDir.Angle(aDir) > M_PI / 2.0) ? !aIsOut : aIsOut) if ((aCircleDir.Angle(aDir) > M_PI / 2.0) ^ aIsOut)
aStart = aNearest->getParam(); aStart = aNearest->getParam();
else else
anEnd = aNearest->getParam(); anEnd = aNearest->getParam();
@@ -619,7 +619,7 @@ TopoDS_Edge ChFi2d_FilletAlgo::Result(const gp_Pnt& thePoint, TopoDS_Edge& theEd
aCircle->D1(aParam2, aPoint2, aCircleDir); aCircle->D1(aParam2, aPoint2, aCircleDir);
if ((aCircleDir.Angle(aDir) > M_PI / 2.0) ? aIsOut : !aIsOut) if ((aCircleDir.Angle(aDir) > M_PI / 2.0) ^ (!aIsOut))
aStart = aNearest->getParam2(); aStart = aNearest->getParam2();
else else
anEnd = aNearest->getParam2(); anEnd = aNearest->getParam2();

View File

@@ -1236,11 +1236,8 @@ void ComputeInternalPoints
// std::cout << "Changement de signe detecte" << std::endl; // std::cout << "Changement de signe detecte" << std::endl;
solution = Standard_False; solution = Standard_False;
while (!solution) { while (!solution) {
// Selecting the middle point between XInf and XSup leads situation, where X values almost do not change. X(1) = (XInf(1) + XSup(1)) /2.;
// To prevent this situation, select shifted point instead of middle. X(2) = (XInf(2) + XSup(2)) /2.;
const Standard_Real aCoef = 2. / 3.;
X(1) = XInf(1) + aCoef * (XSup(1) - XInf(1));
X(2) = XInf(2) + aCoef * (XSup(2) - XInf(2));
rsnld.Perform(SFunc,X,infb,supb); rsnld.Perform(SFunc,X,infb,supb);
if (!rsnld.IsDone()) { if (!rsnld.IsDone()) {

View File

@@ -23,7 +23,6 @@
#include <gp_Ax1.hxx> #include <gp_Ax1.hxx>
#include <gp_Ax2d.hxx> #include <gp_Ax2d.hxx>
#include <StdFail_NotDone.hxx> #include <StdFail_NotDone.hxx>
#include <StepData_Factors.hxx>
#include <StepGeom_Axis1Placement.hxx> #include <StepGeom_Axis1Placement.hxx>
#include <StepGeom_CartesianPoint.hxx> #include <StepGeom_CartesianPoint.hxx>
#include <StepGeom_Direction.hxx> #include <StepGeom_Direction.hxx>
@@ -32,9 +31,7 @@
//============================================================================= //=============================================================================
// Creation d' un axis1_placement de prostep a partir d' un Ax1 de gp // Creation d' un axis1_placement de prostep a partir d' un Ax1 de gp
//============================================================================= //=============================================================================
GeomToStep_MakeAxis1Placement::GeomToStep_MakeAxis1Placement GeomToStep_MakeAxis1Placement::GeomToStep_MakeAxis1Placement( const gp_Ax1& A)
( const gp_Ax1& A,
const StepData_Factors& theLocalFactors)
{ {
#include "GeomToStep_MakeAxis1Placement_gen.pxx" #include "GeomToStep_MakeAxis1Placement_gen.pxx"
} }
@@ -42,9 +39,7 @@ GeomToStep_MakeAxis1Placement::GeomToStep_MakeAxis1Placement
// Creation d' un axis1_placement de prostep a partir d' un Ax2d de gp // Creation d' un axis1_placement de prostep a partir d' un Ax2d de gp
//============================================================================= //=============================================================================
GeomToStep_MakeAxis1Placement::GeomToStep_MakeAxis1Placement GeomToStep_MakeAxis1Placement::GeomToStep_MakeAxis1Placement( const gp_Ax2d& A)
( const gp_Ax2d& A,
const StepData_Factors& theLocalFactors)
{ {
#include "GeomToStep_MakeAxis1Placement_gen.pxx" #include "GeomToStep_MakeAxis1Placement_gen.pxx"
} }
@@ -55,8 +50,7 @@ GeomToStep_MakeAxis1Placement::GeomToStep_MakeAxis1Placement
//============================================================================= //=============================================================================
GeomToStep_MakeAxis1Placement::GeomToStep_MakeAxis1Placement GeomToStep_MakeAxis1Placement::GeomToStep_MakeAxis1Placement
( const Handle(Geom_Axis1Placement)& Axis1, ( const Handle(Geom_Axis1Placement)& Axis1)
const StepData_Factors& theLocalFactors)
{ {
gp_Ax1 A; gp_Ax1 A;
A = Axis1->Ax1(); A = Axis1->Ax1();
@@ -69,8 +63,7 @@ GeomToStep_MakeAxis1Placement::GeomToStep_MakeAxis1Placement
//============================================================================= //=============================================================================
GeomToStep_MakeAxis1Placement::GeomToStep_MakeAxis1Placement GeomToStep_MakeAxis1Placement::GeomToStep_MakeAxis1Placement
( const Handle(Geom2d_AxisPlacement)& Axis1, ( const Handle(Geom2d_AxisPlacement)& Axis1)
const StepData_Factors& theLocalFactors)
{ {
gp_Ax2d A; gp_Ax2d A;
A = Axis1->Ax2d(); A = Axis1->Ax2d();

View File

@@ -22,8 +22,6 @@
#include <Standard_Handle.hxx> #include <Standard_Handle.hxx>
#include <GeomToStep_Root.hxx> #include <GeomToStep_Root.hxx>
class StepData_Factors;
class StepGeom_Axis1Placement; class StepGeom_Axis1Placement;
class gp_Ax1; class gp_Ax1;
class gp_Ax2d; class gp_Ax2d;
@@ -42,17 +40,13 @@ public:
DEFINE_STANDARD_ALLOC DEFINE_STANDARD_ALLOC
Standard_EXPORT GeomToStep_MakeAxis1Placement(const gp_Ax1& A, Standard_EXPORT GeomToStep_MakeAxis1Placement(const gp_Ax1& A);
const StepData_Factors& theLocalFactors);
Standard_EXPORT GeomToStep_MakeAxis1Placement(const gp_Ax2d& A, Standard_EXPORT GeomToStep_MakeAxis1Placement(const gp_Ax2d& A);
const StepData_Factors& theLocalFactors);
Standard_EXPORT GeomToStep_MakeAxis1Placement(const Handle(Geom_Axis1Placement)& A, Standard_EXPORT GeomToStep_MakeAxis1Placement(const Handle(Geom_Axis1Placement)& A);
const StepData_Factors& theLocalFactors);
Standard_EXPORT GeomToStep_MakeAxis1Placement(const Handle(Geom2d_AxisPlacement)& A, Standard_EXPORT GeomToStep_MakeAxis1Placement(const Handle(Geom2d_AxisPlacement)& A);
const StepData_Factors& theLocalFactors);
Standard_EXPORT const Handle(StepGeom_Axis1Placement)& Value() const; Standard_EXPORT const Handle(StepGeom_Axis1Placement)& Value() const;

View File

@@ -18,7 +18,7 @@ Handle(StepGeom_Axis1Placement) Axe = new StepGeom_Axis1Placement;
Handle(StepGeom_CartesianPoint) P; Handle(StepGeom_CartesianPoint) P;
Handle(StepGeom_Direction) D; Handle(StepGeom_Direction) D;
GeomToStep_MakeCartesianPoint MkPoint(A.Location(), theLocalFactors.LengthFactor()); GeomToStep_MakeCartesianPoint MkPoint(A.Location());
GeomToStep_MakeDirection MkDir(A.Direction()); GeomToStep_MakeDirection MkDir(A.Direction());
P = MkPoint.Value(); P = MkPoint.Value();

View File

@@ -21,7 +21,6 @@
#include <gp_Ax2.hxx> #include <gp_Ax2.hxx>
#include <gp_Ax22d.hxx> #include <gp_Ax22d.hxx>
#include <StdFail_NotDone.hxx> #include <StdFail_NotDone.hxx>
#include <StepData_Factors.hxx>
#include <StepGeom_Axis2Placement2d.hxx> #include <StepGeom_Axis2Placement2d.hxx>
#include <StepGeom_CartesianPoint.hxx> #include <StepGeom_CartesianPoint.hxx>
#include <StepGeom_Direction.hxx> #include <StepGeom_Direction.hxx>
@@ -31,14 +30,13 @@
// Creation d' un axis2_placement_2d de prostep a partir d' un Ax2 de gp // Creation d' un axis2_placement_2d de prostep a partir d' un Ax2 de gp
//============================================================================= //=============================================================================
GeomToStep_MakeAxis2Placement2d::GeomToStep_MakeAxis2Placement2d GeomToStep_MakeAxis2Placement2d::GeomToStep_MakeAxis2Placement2d
( const gp_Ax2& A, ( const gp_Ax2& A)
const StepData_Factors& theLocalFactors)
{ {
Handle(StepGeom_Axis2Placement2d) Axe; Handle(StepGeom_Axis2Placement2d) Axe;
Handle(StepGeom_CartesianPoint) P; Handle(StepGeom_CartesianPoint) P;
Handle(StepGeom_Direction) D; Handle(StepGeom_Direction) D;
GeomToStep_MakeCartesianPoint MkPoint(A.Location(), theLocalFactors.LengthFactor()); GeomToStep_MakeCartesianPoint MkPoint(A.Location());
GeomToStep_MakeDirection MkDir(A.Direction()); GeomToStep_MakeDirection MkDir(A.Direction());
P = MkPoint.Value(); P = MkPoint.Value();
@@ -58,14 +56,13 @@ GeomToStep_MakeAxis2Placement2d::GeomToStep_MakeAxis2Placement2d
//============================================================================= //=============================================================================
GeomToStep_MakeAxis2Placement2d::GeomToStep_MakeAxis2Placement2d GeomToStep_MakeAxis2Placement2d::GeomToStep_MakeAxis2Placement2d
( const gp_Ax22d& A, ( const gp_Ax22d& A)
const StepData_Factors& theLocalFactors)
{ {
Handle(StepGeom_Axis2Placement2d) Axe; Handle(StepGeom_Axis2Placement2d) Axe;
Handle(StepGeom_CartesianPoint) P; Handle(StepGeom_CartesianPoint) P;
Handle(StepGeom_Direction) D1; Handle(StepGeom_Direction) D1;
GeomToStep_MakeCartesianPoint MkPoint(A.Location(), theLocalFactors.LengthFactor()); GeomToStep_MakeCartesianPoint MkPoint(A.Location());
GeomToStep_MakeDirection MkDir(A.XDirection()); GeomToStep_MakeDirection MkDir(A.XDirection());
P = MkPoint.Value(); P = MkPoint.Value();

View File

@@ -22,8 +22,6 @@
#include <Standard_Handle.hxx> #include <Standard_Handle.hxx>
#include <GeomToStep_Root.hxx> #include <GeomToStep_Root.hxx>
class StepData_Factors;
class StepGeom_Axis2Placement2d; class StepGeom_Axis2Placement2d;
class gp_Ax2; class gp_Ax2;
class gp_Ax22d; class gp_Ax22d;
@@ -40,11 +38,9 @@ public:
DEFINE_STANDARD_ALLOC DEFINE_STANDARD_ALLOC
Standard_EXPORT GeomToStep_MakeAxis2Placement2d(const gp_Ax2& A, Standard_EXPORT GeomToStep_MakeAxis2Placement2d(const gp_Ax2& A);
const StepData_Factors& theLocalFactors);
Standard_EXPORT GeomToStep_MakeAxis2Placement2d(const gp_Ax22d& A, Standard_EXPORT GeomToStep_MakeAxis2Placement2d(const gp_Ax22d& A);
const StepData_Factors& theLocalFactors);
Standard_EXPORT const Handle(StepGeom_Axis2Placement2d)& Value() const; Standard_EXPORT const Handle(StepGeom_Axis2Placement2d)& Value() const;

View File

@@ -22,20 +22,19 @@
#include <gp_Ax3.hxx> #include <gp_Ax3.hxx>
#include <gp_Trsf.hxx> #include <gp_Trsf.hxx>
#include <StdFail_NotDone.hxx> #include <StdFail_NotDone.hxx>
#include <StepData_Factors.hxx>
#include <StepGeom_Axis2Placement3d.hxx> #include <StepGeom_Axis2Placement3d.hxx>
#include <StepGeom_CartesianPoint.hxx> #include <StepGeom_CartesianPoint.hxx>
#include <StepGeom_Direction.hxx> #include <StepGeom_Direction.hxx>
#include <TCollection_HAsciiString.hxx> #include <TCollection_HAsciiString.hxx>
static Handle(StepGeom_Axis2Placement3d) MakeAxis2Placement3d static Handle(StepGeom_Axis2Placement3d) MakeAxis2Placement3d
(const gp_Pnt& O, const gp_Dir& D, const gp_Dir& X, const Standard_CString nom, Standard_Real aFactor) (const gp_Pnt& O, const gp_Dir& D, const gp_Dir& X, const Standard_CString nom)
{ {
Handle(StepGeom_Axis2Placement3d) Axe; Handle(StepGeom_Axis2Placement3d) Axe;
Handle(StepGeom_CartesianPoint) P; Handle(StepGeom_CartesianPoint) P;
Handle(StepGeom_Direction) D1, D2; Handle(StepGeom_Direction) D1, D2;
GeomToStep_MakeCartesianPoint MkPoint(O, aFactor); GeomToStep_MakeCartesianPoint MkPoint(O);
GeomToStep_MakeDirection MkDir1(D); GeomToStep_MakeDirection MkDir1(D);
GeomToStep_MakeDirection MkDir2(X); GeomToStep_MakeDirection MkDir2(X);
@@ -56,14 +55,13 @@ static Handle(StepGeom_Axis2Placement3d) MakeAxis2Placement3d
// Creation d' un axis2_placement_3d a l origine // Creation d' un axis2_placement_3d a l origine
//============================================================================= //=============================================================================
GeomToStep_MakeAxis2Placement3d::GeomToStep_MakeAxis2Placement3d ( GeomToStep_MakeAxis2Placement3d::GeomToStep_MakeAxis2Placement3d ( )
const StepData_Factors& theLocalFactors)
{ {
gp_Ax2 A (gp_Pnt(0.,0.,0.), gp_Dir (0.,0.,1.), gp_Dir (1.,0.,0.)); gp_Ax2 A (gp_Pnt(0.,0.,0.), gp_Dir (0.,0.,1.), gp_Dir (1.,0.,0.));
// le reste inchange // le reste inchange
Handle(StepGeom_Axis2Placement3d) Axe = MakeAxis2Placement3d Handle(StepGeom_Axis2Placement3d) Axe = MakeAxis2Placement3d
(A.Location(), A.Direction(), A.XDirection(), "", theLocalFactors.LengthFactor()); (A.Location(), A.Direction(), A.XDirection(), "");
theAxis2Placement3d = Axe; theAxis2Placement3d = Axe;
done = Standard_True; done = Standard_True;
} }
@@ -72,12 +70,11 @@ GeomToStep_MakeAxis2Placement3d::GeomToStep_MakeAxis2Placement3d (
// Creation d' un axis2_placement_3d de prostep a partir d' un Ax2 de gp // Creation d' un axis2_placement_3d de prostep a partir d' un Ax2 de gp
//============================================================================= //=============================================================================
GeomToStep_MakeAxis2Placement3d::GeomToStep_MakeAxis2Placement3d( GeomToStep_MakeAxis2Placement3d::GeomToStep_MakeAxis2Placement3d( const gp_Ax2&
const gp_Ax2& A, A)
const StepData_Factors& theLocalFactors)
{ {
Handle(StepGeom_Axis2Placement3d) Axe = MakeAxis2Placement3d Handle(StepGeom_Axis2Placement3d) Axe = MakeAxis2Placement3d
(A.Location(), A.Direction(), A.XDirection(), "", theLocalFactors.LengthFactor()); (A.Location(), A.Direction(), A.XDirection(), "");
theAxis2Placement3d = Axe; theAxis2Placement3d = Axe;
done = Standard_True; done = Standard_True;
} }
@@ -86,12 +83,11 @@ GeomToStep_MakeAxis2Placement3d::GeomToStep_MakeAxis2Placement3d(
// Creation d' un axis2_placement_3d de prostep a partir d' un Ax3 de gp // Creation d' un axis2_placement_3d de prostep a partir d' un Ax3 de gp
//============================================================================= //=============================================================================
GeomToStep_MakeAxis2Placement3d::GeomToStep_MakeAxis2Placement3d( GeomToStep_MakeAxis2Placement3d::GeomToStep_MakeAxis2Placement3d
const gp_Ax3& A, ( const gp_Ax3& A)
const StepData_Factors& theLocalFactors)
{ {
Handle(StepGeom_Axis2Placement3d) Axe = MakeAxis2Placement3d Handle(StepGeom_Axis2Placement3d) Axe = MakeAxis2Placement3d
(A.Location(), A.Direction(), A.XDirection(), "", theLocalFactors.LengthFactor()); (A.Location(), A.Direction(), A.XDirection(), "");
theAxis2Placement3d = Axe; theAxis2Placement3d = Axe;
done = Standard_True; done = Standard_True;
} }
@@ -100,16 +96,15 @@ GeomToStep_MakeAxis2Placement3d::GeomToStep_MakeAxis2Placement3d(
// Creation d' un axis2_placement_3d de prostep a partir d' un Trsf de gp // Creation d' un axis2_placement_3d de prostep a partir d' un Trsf de gp
//============================================================================= //=============================================================================
GeomToStep_MakeAxis2Placement3d::GeomToStep_MakeAxis2Placement3d( GeomToStep_MakeAxis2Placement3d::GeomToStep_MakeAxis2Placement3d
const gp_Trsf& T, ( const gp_Trsf& T)
const StepData_Factors& theLocalFactors)
{ {
gp_Ax2 A (gp_Pnt(0.,0.,0.), gp_Dir (0.,0.,1.), gp_Dir (1.,0.,0.)); gp_Ax2 A (gp_Pnt(0.,0.,0.), gp_Dir (0.,0.,1.), gp_Dir (1.,0.,0.));
A.Transform (T); A.Transform (T);
// le reste inchange // le reste inchange
Handle(StepGeom_Axis2Placement3d) Axe = MakeAxis2Placement3d Handle(StepGeom_Axis2Placement3d) Axe = MakeAxis2Placement3d
(A.Location(), A.Direction(), A.XDirection(), "", theLocalFactors.LengthFactor()); (A.Location(), A.Direction(), A.XDirection(), "");
theAxis2Placement3d = Axe; theAxis2Placement3d = Axe;
done = Standard_True; done = Standard_True;
} }
@@ -119,15 +114,14 @@ GeomToStep_MakeAxis2Placement3d::GeomToStep_MakeAxis2Placement3d(
// de Geom // de Geom
//============================================================================= //=============================================================================
GeomToStep_MakeAxis2Placement3d::GeomToStep_MakeAxis2Placement3d( GeomToStep_MakeAxis2Placement3d::GeomToStep_MakeAxis2Placement3d
const Handle(Geom_Axis2Placement)& Axis2, ( const Handle(Geom_Axis2Placement)& Axis2)
const StepData_Factors& theLocalFactors)
{ {
gp_Ax2 A; gp_Ax2 A;
A = Axis2->Ax2(); A = Axis2->Ax2();
Handle(StepGeom_Axis2Placement3d) Axe = MakeAxis2Placement3d Handle(StepGeom_Axis2Placement3d) Axe = MakeAxis2Placement3d
(A.Location(), A.Direction(), A.XDirection(), "", theLocalFactors.LengthFactor()); (A.Location(), A.Direction(), A.XDirection(), "");
theAxis2Placement3d = Axe; theAxis2Placement3d = Axe;
done = Standard_True; done = Standard_True;
} }

View File

@@ -22,8 +22,6 @@
#include <Standard_Handle.hxx> #include <Standard_Handle.hxx>
#include <GeomToStep_Root.hxx> #include <GeomToStep_Root.hxx>
#include <StepData_StepModel.hxx>
class StepData_Factors;
class StepGeom_Axis2Placement3d; class StepGeom_Axis2Placement3d;
class gp_Ax2; class gp_Ax2;
class gp_Ax3; class gp_Ax3;
@@ -42,19 +40,15 @@ public:
DEFINE_STANDARD_ALLOC DEFINE_STANDARD_ALLOC
Standard_EXPORT GeomToStep_MakeAxis2Placement3d(const StepData_Factors& theLocalFactors); Standard_EXPORT GeomToStep_MakeAxis2Placement3d();
Standard_EXPORT GeomToStep_MakeAxis2Placement3d(const gp_Ax2& A, Standard_EXPORT GeomToStep_MakeAxis2Placement3d(const gp_Ax2& A);
const StepData_Factors& theLocalFactors);
Standard_EXPORT GeomToStep_MakeAxis2Placement3d(const gp_Ax3& A, Standard_EXPORT GeomToStep_MakeAxis2Placement3d(const gp_Ax3& A);
const StepData_Factors& theLocalFactors);
Standard_EXPORT GeomToStep_MakeAxis2Placement3d(const gp_Trsf& T, Standard_EXPORT GeomToStep_MakeAxis2Placement3d(const gp_Trsf& T);
const StepData_Factors& theLocalFactors);
Standard_EXPORT GeomToStep_MakeAxis2Placement3d(const Handle(Geom_Axis2Placement)& A, Standard_EXPORT GeomToStep_MakeAxis2Placement3d(const Handle(Geom_Axis2Placement)& A);
const StepData_Factors& theLocalFactors);
Standard_EXPORT const Handle(StepGeom_Axis2Placement3d)& Value() const; Standard_EXPORT const Handle(StepGeom_Axis2Placement3d)& Value() const;

View File

@@ -21,7 +21,6 @@
#include <GeomToStep_MakeBSplineCurveWithKnots.hxx> #include <GeomToStep_MakeBSplineCurveWithKnots.hxx>
#include <GeomToStep_MakeCartesianPoint.hxx> #include <GeomToStep_MakeCartesianPoint.hxx>
#include <StdFail_NotDone.hxx> #include <StdFail_NotDone.hxx>
#include <StepData_Factors.hxx>
#include <StepGeom_BSplineCurveWithKnots.hxx> #include <StepGeom_BSplineCurveWithKnots.hxx>
#include <StepGeom_CartesianPoint.hxx> #include <StepGeom_CartesianPoint.hxx>
#include <StepGeom_HArray1OfCartesianPoint.hxx> #include <StepGeom_HArray1OfCartesianPoint.hxx>
@@ -36,9 +35,10 @@
// Creation d' une bspline_curve_with_knots de // Creation d' une bspline_curve_with_knots de
// prostep a partir d' une BSplineCurve de Geom // prostep a partir d' une BSplineCurve de Geom
//============================================================================= //=============================================================================
GeomToStep_MakeBSplineCurveWithKnots::GeomToStep_MakeBSplineCurveWithKnots GeomToStep_MakeBSplineCurveWithKnots::
( const Handle(Geom_BSplineCurve)& BS, GeomToStep_MakeBSplineCurveWithKnots( const
const StepData_Factors& theLocalFactors) Handle(Geom_BSplineCurve)& BS )
{ {
#define Array1OfPnt_gen TColgp_Array1OfPnt #define Array1OfPnt_gen TColgp_Array1OfPnt
#include "GeomToStep_MakeBSplineCurveWithKnots_gen.pxx" #include "GeomToStep_MakeBSplineCurveWithKnots_gen.pxx"
@@ -49,9 +49,10 @@ GeomToStep_MakeBSplineCurveWithKnots::GeomToStep_MakeBSplineCurveWithKnots
// prostep a partir d' une BSplineCurve de Geom2d // prostep a partir d' une BSplineCurve de Geom2d
//============================================================================= //=============================================================================
GeomToStep_MakeBSplineCurveWithKnots::GeomToStep_MakeBSplineCurveWithKnots GeomToStep_MakeBSplineCurveWithKnots::
( const Handle(Geom2d_BSplineCurve)& BS, GeomToStep_MakeBSplineCurveWithKnots( const
const StepData_Factors& theLocalFactors) Handle(Geom2d_BSplineCurve)& BS )
{ {
#define Array1OfPnt_gen TColgp_Array1OfPnt2d #define Array1OfPnt_gen TColgp_Array1OfPnt2d
#include "GeomToStep_MakeBSplineCurveWithKnots_gen.pxx" #include "GeomToStep_MakeBSplineCurveWithKnots_gen.pxx"

View File

@@ -22,10 +22,9 @@
#include <Standard_Handle.hxx> #include <Standard_Handle.hxx>
#include <GeomToStep_Root.hxx> #include <GeomToStep_Root.hxx>
class StepGeom_BSplineCurveWithKnots;
class Geom_BSplineCurve; class Geom_BSplineCurve;
class Geom2d_BSplineCurve; class Geom2d_BSplineCurve;
class StepData_Factors;
class StepGeom_BSplineCurveWithKnots;
//! This class implements the mapping between classes //! This class implements the mapping between classes
@@ -40,11 +39,9 @@ public:
DEFINE_STANDARD_ALLOC DEFINE_STANDARD_ALLOC
Standard_EXPORT GeomToStep_MakeBSplineCurveWithKnots(const Handle(Geom_BSplineCurve)& Bsplin, Standard_EXPORT GeomToStep_MakeBSplineCurveWithKnots(const Handle(Geom_BSplineCurve)& Bsplin);
const StepData_Factors& theLocalFactors);
Standard_EXPORT GeomToStep_MakeBSplineCurveWithKnots(const Handle(Geom2d_BSplineCurve)& Bsplin, Standard_EXPORT GeomToStep_MakeBSplineCurveWithKnots(const Handle(Geom2d_BSplineCurve)& Bsplin);
const StepData_Factors& theLocalFactors);
Standard_EXPORT const Handle(StepGeom_BSplineCurveWithKnots)& Value() const; Standard_EXPORT const Handle(StepGeom_BSplineCurveWithKnots)& Value() const;

View File

@@ -21,7 +21,6 @@
#include <GeomToStep_MakeBSplineCurveWithKnotsAndRationalBSplineCurve.hxx> #include <GeomToStep_MakeBSplineCurveWithKnotsAndRationalBSplineCurve.hxx>
#include <GeomToStep_MakeCartesianPoint.hxx> #include <GeomToStep_MakeCartesianPoint.hxx>
#include <StdFail_NotDone.hxx> #include <StdFail_NotDone.hxx>
#include <StepData_Factors.hxx>
#include <StepGeom_BSplineCurveWithKnotsAndRationalBSplineCurve.hxx> #include <StepGeom_BSplineCurveWithKnotsAndRationalBSplineCurve.hxx>
#include <StepGeom_CartesianPoint.hxx> #include <StepGeom_CartesianPoint.hxx>
#include <StepGeom_HArray1OfCartesianPoint.hxx> #include <StepGeom_HArray1OfCartesianPoint.hxx>
@@ -38,7 +37,8 @@
//============================================================================= //=============================================================================
GeomToStep_MakeBSplineCurveWithKnotsAndRationalBSplineCurve:: GeomToStep_MakeBSplineCurveWithKnotsAndRationalBSplineCurve::
GeomToStep_MakeBSplineCurveWithKnotsAndRationalBSplineCurve( const GeomToStep_MakeBSplineCurveWithKnotsAndRationalBSplineCurve( const
Handle(Geom_BSplineCurve)& BS, const StepData_Factors& theLocalFactors) Handle(Geom_BSplineCurve)& BS )
{ {
#define Array1OfPnt_gen TColgp_Array1OfPnt #define Array1OfPnt_gen TColgp_Array1OfPnt
#include "GeomToStep_MakeBSplineCurveWithKnotsAndRationalBSplineCurve_gen.pxx" #include "GeomToStep_MakeBSplineCurveWithKnotsAndRationalBSplineCurve_gen.pxx"
@@ -51,7 +51,7 @@ GeomToStep_MakeBSplineCurveWithKnotsAndRationalBSplineCurve::
GeomToStep_MakeBSplineCurveWithKnotsAndRationalBSplineCurve:: GeomToStep_MakeBSplineCurveWithKnotsAndRationalBSplineCurve::
GeomToStep_MakeBSplineCurveWithKnotsAndRationalBSplineCurve( const GeomToStep_MakeBSplineCurveWithKnotsAndRationalBSplineCurve( const
Handle(Geom2d_BSplineCurve)& BS, const StepData_Factors& theLocalFactors) Handle(Geom2d_BSplineCurve)& BS )
{ {
#define Array1OfPnt_gen TColgp_Array1OfPnt2d #define Array1OfPnt_gen TColgp_Array1OfPnt2d

View File

@@ -22,8 +22,6 @@
#include <Standard_Handle.hxx> #include <Standard_Handle.hxx>
#include <GeomToStep_Root.hxx> #include <GeomToStep_Root.hxx>
class StepData_Factors;
class StepGeom_BSplineCurveWithKnotsAndRationalBSplineCurve; class StepGeom_BSplineCurveWithKnotsAndRationalBSplineCurve;
class Geom_BSplineCurve; class Geom_BSplineCurve;
class Geom2d_BSplineCurve; class Geom2d_BSplineCurve;
@@ -41,11 +39,9 @@ public:
DEFINE_STANDARD_ALLOC DEFINE_STANDARD_ALLOC
Standard_EXPORT GeomToStep_MakeBSplineCurveWithKnotsAndRationalBSplineCurve(const Handle(Geom_BSplineCurve)& Bsplin, Standard_EXPORT GeomToStep_MakeBSplineCurveWithKnotsAndRationalBSplineCurve(const Handle(Geom_BSplineCurve)& Bsplin);
const StepData_Factors& theLocalFactors);
Standard_EXPORT GeomToStep_MakeBSplineCurveWithKnotsAndRationalBSplineCurve(const Handle(Geom2d_BSplineCurve)& Bsplin, Standard_EXPORT GeomToStep_MakeBSplineCurveWithKnotsAndRationalBSplineCurve(const Handle(Geom2d_BSplineCurve)& Bsplin);
const StepData_Factors& theLocalFactors);
Standard_EXPORT const Handle(StepGeom_BSplineCurveWithKnotsAndRationalBSplineCurve)& Value() const; Standard_EXPORT const Handle(StepGeom_BSplineCurveWithKnotsAndRationalBSplineCurve)& Value() const;

View File

@@ -33,7 +33,7 @@ Handle(StepGeom_BSplineCurveWithKnotsAndRationalBSplineCurve) BSWK;
BS->Poles(P); BS->Poles(P);
Listpoints = new StepGeom_HArray1OfCartesianPoint(1,N); Listpoints = new StepGeom_HArray1OfCartesianPoint(1,N);
for ( i=P.Lower(); i<=P.Upper(); i++) { for ( i=P.Lower(); i<=P.Upper(); i++) {
GeomToStep_MakeCartesianPoint MkPoint(P.Value(i), theLocalFactors.LengthFactor()); GeomToStep_MakeCartesianPoint MkPoint(P.Value(i));
Pt = MkPoint.Value(); Pt = MkPoint.Value();
Listpoints->SetValue(i, Pt); Listpoints->SetValue(i, Pt);
} }

View File

@@ -33,7 +33,7 @@ Handle(StepGeom_BSplineCurveWithKnots) BSWK;
BS->Poles(P); BS->Poles(P);
Listpoints = new StepGeom_HArray1OfCartesianPoint(1,N); Listpoints = new StepGeom_HArray1OfCartesianPoint(1,N);
for ( i=P.Lower(); i<=P.Upper(); i++) { for ( i=P.Lower(); i<=P.Upper(); i++) {
GeomToStep_MakeCartesianPoint MkPoint(P.Value(i), theLocalFactors.LengthFactor()); GeomToStep_MakeCartesianPoint MkPoint(P.Value(i));
Pt = MkPoint.Value(); Pt = MkPoint.Value();
Listpoints->SetValue(i, Pt); Listpoints->SetValue(i, Pt);
} }

View File

@@ -20,7 +20,6 @@
#include <GeomToStep_MakeBSplineSurfaceWithKnots.hxx> #include <GeomToStep_MakeBSplineSurfaceWithKnots.hxx>
#include <GeomToStep_MakeCartesianPoint.hxx> #include <GeomToStep_MakeCartesianPoint.hxx>
#include <StdFail_NotDone.hxx> #include <StdFail_NotDone.hxx>
#include <StepData_Factors.hxx>
#include <StepGeom_BSplineSurfaceWithKnots.hxx> #include <StepGeom_BSplineSurfaceWithKnots.hxx>
#include <StepGeom_CartesianPoint.hxx> #include <StepGeom_CartesianPoint.hxx>
#include <StepGeom_HArray2OfCartesianPoint.hxx> #include <StepGeom_HArray2OfCartesianPoint.hxx>
@@ -35,9 +34,10 @@
// Creation d' une bspline_Surface_with_knots_and_rational_bspline_Surface de // Creation d' une bspline_Surface_with_knots_and_rational_bspline_Surface de
// prostep a partir d' une BSplineSurface de Geom // prostep a partir d' une BSplineSurface de Geom
//============================================================================= //=============================================================================
GeomToStep_MakeBSplineSurfaceWithKnots::GeomToStep_MakeBSplineSurfaceWithKnots GeomToStep_MakeBSplineSurfaceWithKnots::
( const Handle(Geom_BSplineSurface)& BS, GeomToStep_MakeBSplineSurfaceWithKnots( const
const StepData_Factors& theLocalFactors) Handle(Geom_BSplineSurface)& BS )
{ {
Handle(StepGeom_BSplineSurfaceWithKnots) BSWK; Handle(StepGeom_BSplineSurfaceWithKnots) BSWK;
Standard_Integer aUDegree, aVDegree, NU, NV, i, j, NUknots, NVknots, itampon; Standard_Integer aUDegree, aVDegree, NU, NV, i, j, NUknots, NVknots, itampon;
@@ -62,7 +62,7 @@ GeomToStep_MakeBSplineSurfaceWithKnots::GeomToStep_MakeBSplineSurfaceWithKnots
aControlPointsList = new StepGeom_HArray2OfCartesianPoint(1,NU,1,NV); aControlPointsList = new StepGeom_HArray2OfCartesianPoint(1,NU,1,NV);
for ( i=P.LowerRow(); i<=P.UpperRow(); i++) { for ( i=P.LowerRow(); i<=P.UpperRow(); i++) {
for ( j=P.LowerCol(); j<=P.UpperCol(); j++) { for ( j=P.LowerCol(); j<=P.UpperCol(); j++) {
GeomToStep_MakeCartesianPoint MkPoint(P.Value(i,j), theLocalFactors.LengthFactor()); GeomToStep_MakeCartesianPoint MkPoint(P.Value(i,j));
Pt = MkPoint.Value(); Pt = MkPoint.Value();
aControlPointsList->SetValue(i, j, Pt); aControlPointsList->SetValue(i, j, Pt);
} }

View File

@@ -22,7 +22,6 @@
#include <Standard_Handle.hxx> #include <Standard_Handle.hxx>
#include <GeomToStep_Root.hxx> #include <GeomToStep_Root.hxx>
class StepData_Factors;
class StepGeom_BSplineSurfaceWithKnots; class StepGeom_BSplineSurfaceWithKnots;
class Geom_BSplineSurface; class Geom_BSplineSurface;
@@ -39,8 +38,7 @@ public:
DEFINE_STANDARD_ALLOC DEFINE_STANDARD_ALLOC
Standard_EXPORT GeomToStep_MakeBSplineSurfaceWithKnots(const Handle(Geom_BSplineSurface)& Bsplin, Standard_EXPORT GeomToStep_MakeBSplineSurfaceWithKnots(const Handle(Geom_BSplineSurface)& Bsplin);
const StepData_Factors& theLocalFactors);
Standard_EXPORT const Handle(StepGeom_BSplineSurfaceWithKnots)& Value() const; Standard_EXPORT const Handle(StepGeom_BSplineSurfaceWithKnots)& Value() const;

View File

@@ -21,7 +21,6 @@
#include <GeomToStep_MakeBSplineSurfaceWithKnotsAndRationalBSplineSurface.hxx> #include <GeomToStep_MakeBSplineSurfaceWithKnotsAndRationalBSplineSurface.hxx>
#include <GeomToStep_MakeCartesianPoint.hxx> #include <GeomToStep_MakeCartesianPoint.hxx>
#include <StdFail_NotDone.hxx> #include <StdFail_NotDone.hxx>
#include <StepData_Factors.hxx>
#include <StepGeom_BSplineSurfaceWithKnotsAndRationalBSplineSurface.hxx> #include <StepGeom_BSplineSurfaceWithKnotsAndRationalBSplineSurface.hxx>
#include <StepGeom_CartesianPoint.hxx> #include <StepGeom_CartesianPoint.hxx>
#include <StepGeom_HArray2OfCartesianPoint.hxx> #include <StepGeom_HArray2OfCartesianPoint.hxx>
@@ -38,7 +37,8 @@
//============================================================================= //=============================================================================
GeomToStep_MakeBSplineSurfaceWithKnotsAndRationalBSplineSurface:: GeomToStep_MakeBSplineSurfaceWithKnotsAndRationalBSplineSurface::
GeomToStep_MakeBSplineSurfaceWithKnotsAndRationalBSplineSurface( const GeomToStep_MakeBSplineSurfaceWithKnotsAndRationalBSplineSurface( const
Handle(Geom_BSplineSurface)& BS, const StepData_Factors& theLocalFactors) Handle(Geom_BSplineSurface)& BS )
{ {
Handle(StepGeom_BSplineSurfaceWithKnotsAndRationalBSplineSurface) BSWK; Handle(StepGeom_BSplineSurfaceWithKnotsAndRationalBSplineSurface) BSWK;
Standard_Integer aUDegree, aVDegree, NU, NV, i, j, NUknots, NVknots, itampon; Standard_Integer aUDegree, aVDegree, NU, NV, i, j, NUknots, NVknots, itampon;
@@ -63,7 +63,7 @@ GeomToStep_MakeBSplineSurfaceWithKnotsAndRationalBSplineSurface::
aControlPointsList = new StepGeom_HArray2OfCartesianPoint(1,NU,1,NV); aControlPointsList = new StepGeom_HArray2OfCartesianPoint(1,NU,1,NV);
for ( i=P.LowerRow(); i<=P.UpperRow(); i++) { for ( i=P.LowerRow(); i<=P.UpperRow(); i++) {
for ( j=P.LowerCol(); j<=P.UpperCol(); j++) { for ( j=P.LowerCol(); j<=P.UpperCol(); j++) {
GeomToStep_MakeCartesianPoint MkPoint(P.Value(i,j), theLocalFactors.LengthFactor()); GeomToStep_MakeCartesianPoint MkPoint(P.Value(i,j));
Pt = MkPoint.Value(); Pt = MkPoint.Value();
aControlPointsList->SetValue(i, j, Pt); aControlPointsList->SetValue(i, j, Pt);
} }

View File

@@ -22,8 +22,6 @@
#include <Standard_Handle.hxx> #include <Standard_Handle.hxx>
#include <GeomToStep_Root.hxx> #include <GeomToStep_Root.hxx>
class StepData_Factors;
class StepGeom_BSplineSurfaceWithKnotsAndRationalBSplineSurface; class StepGeom_BSplineSurfaceWithKnotsAndRationalBSplineSurface;
class Geom_BSplineSurface; class Geom_BSplineSurface;
@@ -40,8 +38,7 @@ public:
DEFINE_STANDARD_ALLOC DEFINE_STANDARD_ALLOC
Standard_EXPORT GeomToStep_MakeBSplineSurfaceWithKnotsAndRationalBSplineSurface(const Handle(Geom_BSplineSurface)& Bsplin, Standard_EXPORT GeomToStep_MakeBSplineSurfaceWithKnotsAndRationalBSplineSurface(const Handle(Geom_BSplineSurface)& Bsplin);
const StepData_Factors& theLocalFactors);
Standard_EXPORT const Handle(StepGeom_BSplineSurfaceWithKnotsAndRationalBSplineSurface)& Value() const; Standard_EXPORT const Handle(StepGeom_BSplineSurfaceWithKnotsAndRationalBSplineSurface)& Value() const;

View File

@@ -27,7 +27,6 @@
#include <GeomToStep_MakeBSplineCurveWithKnots.hxx> #include <GeomToStep_MakeBSplineCurveWithKnots.hxx>
#include <GeomToStep_MakeBSplineCurveWithKnotsAndRationalBSplineCurve.hxx> #include <GeomToStep_MakeBSplineCurveWithKnotsAndRationalBSplineCurve.hxx>
#include <StdFail_NotDone.hxx> #include <StdFail_NotDone.hxx>
#include <StepData_Factors.hxx>
#include <StepGeom_BoundedCurve.hxx> #include <StepGeom_BoundedCurve.hxx>
#include <StepGeom_BSplineCurveWithKnots.hxx> #include <StepGeom_BSplineCurveWithKnots.hxx>
#include <StepGeom_BSplineCurveWithKnotsAndRationalBSplineCurve.hxx> #include <StepGeom_BSplineCurveWithKnotsAndRationalBSplineCurve.hxx>
@@ -35,8 +34,7 @@
//============================================================================= //=============================================================================
// Creation d' une BoundedCurve de prostep a partir d' une BoundedCurve de Geom // Creation d' une BoundedCurve de prostep a partir d' une BoundedCurve de Geom
//============================================================================= //=============================================================================
GeomToStep_MakeBoundedCurve::GeomToStep_MakeBoundedCurve ( const Handle(Geom_BoundedCurve)& C, GeomToStep_MakeBoundedCurve::GeomToStep_MakeBoundedCurve ( const Handle(Geom_BoundedCurve)& C)
const StepData_Factors& theLocalFactors)
{ {
done = Standard_True; done = Standard_True;
@@ -50,11 +48,11 @@ GeomToStep_MakeBoundedCurve::GeomToStep_MakeBoundedCurve ( const Handle(Geom_Bou
Bspli = newBspli; Bspli = newBspli;
} }
if ( Bspli->IsRational() ) { if ( Bspli->IsRational() ) {
GeomToStep_MakeBSplineCurveWithKnotsAndRationalBSplineCurve MkRatBSplineC(Bspli, theLocalFactors); GeomToStep_MakeBSplineCurveWithKnotsAndRationalBSplineCurve MkRatBSplineC(Bspli);
theBoundedCurve = MkRatBSplineC.Value(); theBoundedCurve = MkRatBSplineC.Value();
} }
else { else {
GeomToStep_MakeBSplineCurveWithKnots MkBSplineC(Bspli, theLocalFactors); GeomToStep_MakeBSplineCurveWithKnots MkBSplineC(Bspli);
theBoundedCurve = MkBSplineC.Value(); theBoundedCurve = MkBSplineC.Value();
} }
} }
@@ -62,11 +60,11 @@ GeomToStep_MakeBoundedCurve::GeomToStep_MakeBoundedCurve ( const Handle(Geom_Bou
Handle(Geom_BezierCurve) Cur = Handle(Geom_BezierCurve)::DownCast(C); Handle(Geom_BezierCurve) Cur = Handle(Geom_BezierCurve)::DownCast(C);
Handle(Geom_BSplineCurve) Bspli = GeomConvert::CurveToBSplineCurve(Cur); Handle(Geom_BSplineCurve) Bspli = GeomConvert::CurveToBSplineCurve(Cur);
if ( Bspli->IsRational() ) { if ( Bspli->IsRational() ) {
GeomToStep_MakeBSplineCurveWithKnotsAndRationalBSplineCurve MkRatBSplineC(Bspli, theLocalFactors); GeomToStep_MakeBSplineCurveWithKnotsAndRationalBSplineCurve MkRatBSplineC(Bspli);
theBoundedCurve = MkRatBSplineC.Value(); theBoundedCurve = MkRatBSplineC.Value();
} }
else { else {
GeomToStep_MakeBSplineCurveWithKnots MkBSplineC(Bspli, theLocalFactors); GeomToStep_MakeBSplineCurveWithKnots MkBSplineC(Bspli);
theBoundedCurve = MkBSplineC.Value(); theBoundedCurve = MkBSplineC.Value();
} }
} }
@@ -83,8 +81,7 @@ GeomToStep_MakeBoundedCurve::GeomToStep_MakeBoundedCurve ( const Handle(Geom_Bou
// Geom2d // Geom2d
//============================================================================= //=============================================================================
GeomToStep_MakeBoundedCurve::GeomToStep_MakeBoundedCurve ( const Handle(Geom2d_BoundedCurve)& C, GeomToStep_MakeBoundedCurve::GeomToStep_MakeBoundedCurve ( const Handle(Geom2d_BoundedCurve)& C)
const StepData_Factors& theLocalFactors)
{ {
done = Standard_True; done = Standard_True;
if (C->IsKind(STANDARD_TYPE(Geom2d_BSplineCurve))) if (C->IsKind(STANDARD_TYPE(Geom2d_BSplineCurve)))
@@ -99,11 +96,11 @@ GeomToStep_MakeBoundedCurve::GeomToStep_MakeBoundedCurve ( const Handle(Geom2d_B
Bspli = newBspli; Bspli = newBspli;
} }
if ( Bspli->IsRational() ) { if ( Bspli->IsRational() ) {
GeomToStep_MakeBSplineCurveWithKnotsAndRationalBSplineCurve MkRatBSplineC(Bspli, theLocalFactors); GeomToStep_MakeBSplineCurveWithKnotsAndRationalBSplineCurve MkRatBSplineC(Bspli);
theBoundedCurve = MkRatBSplineC.Value(); theBoundedCurve = MkRatBSplineC.Value();
} }
else { else {
GeomToStep_MakeBSplineCurveWithKnots MkBSplineC(Bspli, theLocalFactors); GeomToStep_MakeBSplineCurveWithKnots MkBSplineC(Bspli);
theBoundedCurve = MkBSplineC.Value(); theBoundedCurve = MkBSplineC.Value();
} }
} }
@@ -111,7 +108,7 @@ GeomToStep_MakeBoundedCurve::GeomToStep_MakeBoundedCurve ( const Handle(Geom2d_B
Handle(Geom2d_BezierCurve) Cur = Handle(Geom2d_BezierCurve)::DownCast(C); Handle(Geom2d_BezierCurve) Cur = Handle(Geom2d_BezierCurve)::DownCast(C);
Handle(Geom2d_BSplineCurve) Bspli = Handle(Geom2d_BSplineCurve) Bspli =
Geom2dConvert::CurveToBSplineCurve(Cur); Geom2dConvert::CurveToBSplineCurve(Cur);
GeomToStep_MakeBSplineCurveWithKnots MkBSplineC(Bspli, theLocalFactors); GeomToStep_MakeBSplineCurveWithKnots MkBSplineC(Bspli);
theBoundedCurve = MkBSplineC.Value(); theBoundedCurve = MkBSplineC.Value();
} }
else else

View File

@@ -22,8 +22,6 @@
#include <Standard_Handle.hxx> #include <Standard_Handle.hxx>
#include <GeomToStep_Root.hxx> #include <GeomToStep_Root.hxx>
class StepData_Factors;
class StepGeom_BoundedCurve; class StepGeom_BoundedCurve;
class Geom_BoundedCurve; class Geom_BoundedCurve;
class Geom2d_BoundedCurve; class Geom2d_BoundedCurve;
@@ -41,11 +39,9 @@ public:
DEFINE_STANDARD_ALLOC DEFINE_STANDARD_ALLOC
Standard_EXPORT GeomToStep_MakeBoundedCurve(const Handle(Geom_BoundedCurve)& C, Standard_EXPORT GeomToStep_MakeBoundedCurve(const Handle(Geom_BoundedCurve)& C);
const StepData_Factors& theLocalFactors);
Standard_EXPORT GeomToStep_MakeBoundedCurve(const Handle(Geom2d_BoundedCurve)& C, Standard_EXPORT GeomToStep_MakeBoundedCurve(const Handle(Geom2d_BoundedCurve)& C);
const StepData_Factors& theLocalFactors);
Standard_EXPORT const Handle(StepGeom_BoundedCurve)& Value() const; Standard_EXPORT const Handle(StepGeom_BoundedCurve)& Value() const;

View File

@@ -25,7 +25,6 @@
#include <GeomToStep_MakeBSplineSurfaceWithKnotsAndRationalBSplineSurface.hxx> #include <GeomToStep_MakeBSplineSurfaceWithKnotsAndRationalBSplineSurface.hxx>
#include <GeomToStep_MakeRectangularTrimmedSurface.hxx> #include <GeomToStep_MakeRectangularTrimmedSurface.hxx>
#include <StdFail_NotDone.hxx> #include <StdFail_NotDone.hxx>
#include <StepData_Factors.hxx>
#include <StepGeom_BoundedSurface.hxx> #include <StepGeom_BoundedSurface.hxx>
#include <StepGeom_BSplineSurfaceWithKnots.hxx> #include <StepGeom_BSplineSurfaceWithKnots.hxx>
#include <StepGeom_BSplineSurfaceWithKnotsAndRationalBSplineSurface.hxx> #include <StepGeom_BSplineSurfaceWithKnotsAndRationalBSplineSurface.hxx>
@@ -36,8 +35,7 @@
// de Geom // de Geom
//============================================================================= //=============================================================================
GeomToStep_MakeBoundedSurface::GeomToStep_MakeBoundedSurface GeomToStep_MakeBoundedSurface::GeomToStep_MakeBoundedSurface
( const Handle(Geom_BoundedSurface)& S, ( const Handle(Geom_BoundedSurface)& S)
const StepData_Factors& theLocalFactors)
{ {
done = Standard_True; done = Standard_True;
if (S->IsKind(STANDARD_TYPE(Geom_BSplineSurface))) { if (S->IsKind(STANDARD_TYPE(Geom_BSplineSurface))) {
@@ -52,11 +50,11 @@ GeomToStep_MakeBoundedSurface::GeomToStep_MakeBoundedSurface
} }
if ( BS->IsURational() || BS->IsVRational() ) { if ( BS->IsURational() || BS->IsVRational() ) {
GeomToStep_MakeBSplineSurfaceWithKnotsAndRationalBSplineSurface GeomToStep_MakeBSplineSurfaceWithKnotsAndRationalBSplineSurface
MkRatBSplineS(BS, theLocalFactors); MkRatBSplineS(BS);
theBoundedSurface = MkRatBSplineS.Value(); theBoundedSurface = MkRatBSplineS.Value();
} }
else { else {
GeomToStep_MakeBSplineSurfaceWithKnots MkBSplineS(BS, theLocalFactors); GeomToStep_MakeBSplineSurfaceWithKnots MkBSplineS(BS);
theBoundedSurface = MkBSplineS.Value(); theBoundedSurface = MkBSplineS.Value();
} }
} }
@@ -66,18 +64,18 @@ GeomToStep_MakeBoundedSurface::GeomToStep_MakeBoundedSurface
GeomConvert::SurfaceToBSplineSurface(Sur); GeomConvert::SurfaceToBSplineSurface(Sur);
if ( BS->IsURational() || BS->IsVRational() ) { if ( BS->IsURational() || BS->IsVRational() ) {
GeomToStep_MakeBSplineSurfaceWithKnotsAndRationalBSplineSurface GeomToStep_MakeBSplineSurfaceWithKnotsAndRationalBSplineSurface
MkRatBSplineS(BS, theLocalFactors); MkRatBSplineS(BS);
theBoundedSurface = MkRatBSplineS.Value(); theBoundedSurface = MkRatBSplineS.Value();
} }
else { else {
GeomToStep_MakeBSplineSurfaceWithKnots MkBSplineS(BS, theLocalFactors); GeomToStep_MakeBSplineSurfaceWithKnots MkBSplineS(BS);
theBoundedSurface = MkBSplineS.Value(); theBoundedSurface = MkBSplineS.Value();
} }
} }
else if (S->IsKind(STANDARD_TYPE(Geom_RectangularTrimmedSurface))) { else if (S->IsKind(STANDARD_TYPE(Geom_RectangularTrimmedSurface))) {
Handle(Geom_RectangularTrimmedSurface) Sur = Handle(Geom_RectangularTrimmedSurface) Sur =
Handle(Geom_RectangularTrimmedSurface)::DownCast(S); Handle(Geom_RectangularTrimmedSurface)::DownCast(S);
GeomToStep_MakeRectangularTrimmedSurface MkRTSurf(Sur, theLocalFactors); GeomToStep_MakeRectangularTrimmedSurface MkRTSurf(Sur);
theBoundedSurface = MkRTSurf.Value(); theBoundedSurface = MkRTSurf.Value();
} }
else else

View File

@@ -22,8 +22,6 @@
#include <Standard_Handle.hxx> #include <Standard_Handle.hxx>
#include <GeomToStep_Root.hxx> #include <GeomToStep_Root.hxx>
class StepData_Factors;
class StepGeom_BoundedSurface; class StepGeom_BoundedSurface;
class Geom_BoundedSurface; class Geom_BoundedSurface;
@@ -40,8 +38,7 @@ public:
DEFINE_STANDARD_ALLOC DEFINE_STANDARD_ALLOC
Standard_EXPORT GeomToStep_MakeBoundedSurface(const Handle(Geom_BoundedSurface)& C, Standard_EXPORT GeomToStep_MakeBoundedSurface(const Handle(Geom_BoundedSurface)& C);
const StepData_Factors& theLocalFactors);
Standard_EXPORT const Handle(StepGeom_BoundedSurface)& Value() const; Standard_EXPORT const Handle(StepGeom_BoundedSurface)& Value() const;

View File

@@ -21,7 +21,7 @@
#include <gp_Pnt.hxx> #include <gp_Pnt.hxx>
#include <gp_Pnt2d.hxx> #include <gp_Pnt2d.hxx>
#include <StdFail_NotDone.hxx> #include <StdFail_NotDone.hxx>
#include <StepData_StepModel.hxx> #include <StepData_GlobalFactors.hxx>
#include <StepGeom_CartesianPoint.hxx> #include <StepGeom_CartesianPoint.hxx>
#include <TCollection_HAsciiString.hxx> #include <TCollection_HAsciiString.hxx>
#include <TColStd_HArray1OfReal.hxx> #include <TColStd_HArray1OfReal.hxx>
@@ -29,8 +29,7 @@
//============================================================================= //=============================================================================
// Creation d' un cartesian_point de prostep a partir d' un point3d de gp // Creation d' un cartesian_point de prostep a partir d' un point3d de gp
//============================================================================= //=============================================================================
GeomToStep_MakeCartesianPoint::GeomToStep_MakeCartesianPoint( const gp_Pnt& P, GeomToStep_MakeCartesianPoint::GeomToStep_MakeCartesianPoint( const gp_Pnt& P)
const Standard_Real aFactor)
{ {
Handle(StepGeom_CartesianPoint) Pstep = new StepGeom_CartesianPoint; Handle(StepGeom_CartesianPoint) Pstep = new StepGeom_CartesianPoint;
// Handle(TColStd_HArray1OfReal) Acoord = new TColStd_HArray1OfReal(1,3); // Handle(TColStd_HArray1OfReal) Acoord = new TColStd_HArray1OfReal(1,3);
@@ -43,7 +42,8 @@ GeomToStep_MakeCartesianPoint::GeomToStep_MakeCartesianPoint( const gp_Pnt& P,
// Pstep->SetCoordinates(Acoord); // Pstep->SetCoordinates(Acoord);
Handle(TCollection_HAsciiString) name = new TCollection_HAsciiString(""); Handle(TCollection_HAsciiString) name = new TCollection_HAsciiString("");
// Pstep->SetName(name); // Pstep->SetName(name);
Pstep->Init3D (name,X/aFactor,Y/aFactor,Z/aFactor); Standard_Real fact = StepData_GlobalFactors::Intance().LengthFactor();
Pstep->Init3D (name,X/fact,Y/fact,Z/fact);
theCartesianPoint = Pstep; theCartesianPoint = Pstep;
done = Standard_True; done = Standard_True;
} }
@@ -51,10 +51,8 @@ GeomToStep_MakeCartesianPoint::GeomToStep_MakeCartesianPoint( const gp_Pnt& P,
// Creation d' un cartesian_point de prostep a partir d' un point 2d de gp // Creation d' un cartesian_point de prostep a partir d' un point 2d de gp
//============================================================================= //=============================================================================
GeomToStep_MakeCartesianPoint::GeomToStep_MakeCartesianPoint( const gp_Pnt2d& P, GeomToStep_MakeCartesianPoint::GeomToStep_MakeCartesianPoint( const gp_Pnt2d& P)
const Standard_Real aFactor)
{ {
(void)aFactor;
Handle(StepGeom_CartesianPoint) Pstep = new StepGeom_CartesianPoint; Handle(StepGeom_CartesianPoint) Pstep = new StepGeom_CartesianPoint;
// Handle(TColStd_HArray1OfReal) Acoord = new TColStd_HArray1OfReal(1,2); // Handle(TColStd_HArray1OfReal) Acoord = new TColStd_HArray1OfReal(1,2);
Standard_Real X, Y; Standard_Real X, Y;
@@ -75,8 +73,7 @@ GeomToStep_MakeCartesianPoint::GeomToStep_MakeCartesianPoint( const gp_Pnt2d& P,
//============================================================================= //=============================================================================
GeomToStep_MakeCartesianPoint:: GeomToStep_MakeCartesianPoint::
GeomToStep_MakeCartesianPoint( const Handle(Geom_CartesianPoint)& P, GeomToStep_MakeCartesianPoint( const Handle(Geom_CartesianPoint)& P)
const Standard_Real aFactor)
{ {
Handle(StepGeom_CartesianPoint) Pstep = new StepGeom_CartesianPoint; Handle(StepGeom_CartesianPoint) Pstep = new StepGeom_CartesianPoint;
@@ -90,7 +87,8 @@ GeomToStep_MakeCartesianPoint::
// Pstep->SetCoordinates(Acoord); // Pstep->SetCoordinates(Acoord);
Handle(TCollection_HAsciiString) name = new TCollection_HAsciiString(""); Handle(TCollection_HAsciiString) name = new TCollection_HAsciiString("");
// Pstep->SetName(name); // Pstep->SetName(name);
Pstep->Init3D (name,X/aFactor,Y/aFactor,Z/aFactor); Standard_Real fact = StepData_GlobalFactors::Intance().LengthFactor();
Pstep->Init3D (name,X/fact,Y/fact,Z/fact);
theCartesianPoint = Pstep; theCartesianPoint = Pstep;
done = Standard_True; done = Standard_True;
} }

View File

@@ -27,7 +27,6 @@ class gp_Pnt;
class gp_Pnt2d; class gp_Pnt2d;
class Geom_CartesianPoint; class Geom_CartesianPoint;
class Geom2d_CartesianPoint; class Geom2d_CartesianPoint;
class StepData_StepModel;
//! This class implements the mapping between classes //! This class implements the mapping between classes
@@ -41,14 +40,11 @@ public:
DEFINE_STANDARD_ALLOC DEFINE_STANDARD_ALLOC
Standard_EXPORT GeomToStep_MakeCartesianPoint(const gp_Pnt& P, Standard_EXPORT GeomToStep_MakeCartesianPoint(const gp_Pnt& P);
const Standard_Real aFactor);
Standard_EXPORT GeomToStep_MakeCartesianPoint(const gp_Pnt2d& P, Standard_EXPORT GeomToStep_MakeCartesianPoint(const gp_Pnt2d& P);
const Standard_Real aFactor);
Standard_EXPORT GeomToStep_MakeCartesianPoint(const Handle(Geom_CartesianPoint)& P, Standard_EXPORT GeomToStep_MakeCartesianPoint(const Handle(Geom_CartesianPoint)& P);
const Standard_Real aFactor);
Standard_EXPORT GeomToStep_MakeCartesianPoint(const Handle(Geom2d_CartesianPoint)& P); Standard_EXPORT GeomToStep_MakeCartesianPoint(const Handle(Geom2d_CartesianPoint)& P);

View File

@@ -23,7 +23,7 @@
#include <gp_Circ.hxx> #include <gp_Circ.hxx>
#include <gp_Circ2d.hxx> #include <gp_Circ2d.hxx>
#include <StdFail_NotDone.hxx> #include <StdFail_NotDone.hxx>
#include <StepData_Factors.hxx> #include <StepData_GlobalFactors.hxx>
#include <StepGeom_Axis2Placement2d.hxx> #include <StepGeom_Axis2Placement2d.hxx>
#include <StepGeom_Axis2Placement3d.hxx> #include <StepGeom_Axis2Placement3d.hxx>
#include <StepGeom_Circle.hxx> #include <StepGeom_Circle.hxx>
@@ -32,8 +32,7 @@
//============================================================================= //=============================================================================
// Creation d' un cercle de prostep a partir d' un cercle 3d de gp // Creation d' un cercle de prostep a partir d' un cercle 3d de gp
//============================================================================= //=============================================================================
GeomToStep_MakeCircle::GeomToStep_MakeCircle( const gp_Circ& C, GeomToStep_MakeCircle::GeomToStep_MakeCircle( const gp_Circ& C)
const StepData_Factors& theLocalFactors)
{ {
#include "GeomToStep_MakeCircle_gen.pxx" #include "GeomToStep_MakeCircle_gen.pxx"
} }
@@ -44,8 +43,7 @@ GeomToStep_MakeCircle::GeomToStep_MakeCircle( const gp_Circ& C,
// Geom // Geom
//============================================================================= //=============================================================================
GeomToStep_MakeCircle::GeomToStep_MakeCircle( const Handle(Geom_Circle)& Cer, GeomToStep_MakeCircle::GeomToStep_MakeCircle( const Handle(Geom_Circle)& Cer)
const StepData_Factors& theLocalFactors)
{ {
gp_Circ C; gp_Circ C;
C = Cer->Circ(); C = Cer->Circ();
@@ -58,8 +56,7 @@ GeomToStep_MakeCircle::GeomToStep_MakeCircle( const Handle(Geom_Circle)& Cer,
// Geom2d // Geom2d
//============================================================================= //=============================================================================
GeomToStep_MakeCircle::GeomToStep_MakeCircle( const Handle(Geom2d_Circle)& Cer, GeomToStep_MakeCircle::GeomToStep_MakeCircle( const Handle(Geom2d_Circle)& Cer)
const StepData_Factors& theLocalFactors)
{ {
gp_Circ2d C2d; gp_Circ2d C2d;
C2d = Cer->Circ2d(); C2d = Cer->Circ2d();
@@ -69,7 +66,7 @@ GeomToStep_MakeCircle::GeomToStep_MakeCircle( const Handle(Geom2d_Circle)& Cer,
Handle(StepGeom_Axis2Placement2d) Ax2Step; Handle(StepGeom_Axis2Placement2d) Ax2Step;
Standard_Real Rayon; Standard_Real Rayon;
GeomToStep_MakeAxis2Placement2d MkAxis2(C2d.Position(), theLocalFactors); GeomToStep_MakeAxis2Placement2d MkAxis2(C2d.Position());
Ax2Step = MkAxis2.Value(); Ax2Step = MkAxis2.Value();
Rayon = C2d.Radius(); Rayon = C2d.Radius();
Ax2.SetValue(Ax2Step); Ax2.SetValue(Ax2Step);

View File

@@ -22,8 +22,6 @@
#include <Standard_Handle.hxx> #include <Standard_Handle.hxx>
#include <GeomToStep_Root.hxx> #include <GeomToStep_Root.hxx>
class StepData_Factors;
class StepGeom_Circle; class StepGeom_Circle;
class gp_Circ; class gp_Circ;
class Geom_Circle; class Geom_Circle;
@@ -41,14 +39,11 @@ public:
DEFINE_STANDARD_ALLOC DEFINE_STANDARD_ALLOC
Standard_EXPORT GeomToStep_MakeCircle(const gp_Circ& C, Standard_EXPORT GeomToStep_MakeCircle(const gp_Circ& C);
const StepData_Factors& theLocalFactors);
Standard_EXPORT GeomToStep_MakeCircle(const Handle(Geom_Circle)& C, Standard_EXPORT GeomToStep_MakeCircle(const Handle(Geom_Circle)& C);
const StepData_Factors& theLocalFactors);
Standard_EXPORT GeomToStep_MakeCircle(const Handle(Geom2d_Circle)& C, Standard_EXPORT GeomToStep_MakeCircle(const Handle(Geom2d_Circle)& C);
const StepData_Factors& theLocalFactors);
Standard_EXPORT const Handle(StepGeom_Circle)& Value() const; Standard_EXPORT const Handle(StepGeom_Circle)& Value() const;

View File

@@ -19,12 +19,12 @@ Handle(StepGeom_Circle) CStep = new StepGeom_Circle;
Handle(StepGeom_Axis2Placement3d) Ax2Step; Handle(StepGeom_Axis2Placement3d) Ax2Step;
Standard_Real Rayon; Standard_Real Rayon;
GeomToStep_MakeAxis2Placement3d MkAxis2(C.Position(), theLocalFactors); GeomToStep_MakeAxis2Placement3d MkAxis2(C.Position());
Ax2Step = MkAxis2.Value(); Ax2Step = MkAxis2.Value();
Rayon = C.Radius(); Rayon = C.Radius();
Ax2.SetValue(Ax2Step); Ax2.SetValue(Ax2Step);
Handle(TCollection_HAsciiString) name = new TCollection_HAsciiString(""); Handle(TCollection_HAsciiString) name = new TCollection_HAsciiString("");
CStep->Init(name, Ax2, Rayon / theLocalFactors.LengthFactor()); CStep->Init(name, Ax2, Rayon / StepData_GlobalFactors::Intance().LengthFactor());
theCircle = CStep; theCircle = CStep;
done = Standard_True; done = Standard_True;

View File

@@ -31,7 +31,6 @@
#include <GeomToStep_MakeHyperbola.hxx> #include <GeomToStep_MakeHyperbola.hxx>
#include <GeomToStep_MakeParabola.hxx> #include <GeomToStep_MakeParabola.hxx>
#include <StdFail_NotDone.hxx> #include <StdFail_NotDone.hxx>
#include <StepData_Factors.hxx>
#include <StepGeom_Circle.hxx> #include <StepGeom_Circle.hxx>
#include <StepGeom_Conic.hxx> #include <StepGeom_Conic.hxx>
#include <StepGeom_Ellipse.hxx> #include <StepGeom_Ellipse.hxx>
@@ -41,28 +40,27 @@
//============================================================================= //=============================================================================
// Creation d' une Conic de prostep a partir d' une Conic de Geom // Creation d' une Conic de prostep a partir d' une Conic de Geom
//============================================================================= //=============================================================================
GeomToStep_MakeConic::GeomToStep_MakeConic ( const Handle(Geom_Conic)& C, GeomToStep_MakeConic::GeomToStep_MakeConic ( const Handle(Geom_Conic)& C)
const StepData_Factors& theLocalFactors)
{ {
done = Standard_True; done = Standard_True;
if (C->IsKind(STANDARD_TYPE(Geom_Circle))) { if (C->IsKind(STANDARD_TYPE(Geom_Circle))) {
Handle(Geom_Circle) Cer = Handle(Geom_Circle)::DownCast(C); Handle(Geom_Circle) Cer = Handle(Geom_Circle)::DownCast(C);
GeomToStep_MakeCircle MkCircle(Cer, theLocalFactors); GeomToStep_MakeCircle MkCircle(Cer);
theConic = MkCircle.Value(); theConic = MkCircle.Value();
} }
else if (C->IsKind(STANDARD_TYPE(Geom_Ellipse))) { else if (C->IsKind(STANDARD_TYPE(Geom_Ellipse))) {
Handle(Geom_Ellipse) Ell = Handle(Geom_Ellipse)::DownCast(C); Handle(Geom_Ellipse) Ell = Handle(Geom_Ellipse)::DownCast(C);
GeomToStep_MakeEllipse MkEllipse(Ell, theLocalFactors); GeomToStep_MakeEllipse MkEllipse(Ell);
theConic = MkEllipse.Value(); theConic = MkEllipse.Value();
} }
else if (C->IsKind(STANDARD_TYPE(Geom_Hyperbola))) { else if (C->IsKind(STANDARD_TYPE(Geom_Hyperbola))) {
Handle(Geom_Hyperbola) Hyp = Handle(Geom_Hyperbola)::DownCast(C); Handle(Geom_Hyperbola) Hyp = Handle(Geom_Hyperbola)::DownCast(C);
GeomToStep_MakeHyperbola MkHyperbola(Hyp, theLocalFactors); GeomToStep_MakeHyperbola MkHyperbola(Hyp);
theConic = MkHyperbola.Value(); theConic = MkHyperbola.Value();
} }
else if (C->IsKind(STANDARD_TYPE(Geom_Parabola))) { else if (C->IsKind(STANDARD_TYPE(Geom_Parabola))) {
Handle(Geom_Parabola) Par = Handle(Geom_Parabola)::DownCast(C); Handle(Geom_Parabola) Par = Handle(Geom_Parabola)::DownCast(C);
GeomToStep_MakeParabola MkParabola(Par, theLocalFactors); GeomToStep_MakeParabola MkParabola(Par);
theConic = MkParabola.Value(); theConic = MkParabola.Value();
} }
else { else {
@@ -77,28 +75,27 @@ GeomToStep_MakeConic::GeomToStep_MakeConic ( const Handle(Geom_Conic)& C,
// Creation d' une Conic2d de prostep a partir d' une Conic de Geom2d // Creation d' une Conic2d de prostep a partir d' une Conic de Geom2d
//============================================================================= //=============================================================================
GeomToStep_MakeConic::GeomToStep_MakeConic ( const Handle(Geom2d_Conic)& C, GeomToStep_MakeConic::GeomToStep_MakeConic ( const Handle(Geom2d_Conic)& C)
const StepData_Factors& theLocalFactors)
{ {
done = Standard_True; done = Standard_True;
if (C->IsKind(STANDARD_TYPE(Geom2d_Circle))) { if (C->IsKind(STANDARD_TYPE(Geom2d_Circle))) {
Handle(Geom2d_Circle) Cer = Handle(Geom2d_Circle)::DownCast(C); Handle(Geom2d_Circle) Cer = Handle(Geom2d_Circle)::DownCast(C);
GeomToStep_MakeCircle MkCircle(Cer, theLocalFactors); GeomToStep_MakeCircle MkCircle(Cer);
theConic = MkCircle.Value(); theConic = MkCircle.Value();
} }
else if (C->IsKind(STANDARD_TYPE(Geom2d_Ellipse))) { else if (C->IsKind(STANDARD_TYPE(Geom2d_Ellipse))) {
Handle(Geom2d_Ellipse) Ell = Handle(Geom2d_Ellipse)::DownCast(C); Handle(Geom2d_Ellipse) Ell = Handle(Geom2d_Ellipse)::DownCast(C);
GeomToStep_MakeEllipse MkEllipse(Ell, theLocalFactors); GeomToStep_MakeEllipse MkEllipse(Ell);
theConic = MkEllipse.Value(); theConic = MkEllipse.Value();
} }
else if (C->IsKind(STANDARD_TYPE(Geom2d_Hyperbola))) { else if (C->IsKind(STANDARD_TYPE(Geom2d_Hyperbola))) {
Handle(Geom2d_Hyperbola) Hyp = Handle(Geom2d_Hyperbola)::DownCast(C); Handle(Geom2d_Hyperbola) Hyp = Handle(Geom2d_Hyperbola)::DownCast(C);
GeomToStep_MakeHyperbola MkHyperbola(Hyp, theLocalFactors); GeomToStep_MakeHyperbola MkHyperbola(Hyp);
theConic = MkHyperbola.Value(); theConic = MkHyperbola.Value();
} }
else if (C->IsKind(STANDARD_TYPE(Geom2d_Parabola))) { else if (C->IsKind(STANDARD_TYPE(Geom2d_Parabola))) {
Handle(Geom2d_Parabola) Par = Handle(Geom2d_Parabola)::DownCast(C); Handle(Geom2d_Parabola) Par = Handle(Geom2d_Parabola)::DownCast(C);
GeomToStep_MakeParabola MkParabola(Par, theLocalFactors); GeomToStep_MakeParabola MkParabola(Par);
theConic = MkParabola.Value(); theConic = MkParabola.Value();
} }
else { else {

View File

@@ -25,7 +25,6 @@
class StepGeom_Conic; class StepGeom_Conic;
class Geom_Conic; class Geom_Conic;
class Geom2d_Conic; class Geom2d_Conic;
class StepData_Factors;
//! This class implements the mapping between classes //! This class implements the mapping between classes
@@ -39,11 +38,9 @@ public:
DEFINE_STANDARD_ALLOC DEFINE_STANDARD_ALLOC
Standard_EXPORT GeomToStep_MakeConic(const Handle(Geom_Conic)& C, Standard_EXPORT GeomToStep_MakeConic(const Handle(Geom_Conic)& C);
const StepData_Factors& theLocalFactors);
Standard_EXPORT GeomToStep_MakeConic(const Handle(Geom2d_Conic)& C, Standard_EXPORT GeomToStep_MakeConic(const Handle(Geom2d_Conic)& C);
const StepData_Factors& theLocalFactors);
Standard_EXPORT const Handle(StepGeom_Conic)& Value() const; Standard_EXPORT const Handle(StepGeom_Conic)& Value() const;

View File

@@ -20,7 +20,7 @@
#include <GeomToStep_MakeConicalSurface.hxx> #include <GeomToStep_MakeConicalSurface.hxx>
#include <Standard_DomainError.hxx> #include <Standard_DomainError.hxx>
#include <StdFail_NotDone.hxx> #include <StdFail_NotDone.hxx>
#include <StepData_Factors.hxx> #include <StepData_GlobalFactors.hxx>
#include <StepGeom_Axis2Placement3d.hxx> #include <StepGeom_Axis2Placement3d.hxx>
#include <StepGeom_ConicalSurface.hxx> #include <StepGeom_ConicalSurface.hxx>
#include <TCollection_HAsciiString.hxx> #include <TCollection_HAsciiString.hxx>
@@ -30,14 +30,14 @@
// de Geom // de Geom
//============================================================================= //=============================================================================
GeomToStep_MakeConicalSurface::GeomToStep_MakeConicalSurface GeomToStep_MakeConicalSurface::GeomToStep_MakeConicalSurface
( const Handle(Geom_ConicalSurface)& CS, const StepData_Factors& theLocalFactors) ( const Handle(Geom_ConicalSurface)& CS )
{ {
Handle(StepGeom_ConicalSurface) CSstep = new StepGeom_ConicalSurface; Handle(StepGeom_ConicalSurface) CSstep = new StepGeom_ConicalSurface;
Handle(StepGeom_Axis2Placement3d) aPosition; Handle(StepGeom_Axis2Placement3d) aPosition;
Standard_Real aRadius, aSemiAngle; Standard_Real aRadius, aSemiAngle;
GeomToStep_MakeAxis2Placement3d MkAxis(CS->Position(), theLocalFactors); GeomToStep_MakeAxis2Placement3d MkAxis(CS->Position());
aPosition = MkAxis.Value(); aPosition = MkAxis.Value();
aRadius = CS->RefRadius(); aRadius = CS->RefRadius();
aSemiAngle = CS->SemiAngle(); aSemiAngle = CS->SemiAngle();
@@ -46,7 +46,7 @@ GeomToStep_MakeConicalSurface::GeomToStep_MakeConicalSurface
} }
Handle(TCollection_HAsciiString) name = new TCollection_HAsciiString(""); Handle(TCollection_HAsciiString) name = new TCollection_HAsciiString("");
CSstep->Init(name, aPosition, aRadius / theLocalFactors.LengthFactor(), aSemiAngle); CSstep->Init(name, aPosition, aRadius / StepData_GlobalFactors::Intance().LengthFactor(), aSemiAngle);
theConicalSurface = CSstep; theConicalSurface = CSstep;
done = Standard_True; done = Standard_True;
} }

View File

@@ -24,7 +24,6 @@
#include <GeomToStep_Root.hxx> #include <GeomToStep_Root.hxx>
class StepGeom_ConicalSurface; class StepGeom_ConicalSurface;
class Geom_ConicalSurface; class Geom_ConicalSurface;
class StepData_Factors;
//! This class implements the mapping between class //! This class implements the mapping between class
@@ -38,8 +37,7 @@ public:
DEFINE_STANDARD_ALLOC DEFINE_STANDARD_ALLOC
Standard_EXPORT GeomToStep_MakeConicalSurface(const Handle(Geom_ConicalSurface)& CSurf, Standard_EXPORT GeomToStep_MakeConicalSurface(const Handle(Geom_ConicalSurface)& CSurf);
const StepData_Factors& theLocalFactors);
Standard_EXPORT const Handle(StepGeom_ConicalSurface)& Value() const; Standard_EXPORT const Handle(StepGeom_ConicalSurface)& Value() const;

View File

@@ -37,7 +37,6 @@
#include <gp_Circ2d.hxx> #include <gp_Circ2d.hxx>
#include <gp_Elips2d.hxx> #include <gp_Elips2d.hxx>
#include <StdFail_NotDone.hxx> #include <StdFail_NotDone.hxx>
#include <StepData_Factors.hxx>
#include <StepGeom_Axis2Placement3d.hxx> #include <StepGeom_Axis2Placement3d.hxx>
#include <StepGeom_BoundedCurve.hxx> #include <StepGeom_BoundedCurve.hxx>
#include <StepGeom_Conic.hxx> #include <StepGeom_Conic.hxx>
@@ -48,18 +47,17 @@
//============================================================================= //=============================================================================
// Creation d' une Curve de prostep a partir d' une Curve de Geom // Creation d' une Curve de prostep a partir d' une Curve de Geom
//============================================================================= //=============================================================================
GeomToStep_MakeCurve::GeomToStep_MakeCurve ( const Handle(Geom_Curve)& C, GeomToStep_MakeCurve::GeomToStep_MakeCurve ( const Handle(Geom_Curve)& C)
const StepData_Factors& theLocalFactors)
{ {
done = Standard_True; done = Standard_True;
if (C->IsKind(STANDARD_TYPE(Geom_Line))) { if (C->IsKind(STANDARD_TYPE(Geom_Line))) {
Handle(Geom_Line) L = Handle(Geom_Line)::DownCast(C); Handle(Geom_Line) L = Handle(Geom_Line)::DownCast(C);
GeomToStep_MakeLine MkLine(L, theLocalFactors); GeomToStep_MakeLine MkLine(L);
theCurve = MkLine.Value(); theCurve = MkLine.Value();
} }
else if (C->IsKind(STANDARD_TYPE(Geom_Conic))) { else if (C->IsKind(STANDARD_TYPE(Geom_Conic))) {
Handle(Geom_Conic) L = Handle(Geom_Conic)::DownCast(C); Handle(Geom_Conic) L = Handle(Geom_Conic)::DownCast(C);
GeomToStep_MakeConic MkConic(L, theLocalFactors); GeomToStep_MakeConic MkConic(L);
theCurve = MkConic.Value(); theCurve = MkConic.Value();
} }
else if (C->IsKind(STANDARD_TYPE(Geom_TrimmedCurve))) { else if (C->IsKind(STANDARD_TYPE(Geom_TrimmedCurve))) {
@@ -84,12 +82,12 @@ GeomToStep_MakeCurve::GeomToStep_MakeCurve ( const Handle(Geom_Curve)& C,
std::cout<<"BasisCurve Type : "<<B->DynamicType()->Name()<<std::endl; std::cout<<"BasisCurve Type : "<<B->DynamicType()->Name()<<std::endl;
#endif #endif
} }
GeomToStep_MakeCurve MkBasisC(B, theLocalFactors); GeomToStep_MakeCurve MkBasisC(B);
theCurve = MkBasisC.Value(); theCurve = MkBasisC.Value();
} }
else if (C->IsKind(STANDARD_TYPE(Geom_BoundedCurve))) { else if (C->IsKind(STANDARD_TYPE(Geom_BoundedCurve))) {
Handle(Geom_BoundedCurve) L = Handle(Geom_BoundedCurve)::DownCast(C); Handle(Geom_BoundedCurve) L = Handle(Geom_BoundedCurve)::DownCast(C);
GeomToStep_MakeBoundedCurve MkBoundedC(L, theLocalFactors); GeomToStep_MakeBoundedCurve MkBoundedC(L);
theCurve = MkBoundedC.Value(); theCurve = MkBoundedC.Value();
} }
else else
@@ -100,13 +98,12 @@ GeomToStep_MakeCurve::GeomToStep_MakeCurve ( const Handle(Geom_Curve)& C,
// Creation d'une Curve de prostep a partir d' une Curve de Geom2d // Creation d'une Curve de prostep a partir d' une Curve de Geom2d
//============================================================================= //=============================================================================
GeomToStep_MakeCurve::GeomToStep_MakeCurve ( const Handle(Geom2d_Curve)& C, GeomToStep_MakeCurve::GeomToStep_MakeCurve ( const Handle(Geom2d_Curve)& C)
const StepData_Factors& theLocalFactors)
{ {
done = Standard_True; done = Standard_True;
if (C->IsKind(STANDARD_TYPE(Geom2d_Line))) { if (C->IsKind(STANDARD_TYPE(Geom2d_Line))) {
Handle(Geom2d_Line) L = Handle(Geom2d_Line)::DownCast(C); Handle(Geom2d_Line) L = Handle(Geom2d_Line)::DownCast(C);
GeomToStep_MakeLine MkLine(L, theLocalFactors); GeomToStep_MakeLine MkLine(L);
theCurve = MkLine.Value(); theCurve = MkLine.Value();
} }
else if (C->IsKind(STANDARD_TYPE(Geom2d_Conic))) { else if (C->IsKind(STANDARD_TYPE(Geom2d_Conic))) {
@@ -127,12 +124,12 @@ GeomToStep_MakeCurve::GeomToStep_MakeCurve ( const Handle(Geom2d_Curve)& C,
Handle(Geom2d_BSplineCurve) aBSplineCurve2d = Handle(Geom2d_BSplineCurve) aBSplineCurve2d =
Geom2dConvert::CurveToBSplineCurve(theC2d); Geom2dConvert::CurveToBSplineCurve(theC2d);
const Handle(Geom2d_BoundedCurve)& aBC2d = aBSplineCurve2d; // to avoid ambiguity const Handle(Geom2d_BoundedCurve)& aBC2d = aBSplineCurve2d; // to avoid ambiguity
GeomToStep_MakeBoundedCurve MkBoundedC(aBC2d, theLocalFactors); GeomToStep_MakeBoundedCurve MkBoundedC(aBC2d);
theCurve = MkBoundedC.Value(); theCurve = MkBoundedC.Value();
} }
else { else {
Handle(Geom2d_Conic) L = Handle(Geom2d_Conic)::DownCast(C); Handle(Geom2d_Conic) L = Handle(Geom2d_Conic)::DownCast(C);
GeomToStep_MakeConic MkConic(L, theLocalFactors); GeomToStep_MakeConic MkConic(L);
theCurve = MkConic.Value(); theCurve = MkConic.Value();
} }
} }
@@ -146,28 +143,28 @@ GeomToStep_MakeCurve::GeomToStep_MakeCurve ( const Handle(Geom2d_Curve)& C,
Handle(Geom2d_BSplineCurve) aBSplineCurve2d = Handle(Geom2d_BSplineCurve) aBSplineCurve2d =
Geom2dConvert::CurveToBSplineCurve(theE2d); Geom2dConvert::CurveToBSplineCurve(theE2d);
const Handle(Geom2d_BoundedCurve)& aBC2d = aBSplineCurve2d; // to avoid ambiguity const Handle(Geom2d_BoundedCurve)& aBC2d = aBSplineCurve2d; // to avoid ambiguity
GeomToStep_MakeBoundedCurve MkBoundedC(aBC2d, theLocalFactors); GeomToStep_MakeBoundedCurve MkBoundedC(aBC2d);
theCurve = MkBoundedC.Value(); theCurve = MkBoundedC.Value();
} }
else { else {
Handle(Geom2d_Conic) L = Handle(Geom2d_Conic)::DownCast(C); Handle(Geom2d_Conic) L = Handle(Geom2d_Conic)::DownCast(C);
GeomToStep_MakeConic MkConic(L, theLocalFactors); GeomToStep_MakeConic MkConic(L);
theCurve = MkConic.Value(); theCurve = MkConic.Value();
} }
} }
else { else {
Handle(Geom2d_Conic) L = Handle(Geom2d_Conic)::DownCast(C); Handle(Geom2d_Conic) L = Handle(Geom2d_Conic)::DownCast(C);
GeomToStep_MakeConic MkConic(L, theLocalFactors); GeomToStep_MakeConic MkConic(L);
theCurve = MkConic.Value(); theCurve = MkConic.Value();
} }
} }
else if (C->IsKind(STANDARD_TYPE(Geom2d_BoundedCurve))) { else if (C->IsKind(STANDARD_TYPE(Geom2d_BoundedCurve))) {
Handle(Geom2d_BoundedCurve) L = Handle(Geom2d_BoundedCurve)::DownCast(C); Handle(Geom2d_BoundedCurve) L = Handle(Geom2d_BoundedCurve)::DownCast(C);
GeomToStep_MakeBoundedCurve MkBoundedC(L, theLocalFactors); GeomToStep_MakeBoundedCurve MkBoundedC(L);
theCurve = MkBoundedC.Value(); theCurve = MkBoundedC.Value();
} }
else if (C->IsKind(STANDARD_TYPE(Geom2d_TrimmedCurve))) { else if (C->IsKind(STANDARD_TYPE(Geom2d_TrimmedCurve))) {
GeomToStep_MakeCurve aMaker(Handle(Geom2d_TrimmedCurve)::DownCast(C)->BasisCurve(), theLocalFactors); GeomToStep_MakeCurve aMaker = (Handle(Geom2d_TrimmedCurve)::DownCast(C)->BasisCurve());
theCurve = aMaker.Value(); theCurve = aMaker.Value();
} }
else else

View File

@@ -22,7 +22,6 @@
#include <Standard_Handle.hxx> #include <Standard_Handle.hxx>
#include <GeomToStep_Root.hxx> #include <GeomToStep_Root.hxx>
class StepData_Factors;
class StepGeom_Curve; class StepGeom_Curve;
class Geom_Curve; class Geom_Curve;
class Geom2d_Curve; class Geom2d_Curve;
@@ -39,11 +38,9 @@ public:
DEFINE_STANDARD_ALLOC DEFINE_STANDARD_ALLOC
Standard_EXPORT GeomToStep_MakeCurve(const Handle(Geom_Curve)& C, Standard_EXPORT GeomToStep_MakeCurve(const Handle(Geom_Curve)& C);
const StepData_Factors& theLocalFactors);
Standard_EXPORT GeomToStep_MakeCurve(const Handle(Geom2d_Curve)& C, Standard_EXPORT GeomToStep_MakeCurve(const Handle(Geom2d_Curve)& C);
const StepData_Factors& theLocalFactors);
Standard_EXPORT const Handle(StepGeom_Curve)& Value() const; Standard_EXPORT const Handle(StepGeom_Curve)& Value() const;

View File

@@ -19,7 +19,7 @@
#include <GeomToStep_MakeAxis2Placement3d.hxx> #include <GeomToStep_MakeAxis2Placement3d.hxx>
#include <GeomToStep_MakeCylindricalSurface.hxx> #include <GeomToStep_MakeCylindricalSurface.hxx>
#include <StdFail_NotDone.hxx> #include <StdFail_NotDone.hxx>
#include <StepData_Factors.hxx> #include <StepData_GlobalFactors.hxx>
#include <StepGeom_Axis2Placement3d.hxx> #include <StepGeom_Axis2Placement3d.hxx>
#include <StepGeom_CylindricalSurface.hxx> #include <StepGeom_CylindricalSurface.hxx>
#include <TCollection_HAsciiString.hxx> #include <TCollection_HAsciiString.hxx>
@@ -29,19 +29,19 @@
// CylindricalSurface de Geom // CylindricalSurface de Geom
//============================================================================= //=============================================================================
GeomToStep_MakeCylindricalSurface::GeomToStep_MakeCylindricalSurface GeomToStep_MakeCylindricalSurface::GeomToStep_MakeCylindricalSurface
( const Handle(Geom_CylindricalSurface)& CS, ( const Handle(Geom_CylindricalSurface)& CS )
const StepData_Factors& theLocalFactors)
{ {
Handle(StepGeom_CylindricalSurface) CSstep; Handle(StepGeom_CylindricalSurface) CSstep;
Handle(StepGeom_Axis2Placement3d) aPosition; Handle(StepGeom_Axis2Placement3d) aPosition;
Standard_Real aRadius; Standard_Real aRadius;
GeomToStep_MakeAxis2Placement3d MkAxis2(CS->Position(), theLocalFactors); GeomToStep_MakeAxis2Placement3d MkAxis2(CS->Position());
aPosition = MkAxis2.Value(); aPosition = MkAxis2.Value();
aRadius = CS->Radius(); aRadius = CS->Radius();
CSstep = new StepGeom_CylindricalSurface; CSstep = new StepGeom_CylindricalSurface;
Handle(TCollection_HAsciiString) name = new TCollection_HAsciiString(""); Handle(TCollection_HAsciiString) name = new TCollection_HAsciiString("");
CSstep->Init(name, aPosition, aRadius / theLocalFactors.LengthFactor()); CSstep->Init(name, aPosition, aRadius / StepData_GlobalFactors::Intance().LengthFactor());
theCylindricalSurface = CSstep; theCylindricalSurface = CSstep;
done = Standard_True; done = Standard_True;
} }

View File

@@ -24,7 +24,6 @@
#include <GeomToStep_Root.hxx> #include <GeomToStep_Root.hxx>
class StepGeom_CylindricalSurface; class StepGeom_CylindricalSurface;
class Geom_CylindricalSurface; class Geom_CylindricalSurface;
class StepData_Factors;
//! This class implements the mapping between class //! This class implements the mapping between class
@@ -38,8 +37,7 @@ public:
DEFINE_STANDARD_ALLOC DEFINE_STANDARD_ALLOC
Standard_EXPORT GeomToStep_MakeCylindricalSurface(const Handle(Geom_CylindricalSurface)& CSurf, Standard_EXPORT GeomToStep_MakeCylindricalSurface(const Handle(Geom_CylindricalSurface)& CSurf);
const StepData_Factors& theLocalFactors);
Standard_EXPORT const Handle(StepGeom_CylindricalSurface)& Value() const; Standard_EXPORT const Handle(StepGeom_CylindricalSurface)& Value() const;

View File

@@ -28,7 +28,6 @@
#include <GeomToStep_MakeSphericalSurface.hxx> #include <GeomToStep_MakeSphericalSurface.hxx>
#include <GeomToStep_MakeToroidalSurface.hxx> #include <GeomToStep_MakeToroidalSurface.hxx>
#include <StdFail_NotDone.hxx> #include <StdFail_NotDone.hxx>
#include <StepData_Factors.hxx>
#include <StepGeom_ConicalSurface.hxx> #include <StepGeom_ConicalSurface.hxx>
#include <StepGeom_CylindricalSurface.hxx> #include <StepGeom_CylindricalSurface.hxx>
#include <StepGeom_ElementarySurface.hxx> #include <StepGeom_ElementarySurface.hxx>
@@ -41,37 +40,36 @@
// ElementarySurface de Geom // ElementarySurface de Geom
//============================================================================= //=============================================================================
GeomToStep_MakeElementarySurface::GeomToStep_MakeElementarySurface GeomToStep_MakeElementarySurface::GeomToStep_MakeElementarySurface
( const Handle(Geom_ElementarySurface)& S, ( const Handle(Geom_ElementarySurface)& S)
const StepData_Factors& theLocalFactors)
{ {
done = Standard_True; done = Standard_True;
if (S->IsKind(STANDARD_TYPE(Geom_CylindricalSurface))) { if (S->IsKind(STANDARD_TYPE(Geom_CylindricalSurface))) {
Handle(Geom_CylindricalSurface) Sur = Handle(Geom_CylindricalSurface) Sur =
Handle(Geom_CylindricalSurface)::DownCast(S); Handle(Geom_CylindricalSurface)::DownCast(S);
GeomToStep_MakeCylindricalSurface MkCylindrical(Sur, theLocalFactors); GeomToStep_MakeCylindricalSurface MkCylindrical(Sur);
theElementarySurface = MkCylindrical.Value(); theElementarySurface = MkCylindrical.Value();
} }
else if (S->IsKind(STANDARD_TYPE(Geom_ConicalSurface))) { else if (S->IsKind(STANDARD_TYPE(Geom_ConicalSurface))) {
Handle(Geom_ConicalSurface) Sur = Handle(Geom_ConicalSurface) Sur =
Handle(Geom_ConicalSurface)::DownCast(S); Handle(Geom_ConicalSurface)::DownCast(S);
GeomToStep_MakeConicalSurface MkConical(Sur, theLocalFactors); GeomToStep_MakeConicalSurface MkConical(Sur);
theElementarySurface = MkConical.Value(); theElementarySurface = MkConical.Value();
} }
else if (S->IsKind(STANDARD_TYPE(Geom_SphericalSurface))) { else if (S->IsKind(STANDARD_TYPE(Geom_SphericalSurface))) {
Handle(Geom_SphericalSurface) Sur = Handle(Geom_SphericalSurface) Sur =
Handle(Geom_SphericalSurface)::DownCast(S); Handle(Geom_SphericalSurface)::DownCast(S);
GeomToStep_MakeSphericalSurface MkSpherical(Sur, theLocalFactors); GeomToStep_MakeSphericalSurface MkSpherical(Sur);
theElementarySurface = MkSpherical.Value(); theElementarySurface = MkSpherical.Value();
} }
else if (S->IsKind(STANDARD_TYPE(Geom_ToroidalSurface))) { else if (S->IsKind(STANDARD_TYPE(Geom_ToroidalSurface))) {
Handle(Geom_ToroidalSurface) Sur = Handle(Geom_ToroidalSurface) Sur =
Handle(Geom_ToroidalSurface)::DownCast(S); Handle(Geom_ToroidalSurface)::DownCast(S);
GeomToStep_MakeToroidalSurface MkToroidal(Sur, theLocalFactors); GeomToStep_MakeToroidalSurface MkToroidal(Sur);
theElementarySurface = MkToroidal.Value(); theElementarySurface = MkToroidal.Value();
} }
else if (S->IsKind(STANDARD_TYPE(Geom_Plane))) { else if (S->IsKind(STANDARD_TYPE(Geom_Plane))) {
Handle(Geom_Plane) Sur = Handle(Geom_Plane)::DownCast(S); Handle(Geom_Plane) Sur = Handle(Geom_Plane)::DownCast(S);
GeomToStep_MakePlane MkPlane(Sur, theLocalFactors); GeomToStep_MakePlane MkPlane(Sur);
theElementarySurface = MkPlane.Value(); theElementarySurface = MkPlane.Value();
} }
else else

View File

@@ -22,8 +22,6 @@
#include <Standard_Handle.hxx> #include <Standard_Handle.hxx>
#include <GeomToStep_Root.hxx> #include <GeomToStep_Root.hxx>
class StepData_Factors;
class StepGeom_ElementarySurface; class StepGeom_ElementarySurface;
class Geom_ElementarySurface; class Geom_ElementarySurface;
@@ -40,8 +38,7 @@ public:
DEFINE_STANDARD_ALLOC DEFINE_STANDARD_ALLOC
Standard_EXPORT GeomToStep_MakeElementarySurface(const Handle(Geom_ElementarySurface)& S, Standard_EXPORT GeomToStep_MakeElementarySurface(const Handle(Geom_ElementarySurface)& S);
const StepData_Factors& theLocalFactors);
Standard_EXPORT const Handle(StepGeom_ElementarySurface)& Value() const; Standard_EXPORT const Handle(StepGeom_ElementarySurface)& Value() const;

View File

@@ -23,7 +23,7 @@
#include <gp_Elips.hxx> #include <gp_Elips.hxx>
#include <gp_Elips2d.hxx> #include <gp_Elips2d.hxx>
#include <StdFail_NotDone.hxx> #include <StdFail_NotDone.hxx>
#include <StepData_Factors.hxx> #include <StepData_GlobalFactors.hxx>
#include <StepGeom_Axis2Placement2d.hxx> #include <StepGeom_Axis2Placement2d.hxx>
#include <StepGeom_Axis2Placement3d.hxx> #include <StepGeom_Axis2Placement3d.hxx>
#include <StepGeom_Ellipse.hxx> #include <StepGeom_Ellipse.hxx>
@@ -32,8 +32,7 @@
//============================================================================= //=============================================================================
// Creation d'une ellipse de prostep a partir d'une ellipse 3d de gp // Creation d'une ellipse de prostep a partir d'une ellipse 3d de gp
//============================================================================= //=============================================================================
GeomToStep_MakeEllipse::GeomToStep_MakeEllipse( const gp_Elips& E, GeomToStep_MakeEllipse::GeomToStep_MakeEllipse( const gp_Elips& E)
const StepData_Factors& theLocalFactors)
{ {
#include "GeomToStep_MakeEllipse_gen.pxx" #include "GeomToStep_MakeEllipse_gen.pxx"
} }
@@ -44,8 +43,7 @@ GeomToStep_MakeEllipse::GeomToStep_MakeEllipse( const gp_Elips& E,
// Geom // Geom
//============================================================================= //=============================================================================
GeomToStep_MakeEllipse::GeomToStep_MakeEllipse( const Handle(Geom_Ellipse)& Cer, GeomToStep_MakeEllipse::GeomToStep_MakeEllipse( const Handle(Geom_Ellipse)& Cer)
const StepData_Factors& theLocalFactors)
{ {
gp_Elips E; gp_Elips E;
E = Cer->Elips(); E = Cer->Elips();
@@ -58,8 +56,7 @@ GeomToStep_MakeEllipse::GeomToStep_MakeEllipse( const Handle(Geom_Ellipse)& Cer,
// Geom2d // Geom2d
//============================================================================= //=============================================================================
GeomToStep_MakeEllipse::GeomToStep_MakeEllipse( const Handle(Geom2d_Ellipse)& Cer, GeomToStep_MakeEllipse::GeomToStep_MakeEllipse( const Handle(Geom2d_Ellipse)& Cer)
const StepData_Factors& theLocalFactors)
{ {
gp_Elips2d E2d; gp_Elips2d E2d;
E2d = Cer->Elips2d(); E2d = Cer->Elips2d();
@@ -69,7 +66,7 @@ GeomToStep_MakeEllipse::GeomToStep_MakeEllipse( const Handle(Geom2d_Ellipse)& Ce
Handle(StepGeom_Axis2Placement2d) Ax2Step; Handle(StepGeom_Axis2Placement2d) Ax2Step;
Standard_Real majorR, minorR; Standard_Real majorR, minorR;
GeomToStep_MakeAxis2Placement2d MkAxis2(E2d.Axis(), theLocalFactors); GeomToStep_MakeAxis2Placement2d MkAxis2(E2d.Axis());
Ax2Step = MkAxis2.Value(); Ax2Step = MkAxis2.Value();
majorR = E2d.MajorRadius(); majorR = E2d.MajorRadius();
minorR = E2d.MinorRadius(); minorR = E2d.MinorRadius();

View File

@@ -22,8 +22,6 @@
#include <Standard_Handle.hxx> #include <Standard_Handle.hxx>
#include <GeomToStep_Root.hxx> #include <GeomToStep_Root.hxx>
class StepData_Factors;
class StepGeom_Ellipse; class StepGeom_Ellipse;
class gp_Elips; class gp_Elips;
class Geom_Ellipse; class Geom_Ellipse;
@@ -41,14 +39,11 @@ public:
DEFINE_STANDARD_ALLOC DEFINE_STANDARD_ALLOC
Standard_EXPORT GeomToStep_MakeEllipse(const gp_Elips& C, Standard_EXPORT GeomToStep_MakeEllipse(const gp_Elips& C);
const StepData_Factors& theLocalFactors);
Standard_EXPORT GeomToStep_MakeEllipse(const Handle(Geom_Ellipse)& C, Standard_EXPORT GeomToStep_MakeEllipse(const Handle(Geom_Ellipse)& C);
const StepData_Factors& theLocalFactors);
Standard_EXPORT GeomToStep_MakeEllipse(const Handle(Geom2d_Ellipse)& C, Standard_EXPORT GeomToStep_MakeEllipse(const Handle(Geom2d_Ellipse)& C);
const StepData_Factors& theLocalFactors);
Standard_EXPORT const Handle(StepGeom_Ellipse)& Value() const; Standard_EXPORT const Handle(StepGeom_Ellipse)& Value() const;

View File

@@ -19,13 +19,13 @@ Handle(StepGeom_Ellipse) EStep = new StepGeom_Ellipse;
Handle(StepGeom_Axis2Placement3d) Ax2Step; Handle(StepGeom_Axis2Placement3d) Ax2Step;
Standard_Real majorR, minorR; Standard_Real majorR, minorR;
GeomToStep_MakeAxis2Placement3d MkAxis2(E.Position(), theLocalFactors); GeomToStep_MakeAxis2Placement3d MkAxis2(E.Position());
Ax2Step = MkAxis2.Value(); Ax2Step = MkAxis2.Value();
majorR = E.MajorRadius(); majorR = E.MajorRadius();
minorR = E.MinorRadius(); minorR = E.MinorRadius();
Ax2.SetValue(Ax2Step); Ax2.SetValue(Ax2Step);
Handle(TCollection_HAsciiString) name = new TCollection_HAsciiString(""); Handle(TCollection_HAsciiString) name = new TCollection_HAsciiString("");
Standard_Real fact = theLocalFactors.LengthFactor(); Standard_Real fact = StepData_GlobalFactors::Intance().LengthFactor();
EStep->Init(name, Ax2,majorR/fact,minorR/fact); EStep->Init(name, Ax2,majorR/fact,minorR/fact);
theEllipse = EStep; theEllipse = EStep;
done = Standard_True; done = Standard_True;

View File

@@ -20,7 +20,7 @@
#include <gp_Hypr.hxx> #include <gp_Hypr.hxx>
#include <gp_Hypr2d.hxx> #include <gp_Hypr2d.hxx>
#include <StdFail_NotDone.hxx> #include <StdFail_NotDone.hxx>
#include <StepData_Factors.hxx> #include <StepData_GlobalFactors.hxx>
#include <StepGeom_Axis2Placement2d.hxx> #include <StepGeom_Axis2Placement2d.hxx>
#include <StepGeom_Axis2Placement3d.hxx> #include <StepGeom_Axis2Placement3d.hxx>
#include <StepGeom_Hyperbola.hxx> #include <StepGeom_Hyperbola.hxx>
@@ -30,8 +30,7 @@
// Creation d'une hyperbola de prostep a partir d'une hyperbola de // Creation d'une hyperbola de prostep a partir d'une hyperbola de
// Geom2d // Geom2d
//============================================================================= //=============================================================================
GeomToStep_MakeHyperbola::GeomToStep_MakeHyperbola(const Handle(Geom2d_Hyperbola)& C, GeomToStep_MakeHyperbola::GeomToStep_MakeHyperbola(const Handle(Geom2d_Hyperbola)& C)
const StepData_Factors& theLocalFactors)
{ {
gp_Hypr2d gpHyp; gp_Hypr2d gpHyp;
gpHyp = C->Hypr2d(); gpHyp = C->Hypr2d();
@@ -41,7 +40,7 @@ GeomToStep_MakeHyperbola::GeomToStep_MakeHyperbola(const Handle(Geom2d_Hyperbola
Handle(StepGeom_Axis2Placement2d) Ax2Step; Handle(StepGeom_Axis2Placement2d) Ax2Step;
Standard_Real majorR, minorR; Standard_Real majorR, minorR;
GeomToStep_MakeAxis2Placement2d MkAxis2(gpHyp.Axis(), theLocalFactors); GeomToStep_MakeAxis2Placement2d MkAxis2(gpHyp.Axis());
Ax2Step = MkAxis2.Value(); Ax2Step = MkAxis2.Value();
majorR = gpHyp.MajorRadius(); majorR = gpHyp.MajorRadius();
minorR = gpHyp.MinorRadius(); minorR = gpHyp.MinorRadius();
@@ -57,8 +56,7 @@ GeomToStep_MakeHyperbola::GeomToStep_MakeHyperbola(const Handle(Geom2d_Hyperbola
// Geom // Geom
//============================================================================= //=============================================================================
GeomToStep_MakeHyperbola::GeomToStep_MakeHyperbola(const Handle(Geom_Hyperbola)& C, GeomToStep_MakeHyperbola::GeomToStep_MakeHyperbola(const Handle(Geom_Hyperbola)& C)
const StepData_Factors& theLocalFactors)
{ {
gp_Hypr gpHyp; gp_Hypr gpHyp;
gpHyp = C->Hypr(); gpHyp = C->Hypr();
@@ -68,13 +66,13 @@ GeomToStep_MakeHyperbola::GeomToStep_MakeHyperbola(const Handle(Geom2d_Hyperbola
Handle(StepGeom_Axis2Placement3d) Ax2Step; Handle(StepGeom_Axis2Placement3d) Ax2Step;
Standard_Real majorR, minorR; Standard_Real majorR, minorR;
GeomToStep_MakeAxis2Placement3d MkAxis2(gpHyp.Position(), theLocalFactors); GeomToStep_MakeAxis2Placement3d MkAxis2(gpHyp.Position());
Ax2Step = MkAxis2.Value(); Ax2Step = MkAxis2.Value();
majorR = gpHyp.MajorRadius(); majorR = gpHyp.MajorRadius();
minorR = gpHyp.MinorRadius(); minorR = gpHyp.MinorRadius();
Ax2.SetValue(Ax2Step); Ax2.SetValue(Ax2Step);
Handle(TCollection_HAsciiString) name = new TCollection_HAsciiString(""); Handle(TCollection_HAsciiString) name = new TCollection_HAsciiString("");
Standard_Real fact = theLocalFactors.LengthFactor(); Standard_Real fact = StepData_GlobalFactors::Intance().LengthFactor();
HStep->Init(name, Ax2,majorR/fact,minorR/fact); HStep->Init(name, Ax2,majorR/fact,minorR/fact);
theHyperbola = HStep; theHyperbola = HStep;
done = Standard_True; done = Standard_True;

View File

@@ -37,11 +37,9 @@ public:
DEFINE_STANDARD_ALLOC DEFINE_STANDARD_ALLOC
Standard_EXPORT GeomToStep_MakeHyperbola(const Handle(Geom2d_Hyperbola)& C, Standard_EXPORT GeomToStep_MakeHyperbola(const Handle(Geom2d_Hyperbola)& C);
const StepData_Factors& theLocalFactors);
Standard_EXPORT GeomToStep_MakeHyperbola(const Handle(Geom_Hyperbola)& C, Standard_EXPORT GeomToStep_MakeHyperbola(const Handle(Geom_Hyperbola)& C);
const StepData_Factors& theLocalFactors);
Standard_EXPORT const Handle(StepGeom_Hyperbola)& Value() const; Standard_EXPORT const Handle(StepGeom_Hyperbola)& Value() const;

View File

@@ -25,7 +25,6 @@
#include <gp_Vec.hxx> #include <gp_Vec.hxx>
#include <gp_Vec2d.hxx> #include <gp_Vec2d.hxx>
#include <StdFail_NotDone.hxx> #include <StdFail_NotDone.hxx>
#include <StepData_Factors.hxx>
#include <StepGeom_CartesianPoint.hxx> #include <StepGeom_CartesianPoint.hxx>
#include <StepGeom_Line.hxx> #include <StepGeom_Line.hxx>
#include <StepGeom_Vector.hxx> #include <StepGeom_Vector.hxx>
@@ -34,8 +33,7 @@
//============================================================================= //=============================================================================
// Creation d' une line de prostep a partir d' une Lin de gp // Creation d' une line de prostep a partir d' une Lin de gp
//============================================================================= //=============================================================================
GeomToStep_MakeLine::GeomToStep_MakeLine( const gp_Lin& L, GeomToStep_MakeLine::GeomToStep_MakeLine( const gp_Lin& L)
const StepData_Factors& theLocalFactors)
{ {
#define Vec_gen gp_Vec #define Vec_gen gp_Vec
#include "GeomToStep_MakeLine_gen.pxx" #include "GeomToStep_MakeLine_gen.pxx"
@@ -46,8 +44,7 @@ GeomToStep_MakeLine::GeomToStep_MakeLine( const gp_Lin& L,
// Creation d' une line de prostep a partir d' une Lin2d de gp // Creation d' une line de prostep a partir d' une Lin2d de gp
//============================================================================= //=============================================================================
GeomToStep_MakeLine::GeomToStep_MakeLine( const gp_Lin2d& L, GeomToStep_MakeLine::GeomToStep_MakeLine( const gp_Lin2d& L)
const StepData_Factors& theLocalFactors)
{ {
#define Vec_gen gp_Vec2d #define Vec_gen gp_Vec2d
#include "GeomToStep_MakeLine_gen.pxx" #include "GeomToStep_MakeLine_gen.pxx"
@@ -58,8 +55,7 @@ GeomToStep_MakeLine::GeomToStep_MakeLine( const gp_Lin2d& L,
// Creation d' une line de prostep a partir d' une Line de Geom // Creation d' une line de prostep a partir d' une Line de Geom
//============================================================================= //=============================================================================
GeomToStep_MakeLine::GeomToStep_MakeLine ( const Handle(Geom_Line)& Gline, GeomToStep_MakeLine::GeomToStep_MakeLine ( const Handle(Geom_Line)& Gline)
const StepData_Factors& theLocalFactors)
{ {
gp_Lin L; gp_Lin L;
L = Gline->Lin(); L = Gline->Lin();
@@ -72,8 +68,7 @@ GeomToStep_MakeLine::GeomToStep_MakeLine ( const Handle(Geom_Line)& Gline,
// Creation d' une line de prostep a partir d' une Line de Geom2d // Creation d' une line de prostep a partir d' une Line de Geom2d
//============================================================================= //=============================================================================
GeomToStep_MakeLine::GeomToStep_MakeLine ( const Handle(Geom2d_Line)& Gline, GeomToStep_MakeLine::GeomToStep_MakeLine ( const Handle(Geom2d_Line)& Gline)
const StepData_Factors& theLocalFactors)
{ {
gp_Lin2d L; gp_Lin2d L;
L = Gline->Lin2d(); L = Gline->Lin2d();

View File

@@ -22,7 +22,6 @@
#include <Standard_Handle.hxx> #include <Standard_Handle.hxx>
#include <GeomToStep_Root.hxx> #include <GeomToStep_Root.hxx>
class StepData_Factors;
class StepGeom_Line; class StepGeom_Line;
class gp_Lin; class gp_Lin;
class gp_Lin2d; class gp_Lin2d;
@@ -41,17 +40,13 @@ public:
DEFINE_STANDARD_ALLOC DEFINE_STANDARD_ALLOC
Standard_EXPORT GeomToStep_MakeLine(const gp_Lin& L, Standard_EXPORT GeomToStep_MakeLine(const gp_Lin& L);
const StepData_Factors& theLocalFactors);
Standard_EXPORT GeomToStep_MakeLine(const gp_Lin2d& L, Standard_EXPORT GeomToStep_MakeLine(const gp_Lin2d& L);
const StepData_Factors& theLocalFactors);
Standard_EXPORT GeomToStep_MakeLine(const Handle(Geom_Line)& C, Standard_EXPORT GeomToStep_MakeLine(const Handle(Geom_Line)& C);
const StepData_Factors& theLocalFactors);
Standard_EXPORT GeomToStep_MakeLine(const Handle(Geom2d_Line)& C, Standard_EXPORT GeomToStep_MakeLine(const Handle(Geom2d_Line)& C);
const StepData_Factors& theLocalFactors);
Standard_EXPORT const Handle(StepGeom_Line)& Value() const; Standard_EXPORT const Handle(StepGeom_Line)& Value() const;

View File

@@ -18,8 +18,8 @@ Handle(StepGeom_Line) Lin = new StepGeom_Line;
Handle(StepGeom_CartesianPoint) aPnt; Handle(StepGeom_CartesianPoint) aPnt;
Handle(StepGeom_Vector) aDir; Handle(StepGeom_Vector) aDir;
GeomToStep_MakeCartesianPoint MkPoint(L.Location(), theLocalFactors.LengthFactor()); GeomToStep_MakeCartesianPoint MkPoint(L.Location());
GeomToStep_MakeVector MkVector(Vec_gen(L.Direction()), theLocalFactors); GeomToStep_MakeVector MkVector(Vec_gen(L.Direction()));
aPnt = MkPoint.Value(); aPnt = MkPoint.Value();
aDir = MkVector.Value(); aDir = MkVector.Value();
Handle(TCollection_HAsciiString) name = new TCollection_HAsciiString(""); Handle(TCollection_HAsciiString) name = new TCollection_HAsciiString("");

View File

@@ -20,7 +20,7 @@
#include <gp_Parab.hxx> #include <gp_Parab.hxx>
#include <gp_Parab2d.hxx> #include <gp_Parab2d.hxx>
#include <StdFail_NotDone.hxx> #include <StdFail_NotDone.hxx>
#include <StepData_Factors.hxx> #include <StepData_GlobalFactors.hxx>
#include <StepGeom_Axis2Placement2d.hxx> #include <StepGeom_Axis2Placement2d.hxx>
#include <StepGeom_Axis2Placement3d.hxx> #include <StepGeom_Axis2Placement3d.hxx>
#include <StepGeom_Parabola.hxx> #include <StepGeom_Parabola.hxx>
@@ -30,8 +30,7 @@
// Creation d'une Parabola de prostep a partir d'une Parabola de // Creation d'une Parabola de prostep a partir d'une Parabola de
// Geom2d // Geom2d
//============================================================================= //=============================================================================
GeomToStep_MakeParabola::GeomToStep_MakeParabola(const Handle(Geom2d_Parabola)& C, GeomToStep_MakeParabola::GeomToStep_MakeParabola(const Handle(Geom2d_Parabola)& C)
const StepData_Factors& theLocalFactors)
{ {
gp_Parab2d gpPar; gp_Parab2d gpPar;
gpPar = C->Parab2d(); gpPar = C->Parab2d();
@@ -41,7 +40,7 @@ GeomToStep_MakeParabola::GeomToStep_MakeParabola(const Handle(Geom2d_Parabola)&
Handle(StepGeom_Axis2Placement2d) Ax2Step; Handle(StepGeom_Axis2Placement2d) Ax2Step;
Standard_Real focal; Standard_Real focal;
GeomToStep_MakeAxis2Placement2d MkAxis2(gpPar.Axis(), theLocalFactors); GeomToStep_MakeAxis2Placement2d MkAxis2(gpPar.Axis());
Ax2Step = MkAxis2.Value(); Ax2Step = MkAxis2.Value();
focal = gpPar.Focal(); focal = gpPar.Focal();
Ax2.SetValue(Ax2Step); Ax2.SetValue(Ax2Step);
@@ -56,8 +55,7 @@ GeomToStep_MakeParabola::GeomToStep_MakeParabola(const Handle(Geom2d_Parabola)&
// Geom // Geom
//============================================================================= //=============================================================================
GeomToStep_MakeParabola::GeomToStep_MakeParabola(const Handle(Geom_Parabola)& C, GeomToStep_MakeParabola::GeomToStep_MakeParabola(const Handle(Geom_Parabola)& C)
const StepData_Factors& theLocalFactors)
{ {
gp_Parab gpPar; gp_Parab gpPar;
gpPar = C->Parab(); gpPar = C->Parab();
@@ -67,12 +65,12 @@ GeomToStep_MakeParabola::GeomToStep_MakeParabola(const Handle(Geom2d_Parabola)&
Handle(StepGeom_Axis2Placement3d) Ax2Step; Handle(StepGeom_Axis2Placement3d) Ax2Step;
Standard_Real focal; Standard_Real focal;
GeomToStep_MakeAxis2Placement3d MkAxis2(gpPar.Position(), theLocalFactors); GeomToStep_MakeAxis2Placement3d MkAxis2(gpPar.Position());
Ax2Step = MkAxis2.Value(); Ax2Step = MkAxis2.Value();
focal = gpPar.Focal(); focal = gpPar.Focal();
Ax2.SetValue(Ax2Step); Ax2.SetValue(Ax2Step);
Handle(TCollection_HAsciiString) name = new TCollection_HAsciiString(""); Handle(TCollection_HAsciiString) name = new TCollection_HAsciiString("");
PStep->Init(name, Ax2, focal / theLocalFactors.LengthFactor()); PStep->Init(name, Ax2, focal / StepData_GlobalFactors::Intance().LengthFactor());
theParabola = PStep; theParabola = PStep;
done = Standard_True; done = Standard_True;
} }

View File

@@ -25,7 +25,6 @@
class StepGeom_Parabola; class StepGeom_Parabola;
class Geom2d_Parabola; class Geom2d_Parabola;
class Geom_Parabola; class Geom_Parabola;
class StepData_Factors;
//! This class implements the mapping between the class //! This class implements the mapping between the class
@@ -38,11 +37,9 @@ public:
DEFINE_STANDARD_ALLOC DEFINE_STANDARD_ALLOC
Standard_EXPORT GeomToStep_MakeParabola(const Handle(Geom2d_Parabola)& C, Standard_EXPORT GeomToStep_MakeParabola(const Handle(Geom2d_Parabola)& C);
const StepData_Factors& theLocalFactors);
Standard_EXPORT GeomToStep_MakeParabola(const Handle(Geom_Parabola)& C, Standard_EXPORT GeomToStep_MakeParabola(const Handle(Geom_Parabola)& C);
const StepData_Factors& theLocalFactors);
Standard_EXPORT const Handle(StepGeom_Parabola)& Value() const; Standard_EXPORT const Handle(StepGeom_Parabola)& Value() const;

View File

@@ -27,13 +27,12 @@
//============================================================================= //=============================================================================
// Creation d' un plane de prostep a partir d' un Pln de gp // Creation d' un plane de prostep a partir d' un Pln de gp
//============================================================================= //=============================================================================
GeomToStep_MakePlane::GeomToStep_MakePlane( const gp_Pln& P, GeomToStep_MakePlane::GeomToStep_MakePlane( const gp_Pln& P)
const StepData_Factors& theLocalFactors)
{ {
Handle(StepGeom_Plane) Plan = new StepGeom_Plane; Handle(StepGeom_Plane) Plan = new StepGeom_Plane;
Handle(StepGeom_Axis2Placement3d) aPosition; Handle(StepGeom_Axis2Placement3d) aPosition;
GeomToStep_MakeAxis2Placement3d MkAxis2(P.Position(), theLocalFactors); GeomToStep_MakeAxis2Placement3d MkAxis2(P.Position());
aPosition = MkAxis2.Value(); aPosition = MkAxis2.Value();
Plan->SetPosition(aPosition); Plan->SetPosition(aPosition);
Handle(TCollection_HAsciiString) name = new TCollection_HAsciiString(""); Handle(TCollection_HAsciiString) name = new TCollection_HAsciiString("");
@@ -46,8 +45,7 @@ GeomToStep_MakePlane::GeomToStep_MakePlane( const gp_Pln& P,
// Creation d' un plane de prostep a partir d' un Plane de Geom // Creation d' un plane de prostep a partir d' un Plane de Geom
//============================================================================= //=============================================================================
GeomToStep_MakePlane::GeomToStep_MakePlane( const Handle(Geom_Plane)& Gpln, GeomToStep_MakePlane::GeomToStep_MakePlane( const Handle(Geom_Plane)& Gpln)
const StepData_Factors& theLocalFactors)
{ {
gp_Pln P; gp_Pln P;
Handle(StepGeom_Plane) Plan = new StepGeom_Plane; Handle(StepGeom_Plane) Plan = new StepGeom_Plane;
@@ -55,7 +53,7 @@ GeomToStep_MakePlane::GeomToStep_MakePlane( const Handle(Geom_Plane)& Gpln,
P = Gpln->Pln(); P = Gpln->Pln();
GeomToStep_MakeAxis2Placement3d MkAxis2(P.Position(), theLocalFactors); GeomToStep_MakeAxis2Placement3d MkAxis2(P.Position());
aPosition = MkAxis2.Value(); aPosition = MkAxis2.Value();
Plan->SetPosition(aPosition); Plan->SetPosition(aPosition);
Handle(TCollection_HAsciiString) name = new TCollection_HAsciiString(""); Handle(TCollection_HAsciiString) name = new TCollection_HAsciiString("");

View File

@@ -22,7 +22,6 @@
#include <Standard_Handle.hxx> #include <Standard_Handle.hxx>
#include <GeomToStep_Root.hxx> #include <GeomToStep_Root.hxx>
class StepData_Factors;
class StepGeom_Plane; class StepGeom_Plane;
class gp_Pln; class gp_Pln;
class Geom_Plane; class Geom_Plane;
@@ -39,11 +38,9 @@ public:
DEFINE_STANDARD_ALLOC DEFINE_STANDARD_ALLOC
Standard_EXPORT GeomToStep_MakePlane(const gp_Pln& P, Standard_EXPORT GeomToStep_MakePlane(const gp_Pln& P);
const StepData_Factors& theLocalFactors);
Standard_EXPORT GeomToStep_MakePlane(const Handle(Geom_Plane)& P, Standard_EXPORT GeomToStep_MakePlane(const Handle(Geom_Plane)& P);
const StepData_Factors& theLocalFactors);
Standard_EXPORT const Handle(StepGeom_Plane)& Value() const; Standard_EXPORT const Handle(StepGeom_Plane)& Value() const;

View File

@@ -20,7 +20,6 @@
#include <gp_Pnt.hxx> #include <gp_Pnt.hxx>
#include <gp_Pnt2d.hxx> #include <gp_Pnt2d.hxx>
#include <StdFail_NotDone.hxx> #include <StdFail_NotDone.hxx>
#include <StepData_Factors.hxx>
#include <StepGeom_Polyline.hxx> #include <StepGeom_Polyline.hxx>
#include <TColgp_Array1OfPnt.hxx> #include <TColgp_Array1OfPnt.hxx>
#include <TColgp_Array1OfPnt2d.hxx> #include <TColgp_Array1OfPnt2d.hxx>
@@ -29,8 +28,7 @@
//============================================================================= //=============================================================================
// Creation d' une polyline Step a partir d' une Array1OfPnt // Creation d' une polyline Step a partir d' une Array1OfPnt
//============================================================================= //=============================================================================
GeomToStep_MakePolyline::GeomToStep_MakePolyline( const TColgp_Array1OfPnt& P, GeomToStep_MakePolyline::GeomToStep_MakePolyline( const TColgp_Array1OfPnt& P)
const StepData_Factors& theLocalFactors)
{ {
gp_Pnt P1; gp_Pnt P1;
#include "GeomToStep_MakePolyline_gen.pxx" #include "GeomToStep_MakePolyline_gen.pxx"
@@ -40,8 +38,7 @@ GeomToStep_MakePolyline::GeomToStep_MakePolyline( const TColgp_Array1OfPnt& P,
// Creation d' une polyline Step a partir d' une Array1OfPnt2d // Creation d' une polyline Step a partir d' une Array1OfPnt2d
//============================================================================= //=============================================================================
GeomToStep_MakePolyline::GeomToStep_MakePolyline( const TColgp_Array1OfPnt2d& P, GeomToStep_MakePolyline::GeomToStep_MakePolyline( const TColgp_Array1OfPnt2d& P)
const StepData_Factors& theLocalFactors)
{ {
gp_Pnt2d P1; gp_Pnt2d P1;
#include "GeomToStep_MakePolyline_gen.pxx" #include "GeomToStep_MakePolyline_gen.pxx"

View File

@@ -24,8 +24,6 @@
#include <GeomToStep_Root.hxx> #include <GeomToStep_Root.hxx>
#include <TColgp_Array1OfPnt.hxx> #include <TColgp_Array1OfPnt.hxx>
#include <TColgp_Array1OfPnt2d.hxx> #include <TColgp_Array1OfPnt2d.hxx>
class StepData_Factors;
class StepGeom_Polyline; class StepGeom_Polyline;
@@ -38,11 +36,9 @@ public:
DEFINE_STANDARD_ALLOC DEFINE_STANDARD_ALLOC
Standard_EXPORT GeomToStep_MakePolyline(const TColgp_Array1OfPnt& P, Standard_EXPORT GeomToStep_MakePolyline(const TColgp_Array1OfPnt& P);
const StepData_Factors& theLocalFactors);
Standard_EXPORT GeomToStep_MakePolyline(const TColgp_Array1OfPnt2d& P, Standard_EXPORT GeomToStep_MakePolyline(const TColgp_Array1OfPnt2d& P);
const StepData_Factors& theLocalFactors);
Standard_EXPORT const Handle(StepGeom_Polyline)& Value() const; Standard_EXPORT const Handle(StepGeom_Polyline)& Value() const;

View File

@@ -22,7 +22,7 @@ Standard_Integer N, i;
aPoints = new StepGeom_HArray1OfCartesianPoint(1,N); aPoints = new StepGeom_HArray1OfCartesianPoint(1,N);
for (i=P.Lower(); i<=P.Upper(); i++) { for (i=P.Lower(); i<=P.Upper(); i++) {
P1 = P.Value(i); P1 = P.Value(i);
GeomToStep_MakeCartesianPoint MkPoint(P1, theLocalFactors.LengthFactor()); GeomToStep_MakeCartesianPoint MkPoint(P1);
P2 = MkPoint.Value(); P2 = MkPoint.Value();
aPoints->SetValue(i,P2); aPoints->SetValue(i,P2);
} }

View File

@@ -25,7 +25,7 @@
#include <GeomToStep_MakeRectangularTrimmedSurface.hxx> #include <GeomToStep_MakeRectangularTrimmedSurface.hxx>
#include <GeomToStep_MakeSurface.hxx> #include <GeomToStep_MakeSurface.hxx>
#include <StdFail_NotDone.hxx> #include <StdFail_NotDone.hxx>
#include <StepData_Factors.hxx> #include <StepData_GlobalFactors.hxx>
#include <StepGeom_RectangularTrimmedSurface.hxx> #include <StepGeom_RectangularTrimmedSurface.hxx>
#include <StepGeom_Surface.hxx> #include <StepGeom_Surface.hxx>
#include <TCollection_HAsciiString.hxx> #include <TCollection_HAsciiString.hxx>
@@ -36,15 +36,15 @@
//============================================================================= //=============================================================================
GeomToStep_MakeRectangularTrimmedSurface:: GeomToStep_MakeRectangularTrimmedSurface::
GeomToStep_MakeRectangularTrimmedSurface( const GeomToStep_MakeRectangularTrimmedSurface( const
Handle(Geom_RectangularTrimmedSurface)& RTSurf, Handle(Geom_RectangularTrimmedSurface)& RTSurf )
const StepData_Factors& theLocalFactors)
{ {
Handle(StepGeom_RectangularTrimmedSurface) StepRTS = new StepGeom_RectangularTrimmedSurface; Handle(StepGeom_RectangularTrimmedSurface) StepRTS = new StepGeom_RectangularTrimmedSurface;
Handle(TCollection_HAsciiString) aName = new TCollection_HAsciiString(""); Handle(TCollection_HAsciiString) aName = new TCollection_HAsciiString("");
GeomToStep_MakeSurface mkSurf(RTSurf->BasisSurface(), theLocalFactors); GeomToStep_MakeSurface mkSurf(RTSurf->BasisSurface());
if (!mkSurf.IsDone()) { if (!mkSurf.IsDone()) {
done = Standard_False; done = Standard_False;
return; return;
@@ -61,7 +61,7 @@ GeomToStep_MakeRectangularTrimmedSurface::
Standard_Real AngleFact = 180./M_PI; Standard_Real AngleFact = 180./M_PI;
Standard_Real uFact = 1.; Standard_Real uFact = 1.;
Standard_Real vFact = 1.; Standard_Real vFact = 1.;
Standard_Real LengthFact = theLocalFactors.LengthFactor(); Standard_Real LengthFact = StepData_GlobalFactors::Intance().LengthFactor();
Handle(Geom_Surface) theSurf = RTSurf->BasisSurface(); Handle(Geom_Surface) theSurf = RTSurf->BasisSurface();
if (theSurf->IsKind(STANDARD_TYPE(Geom_CylindricalSurface))) { if (theSurf->IsKind(STANDARD_TYPE(Geom_CylindricalSurface))) {
uFact = AngleFact; uFact = AngleFact;

View File

@@ -22,8 +22,6 @@
#include <Standard_Handle.hxx> #include <Standard_Handle.hxx>
#include <GeomToStep_Root.hxx> #include <GeomToStep_Root.hxx>
class StepData_Factors;
class StepGeom_RectangularTrimmedSurface; class StepGeom_RectangularTrimmedSurface;
class Geom_RectangularTrimmedSurface; class Geom_RectangularTrimmedSurface;
@@ -40,8 +38,7 @@ public:
DEFINE_STANDARD_ALLOC DEFINE_STANDARD_ALLOC
Standard_EXPORT GeomToStep_MakeRectangularTrimmedSurface(const Handle(Geom_RectangularTrimmedSurface)& RTSurf, Standard_EXPORT GeomToStep_MakeRectangularTrimmedSurface(const Handle(Geom_RectangularTrimmedSurface)& RTSurf);
const StepData_Factors& theLocalFactors);
Standard_EXPORT const Handle(StepGeom_RectangularTrimmedSurface)& Value() const; Standard_EXPORT const Handle(StepGeom_RectangularTrimmedSurface)& Value() const;

View File

@@ -19,29 +19,29 @@
#include <GeomToStep_MakeAxis2Placement3d.hxx> #include <GeomToStep_MakeAxis2Placement3d.hxx>
#include <GeomToStep_MakeSphericalSurface.hxx> #include <GeomToStep_MakeSphericalSurface.hxx>
#include <StdFail_NotDone.hxx> #include <StdFail_NotDone.hxx>
#include <StepData_Factors.hxx>
#include <StepGeom_Axis2Placement3d.hxx> #include <StepGeom_Axis2Placement3d.hxx>
#include <StepGeom_SphericalSurface.hxx> #include <StepGeom_SphericalSurface.hxx>
#include <TCollection_HAsciiString.hxx> #include <TCollection_HAsciiString.hxx>
#include <StepData_GlobalFactors.hxx>
//============================================================================= //=============================================================================
// Creation d' une conical_surface de prostep a partir d' une SphericalSurface // Creation d' une conical_surface de prostep a partir d' une SphericalSurface
// de Geom // de Geom
//============================================================================= //=============================================================================
GeomToStep_MakeSphericalSurface::GeomToStep_MakeSphericalSurface GeomToStep_MakeSphericalSurface::GeomToStep_MakeSphericalSurface
( const Handle(Geom_SphericalSurface)& S, ( const Handle(Geom_SphericalSurface)& S )
const StepData_Factors& theLocalFactors)
{ {
Handle(StepGeom_SphericalSurface) Surf; Handle(StepGeom_SphericalSurface) Surf;
Handle(StepGeom_Axis2Placement3d) aPosition; Handle(StepGeom_Axis2Placement3d) aPosition;
Standard_Real aRadius; Standard_Real aRadius;
GeomToStep_MakeAxis2Placement3d MkAxis2(S->Position(), theLocalFactors); GeomToStep_MakeAxis2Placement3d MkAxis2(S->Position());
aPosition = MkAxis2.Value(); aPosition = MkAxis2.Value();
aRadius = S->Radius(); aRadius = S->Radius();
Surf = new StepGeom_SphericalSurface; Surf = new StepGeom_SphericalSurface;
Handle(TCollection_HAsciiString) name = new TCollection_HAsciiString(""); Handle(TCollection_HAsciiString) name = new TCollection_HAsciiString("");
Surf->Init(name, aPosition, aRadius/ theLocalFactors.LengthFactor()); Surf->Init(name, aPosition, aRadius/ StepData_GlobalFactors::Intance().LengthFactor());
theSphericalSurface = Surf; theSphericalSurface = Surf;
done = Standard_True; done = Standard_True;
} }

View File

@@ -22,8 +22,6 @@
#include <Standard_Handle.hxx> #include <Standard_Handle.hxx>
#include <GeomToStep_Root.hxx> #include <GeomToStep_Root.hxx>
class StepData_Factors;
class StepGeom_SphericalSurface; class StepGeom_SphericalSurface;
class Geom_SphericalSurface; class Geom_SphericalSurface;
@@ -39,8 +37,7 @@ public:
DEFINE_STANDARD_ALLOC DEFINE_STANDARD_ALLOC
Standard_EXPORT GeomToStep_MakeSphericalSurface(const Handle(Geom_SphericalSurface)& CSurf, Standard_EXPORT GeomToStep_MakeSphericalSurface(const Handle(Geom_SphericalSurface)& CSurf);
const StepData_Factors& theLocalFactors);
Standard_EXPORT const Handle(StepGeom_SphericalSurface)& Value() const; Standard_EXPORT const Handle(StepGeom_SphericalSurface)& Value() const;

View File

@@ -26,48 +26,47 @@
#include <GeomToStep_MakeSweptSurface.hxx> #include <GeomToStep_MakeSweptSurface.hxx>
#include <StdFail_NotDone.hxx> #include <StdFail_NotDone.hxx>
#include <StepData_Logical.hxx> #include <StepData_Logical.hxx>
#include <StepData_Factors.hxx>
#include <StepGeom_BoundedSurface.hxx> #include <StepGeom_BoundedSurface.hxx>
#include <StepGeom_ElementarySurface.hxx> #include <StepGeom_ElementarySurface.hxx>
#include <StepGeom_OffsetSurface.hxx> #include <StepGeom_OffsetSurface.hxx>
#include <StepGeom_Surface.hxx> #include <StepGeom_Surface.hxx>
#include <StepGeom_SweptSurface.hxx> #include <StepGeom_SweptSurface.hxx>
#include <TCollection_HAsciiString.hxx> #include <TCollection_HAsciiString.hxx>
#include <StepData_GlobalFactors.hxx>
//============================================================================= //=============================================================================
// Creation d' une Surface de prostep a partir d' une Surface de Geom // Creation d' une Surface de prostep a partir d' une Surface de Geom
//============================================================================= //=============================================================================
GeomToStep_MakeSurface::GeomToStep_MakeSurface ( const Handle(Geom_Surface)& S, GeomToStep_MakeSurface::GeomToStep_MakeSurface ( const Handle(Geom_Surface)& S)
const StepData_Factors& theLocalFactors)
{ {
done = Standard_True; done = Standard_True;
if (S->IsKind(STANDARD_TYPE(Geom_BoundedSurface))) { if (S->IsKind(STANDARD_TYPE(Geom_BoundedSurface))) {
Handle(Geom_BoundedSurface) S1 = Handle(Geom_BoundedSurface) S1 =
Handle(Geom_BoundedSurface)::DownCast(S); Handle(Geom_BoundedSurface)::DownCast(S);
GeomToStep_MakeBoundedSurface MkBoundedS(S1, theLocalFactors); GeomToStep_MakeBoundedSurface MkBoundedS(S1);
theSurface = MkBoundedS.Value(); theSurface = MkBoundedS.Value();
} }
else if (S->IsKind(STANDARD_TYPE(Geom_ElementarySurface))) { else if (S->IsKind(STANDARD_TYPE(Geom_ElementarySurface))) {
Handle(Geom_ElementarySurface) S1 = Handle(Geom_ElementarySurface) S1 =
Handle(Geom_ElementarySurface)::DownCast(S); Handle(Geom_ElementarySurface)::DownCast(S);
GeomToStep_MakeElementarySurface MkElementaryS(S1, theLocalFactors); GeomToStep_MakeElementarySurface MkElementaryS(S1);
theSurface = MkElementaryS.Value(); theSurface = MkElementaryS.Value();
} }
else if (S->IsKind(STANDARD_TYPE(Geom_SweptSurface))) { else if (S->IsKind(STANDARD_TYPE(Geom_SweptSurface))) {
Handle(Geom_SweptSurface) S1 = Handle(Geom_SweptSurface) S1 =
Handle(Geom_SweptSurface)::DownCast(S); Handle(Geom_SweptSurface)::DownCast(S);
GeomToStep_MakeSweptSurface MkSwept(S1, theLocalFactors); GeomToStep_MakeSweptSurface MkSwept(S1);
theSurface = MkSwept.Value(); theSurface = MkSwept.Value();
} }
else if (S->IsKind(STANDARD_TYPE(Geom_OffsetSurface))) { else if (S->IsKind(STANDARD_TYPE(Geom_OffsetSurface))) {
Handle(Geom_OffsetSurface) S1 = Handle(Geom_OffsetSurface) S1 =
Handle(Geom_OffsetSurface)::DownCast(S); Handle(Geom_OffsetSurface)::DownCast(S);
GeomToStep_MakeSurface MkBasis(S1->BasisSurface(), theLocalFactors); GeomToStep_MakeSurface MkBasis(S1->BasisSurface());
done = MkBasis.IsDone(); done = MkBasis.IsDone();
if (!done) return; if (!done) return;
Handle(StepGeom_OffsetSurface) Surf = new StepGeom_OffsetSurface; Handle(StepGeom_OffsetSurface) Surf = new StepGeom_OffsetSurface;
Surf->Init (new TCollection_HAsciiString(""), Surf->Init (new TCollection_HAsciiString(""),
MkBasis.Value(),S1->Offset()/ theLocalFactors.LengthFactor(),StepData_LFalse); MkBasis.Value(),S1->Offset()/ StepData_GlobalFactors::Intance().LengthFactor(),StepData_LFalse);
theSurface = Surf; theSurface = Surf;
} }
else { else {

View File

@@ -22,8 +22,6 @@
#include <Standard_Handle.hxx> #include <Standard_Handle.hxx>
#include <GeomToStep_Root.hxx> #include <GeomToStep_Root.hxx>
class StepData_Factors;
class StepGeom_Surface; class StepGeom_Surface;
class Geom_Surface; class Geom_Surface;
@@ -39,8 +37,7 @@ public:
DEFINE_STANDARD_ALLOC DEFINE_STANDARD_ALLOC
Standard_EXPORT GeomToStep_MakeSurface(const Handle(Geom_Surface)& C, Standard_EXPORT GeomToStep_MakeSurface(const Handle(Geom_Surface)& C);
const StepData_Factors& theLocalFactors);
Standard_EXPORT const Handle(StepGeom_Surface)& Value() const; Standard_EXPORT const Handle(StepGeom_Surface)& Value() const;

View File

@@ -21,7 +21,6 @@
#include <GeomToStep_MakeVector.hxx> #include <GeomToStep_MakeVector.hxx>
#include <gp_Vec.hxx> #include <gp_Vec.hxx>
#include <StdFail_NotDone.hxx> #include <StdFail_NotDone.hxx>
#include <StepData_Factors.hxx>
#include <StepGeom_Curve.hxx> #include <StepGeom_Curve.hxx>
#include <StepGeom_SurfaceOfLinearExtrusion.hxx> #include <StepGeom_SurfaceOfLinearExtrusion.hxx>
#include <StepGeom_Vector.hxx> #include <StepGeom_Vector.hxx>
@@ -32,15 +31,15 @@
// SurfaceOfLinearExtrusion de Geom // SurfaceOfLinearExtrusion de Geom
//============================================================================= //=============================================================================
GeomToStep_MakeSurfaceOfLinearExtrusion::GeomToStep_MakeSurfaceOfLinearExtrusion GeomToStep_MakeSurfaceOfLinearExtrusion::GeomToStep_MakeSurfaceOfLinearExtrusion
( const Handle(Geom_SurfaceOfLinearExtrusion)& S, ( const Handle(Geom_SurfaceOfLinearExtrusion)& S )
const StepData_Factors& theLocalFactors)
{ {
Handle(StepGeom_SurfaceOfLinearExtrusion) Surf; Handle(StepGeom_SurfaceOfLinearExtrusion) Surf;
Handle(StepGeom_Curve) aSweptCurve; Handle(StepGeom_Curve) aSweptCurve;
Handle(StepGeom_Vector) aExtrusionAxis; Handle(StepGeom_Vector) aExtrusionAxis;
GeomToStep_MakeCurve MkCurve(S->BasisCurve(), theLocalFactors); GeomToStep_MakeCurve MkCurve(S->BasisCurve());
GeomToStep_MakeVector MkVector(gp_Vec(S->Direction()), theLocalFactors); GeomToStep_MakeVector MkVector(gp_Vec(S->Direction()));
aSweptCurve = MkCurve.Value(); aSweptCurve = MkCurve.Value();
aExtrusionAxis = MkVector.Value(); aExtrusionAxis = MkVector.Value();

View File

@@ -22,8 +22,6 @@
#include <Standard_Handle.hxx> #include <Standard_Handle.hxx>
#include <GeomToStep_Root.hxx> #include <GeomToStep_Root.hxx>
class StepData_Factors;
class StepGeom_SurfaceOfLinearExtrusion; class StepGeom_SurfaceOfLinearExtrusion;
class Geom_SurfaceOfLinearExtrusion; class Geom_SurfaceOfLinearExtrusion;
@@ -39,8 +37,7 @@ public:
DEFINE_STANDARD_ALLOC DEFINE_STANDARD_ALLOC
Standard_EXPORT GeomToStep_MakeSurfaceOfLinearExtrusion(const Handle(Geom_SurfaceOfLinearExtrusion)& CSurf, Standard_EXPORT GeomToStep_MakeSurfaceOfLinearExtrusion(const Handle(Geom_SurfaceOfLinearExtrusion)& CSurf);
const StepData_Factors& theLocalFactors);
Standard_EXPORT const Handle(StepGeom_SurfaceOfLinearExtrusion)& Value() const; Standard_EXPORT const Handle(StepGeom_SurfaceOfLinearExtrusion)& Value() const;

View File

@@ -20,7 +20,6 @@
#include <GeomToStep_MakeCurve.hxx> #include <GeomToStep_MakeCurve.hxx>
#include <GeomToStep_MakeSurfaceOfRevolution.hxx> #include <GeomToStep_MakeSurfaceOfRevolution.hxx>
#include <StdFail_NotDone.hxx> #include <StdFail_NotDone.hxx>
#include <StepData_Factors.hxx>
#include <StepGeom_Axis1Placement.hxx> #include <StepGeom_Axis1Placement.hxx>
#include <StepGeom_Curve.hxx> #include <StepGeom_Curve.hxx>
#include <StepGeom_SurfaceOfRevolution.hxx> #include <StepGeom_SurfaceOfRevolution.hxx>
@@ -31,15 +30,15 @@
// SurfaceOfRevolution de Geom // SurfaceOfRevolution de Geom
//============================================================================= //=============================================================================
GeomToStep_MakeSurfaceOfRevolution::GeomToStep_MakeSurfaceOfRevolution GeomToStep_MakeSurfaceOfRevolution::GeomToStep_MakeSurfaceOfRevolution
( const Handle(Geom_SurfaceOfRevolution)& S, ( const Handle(Geom_SurfaceOfRevolution)& S )
const StepData_Factors& theLocalFactors)
{ {
Handle(StepGeom_SurfaceOfRevolution) Surf; Handle(StepGeom_SurfaceOfRevolution) Surf;
Handle(StepGeom_Curve) aSweptCurve; Handle(StepGeom_Curve) aSweptCurve;
Handle(StepGeom_Axis1Placement) aAxisPosition; Handle(StepGeom_Axis1Placement) aAxisPosition;
GeomToStep_MakeCurve MkSwept(S->BasisCurve(), theLocalFactors); GeomToStep_MakeCurve MkSwept(S->BasisCurve());
GeomToStep_MakeAxis1Placement MkAxis1(S->Axis(), theLocalFactors); GeomToStep_MakeAxis1Placement MkAxis1(S->Axis());
aSweptCurve = MkSwept.Value(); aSweptCurve = MkSwept.Value();
aAxisPosition = MkAxis1.Value(); aAxisPosition = MkAxis1.Value();
Surf = new StepGeom_SurfaceOfRevolution; Surf = new StepGeom_SurfaceOfRevolution;

View File

@@ -22,8 +22,6 @@
#include <Standard_Handle.hxx> #include <Standard_Handle.hxx>
#include <GeomToStep_Root.hxx> #include <GeomToStep_Root.hxx>
class StepData_Factors;
class StepGeom_SurfaceOfRevolution; class StepGeom_SurfaceOfRevolution;
class Geom_SurfaceOfRevolution; class Geom_SurfaceOfRevolution;
@@ -39,8 +37,7 @@ public:
DEFINE_STANDARD_ALLOC DEFINE_STANDARD_ALLOC
Standard_EXPORT GeomToStep_MakeSurfaceOfRevolution(const Handle(Geom_SurfaceOfRevolution)& RevSurf, Standard_EXPORT GeomToStep_MakeSurfaceOfRevolution(const Handle(Geom_SurfaceOfRevolution)& RevSurf);
const StepData_Factors& theLocalFactors);
Standard_EXPORT const Handle(StepGeom_SurfaceOfRevolution)& Value() const; Standard_EXPORT const Handle(StepGeom_SurfaceOfRevolution)& Value() const;

View File

@@ -22,7 +22,6 @@
#include <GeomToStep_MakeSurfaceOfRevolution.hxx> #include <GeomToStep_MakeSurfaceOfRevolution.hxx>
#include <GeomToStep_MakeSweptSurface.hxx> #include <GeomToStep_MakeSweptSurface.hxx>
#include <StdFail_NotDone.hxx> #include <StdFail_NotDone.hxx>
#include <StepData_Factors.hxx>
#include <StepGeom_SurfaceOfLinearExtrusion.hxx> #include <StepGeom_SurfaceOfLinearExtrusion.hxx>
#include <StepGeom_SurfaceOfRevolution.hxx> #include <StepGeom_SurfaceOfRevolution.hxx>
#include <StepGeom_SweptSurface.hxx> #include <StepGeom_SweptSurface.hxx>
@@ -33,20 +32,19 @@
// SweptSurface de Geom // SweptSurface de Geom
//============================================================================= //=============================================================================
GeomToStep_MakeSweptSurface::GeomToStep_MakeSweptSurface GeomToStep_MakeSweptSurface::GeomToStep_MakeSweptSurface
( const Handle(Geom_SweptSurface)& S, ( const Handle(Geom_SweptSurface)& S)
const StepData_Factors& theLocalFactors)
{ {
done = Standard_True; done = Standard_True;
if (S->IsKind(STANDARD_TYPE(Geom_SurfaceOfLinearExtrusion))) { if (S->IsKind(STANDARD_TYPE(Geom_SurfaceOfLinearExtrusion))) {
Handle(Geom_SurfaceOfLinearExtrusion) Sur = Handle(Geom_SurfaceOfLinearExtrusion) Sur =
Handle(Geom_SurfaceOfLinearExtrusion)::DownCast(S); Handle(Geom_SurfaceOfLinearExtrusion)::DownCast(S);
GeomToStep_MakeSurfaceOfLinearExtrusion MkLinear(Sur, theLocalFactors); GeomToStep_MakeSurfaceOfLinearExtrusion MkLinear(Sur);
theSweptSurface = MkLinear.Value(); theSweptSurface = MkLinear.Value();
} }
else if (S->IsKind(STANDARD_TYPE(Geom_SurfaceOfRevolution))) { else if (S->IsKind(STANDARD_TYPE(Geom_SurfaceOfRevolution))) {
Handle(Geom_SurfaceOfRevolution) Sur = Handle(Geom_SurfaceOfRevolution) Sur =
Handle(Geom_SurfaceOfRevolution)::DownCast(S); Handle(Geom_SurfaceOfRevolution)::DownCast(S);
GeomToStep_MakeSurfaceOfRevolution MkRevol(Sur, theLocalFactors); GeomToStep_MakeSurfaceOfRevolution MkRevol(Sur);
theSweptSurface = MkRevol.Value(); theSweptSurface = MkRevol.Value();
} }
else else

View File

@@ -22,8 +22,6 @@
#include <Standard_Handle.hxx> #include <Standard_Handle.hxx>
#include <GeomToStep_Root.hxx> #include <GeomToStep_Root.hxx>
class StepData_Factors;
class StepGeom_SweptSurface; class StepGeom_SweptSurface;
class Geom_SweptSurface; class Geom_SweptSurface;
@@ -40,8 +38,7 @@ public:
DEFINE_STANDARD_ALLOC DEFINE_STANDARD_ALLOC
Standard_EXPORT GeomToStep_MakeSweptSurface(const Handle(Geom_SweptSurface)& S, Standard_EXPORT GeomToStep_MakeSweptSurface(const Handle(Geom_SweptSurface)& S);
const StepData_Factors& theLocalFactors);
Standard_EXPORT const Handle(StepGeom_SweptSurface)& Value() const; Standard_EXPORT const Handle(StepGeom_SweptSurface)& Value() const;

View File

@@ -19,29 +19,29 @@
#include <GeomToStep_MakeAxis2Placement3d.hxx> #include <GeomToStep_MakeAxis2Placement3d.hxx>
#include <GeomToStep_MakeToroidalSurface.hxx> #include <GeomToStep_MakeToroidalSurface.hxx>
#include <StdFail_NotDone.hxx> #include <StdFail_NotDone.hxx>
#include <StepData_Factors.hxx>
#include <StepGeom_ToroidalSurface.hxx> #include <StepGeom_ToroidalSurface.hxx>
#include <TCollection_HAsciiString.hxx> #include <TCollection_HAsciiString.hxx>
#include <StepData_GlobalFactors.hxx>
//============================================================================= //=============================================================================
// Creation d' une toroidal_surface de prostep a partir d' une ToroidalSurface // Creation d' une toroidal_surface de prostep a partir d' une ToroidalSurface
// de Geom // de Geom
//============================================================================= //=============================================================================
GeomToStep_MakeToroidalSurface::GeomToStep_MakeToroidalSurface GeomToStep_MakeToroidalSurface::GeomToStep_MakeToroidalSurface
( const Handle(Geom_ToroidalSurface)& S, ( const Handle(Geom_ToroidalSurface)& S )
const StepData_Factors& theLocalFactors)
{ {
Handle(StepGeom_ToroidalSurface) Surf; Handle(StepGeom_ToroidalSurface) Surf;
Handle(StepGeom_Axis2Placement3d) aPosition; Handle(StepGeom_Axis2Placement3d) aPosition;
Standard_Real aMajorRadius, aMinorRadius; Standard_Real aMajorRadius, aMinorRadius;
GeomToStep_MakeAxis2Placement3d MkAxis2(S->Position(), theLocalFactors); GeomToStep_MakeAxis2Placement3d MkAxis2(S->Position());
aPosition = MkAxis2.Value(); aPosition = MkAxis2.Value();
aMajorRadius = S->MajorRadius(); aMajorRadius = S->MajorRadius();
aMinorRadius = S->MinorRadius(); aMinorRadius = S->MinorRadius();
Surf = new StepGeom_ToroidalSurface; Surf = new StepGeom_ToroidalSurface;
Handle(TCollection_HAsciiString) name = new TCollection_HAsciiString(""); Handle(TCollection_HAsciiString) name = new TCollection_HAsciiString("");
Standard_Real fact = theLocalFactors.LengthFactor(); Standard_Real fact = StepData_GlobalFactors::Intance().LengthFactor();
Surf->Init(name, aPosition, aMajorRadius/fact, aMinorRadius/fact); Surf->Init(name, aPosition, aMajorRadius/fact, aMinorRadius/fact);
theToroidalSurface = Surf; theToroidalSurface = Surf;
done = Standard_True; done = Standard_True;

View File

@@ -22,8 +22,6 @@
#include <Standard_Handle.hxx> #include <Standard_Handle.hxx>
#include <GeomToStep_Root.hxx> #include <GeomToStep_Root.hxx>
class StepData_Factors;
class StepGeom_ToroidalSurface; class StepGeom_ToroidalSurface;
class Geom_ToroidalSurface; class Geom_ToroidalSurface;
@@ -39,8 +37,7 @@ public:
DEFINE_STANDARD_ALLOC DEFINE_STANDARD_ALLOC
Standard_EXPORT GeomToStep_MakeToroidalSurface(const Handle(Geom_ToroidalSurface)& TorSurf, Standard_EXPORT GeomToStep_MakeToroidalSurface(const Handle(Geom_ToroidalSurface)& TorSurf);
const StepData_Factors& theLocalFactors);
Standard_EXPORT const Handle(StepGeom_ToroidalSurface)& Value() const; Standard_EXPORT const Handle(StepGeom_ToroidalSurface)& Value() const;

View File

@@ -24,28 +24,25 @@
#include <gp_Vec.hxx> #include <gp_Vec.hxx>
#include <gp_Vec2d.hxx> #include <gp_Vec2d.hxx>
#include <StdFail_NotDone.hxx> #include <StdFail_NotDone.hxx>
#include <StepData_Factors.hxx> #include <StepData_GlobalFactors.hxx>
#include <StepGeom_Vector.hxx> #include <StepGeom_Vector.hxx>
#include <TCollection_HAsciiString.hxx> #include <TCollection_HAsciiString.hxx>
//============================================================================= //=============================================================================
// Creation d' un vector de prostep a partir d' un Vec de gp // Creation d' un vector de prostep a partir d' un Vec de gp
//============================================================================= //=============================================================================
GeomToStep_MakeVector::GeomToStep_MakeVector( const gp_Vec& V, GeomToStep_MakeVector::GeomToStep_MakeVector( const gp_Vec& V)
const StepData_Factors& theLocalFactors)
{ {
gp_Dir D = gp_Dir(V); gp_Dir D = gp_Dir(V);
Standard_Real lFactor = theLocalFactors.LengthFactor(); Standard_Real lFactor = StepData_GlobalFactors::Intance().LengthFactor();
#include "GeomToStep_MakeVector_gen.pxx" #include "GeomToStep_MakeVector_gen.pxx"
} }
//============================================================================= //=============================================================================
// Creation d' un vector de prostep a partir d' un Vec2d de gp // Creation d' un vector de prostep a partir d' un Vec2d de gp
//============================================================================= //=============================================================================
GeomToStep_MakeVector::GeomToStep_MakeVector( const gp_Vec2d& V, GeomToStep_MakeVector::GeomToStep_MakeVector( const gp_Vec2d& V)
const StepData_Factors& theLocalFactors)
{ {
(void)theLocalFactors;
gp_Dir2d D = gp_Dir2d(V); gp_Dir2d D = gp_Dir2d(V);
Standard_Real lFactor = 1.; Standard_Real lFactor = 1.;
#include "GeomToStep_MakeVector_gen.pxx" #include "GeomToStep_MakeVector_gen.pxx"
@@ -55,13 +52,13 @@ GeomToStep_MakeVector::GeomToStep_MakeVector( const gp_Vec2d& V,
// Creation d' un vector de prostep a partir d' un Vector de Geom // Creation d' un vector de prostep a partir d' un Vector de Geom
//============================================================================= //=============================================================================
GeomToStep_MakeVector::GeomToStep_MakeVector ( const Handle(Geom_Vector)& GVector, GeomToStep_MakeVector::GeomToStep_MakeVector ( const Handle(Geom_Vector)&
const StepData_Factors& theLocalFactors) GVector)
{ {
gp_Vec V; gp_Vec V;
V = GVector->Vec(); V = GVector->Vec();
gp_Dir D = gp_Dir(V); gp_Dir D = gp_Dir(V);
Standard_Real lFactor = theLocalFactors.LengthFactor(); Standard_Real lFactor = StepData_GlobalFactors::Intance().LengthFactor();
#include "GeomToStep_MakeVector_gen.pxx" #include "GeomToStep_MakeVector_gen.pxx"
} }
@@ -69,10 +66,9 @@ GeomToStep_MakeVector::GeomToStep_MakeVector ( const Handle(Geom_Vector)& GVecto
// Creation d' un vector de prostep a partir d' un Vector de Geom2d // Creation d' un vector de prostep a partir d' un Vector de Geom2d
//============================================================================= //=============================================================================
GeomToStep_MakeVector::GeomToStep_MakeVector ( const Handle(Geom2d_Vector)& GVector, GeomToStep_MakeVector::GeomToStep_MakeVector ( const Handle(Geom2d_Vector)&
const StepData_Factors& theLocalFactors) GVector)
{ {
(void)theLocalFactors;
gp_Vec2d V; gp_Vec2d V;
V = GVector->Vec2d(); V = GVector->Vec2d();
gp_Dir2d D = gp_Dir2d(V); gp_Dir2d D = gp_Dir2d(V);

View File

@@ -22,8 +22,6 @@
#include <Standard_Handle.hxx> #include <Standard_Handle.hxx>
#include <GeomToStep_Root.hxx> #include <GeomToStep_Root.hxx>
class StepData_Factors;
class StepGeom_Vector; class StepGeom_Vector;
class gp_Vec; class gp_Vec;
class gp_Vec2d; class gp_Vec2d;
@@ -42,17 +40,13 @@ public:
DEFINE_STANDARD_ALLOC DEFINE_STANDARD_ALLOC
Standard_EXPORT GeomToStep_MakeVector(const gp_Vec& V, Standard_EXPORT GeomToStep_MakeVector(const gp_Vec& V);
const StepData_Factors& theLocalFactors);
Standard_EXPORT GeomToStep_MakeVector(const gp_Vec2d& V, Standard_EXPORT GeomToStep_MakeVector(const gp_Vec2d& V);
const StepData_Factors& theLocalFactors);
Standard_EXPORT GeomToStep_MakeVector(const Handle(Geom_Vector)& V, Standard_EXPORT GeomToStep_MakeVector(const Handle(Geom_Vector)& V);
const StepData_Factors& theLocalFactors);
Standard_EXPORT GeomToStep_MakeVector(const Handle(Geom2d_Vector)& V, Standard_EXPORT GeomToStep_MakeVector(const Handle(Geom2d_Vector)& V);
const StepData_Factors& theLocalFactors);
Standard_EXPORT const Handle(StepGeom_Vector)& Value() const; Standard_EXPORT const Handle(StepGeom_Vector)& Value() const;

View File

@@ -27,7 +27,6 @@
#include <Standard_Real.hxx> #include <Standard_Real.hxx>
#include <TColStd_HArray1OfInteger.hxx> #include <TColStd_HArray1OfInteger.hxx>
#include <TColStd_HArray2OfInteger.hxx> #include <TColStd_HArray2OfInteger.hxx>
#include <TColStd_HArray1OfTransient.hxx>
//======================================================================= //=======================================================================
//function : RWStepVisual_RWComplexTriangulatedSurfaceSet //function : RWStepVisual_RWComplexTriangulatedSurfaceSet
@@ -107,16 +106,15 @@ void RWStepVisual_RWComplexTriangulatedSurfaceSet::ReadStep(
} }
} }
Handle(TColStd_HArray1OfTransient) aTriangleStrips; Handle(TColStd_HArray2OfInteger) aTriangleStrips;
Standard_Integer sub6 = 0; Standard_Integer sub6 = 0;
if (theData->ReadSubList(theNum, 6, "triangle_strips", theCheck, sub6)) if (theData->ReadSubList(theNum, 6, "triangle_strips", theCheck, sub6))
{ {
Standard_Integer nb0 = theData->NbParams(sub6); Standard_Integer nb0 = theData->NbParams(sub6);
aTriangleStrips = new TColStd_HArray1OfTransient(1, nb0); Standard_Integer nbj0 = theData->NbParams(theData->ParamNumber(sub6,1));
aTriangleStrips = new TColStd_HArray2OfInteger(1, nb0, 1, nbj0);
for (Standard_Integer i0 = 1; i0 <= nb0; i0++) 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; Standard_Integer subj6 = 0;
if ( theData->ReadSubList (sub6, i0, "sub-part(triangle_strips)", theCheck, subj6) ) { if ( theData->ReadSubList (sub6, i0, "sub-part(triangle_strips)", theCheck, subj6) ) {
Standard_Integer num4 = subj6; Standard_Integer num4 = subj6;
@@ -124,23 +122,21 @@ void RWStepVisual_RWComplexTriangulatedSurfaceSet::ReadStep(
{ {
Standard_Integer anIt0; Standard_Integer anIt0;
theData->ReadInteger(num4, j0, "integer", theCheck, anIt0); theData->ReadInteger(num4, j0, "integer", theCheck, anIt0);
aSingleTriangleStrip->SetValue(j0, anIt0); aTriangleStrips->SetValue(i0,j0, anIt0);
} }
aTriangleStrips->SetValue(i0, aSingleTriangleStrip);
} }
} }
} }
Handle(TColStd_HArray1OfTransient) aTriangleFans; Handle(TColStd_HArray2OfInteger) aTriangleFans;
Standard_Integer sub7 = 0; Standard_Integer sub7 = 0;
if (theData->ReadSubList(theNum, 7, "triangle_fans", theCheck, sub7)) if (theData->ReadSubList(theNum, 7, "triangle_fans", theCheck, sub7))
{ {
Standard_Integer nb0 = theData->NbParams(sub7); Standard_Integer nb0 = theData->NbParams(sub7);
aTriangleFans = new TColStd_HArray1OfTransient(1, nb0); Standard_Integer nbj0 = theData->NbParams(theData->ParamNumber(sub7,1));
aTriangleFans = new TColStd_HArray2OfInteger(1, nb0, 1, nbj0);
for (Standard_Integer i0 = 1; i0 <= nb0; i0++) 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; Standard_Integer subj7 = 0;
if ( theData->ReadSubList (sub7, i0, "sub-part(triangle_fans)", theCheck, subj7) ) { if ( theData->ReadSubList (sub7, i0, "sub-part(triangle_fans)", theCheck, subj7) ) {
Standard_Integer num4 = subj7; Standard_Integer num4 = subj7;
@@ -148,9 +144,8 @@ void RWStepVisual_RWComplexTriangulatedSurfaceSet::ReadStep(
{ {
Standard_Integer anIt0; Standard_Integer anIt0;
theData->ReadInteger(num4, j0, "integer", theCheck, anIt0); theData->ReadInteger(num4, j0, "integer", theCheck, anIt0);
aSingleTriangleFan->SetValue(j0, anIt0); aTriangleFans->SetValue(i0,j0, anIt0);
} }
aTriangleFans->SetValue(i0, aSingleTriangleFan);
} }
} }
} }
@@ -204,14 +199,13 @@ void RWStepVisual_RWComplexTriangulatedSurfaceSet::WriteStep(
theSW.CloseSub(); theSW.CloseSub();
theSW.OpenSub(); theSW.OpenSub();
for (Standard_Integer i5 = 1; i5 <= theEnt->NbTriangleStrips(); i5++) for (Standard_Integer i5 = 1; i5 <= theEnt->TriangleStrips()->RowLength(); i5++)
{ {
theSW.NewLine(Standard_False); theSW.NewLine(Standard_False);
theSW.OpenSub(); theSW.OpenSub();
Handle(TColStd_HArray1OfInteger) aTriangleStrip = Handle(TColStd_HArray1OfInteger)::DownCast(theEnt->TriangleStrips()->Value(i5)); for (Standard_Integer j5 = 1; j5 <= theEnt->TriangleStrips()->ColLength(); j5++)
for (Standard_Integer j5 = 1; j5 <= aTriangleStrip->Length(); j5++)
{ {
Standard_Integer Var0 = aTriangleStrip->Value(j5); Standard_Integer Var0 = theEnt->TriangleStrips()->Value(i5,j5);
theSW.Send(Var0); theSW.Send(Var0);
} }
theSW.CloseSub(); theSW.CloseSub();
@@ -219,14 +213,13 @@ void RWStepVisual_RWComplexTriangulatedSurfaceSet::WriteStep(
theSW.CloseSub(); theSW.CloseSub();
theSW.OpenSub(); theSW.OpenSub();
for (Standard_Integer i6 = 1; i6 <= theEnt->NbTriangleFans(); i6++) for (Standard_Integer i6 = 1; i6 <= theEnt->TriangleFans()->RowLength(); i6++)
{ {
theSW.NewLine(Standard_False); theSW.NewLine(Standard_False);
theSW.OpenSub(); theSW.OpenSub();
Handle(TColStd_HArray1OfInteger) aTriangleFan = Handle(TColStd_HArray1OfInteger)::DownCast(theEnt->TriangleFans()->Value(i6)); for (Standard_Integer j6 = 1; j6 <= theEnt->TriangleFans()->ColLength(); j6++)
for (Standard_Integer j6 = 1; j6 <= aTriangleFan->Length(); j6++)
{ {
Standard_Integer Var0 = aTriangleFan->Value(j6); Standard_Integer Var0 = theEnt->TriangleFans()->Value(i6,j6);
theSW.Send(Var0); theSW.Send(Var0);
} }
theSW.CloseSub(); theSW.CloseSub();

View File

@@ -39,13 +39,9 @@ STEPCAFControl_Controller::STEPCAFControl_Controller ()
Standard_Boolean STEPCAFControl_Controller::Init () Standard_Boolean STEPCAFControl_Controller::Init ()
{ {
static Standard_Mutex theMutex;
{
Standard_Mutex::Sentry aSentry(theMutex);
static Standard_Boolean inic = Standard_False; static Standard_Boolean inic = Standard_False;
if (inic) return Standard_True; if (inic) return Standard_True;
inic = Standard_True; inic = Standard_True;
}
// self-registering // self-registering
Handle(STEPCAFControl_Controller) STEPCTL = new STEPCAFControl_Controller; Handle(STEPCAFControl_Controller) STEPCTL = new STEPCAFControl_Controller;
// do XSAlgo::Init, cause it does not called before. // do XSAlgo::Init, cause it does not called before.

View File

@@ -1309,7 +1309,6 @@ Handle(TCollection_HAsciiString) STEPCAFControl_GDTProperty::GetTolValueType(con
//======================================================================= //=======================================================================
Handle(StepVisual_TessellatedGeometricSet) STEPCAFControl_GDTProperty::GetTessellation(const TopoDS_Shape& theShape) Handle(StepVisual_TessellatedGeometricSet) STEPCAFControl_GDTProperty::GetTessellation(const TopoDS_Shape& theShape)
{ {
Handle(StepVisual_TessellatedGeometricSet) aGeomSet;
// Build coordinate list and curves // Build coordinate list and curves
NCollection_Handle<StepVisual_VectorOfHSequenceOfInteger> aCurves = new StepVisual_VectorOfHSequenceOfInteger; NCollection_Handle<StepVisual_VectorOfHSequenceOfInteger> aCurves = new StepVisual_VectorOfHSequenceOfInteger;
NCollection_Vector<gp_XYZ> aCoords; NCollection_Vector<gp_XYZ> aCoords;
@@ -1343,11 +1342,6 @@ Handle(StepVisual_TessellatedGeometricSet) STEPCAFControl_GDTProperty::GetTessel
aCurves->Append(aCurve); aCurves->Append(aCurve);
} }
if (!aCoords.Length())
{
return aGeomSet;
}
Handle(TColgp_HArray1OfXYZ) aPoints = new TColgp_HArray1OfXYZ(1, aCoords.Length()); Handle(TColgp_HArray1OfXYZ) aPoints = new TColgp_HArray1OfXYZ(1, aCoords.Length());
for (Standard_Integer i = 1; i <= aPoints->Length(); i++) { for (Standard_Integer i = 1; i <= aPoints->Length(); i++) {
aPoints->SetValue(i, aCoords.Value(i - 1)); aPoints->SetValue(i, aCoords.Value(i - 1));
@@ -1359,7 +1353,7 @@ Handle(StepVisual_TessellatedGeometricSet) STEPCAFControl_GDTProperty::GetTessel
aCurveSet->Init(new TCollection_HAsciiString(), aCoordList, aCurves); aCurveSet->Init(new TCollection_HAsciiString(), aCoordList, aCurves);
NCollection_Handle<StepVisual_Array1OfTessellatedItem> aTessItems = new StepVisual_Array1OfTessellatedItem(1, 1); NCollection_Handle<StepVisual_Array1OfTessellatedItem> aTessItems = new StepVisual_Array1OfTessellatedItem(1, 1);
aTessItems->SetValue(1, aCurveSet); aTessItems->SetValue(1, aCurveSet);
aGeomSet = new StepVisual_TessellatedGeometricSet(); Handle(StepVisual_TessellatedGeometricSet) aGeomSet = new StepVisual_TessellatedGeometricSet();
aGeomSet->Init(new TCollection_HAsciiString(), aTessItems); aGeomSet->Init(new TCollection_HAsciiString(), aTessItems);
return aGeomSet; return aGeomSet;
} }

View File

@@ -40,6 +40,7 @@
#include <StepBasic_ProductDefinitionFormation.hxx> #include <StepBasic_ProductDefinitionFormation.hxx>
#include <StepBasic_ProductDefinitionWithAssociatedDocuments.hxx> #include <StepBasic_ProductDefinitionWithAssociatedDocuments.hxx>
#include <StepBasic_SiUnitAndLengthUnit.hxx> #include <StepBasic_SiUnitAndLengthUnit.hxx>
#include <StepData_GlobalFactors.hxx>
#include <STEPCAFControl_Controller.hxx> #include <STEPCAFControl_Controller.hxx>
#include <STEPCAFControl_DataMapOfPDExternFile.hxx> #include <STEPCAFControl_DataMapOfPDExternFile.hxx>
#include <STEPCAFControl_DataMapOfShapePD.hxx> #include <STEPCAFControl_DataMapOfShapePD.hxx>
@@ -54,7 +55,6 @@
#include <STEPControl_Reader.hxx> #include <STEPControl_Reader.hxx>
#include <StepGeom_Axis2Placement3d.hxx> #include <StepGeom_Axis2Placement3d.hxx>
#include <StepGeom_Direction.hxx> #include <StepGeom_Direction.hxx>
#include <StepData_Factors.hxx>
#include <StepDimTol_AngularityTolerance.hxx> #include <StepDimTol_AngularityTolerance.hxx>
#include <StepDimTol_CircularRunoutTolerance.hxx> #include <StepDimTol_CircularRunoutTolerance.hxx>
#include <StepDimTol_CoaxialityTolerance.hxx> #include <StepDimTol_CoaxialityTolerance.hxx>
@@ -219,7 +219,6 @@
#include <StepVisual_TessellatedAnnotationOccurrence.hxx> #include <StepVisual_TessellatedAnnotationOccurrence.hxx>
#include <StepVisual_TessellatedGeometricSet.hxx> #include <StepVisual_TessellatedGeometricSet.hxx>
#include <StepVisual_TessellatedCurveSet.hxx> #include <StepVisual_TessellatedCurveSet.hxx>
#include <StepVisual_ComplexTriangulatedSurfaceSet.hxx>
#include <StepVisual_CoordinatesList.hxx> #include <StepVisual_CoordinatesList.hxx>
#include <NCollection_Vector.hxx> #include <NCollection_Vector.hxx>
#include <StepVisual_OverRidingStyledItem.hxx> #include <StepVisual_OverRidingStyledItem.hxx>
@@ -500,8 +499,7 @@ static void FillShapesMap(const TopoDS_Shape &S, TopTools_MapOfShape &map)
//purpose : //purpose :
//======================================================================= //=======================================================================
void STEPCAFControl_Reader::prepareUnits(const Handle(StepData_StepModel)& theModel, void STEPCAFControl_Reader::prepareUnits(const Handle(StepData_StepModel)& theModel,
const Handle(TDocStd_Document)& theDoc, const Handle(TDocStd_Document)& theDoc) const
StepData_Factors& theLocalFactors) const
{ {
Standard_Real aScaleFactorMM = 1.; Standard_Real aScaleFactorMM = 1.;
if (!XCAFDoc_DocumentTool::GetLengthUnit(theDoc, aScaleFactorMM, UnitsMethods_LengthUnit_Millimeter)) if (!XCAFDoc_DocumentTool::GetLengthUnit(theDoc, aScaleFactorMM, UnitsMethods_LengthUnit_Millimeter))
@@ -511,7 +509,6 @@ void STEPCAFControl_Reader::prepareUnits(const Handle(StepData_StepModel)& theMo
// Sets length unit to the document // Sets length unit to the document
XCAFDoc_DocumentTool::SetLengthUnit(theDoc, aScaleFactorMM, UnitsMethods_LengthUnit_Millimeter); XCAFDoc_DocumentTool::SetLengthUnit(theDoc, aScaleFactorMM, UnitsMethods_LengthUnit_Millimeter);
} }
theLocalFactors.SetCascadeUnit(aScaleFactorMM);
theModel->SetLocalLengthUnit(aScaleFactorMM); theModel->SetLocalLengthUnit(aScaleFactorMM);
} }
@@ -529,8 +526,7 @@ Standard_Boolean STEPCAFControl_Reader::Transfer (STEPControl_Reader &reader,
{ {
reader.ClearShapes(); reader.ClearShapes();
Handle(StepData_StepModel) aModel = Handle(StepData_StepModel)::DownCast(reader.Model()); Handle(StepData_StepModel) aModel = Handle(StepData_StepModel)::DownCast(reader.Model());
StepData_Factors aLocalFactors; prepareUnits(aModel, doc);
prepareUnits(aModel, doc, aLocalFactors);
Standard_Integer i; Standard_Integer i;
// Read all shapes // Read all shapes
@@ -696,7 +692,7 @@ Standard_Boolean STEPCAFControl_Reader::Transfer (STEPControl_Reader &reader,
// read colors // read colors
if (GetColorMode()) if (GetColorMode())
ReadColors(reader.WS(), doc, aLocalFactors); ReadColors(reader.WS(), doc);
// read names // read names
if (GetNameMode()) if (GetNameMode())
@@ -704,7 +700,7 @@ Standard_Boolean STEPCAFControl_Reader::Transfer (STEPControl_Reader &reader,
// read validation props // read validation props
if (GetPropsMode()) if (GetPropsMode())
ReadValProps(reader.WS(), doc, PDFileMap, aLocalFactors); ReadValProps(reader.WS(), doc, PDFileMap);
// read layers // read layers
if (GetLayerMode()) if (GetLayerMode())
@@ -716,15 +712,15 @@ Standard_Boolean STEPCAFControl_Reader::Transfer (STEPControl_Reader &reader,
// read GDT entities from STEP model // read GDT entities from STEP model
if (GetGDTMode()) if (GetGDTMode())
ReadGDTs(reader.WS(), doc, aLocalFactors); ReadGDTs(reader.WS(), doc);
// read Material entities from STEP model // read Material entities from STEP model
if (GetMatMode()) if (GetMatMode())
ReadMaterials(reader.WS(), doc, SeqPDS, aLocalFactors); ReadMaterials(reader.WS(), doc, SeqPDS);
// read View entities from STEP model // read View entities from STEP model
if (GetViewMode()) if (GetViewMode())
ReadViews(reader.WS(), doc, aLocalFactors); ReadViews(reader.WS(), doc);
// Expand resulting CAF structure for sub-shapes (optionally with their // Expand resulting CAF structure for sub-shapes (optionally with their
// names) if requested // names) if requested
@@ -954,8 +950,7 @@ static void propagateColorToParts(const Handle(XCAFDoc_ShapeTool)& theSTool,
static void SetAssemblyComponentStyle(const Handle(Transfer_TransientProcess) &theTP, static void SetAssemblyComponentStyle(const Handle(Transfer_TransientProcess) &theTP,
const Handle(XCAFDoc_ColorTool)& theCTool, const Handle(XCAFDoc_ColorTool)& theCTool,
const STEPConstruct_Styles& theStyles, const STEPConstruct_Styles& theStyles,
const Handle(StepVisual_ContextDependentOverRidingStyledItem)& theStyle, const Handle(StepVisual_ContextDependentOverRidingStyledItem)& theStyle)
const StepData_Factors& theLocalFactors)
{ {
if (theStyle.IsNull()) return; if (theStyle.IsNull()) return;
@@ -1009,8 +1004,8 @@ static void SetAssemblyComponentStyle(const Handle(Transfer_TransientProcess) &t
if(!anAxp1.IsNull() && !anAxp2.IsNull()) if(!anAxp1.IsNull() && !anAxp2.IsNull())
{ {
Handle(Geom_Axis2Placement) anOrig = StepToGeom::MakeAxis2Placement (anAxp1, theLocalFactors); Handle(Geom_Axis2Placement) anOrig = StepToGeom::MakeAxis2Placement (anAxp1);
Handle(Geom_Axis2Placement) aTarg = StepToGeom::MakeAxis2Placement (anAxp2, theLocalFactors); Handle(Geom_Axis2Placement) aTarg = StepToGeom::MakeAxis2Placement (anAxp2);
gp_Ax3 anAx3Orig(anOrig->Ax2()); gp_Ax3 anAx3Orig(anOrig->Ax2());
gp_Ax3 anAx3Targ(aTarg->Ax2()); gp_Ax3 anAx3Targ(aTarg->Ax2());
@@ -1061,18 +1056,17 @@ static void SetStyle(const Handle(XSControl_WorkSession) &theWS,
const Handle(XCAFDoc_ShapeTool)& theSTool, const Handle(XCAFDoc_ShapeTool)& theSTool,
const STEPConstruct_Styles& theStyles, const STEPConstruct_Styles& theStyles,
const Handle(TColStd_HSequenceOfTransient)& theHSeqOfInvisStyle, const Handle(TColStd_HSequenceOfTransient)& theHSeqOfInvisStyle,
const Handle(StepVisual_StyledItem)& theStyle, const Handle(StepVisual_StyledItem)& theStyle)
const StepData_Factors& theLocalFactors)
{ {
if (theStyle.IsNull()) return; if (theStyle.IsNull()) return;
const Handle(Transfer_TransientProcess) &aTP = theWS->TransferReader()->TransientProcess(); const Handle(Transfer_TransientProcess) &aTP = theWS->TransferReader()->TransientProcess();
if (Handle(StepVisual_OverRidingStyledItem) anOverridingStyle = Handle(StepVisual_OverRidingStyledItem)::DownCast (theStyle)) if (Handle(StepVisual_OverRidingStyledItem) anOverridingStyle = Handle(StepVisual_OverRidingStyledItem)::DownCast (theStyle))
{ {
SetStyle (theWS, theMap, theCTool, theSTool, theStyles, theHSeqOfInvisStyle, anOverridingStyle->OverRiddenStyle (), theLocalFactors); SetStyle (theWS, theMap, theCTool, theSTool, theStyles, theHSeqOfInvisStyle, anOverridingStyle->OverRiddenStyle ());
if (Handle(StepVisual_ContextDependentOverRidingStyledItem) anAssemblyComponentStyle = Handle(StepVisual_ContextDependentOverRidingStyledItem)::DownCast (theStyle)) if (Handle(StepVisual_ContextDependentOverRidingStyledItem) anAssemblyComponentStyle = Handle(StepVisual_ContextDependentOverRidingStyledItem)::DownCast (theStyle))
{ {
SetAssemblyComponentStyle (aTP, theCTool, theStyles,anAssemblyComponentStyle, theLocalFactors); SetAssemblyComponentStyle (aTP, theCTool, theStyles,anAssemblyComponentStyle);
return; return;
} }
} }
@@ -1253,8 +1247,7 @@ static Standard_Boolean IsOverriden(const Interface_Graph& theGraph,
//======================================================================= //=======================================================================
Standard_Boolean STEPCAFControl_Reader::ReadColors(const Handle(XSControl_WorkSession) &WS, Standard_Boolean STEPCAFControl_Reader::ReadColors(const Handle(XSControl_WorkSession) &WS,
const Handle(TDocStd_Document)& Doc, const Handle(TDocStd_Document)& Doc) const
const StepData_Factors& theLocalFactors) const
{ {
STEPConstruct_Styles Styles(WS); STEPConstruct_Styles Styles(WS);
if (!Styles.LoadStyles()) { if (!Styles.LoadStyles()) {
@@ -1285,7 +1278,7 @@ Standard_Boolean STEPCAFControl_Reader::ReadColors(const Handle(XSControl_WorkSe
// check that style is overridden by other root style // check that style is overridden by other root style
if (!IsOverriden (aGraph, Style, anIsRootStyle)) if (!IsOverriden (aGraph, Style, anIsRootStyle))
{ {
SetStyle (WS, myMap, CTool, STool, Styles, aHSeqOfInvisStyle, Style, theLocalFactors); SetStyle (WS, myMap, CTool, STool, Styles, aHSeqOfInvisStyle, Style);
} }
} }
@@ -1298,7 +1291,7 @@ Standard_Boolean STEPCAFControl_Reader::ReadColors(const Handle(XSControl_WorkSe
// check that style is overridden // check that style is overridden
if (!IsOverriden (aGraph, Style, anIsRootStyle)) if (!IsOverriden (aGraph, Style, anIsRootStyle))
{ {
SetStyle (WS, myMap, CTool, STool, Styles, aHSeqOfInvisStyle, Style, theLocalFactors); SetStyle (WS, myMap, CTool, STool, Styles, aHSeqOfInvisStyle, Style);
} }
} }
@@ -1497,8 +1490,7 @@ static TDF_Label GetLabelFromPD(const Handle(StepBasic_ProductDefinition) &PD,
Standard_Boolean STEPCAFControl_Reader::ReadValProps(const Handle(XSControl_WorkSession) &WS, Standard_Boolean STEPCAFControl_Reader::ReadValProps(const Handle(XSControl_WorkSession) &WS,
const Handle(TDocStd_Document)& Doc, const Handle(TDocStd_Document)& Doc,
const STEPCAFControl_DataMapOfPDExternFile& PDFileMap, const STEPCAFControl_DataMapOfPDExternFile& PDFileMap) const
const StepData_Factors& theLocalFactors) const
{ {
// get starting data // get starting data
const Handle(XSControl_TransferReader) &TR = WS->TransferReader(); const Handle(XSControl_TransferReader) &TR = WS->TransferReader();
@@ -1611,11 +1603,11 @@ Standard_Boolean STEPCAFControl_Reader::ReadValProps(const Handle(XSControl_Work
Standard_Boolean isArea; Standard_Boolean isArea;
Standard_Real val; Standard_Real val;
gp_Pnt pos; gp_Pnt pos;
if (Props.GetPropReal(ent, val, isArea, theLocalFactors)) { if (Props.GetPropReal(ent, val, isArea)) {
if (isArea) XCAFDoc_Area::Set(L, val); if (isArea) XCAFDoc_Area::Set(L, val);
else XCAFDoc_Volume::Set(L, val); else XCAFDoc_Volume::Set(L, val);
} }
else if (Props.GetPropPnt(ent, rep->ContextOfItems(), pos, theLocalFactors)) { else if (Props.GetPropPnt(ent, rep->ContextOfItems(), pos)) {
XCAFDoc_Centroid::Set(L, pos); XCAFDoc_Centroid::Set(L, pos);
} }
} }
@@ -1936,120 +1928,6 @@ static Standard_Boolean GetMassConversionFactor(Handle(StepBasic_NamedUnit)& NU,
return Standard_True; 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 //function : readPMIPresentation
//purpose : read polyline or tessellated presentation for //purpose : read polyline or tessellated presentation for
@@ -2060,21 +1938,17 @@ Standard_Boolean readPMIPresentation(const Handle(Standard_Transient)& thePresen
const Standard_Real theFact, const Standard_Real theFact,
TopoDS_Shape& thePresentation, TopoDS_Shape& thePresentation,
Handle(TCollection_HAsciiString)& thePresentName, Handle(TCollection_HAsciiString)& thePresentName,
Bnd_Box& theBox, Bnd_Box& theBox)
const StepData_Factors& theLocalFactors)
{ {
if (thePresentEntity.IsNull()) if (thePresentEntity.IsNull())
{
return Standard_False; return Standard_False;
}
Handle(Transfer_TransientProcess) aTP = theTR->TransientProcess(); Handle(Transfer_TransientProcess) aTP = theTR->TransientProcess();
Handle(StepVisual_AnnotationOccurrence) anAO; Handle(StepVisual_AnnotationOccurrence) anAO;
NCollection_Vector<Handle(StepVisual_StyledItem)> anAnnotations; NCollection_Vector<Handle(StepVisual_StyledItem)> anAnnotations;
if (thePresentEntity->IsKind(STANDARD_TYPE(StepVisual_AnnotationOccurrence))) if (thePresentEntity->IsKind(STANDARD_TYPE(StepVisual_AnnotationOccurrence)))
{ {
anAO = Handle(StepVisual_AnnotationOccurrence)::DownCast(thePresentEntity); anAO = Handle(StepVisual_AnnotationOccurrence)::DownCast(thePresentEntity);
if (!anAO.IsNull()) if (!anAO.IsNull()) {
{
thePresentName = anAO->Name(); thePresentName = anAO->Name();
anAnnotations.Append(anAO); anAnnotations.Append(anAO);
} }
@@ -2099,17 +1973,17 @@ Standard_Boolean readPMIPresentation(const Handle(Standard_Transient)& thePresen
} }
if (!anAnnotations.Length()) if (!anAnnotations.Length())
{
return Standard_False; return Standard_False;
}
BRep_Builder aB; BRep_Builder aB;
TopoDS_Compound aResAnnotation; TopoDS_Compound aResAnnotation;
aB.MakeCompound(aResAnnotation); aB.MakeCompound(aResAnnotation);
Standard_Integer i = 0;
Bnd_Box aBox; Bnd_Box aBox;
Standard_Integer aNbShapes = 0; Standard_Integer nbShapes = 0;
for (Standard_Integer i = 0; i < anAnnotations.Length(); i++) for (; i < anAnnotations.Length(); i++)
{ {
Handle(StepVisual_StyledItem) anItem = anAnnotations(i); Handle(StepVisual_StyledItem) anItem = anAnnotations(i);
anAO = Handle(StepVisual_AnnotationOccurrence)::DownCast(anItem); anAO = Handle(StepVisual_AnnotationOccurrence)::DownCast(anItem);
@@ -2120,19 +1994,19 @@ Standard_Boolean readPMIPresentation(const Handle(Standard_Transient)& thePresen
anAnnotationShape = STEPConstruct::FindShape(aTP, aCurveItem); anAnnotationShape = STEPConstruct::FindShape(aTP, aCurveItem);
if (anAnnotationShape.IsNull()) if (anAnnotationShape.IsNull())
{ {
Handle(Transfer_Binder) aBinder = theTR->Actor()->Transfer(aCurveItem, aTP); Handle(Transfer_Binder) binder = theTR->Actor()->Transfer(aCurveItem, aTP);
if (!aBinder.IsNull() && aBinder->HasResult()) { if (!binder.IsNull() && binder->HasResult()) {
anAnnotationShape = TransferBRep::ShapeResult(aTP, aBinder); anAnnotationShape = TransferBRep::ShapeResult(aTP, binder);
} }
} }
} }
//case of tessellated entities //case of tessellated entities
else else
{ {
Handle(StepRepr_RepresentationItem) aRepresentationItem = anItem->Item(); Handle(StepRepr_RepresentationItem) aTessItem = anItem->Item();
if (aRepresentationItem.IsNull()) if (aTessItem.IsNull())
continue; continue;
Handle(StepVisual_TessellatedGeometricSet) aTessSet = Handle(StepVisual_TessellatedGeometricSet)::DownCast(aRepresentationItem); Handle(StepVisual_TessellatedGeometricSet) aTessSet = Handle(StepVisual_TessellatedGeometricSet)::DownCast(aTessItem);
if (aTessSet.IsNull()) if (aTessSet.IsNull())
continue; continue;
gp_Trsf aTransf; gp_Trsf aTransf;
@@ -2140,7 +2014,7 @@ Standard_Boolean readPMIPresentation(const Handle(Standard_Transient)& thePresen
{ {
Handle(StepVisual_RepositionedTessellatedGeometricSet) aRTGS = Handle(StepVisual_RepositionedTessellatedGeometricSet) aRTGS =
Handle(StepVisual_RepositionedTessellatedGeometricSet)::DownCast(aTessSet); Handle(StepVisual_RepositionedTessellatedGeometricSet)::DownCast(aTessSet);
Handle(Geom_Axis2Placement) aLocation = StepToGeom::MakeAxis2Placement(aRTGS->Location(), theLocalFactors); Handle(Geom_Axis2Placement) aLocation = StepToGeom::MakeAxis2Placement(aRTGS->Location());
if (!aLocation.IsNull()) if (!aLocation.IsNull())
{ {
const gp_Ax3 anAx3Orig = gp::XOY(); const gp_Ax3 anAx3Orig = gp::XOY();
@@ -2155,48 +2029,41 @@ Standard_Boolean readPMIPresentation(const Handle(Standard_Transient)& thePresen
} }
} }
NCollection_Handle<StepVisual_Array1OfTessellatedItem> aListItems = aTessSet->Items(); NCollection_Handle<StepVisual_Array1OfTessellatedItem> aListItems = aTessSet->Items();
Standard_Integer aNbItems = aListItems.IsNull() ? 0 : aListItems->Length(); Standard_Integer nb = aListItems.IsNull() ? 0 : aListItems->Length();
TopoDS_Compound aComp; Handle(StepVisual_TessellatedCurveSet) aTessCurve;
aB.MakeCompound(aComp); for (Standard_Integer n = 1; n <= nb && aTessCurve.IsNull(); n++)
for (Standard_Integer j = 1; j <= aNbItems; j++)
{ {
Handle(StepVisual_TessellatedItem) aTessItem = aListItems->Value(j); aTessCurve = Handle(StepVisual_TessellatedCurveSet)::DownCast(aListItems->Value(n));
if (aTessItem.IsNull())
{
continue;
} }
if (aTessItem->IsKind(STANDARD_TYPE(StepVisual_TessellatedCurveSet))) if (aTessCurve.IsNull())
{ continue;
Handle(StepVisual_TessellatedCurveSet) aTessCurve = Handle(StepVisual_TessellatedCurveSet)::DownCast(aTessItem);
Handle(StepVisual_CoordinatesList) aCoordList = aTessCurve->CoordList(); Handle(StepVisual_CoordinatesList) aCoordList = aTessCurve->CoordList();
if (aCoordList.IsNull()) if (aCoordList.IsNull())
{
continue; continue;
}
Handle(TColgp_HArray1OfXYZ) aPoints = aCoordList->Points(); Handle(TColgp_HArray1OfXYZ) aPoints = aCoordList->Points();
if (aPoints.IsNull() || aPoints->Length() == 0)
{
continue;
}
if (aPoints.IsNull() || aPoints->Length() == 0)
continue;
NCollection_Handle<StepVisual_VectorOfHSequenceOfInteger> aCurves = aTessCurve->Curves(); NCollection_Handle<StepVisual_VectorOfHSequenceOfInteger> aCurves = aTessCurve->Curves();
Standard_Integer aNbCurves = (aCurves.IsNull() ? 0 : aCurves->Length()); Standard_Integer aNbC = (aCurves.IsNull() ? 0 : aCurves->Length());
for (Standard_Integer k = 0; k < aNbCurves; k++) TopoDS_Compound aComp;
aB.MakeCompound(aComp);
Standard_Integer k = 0;
for (; k < aNbC; k++)
{ {
Handle(TColStd_HSequenceOfInteger) anIndexes = aCurves->Value(k); Handle(TColStd_HSequenceOfInteger) anIndexes = aCurves->Value(k);
TopoDS_Wire aCurW; TopoDS_Wire aCurW;
aB.MakeWire(aCurW); aB.MakeWire(aCurW);
for (Standard_Integer n = 1; n < anIndexes->Length(); n++) for (Standard_Integer n = 1; n < anIndexes->Length(); n++)
{ {
Standard_Integer anIndex = anIndexes->Value(n); Standard_Integer ind = anIndexes->Value(n);
Standard_Integer aNextIndex = anIndexes->Value(n + 1); Standard_Integer indnext = anIndexes->Value(n + 1);
if (anIndex > aPoints->Length() || aNextIndex > aPoints->Length()) if (ind > aPoints->Length() || indnext > aPoints->Length())
{
continue; continue;
} gp_Pnt aP1(aPoints->Value(ind) * theFact);
gp_Pnt aP1(aPoints->Value(anIndex) * theFact); gp_Pnt aP2(aPoints->Value(indnext) * theFact);
gp_Pnt aP2(aPoints->Value(aNextIndex) * theFact);
BRepBuilderAPI_MakeEdge aMaker(aP1, aP2); BRepBuilderAPI_MakeEdge aMaker(aP1, aP2);
if (aMaker.IsDone()) if (aMaker.IsDone())
{ {
@@ -2206,24 +2073,11 @@ Standard_Boolean readPMIPresentation(const Handle(Standard_Transient)& thePresen
} }
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()) if (!anAnnotationShape.IsNull())
{ {
aNbShapes++; nbShapes++;
aB.Add(aResAnnotation, anAnnotationShape); aB.Add(aResAnnotation, anAnnotationShape);
if (i == anAnnotations.Length() - 1) if (i == anAnnotations.Length() - 1)
BRepBndLib::AddClose(anAnnotationShape, aBox); BRepBndLib::AddClose(anAnnotationShape, aBox);
@@ -2232,7 +2086,7 @@ Standard_Boolean readPMIPresentation(const Handle(Standard_Transient)& thePresen
thePresentation = aResAnnotation; thePresentation = aResAnnotation;
theBox = aBox; theBox = aBox;
return (aNbShapes > 0); return (nbShapes > 0);
} }
//======================================================================= //=======================================================================
@@ -2240,8 +2094,7 @@ Standard_Boolean readPMIPresentation(const Handle(Standard_Transient)& thePresen
//purpose : read annotation plane //purpose : read annotation plane
//======================================================================= //=======================================================================
Standard_Boolean readAnnotationPlane(const Handle(StepVisual_AnnotationPlane)& theAnnotationPlane, Standard_Boolean readAnnotationPlane(const Handle(StepVisual_AnnotationPlane)& theAnnotationPlane,
gp_Ax2& thePlane, gp_Ax2& thePlane)
const StepData_Factors& theLocalFactors)
{ {
if (theAnnotationPlane.IsNull()) if (theAnnotationPlane.IsNull())
return Standard_False; return Standard_False;
@@ -2261,7 +2114,7 @@ Standard_Boolean readAnnotationPlane(const Handle(StepVisual_AnnotationPlane)& t
if (aA2P3D.IsNull()) if (aA2P3D.IsNull())
return Standard_False; return Standard_False;
Handle(Geom_Axis2Placement) anAxis = StepToGeom::MakeAxis2Placement(aA2P3D, theLocalFactors); Handle(Geom_Axis2Placement) anAxis = StepToGeom::MakeAxis2Placement(aA2P3D);
thePlane = anAxis->Ax2(); thePlane = anAxis->Ax2();
return Standard_True; return Standard_True;
} }
@@ -2273,8 +2126,7 @@ Standard_Boolean readAnnotationPlane(const Handle(StepVisual_AnnotationPlane)& t
//======================================================================= //=======================================================================
void readAnnotation(const Handle(XSControl_TransferReader)& theTR, void readAnnotation(const Handle(XSControl_TransferReader)& theTR,
const Handle(Standard_Transient)& theGDT, const Handle(Standard_Transient)& theGDT,
const Handle(Standard_Transient)& theDimObject, const Handle(Standard_Transient)& theDimObject)
const StepData_Factors& theLocalFactors)
{ {
if (theGDT.IsNull() || theDimObject.IsNull()) if (theGDT.IsNull() || theDimObject.IsNull())
return; return;
@@ -2303,9 +2155,8 @@ void readAnnotation(const Handle(XSControl_TransferReader)& theTR,
Handle(StepVisual_DraughtingModel)::DownCast(aDMIA->UsedRepresentation()); Handle(StepVisual_DraughtingModel)::DownCast(aDMIA->UsedRepresentation());
XSAlgo::AlgoContainer()->PrepareForTransfer(); XSAlgo::AlgoContainer()->PrepareForTransfer();
STEPControl_ActorRead anActor; STEPControl_ActorRead anActor;
StepData_Factors aLocalFactors = theLocalFactors; anActor.PrepareUnits(aDModel, aTP);
anActor.PrepareUnits(aDModel, aTP, aLocalFactors); Standard_Real aFact = StepData_GlobalFactors::Intance().LengthFactor();
Standard_Real aFact = aLocalFactors.LengthFactor();
// retrieve AnnotationPlane // retrieve AnnotationPlane
Handle(StepRepr_RepresentationItem) aDMIAE = aDMIA->IdentifiedItemValue(1); Handle(StepRepr_RepresentationItem) aDMIAE = aDMIA->IdentifiedItemValue(1);
@@ -2317,7 +2168,7 @@ void readAnnotation(const Handle(XSControl_TransferReader)& theTR,
for (subs.Start(); subs.More() && anAnPlane.IsNull(); subs.Next()) { for (subs.Start(); subs.More() && anAnPlane.IsNull(); subs.Next()) {
anAnPlane = Handle(StepVisual_AnnotationPlane)::DownCast(subs.Value()); anAnPlane = Handle(StepVisual_AnnotationPlane)::DownCast(subs.Value());
} }
Standard_Boolean isHasPlane = readAnnotationPlane(anAnPlane, aPlaneAxes, aLocalFactors); Standard_Boolean isHasPlane = readAnnotationPlane(anAnPlane, aPlaneAxes);
// set plane axes to XCAF // set plane axes to XCAF
if (isHasPlane) { if (isHasPlane) {
@@ -2341,7 +2192,7 @@ void readAnnotation(const Handle(XSControl_TransferReader)& theTR,
// Retrieve presentation // Retrieve presentation
Bnd_Box aBox; Bnd_Box aBox;
if (!readPMIPresentation(aDMIAE, theTR, aFact, aResAnnotation, aPresentName, aBox, aLocalFactors)) if (!readPMIPresentation(aDMIAE, theTR, aFact, aResAnnotation, aPresentName, aBox))
return; return;
gp_Pnt aPtext(0., 0., 0.); gp_Pnt aPtext(0., 0., 0.);
// if Annotation plane location inside bounding box set it to text position // if Annotation plane location inside bounding box set it to text position
@@ -2389,8 +2240,7 @@ void readAnnotation(const Handle(XSControl_TransferReader)& theTR,
//======================================================================= //=======================================================================
void readConnectionPoints(const Handle(XSControl_TransferReader)& theTR, void readConnectionPoints(const Handle(XSControl_TransferReader)& theTR,
const Handle(Standard_Transient)& theGDT, const Handle(Standard_Transient)& theGDT,
const Handle(XCAFDimTolObjects_DimensionObject)& theDimObject, const Handle(XCAFDimTolObjects_DimensionObject)& theDimObject)
const StepData_Factors& theLocalFactors)
{ {
if (theGDT.IsNull() || theDimObject.IsNull()) if (theGDT.IsNull() || theDimObject.IsNull())
return; return;
@@ -2412,9 +2262,8 @@ void readConnectionPoints(const Handle(XSControl_TransferReader)& theTR,
{ {
XSAlgo::AlgoContainer()->PrepareForTransfer(); XSAlgo::AlgoContainer()->PrepareForTransfer();
STEPControl_ActorRead anActor; STEPControl_ActorRead anActor;
StepData_Factors aLocalFactors = theLocalFactors; anActor.PrepareUnits(aSDR, aTP);
anActor.PrepareUnits(aSDR, aTP, aLocalFactors); aFact = StepData_GlobalFactors::Intance().LengthFactor();
aFact = aLocalFactors.LengthFactor();
} }
if (theGDT->IsKind(STANDARD_TYPE(StepShape_DimensionalSize))) { if (theGDT->IsKind(STANDARD_TYPE(StepShape_DimensionalSize))) {
@@ -2669,8 +2518,7 @@ Standard_Boolean STEPCAFControl_Reader::setDatumToXCAF(const Handle(StepDimTol_D
const XCAFDimTolObjects_DatumModifWithValue theXCAFModifWithVal, const XCAFDimTolObjects_DatumModifWithValue theXCAFModifWithVal,
const Standard_Real theModifValue, const Standard_Real theModifValue,
const Handle(TDocStd_Document)& theDoc, const Handle(TDocStd_Document)& theDoc,
const Handle(XSControl_WorkSession)& theWS, const Handle(XSControl_WorkSession)& theWS)
const StepData_Factors& theLocalFactors)
{ {
Handle(XCAFDoc_ShapeTool) aSTool = XCAFDoc_DocumentTool::ShapeTool(theDoc->Main()); Handle(XCAFDoc_ShapeTool) aSTool = XCAFDoc_DocumentTool::ShapeTool(theDoc->Main());
Handle(XCAFDoc_DimTolTool) aDGTTool = XCAFDoc_DocumentTool::DimTolTool(theDoc->Main()); Handle(XCAFDoc_DimTolTool) aDGTTool = XCAFDoc_DocumentTool::DimTolTool(theDoc->Main());
@@ -2691,7 +2539,7 @@ Standard_Boolean STEPCAFControl_Reader::setDatumToXCAF(const Handle(StepDimTol_D
collectShapeAspect(aSAR->RelatingShapeAspect(), theWS, aSAs); collectShapeAspect(aSAR->RelatingShapeAspect(), theWS, aSAs);
Handle(StepDimTol_DatumFeature) aDF = Handle(StepDimTol_DatumFeature)::DownCast(aSAR->RelatingShapeAspect()); Handle(StepDimTol_DatumFeature) aDF = Handle(StepDimTol_DatumFeature)::DownCast(aSAR->RelatingShapeAspect());
if (!aSAR->RelatingShapeAspect()->IsKind(STANDARD_TYPE(StepDimTol_DatumTarget))) if (!aSAR->RelatingShapeAspect()->IsKind(STANDARD_TYPE(StepDimTol_DatumTarget)))
readAnnotation(aTR, aSAR->RelatingShapeAspect(), aDatObj, theLocalFactors); readAnnotation(aTR, aSAR->RelatingShapeAspect(), aDatObj);
} }
// Collect shape labels // Collect shape labels
@@ -2825,9 +2673,8 @@ Standard_Boolean STEPCAFControl_Reader::setDatumToXCAF(const Handle(StepDimTol_D
= Handle(StepGeom_Axis2Placement3d)::DownCast(aSRWP->ItemsValue(j)); = Handle(StepGeom_Axis2Placement3d)::DownCast(aSRWP->ItemsValue(j));
XSAlgo::AlgoContainer()->PrepareForTransfer(); XSAlgo::AlgoContainer()->PrepareForTransfer();
STEPControl_ActorRead anActor; STEPControl_ActorRead anActor;
StepData_Factors aLocalFactors = theLocalFactors; anActor.PrepareUnits(aSRWP, aTP);
anActor.PrepareUnits(aSRWP, aTP, aLocalFactors); Handle(Geom_Axis2Placement) anAxis = StepToGeom::MakeAxis2Placement(anAx);
Handle(Geom_Axis2Placement) anAxis = StepToGeom::MakeAxis2Placement(anAx, aLocalFactors);
aDatTargetObj->SetDatumTargetAxis(anAxis->Ax2()); aDatTargetObj->SetDatumTargetAxis(anAxis->Ax2());
} }
else if (aSRWP->ItemsValue(j)->IsKind(STANDARD_TYPE(StepRepr_ReprItemAndLengthMeasureWithUnit))) else if (aSRWP->ItemsValue(j)->IsKind(STANDARD_TYPE(StepRepr_ReprItemAndLengthMeasureWithUnit)))
@@ -2842,7 +2689,7 @@ Standard_Boolean STEPCAFControl_Reader::setDatumToXCAF(const Handle(StepDimTol_D
if (aNU.IsNull()) if (aNU.IsNull())
continue; continue;
STEPConstruct_UnitContext anUnitCtx; STEPConstruct_UnitContext anUnitCtx;
anUnitCtx.ComputeFactors(aNU, theLocalFactors); anUnitCtx.ComputeFactors(aNU);
aVal = aVal * anUnitCtx.LengthFactor(); aVal = aVal * anUnitCtx.LengthFactor();
if (aM->Name()->String().IsEqual("target length") || if (aM->Name()->String().IsEqual("target length") ||
aM->Name()->String().IsEqual("target diameter")) aM->Name()->String().IsEqual("target diameter"))
@@ -2872,7 +2719,7 @@ Standard_Boolean STEPCAFControl_Reader::setDatumToXCAF(const Handle(StepDimTol_D
aDGTTool->SetDatumToGeomTol(aDatL, theGDTL); aDGTTool->SetDatumToGeomTol(aDatL, theGDTL);
aDatTargetObj->IsDatumTarget(Standard_True); aDatTargetObj->IsDatumTarget(Standard_True);
aDatTargetObj->SetDatumTargetNumber(aDT->TargetId()->IntegerValue()); aDatTargetObj->SetDatumTargetNumber(aDT->TargetId()->IntegerValue());
readAnnotation(aTR, aDT, aDatTargetObj, theLocalFactors); readAnnotation(aTR, aDT, aDatTargetObj);
aDat->SetObject(aDatTargetObj); aDat->SetObject(aDatTargetObj);
isExistDatumTarget = Standard_True; isExistDatumTarget = Standard_True;
} }
@@ -2901,7 +2748,7 @@ Standard_Boolean STEPCAFControl_Reader::setDatumToXCAF(const Handle(StepDimTol_D
aDGTTool->SetDatumToGeomTol(aDatL, theGDTL); aDGTTool->SetDatumToGeomTol(aDatL, theGDTL);
if (aDatObj->GetPresentation().IsNull()) { if (aDatObj->GetPresentation().IsNull()) {
// Try find annotation connected to datum entity (not right case, according recommended practices) // Try find annotation connected to datum entity (not right case, according recommended practices)
readAnnotation(aTR, theDat, aDatObj, theLocalFactors); readAnnotation(aTR, theDat, aDatObj);
} }
aDat->SetObject(aDatObj); aDat->SetObject(aDatObj);
} }
@@ -2917,8 +2764,7 @@ Standard_Boolean STEPCAFControl_Reader::setDatumToXCAF(const Handle(StepDimTol_D
Standard_Boolean STEPCAFControl_Reader::readDatumsAP242(const Handle(Standard_Transient)& theEnt, Standard_Boolean STEPCAFControl_Reader::readDatumsAP242(const Handle(Standard_Transient)& theEnt,
const TDF_Label theGDTL, const TDF_Label theGDTL,
const Handle(TDocStd_Document)& theDoc, const Handle(TDocStd_Document)& theDoc,
const Handle(XSControl_WorkSession)& theWS, const Handle(XSControl_WorkSession)& theWS)
const StepData_Factors& theLocalFactors)
{ {
const Handle(XSControl_TransferReader) &aTR = theWS->TransferReader(); const Handle(XSControl_TransferReader) &aTR = theWS->TransferReader();
const Handle(Transfer_TransientProcess) &aTP = aTR->TransientProcess(); const Handle(Transfer_TransientProcess) &aTP = aTR->TransientProcess();
@@ -2999,7 +2845,7 @@ Standard_Boolean STEPCAFControl_Reader::readDatumsAP242(const Handle(Standard_Tr
if (!(anUnit.CaseNum(anUnit.Value()) == 1)) continue; if (!(anUnit.CaseNum(anUnit.Value()) == 1)) continue;
Handle(StepBasic_NamedUnit) NU = anUnit.NamedUnit(); Handle(StepBasic_NamedUnit) NU = anUnit.NamedUnit();
STEPConstruct_UnitContext anUnitCtx; STEPConstruct_UnitContext anUnitCtx;
anUnitCtx.ComputeFactors(NU, theLocalFactors); anUnitCtx.ComputeFactors(NU);
aModifValue = aVal * anUnitCtx.LengthFactor(); aModifValue = aVal * anUnitCtx.LengthFactor();
} }
} }
@@ -3011,7 +2857,7 @@ Standard_Boolean STEPCAFControl_Reader::readDatumsAP242(const Handle(Standard_Tr
if (anIterDRC.Value()->IsKind(STANDARD_TYPE(StepDimTol_Datum))) if (anIterDRC.Value()->IsKind(STANDARD_TYPE(StepDimTol_Datum)))
{ {
Handle(StepDimTol_Datum) aD = Handle(StepDimTol_Datum)::DownCast(anIterDRC.Value()); Handle(StepDimTol_Datum) aD = Handle(StepDimTol_Datum)::DownCast(anIterDRC.Value());
setDatumToXCAF(aD, theGDTL, aPositionCounter, aXCAFModifiers, aXCAFModifWithVal, aModifValue, theDoc, theWS, theLocalFactors); setDatumToXCAF(aD, theGDTL, aPositionCounter, aXCAFModifiers, aXCAFModifWithVal, aModifValue, theDoc, theWS);
} }
else if (anIterDRC.Value()->IsKind(STANDARD_TYPE(StepDimTol_DatumReferenceElement))) else if (anIterDRC.Value()->IsKind(STANDARD_TYPE(StepDimTol_DatumReferenceElement)))
{ {
@@ -3036,7 +2882,7 @@ Standard_Boolean STEPCAFControl_Reader::readDatumsAP242(const Handle(Standard_Tr
if (!(anUnit.CaseNum(anUnit.Value()) == 1)) continue; if (!(anUnit.CaseNum(anUnit.Value()) == 1)) continue;
Handle(StepBasic_NamedUnit) NU = anUnit.NamedUnit(); Handle(StepBasic_NamedUnit) NU = anUnit.NamedUnit();
STEPConstruct_UnitContext anUnitCtx; STEPConstruct_UnitContext anUnitCtx;
anUnitCtx.ComputeFactors(NU, theLocalFactors); anUnitCtx.ComputeFactors(NU);
aModifValue = aVal * anUnitCtx.LengthFactor(); aModifValue = aVal * anUnitCtx.LengthFactor();
} }
} }
@@ -3046,7 +2892,7 @@ Standard_Boolean STEPCAFControl_Reader::readDatumsAP242(const Handle(Standard_Tr
if (anIterDRE.Value()->IsKind(STANDARD_TYPE(StepDimTol_Datum))) if (anIterDRE.Value()->IsKind(STANDARD_TYPE(StepDimTol_Datum)))
{ {
Handle(StepDimTol_Datum) aD = Handle(StepDimTol_Datum)::DownCast(anIterDRE.Value()); Handle(StepDimTol_Datum) aD = Handle(StepDimTol_Datum)::DownCast(anIterDRE.Value());
setDatumToXCAF(aD, theGDTL, aPositionCounter, aXCAFModifiers, aXCAFModifWithVal, aModifValue, theDoc, theWS, theLocalFactors); setDatumToXCAF(aD, theGDTL, aPositionCounter, aXCAFModifiers, aXCAFModifWithVal, aModifValue, theDoc, theWS);
} }
} }
} }
@@ -3065,8 +2911,7 @@ Standard_Boolean STEPCAFControl_Reader::readDatumsAP242(const Handle(Standard_Tr
//======================================================================= //=======================================================================
TDF_Label STEPCAFControl_Reader::createGDTObjectInXCAF(const Handle(Standard_Transient)& theEnt, TDF_Label STEPCAFControl_Reader::createGDTObjectInXCAF(const Handle(Standard_Transient)& theEnt,
const Handle(TDocStd_Document)& theDoc, const Handle(TDocStd_Document)& theDoc,
const Handle(XSControl_WorkSession)& theWS, const Handle(XSControl_WorkSession)& theWS)
const StepData_Factors& theLocalFactors)
{ {
TDF_Label aGDTL; TDF_Label aGDTL;
if (!theEnt->IsKind(STANDARD_TYPE(StepShape_DimensionalSize)) && if (!theEnt->IsKind(STANDARD_TYPE(StepShape_DimensionalSize)) &&
@@ -3237,7 +3082,7 @@ TDF_Label STEPCAFControl_Reader::createGDTObjectInXCAF(const Handle(Standard_Tra
if (!(anUnit.CaseNum(anUnit.Value()) == 1)) continue; if (!(anUnit.CaseNum(anUnit.Value()) == 1)) continue;
Handle(StepBasic_NamedUnit) NU = anUnit.NamedUnit(); Handle(StepBasic_NamedUnit) NU = anUnit.NamedUnit();
STEPConstruct_UnitContext anUnitCtx; STEPConstruct_UnitContext anUnitCtx;
anUnitCtx.ComputeFactors(NU, theLocalFactors); anUnitCtx.ComputeFactors(NU);
dim1 = dim1 * anUnitCtx.LengthFactor(); dim1 = dim1 * anUnitCtx.LengthFactor();
} }
} }
@@ -3253,7 +3098,7 @@ TDF_Label STEPCAFControl_Reader::createGDTObjectInXCAF(const Handle(Standard_Tra
if (!(anUnit.CaseNum(anUnit.Value()) == 1)) continue; if (!(anUnit.CaseNum(anUnit.Value()) == 1)) continue;
Handle(StepBasic_NamedUnit) NU = anUnit.NamedUnit(); Handle(StepBasic_NamedUnit) NU = anUnit.NamedUnit();
STEPConstruct_UnitContext anUnitCtx; STEPConstruct_UnitContext anUnitCtx;
anUnitCtx.ComputeFactors(NU, theLocalFactors); anUnitCtx.ComputeFactors(NU);
dim2 = dim2 * anUnitCtx.LengthFactor(); dim2 = dim2 * anUnitCtx.LengthFactor();
} }
} }
@@ -3294,7 +3139,7 @@ TDF_Label STEPCAFControl_Reader::createGDTObjectInXCAF(const Handle(Standard_Tra
if (!(anUnit.CaseNum(anUnit.Value()) == 1)) continue; if (!(anUnit.CaseNum(anUnit.Value()) == 1)) continue;
Handle(StepBasic_NamedUnit) NU = anUnit.NamedUnit(); Handle(StepBasic_NamedUnit) NU = anUnit.NamedUnit();
STEPConstruct_UnitContext anUnitCtx; STEPConstruct_UnitContext anUnitCtx;
anUnitCtx.ComputeFactors(NU, theLocalFactors); anUnitCtx.ComputeFactors(NU);
dim = dim * anUnitCtx.LengthFactor(); dim = dim * anUnitCtx.LengthFactor();
//std::cout<<"GeometricTolerance: Magnitude = "<<dim<<std::endl; //std::cout<<"GeometricTolerance: Magnitude = "<<dim<<std::endl;
Handle(TColStd_HArray1OfReal) arr = new TColStd_HArray1OfReal(1, 1); Handle(TColStd_HArray1OfReal) arr = new TColStd_HArray1OfReal(1, 1);
@@ -3514,7 +3359,7 @@ TDF_Label STEPCAFControl_Reader::createGDTObjectInXCAF(const Handle(Standard_Tra
TDataStd_Name::Set(aGDTL, str); TDataStd_Name::Set(aGDTL, str);
} }
readDatumsAP242(theEnt, aGDTL, theDoc, theWS, theLocalFactors); readDatumsAP242(theEnt, aGDTL, theDoc, theWS);
} }
return aGDTL; return aGDTL;
} }
@@ -3545,8 +3390,7 @@ void convertAngleValue(
static void setDimObjectToXCAF(const Handle(Standard_Transient)& theEnt, static void setDimObjectToXCAF(const Handle(Standard_Transient)& theEnt,
const TDF_Label& aDimL, const TDF_Label& aDimL,
const Handle(TDocStd_Document)& theDoc, const Handle(TDocStd_Document)& theDoc,
const Handle(XSControl_WorkSession)& theWS, const Handle(XSControl_WorkSession)& theWS)
const StepData_Factors& theLocalFactors)
{ {
Handle(XCAFDoc_ShapeTool) aSTool = XCAFDoc_DocumentTool::ShapeTool(theDoc->Main()); Handle(XCAFDoc_ShapeTool) aSTool = XCAFDoc_DocumentTool::ShapeTool(theDoc->Main());
Handle(XCAFDoc_DimTolTool) aDGTTool = XCAFDoc_DocumentTool::DimTolTool(theDoc->Main()); Handle(XCAFDoc_DimTolTool) aDGTTool = XCAFDoc_DocumentTool::DimTolTool(theDoc->Main());
@@ -3611,7 +3455,7 @@ static void setDimObjectToXCAF(const Handle(Standard_Transient)& theEnt,
continue; continue;
Handle(StepBasic_NamedUnit) NU = anUnit.NamedUnit(); Handle(StepBasic_NamedUnit) NU = anUnit.NamedUnit();
STEPConstruct_UnitContext anUnitCtx; STEPConstruct_UnitContext anUnitCtx;
anUnitCtx.ComputeFactors(NU, theLocalFactors); anUnitCtx.ComputeFactors(NU);
if (aMWU->IsKind(STANDARD_TYPE(StepRepr_ReprItemAndLengthMeasureWithUnit))) { if (aMWU->IsKind(STANDARD_TYPE(StepRepr_ReprItemAndLengthMeasureWithUnit))) {
aVal = aVal * anUnitCtx.LengthFactor(); aVal = aVal * anUnitCtx.LengthFactor();
@@ -3638,7 +3482,7 @@ static void setDimObjectToXCAF(const Handle(Standard_Transient)& theEnt,
continue; continue;
Handle(StepBasic_NamedUnit) NU = anUnit.NamedUnit(); Handle(StepBasic_NamedUnit) NU = anUnit.NamedUnit();
STEPConstruct_UnitContext anUnitCtx; STEPConstruct_UnitContext anUnitCtx;
anUnitCtx.ComputeFactors(NU, theLocalFactors); anUnitCtx.ComputeFactors(NU);
if (aMWU->IsKind(STANDARD_TYPE(StepRepr_ReprItemAndLengthMeasureWithUnitAndQRI))) { if (aMWU->IsKind(STANDARD_TYPE(StepRepr_ReprItemAndLengthMeasureWithUnitAndQRI))) {
aVal = aVal * anUnitCtx.LengthFactor(); aVal = aVal * anUnitCtx.LengthFactor();
} }
@@ -3718,7 +3562,7 @@ static void setDimObjectToXCAF(const Handle(Standard_Transient)& theEnt,
if (!(anUnit.CaseNum(anUnit.Value()) == 1)) continue; if (!(anUnit.CaseNum(anUnit.Value()) == 1)) continue;
Handle(StepBasic_NamedUnit) NU = anUnit.NamedUnit(); Handle(StepBasic_NamedUnit) NU = anUnit.NamedUnit();
STEPConstruct_UnitContext anUnitCtxUpperBound; STEPConstruct_UnitContext anUnitCtxUpperBound;
anUnitCtxUpperBound.ComputeFactors(NU, theLocalFactors); anUnitCtxUpperBound.ComputeFactors(NU);
if (aMWU->IsKind(STANDARD_TYPE(StepBasic_PlaneAngleMeasureWithUnit)) || if (aMWU->IsKind(STANDARD_TYPE(StepBasic_PlaneAngleMeasureWithUnit)) ||
aMWU->IsKind(STANDARD_TYPE(StepRepr_ReprItemAndPlaneAngleMeasureWithUnitAndQRI))) aMWU->IsKind(STANDARD_TYPE(StepRepr_ReprItemAndPlaneAngleMeasureWithUnitAndQRI)))
{ {
@@ -3754,7 +3598,7 @@ static void setDimObjectToXCAF(const Handle(Standard_Transient)& theEnt,
if (!(anUnit.CaseNum(anUnit.Value()) == 1)) continue; if (!(anUnit.CaseNum(anUnit.Value()) == 1)) continue;
NU = anUnit.NamedUnit(); NU = anUnit.NamedUnit();
STEPConstruct_UnitContext anUnitCtxLowerBound; STEPConstruct_UnitContext anUnitCtxLowerBound;
anUnitCtxLowerBound.ComputeFactors(NU, theLocalFactors); anUnitCtxLowerBound.ComputeFactors(NU);
if (aMWU->IsKind(STANDARD_TYPE(StepBasic_PlaneAngleMeasureWithUnit)) || if (aMWU->IsKind(STANDARD_TYPE(StepBasic_PlaneAngleMeasureWithUnit)) ||
aMWU->IsKind(STANDARD_TYPE(StepRepr_ReprItemAndPlaneAngleMeasureWithUnitAndQRI))) aMWU->IsKind(STANDARD_TYPE(StepRepr_ReprItemAndPlaneAngleMeasureWithUnitAndQRI)))
{ {
@@ -3940,15 +3784,14 @@ static void setDimObjectToXCAF(const Handle(Standard_Transient)& theEnt,
//for Oriented Dimensional Location //for Oriented Dimensional Location
Handle(TColStd_HArray1OfReal) aDirArr = anAP->RefDirection()->DirectionRatios(); Handle(TColStd_HArray1OfReal) aDirArr = anAP->RefDirection()->DirectionRatios();
gp_Dir aDir; gp_Dir aDir;
Standard_Integer aDirLower = aDirArr->Lower();
if (!aDirArr.IsNull() && aDirArr->Length() > 2) if (!aDirArr.IsNull() && aDirArr->Length() > 2)
{ {
aDir.SetCoord(aDirArr->Value(aDirLower), aDirArr->Value(aDirLower + 1), aDirArr->Value(aDirLower + 2)); aDir.SetCoord(aDirArr->Lower(), aDirArr->Lower() + 1, aDirArr->Lower() + 2);
aDimObj->SetDirection(aDir); aDimObj->SetDirection(aDir);
} }
else if (aDirArr->Length() > 1) else if (aDirArr->Length() > 1)
{ {
aDir.SetCoord(aDirArr->Value(aDirLower), aDirArr->Value(aDirLower + 1), 0); aDir.SetCoord(aDirArr->Lower(), aDirArr->Lower() + 1, 0);
aDimObj->SetDirection(aDir); aDimObj->SetDirection(aDir);
} }
} }
@@ -3965,8 +3808,8 @@ static void setDimObjectToXCAF(const Handle(Standard_Transient)& theEnt,
if (aDimL.FindAttribute(XCAFDoc_Dimension::GetID(), aDim)) if (aDimL.FindAttribute(XCAFDoc_Dimension::GetID(), aDim))
{ {
readAnnotation(aTR, theEnt, aDimObj, theLocalFactors); readAnnotation(aTR, theEnt, aDimObj);
readConnectionPoints(aTR, theEnt, aDimObj, theLocalFactors); readConnectionPoints(aTR, theEnt, aDimObj);
aDim->SetObject(aDimObj); aDim->SetObject(aDimObj);
} }
} }
@@ -4087,8 +3930,7 @@ static Standard_Boolean getTolType(const Handle(Standard_Transient)& theEnt,
static void setGeomTolObjectToXCAF(const Handle(Standard_Transient)& theEnt, static void setGeomTolObjectToXCAF(const Handle(Standard_Transient)& theEnt,
const TDF_Label& theTolL, const TDF_Label& theTolL,
const Handle(TDocStd_Document)& theDoc, const Handle(TDocStd_Document)& theDoc,
const Handle(XSControl_WorkSession)& theWS, const Handle(XSControl_WorkSession)& theWS)
const StepData_Factors& theLocalFactors)
{ {
Handle(XCAFDoc_ShapeTool) aSTool = XCAFDoc_DocumentTool::ShapeTool(theDoc->Main()); Handle(XCAFDoc_ShapeTool) aSTool = XCAFDoc_DocumentTool::ShapeTool(theDoc->Main());
Handle(XCAFDoc_DimTolTool) aDGTTool = XCAFDoc_DocumentTool::DimTolTool(theDoc->Main()); Handle(XCAFDoc_DimTolTool) aDGTTool = XCAFDoc_DocumentTool::DimTolTool(theDoc->Main());
@@ -4114,7 +3956,7 @@ static void setGeomTolObjectToXCAF(const Handle(Standard_Transient)& theEnt,
if (!(anUnit.CaseNum(anUnit.Value()) == 1)) return; if (!(anUnit.CaseNum(anUnit.Value()) == 1)) return;
Handle(StepBasic_NamedUnit) NU = anUnit.NamedUnit(); Handle(StepBasic_NamedUnit) NU = anUnit.NamedUnit();
STEPConstruct_UnitContext anUnitCtx; STEPConstruct_UnitContext anUnitCtx;
anUnitCtx.ComputeFactors(NU, theLocalFactors); anUnitCtx.ComputeFactors(NU);
aVal = aVal * anUnitCtx.LengthFactor(); aVal = aVal * anUnitCtx.LengthFactor();
aTolObj->SetValue(aVal); aTolObj->SetValue(aVal);
} }
@@ -4139,7 +3981,7 @@ static void setGeomTolObjectToXCAF(const Handle(Standard_Transient)& theEnt,
if (!(anUnit.CaseNum(anUnit.Value()) == 1)) return; if (!(anUnit.CaseNum(anUnit.Value()) == 1)) return;
Handle(StepBasic_NamedUnit) NU = anUnit.NamedUnit(); Handle(StepBasic_NamedUnit) NU = anUnit.NamedUnit();
STEPConstruct_UnitContext anUnitCtx; STEPConstruct_UnitContext anUnitCtx;
anUnitCtx.ComputeFactors(NU, theLocalFactors); anUnitCtx.ComputeFactors(NU);
aVal = aVal * anUnitCtx.LengthFactor(); aVal = aVal * anUnitCtx.LengthFactor();
aTolObj->SetValueOfZoneModifier(aVal); aTolObj->SetValueOfZoneModifier(aVal);
aTolObj->SetZoneModifier(XCAFDimTolObjects_GeomToleranceZoneModif_Projected); aTolObj->SetZoneModifier(XCAFDimTolObjects_GeomToleranceZoneModif_Projected);
@@ -4157,7 +3999,7 @@ static void setGeomTolObjectToXCAF(const Handle(Standard_Transient)& theEnt,
if (!(anUnit.CaseNum(anUnit.Value()) == 1)) continue; if (!(anUnit.CaseNum(anUnit.Value()) == 1)) continue;
Handle(StepBasic_NamedUnit) NU = anUnit.NamedUnit(); Handle(StepBasic_NamedUnit) NU = anUnit.NamedUnit();
STEPConstruct_UnitContext anUnitCtx; STEPConstruct_UnitContext anUnitCtx;
anUnitCtx.ComputeFactors(NU, theLocalFactors); anUnitCtx.ComputeFactors(NU);
convertAngleValue(anUnitCtx, aVal); convertAngleValue(anUnitCtx, aVal);
aTolObj->SetValueOfZoneModifier(aVal); aTolObj->SetValueOfZoneModifier(aVal);
aTolObj->SetZoneModifier(XCAFDimTolObjects_GeomToleranceZoneModif_Runout); aTolObj->SetZoneModifier(XCAFDimTolObjects_GeomToleranceZoneModif_Runout);
@@ -4230,12 +4072,12 @@ static void setGeomTolObjectToXCAF(const Handle(Standard_Transient)& theEnt,
{ {
Handle(StepBasic_NamedUnit) NU = anUnit.NamedUnit(); Handle(StepBasic_NamedUnit) NU = anUnit.NamedUnit();
STEPConstruct_UnitContext anUnitCtx; STEPConstruct_UnitContext anUnitCtx;
anUnitCtx.ComputeFactors(NU, theLocalFactors); anUnitCtx.ComputeFactors(NU);
convertAngleValue(anUnitCtx, aVal); convertAngleValue(anUnitCtx, aVal);
aTolObj->SetMaxValueModifier(aVal); aTolObj->SetMaxValueModifier(aVal);
} }
readAnnotation(aTR, theEnt, aTolObj, theLocalFactors); readAnnotation(aTR, theEnt, aTolObj);
aGTol->SetObject(aTolObj); aGTol->SetObject(aTolObj);
} }
@@ -4245,8 +4087,7 @@ static void setGeomTolObjectToXCAF(const Handle(Standard_Transient)& theEnt,
//======================================================================= //=======================================================================
Standard_Boolean STEPCAFControl_Reader::ReadGDTs(const Handle(XSControl_WorkSession)& theWS, Standard_Boolean STEPCAFControl_Reader::ReadGDTs(const Handle(XSControl_WorkSession)& theWS,
const Handle(TDocStd_Document)& theDoc, const Handle(TDocStd_Document)& theDoc)
const StepData_Factors& theLocalFactors)
{ {
const Handle(Interface_InterfaceModel) &aModel = theWS->Model(); const Handle(Interface_InterfaceModel) &aModel = theWS->Model();
const Interface_Graph& aGraph = theWS->Graph(); const Interface_Graph& aGraph = theWS->Graph();
@@ -4266,13 +4107,13 @@ Standard_Boolean STEPCAFControl_Reader::ReadGDTs(const Handle(XSControl_WorkSess
if (anEnt->IsKind(STANDARD_TYPE(StepShape_DimensionalSize)) || if (anEnt->IsKind(STANDARD_TYPE(StepShape_DimensionalSize)) ||
anEnt->IsKind(STANDARD_TYPE(StepShape_DimensionalLocation)) || anEnt->IsKind(STANDARD_TYPE(StepShape_DimensionalLocation)) ||
anEnt->IsKind(STANDARD_TYPE(StepDimTol_GeometricTolerance))) { anEnt->IsKind(STANDARD_TYPE(StepDimTol_GeometricTolerance))) {
TDF_Label aGDTL = createGDTObjectInXCAF(anEnt, theDoc, theWS, theLocalFactors); TDF_Label aGDTL = createGDTObjectInXCAF(anEnt, theDoc, theWS);
if (!aGDTL.IsNull()) { if (!aGDTL.IsNull()) {
if (anEnt->IsKind(STANDARD_TYPE(StepDimTol_GeometricTolerance))) { if (anEnt->IsKind(STANDARD_TYPE(StepDimTol_GeometricTolerance))) {
setGeomTolObjectToXCAF(anEnt, aGDTL, theDoc, theWS, theLocalFactors); setGeomTolObjectToXCAF(anEnt, aGDTL, theDoc, theWS);
} }
else { else {
setDimObjectToXCAF(anEnt, aGDTL, theDoc, theWS, theLocalFactors); setDimObjectToXCAF(anEnt, aGDTL, theDoc, theWS);
} }
} }
} }
@@ -4359,21 +4200,20 @@ Standard_Boolean STEPCAFControl_Reader::ReadGDTs(const Handle(XSControl_WorkSess
// Calculate unit // Calculate unit
Standard_Real aFact = 1.0; Standard_Real aFact = 1.0;
StepData_Factors aLocalFactors = theLocalFactors;
if (!aDMIA.IsNull()) if (!aDMIA.IsNull())
{ {
XSAlgo::AlgoContainer()->PrepareForTransfer(); XSAlgo::AlgoContainer()->PrepareForTransfer();
STEPControl_ActorRead anActor; STEPControl_ActorRead anActor;
Handle(Transfer_TransientProcess) aTP = aTR->TransientProcess(); Handle(Transfer_TransientProcess) aTP = aTR->TransientProcess();
anActor.PrepareUnits(aDMIA->UsedRepresentation(), aTP, aLocalFactors); anActor.PrepareUnits(aDMIA->UsedRepresentation(), aTP);
aFact = aLocalFactors.LengthFactor(); aFact = StepData_GlobalFactors::Intance().LengthFactor();
} }
// Presentation // Presentation
TopoDS_Shape aPresentation; TopoDS_Shape aPresentation;
Handle(TCollection_HAsciiString) aPresentName; Handle(TCollection_HAsciiString) aPresentName;
Bnd_Box aBox; Bnd_Box aBox;
if (!readPMIPresentation(anEnt, aTR, aFact, aPresentation, aPresentName, aBox, aLocalFactors)) if (!readPMIPresentation(anEnt, aTR, aFact, aPresentation, aPresentName, aBox))
continue; continue;
// Annotation plane // Annotation plane
Handle(StepVisual_AnnotationPlane) anAnPlane; Handle(StepVisual_AnnotationPlane) anAnPlane;
@@ -4400,7 +4240,7 @@ Standard_Boolean STEPCAFControl_Reader::ReadGDTs(const Handle(XSControl_WorkSess
aDGTTool->SetDimension(aShapesL, anEmptySeq2, aGDTL); aDGTTool->SetDimension(aShapesL, anEmptySeq2, aGDTL);
gp_Ax2 aPlaneAxes; gp_Ax2 aPlaneAxes;
if (!anAnPlane.IsNull()) { if (!anAnPlane.IsNull()) {
if (readAnnotationPlane(anAnPlane, aPlaneAxes, aLocalFactors)) if (readAnnotationPlane(anAnPlane, aPlaneAxes))
aDimObj->SetPlane(aPlaneAxes); aDimObj->SetPlane(aPlaneAxes);
} }
aDimObj->SetPresentation(aPresentation, aPresentName); aDimObj->SetPresentation(aPresentation, aPresentName);
@@ -4458,8 +4298,7 @@ static Handle(StepShape_SolidModel) FindSolidForPDS(const Handle(StepRepr_Produc
Standard_Boolean STEPCAFControl_Reader::ReadMaterials(const Handle(XSControl_WorkSession) &WS, Standard_Boolean STEPCAFControl_Reader::ReadMaterials(const Handle(XSControl_WorkSession) &WS,
const Handle(TDocStd_Document)& Doc, const Handle(TDocStd_Document)& Doc,
const Handle(TColStd_HSequenceOfTransient)& SeqPDS, const Handle(TColStd_HSequenceOfTransient)& SeqPDS) const
const StepData_Factors& theLocalFactors) const
{ {
const Handle(XSControl_TransferReader) &TR = WS->TransferReader(); const Handle(XSControl_TransferReader) &TR = WS->TransferReader();
const Handle(Transfer_TransientProcess) &TP = TR->TransientProcess(); const Handle(Transfer_TransientProcess) &TP = TR->TransientProcess();
@@ -4527,11 +4366,11 @@ Standard_Boolean STEPCAFControl_Reader::ReadMaterials(const Handle(XSControl_Wor
NU->IsKind(STANDARD_TYPE(StepBasic_SiUnitAndLengthUnit))) NU->IsKind(STANDARD_TYPE(StepBasic_SiUnitAndLengthUnit)))
{ {
STEPConstruct_UnitContext anUnitCtx; STEPConstruct_UnitContext anUnitCtx;
anUnitCtx.ComputeFactors(NU, theLocalFactors); anUnitCtx.ComputeFactors(NU);
aDensity = aDensity / (anUnitCtx.LengthFactor()*anUnitCtx.LengthFactor()*anUnitCtx.LengthFactor()); aDensity = aDensity / (anUnitCtx.LengthFactor()*anUnitCtx.LengthFactor()*anUnitCtx.LengthFactor());
// transfer length value for Density from millimeter to santimeter // transfer length value for Density from millimeter to santimeter
// in order to result density has dimension gram/(sm*sm*sm) // in order to result density has dimension gram/(sm*sm*sm)
const Standard_Real aCascadeUnit = theLocalFactors.CascadeUnit(); const Standard_Real aCascadeUnit = StepData_GlobalFactors::Intance().CascadeUnit();
aDensity = aDensity*1000. / (aCascadeUnit * aCascadeUnit * aCascadeUnit); aDensity = aDensity*1000. / (aCascadeUnit * aCascadeUnit * aCascadeUnit);
} }
if (NU->IsKind(STANDARD_TYPE(StepBasic_ConversionBasedUnitAndMassUnit))) { if (NU->IsKind(STANDARD_TYPE(StepBasic_ConversionBasedUnitAndMassUnit))) {
@@ -4612,8 +4451,7 @@ void collectViewShapes(const Handle(XSControl_WorkSession)& theWS,
//======================================================================= //=======================================================================
Handle(TCollection_HAsciiString) buildClippingPlanes(const Handle(StepGeom_GeometricRepresentationItem)& theClippingCameraModel, Handle(TCollection_HAsciiString) buildClippingPlanes(const Handle(StepGeom_GeometricRepresentationItem)& theClippingCameraModel,
TDF_LabelSequence& theClippingPlanes, TDF_LabelSequence& theClippingPlanes,
const Handle(XCAFDoc_ClippingPlaneTool)& theTool, const Handle(XCAFDoc_ClippingPlaneTool)& theTool)
const StepData_Factors& theLocalFactors)
{ {
Handle(TCollection_HAsciiString) anExpression = new TCollection_HAsciiString(); Handle(TCollection_HAsciiString) anExpression = new TCollection_HAsciiString();
NCollection_Sequence<Handle(StepGeom_GeometricRepresentationItem)> aPlanes; NCollection_Sequence<Handle(StepGeom_GeometricRepresentationItem)> aPlanes;
@@ -4632,7 +4470,7 @@ Handle(TCollection_HAsciiString) buildClippingPlanes(const Handle(StepGeom_Geome
Handle(StepVisual_CameraModelD3MultiClippingUnion) aCameraModelUnion = Handle(StepVisual_CameraModelD3MultiClippingUnion) aCameraModelUnion =
aCameraModel->ShapeClipping()->Value(1).CameraModelD3MultiClippingUnion(); aCameraModel->ShapeClipping()->Value(1).CameraModelD3MultiClippingUnion();
if (!aCameraModelUnion.IsNull()) if (!aCameraModelUnion.IsNull())
return buildClippingPlanes(aCameraModelUnion, theClippingPlanes, theTool, theLocalFactors); return buildClippingPlanes(aCameraModelUnion, theClippingPlanes, theTool);
} }
for (Standard_Integer i = 1; i <= aCameraModel->ShapeClipping()->Length(); i++) { for (Standard_Integer i = 1; i <= aCameraModel->ShapeClipping()->Length(); i++) {
aPlanes.Append(Handle(StepGeom_GeometricRepresentationItem)::DownCast(aCameraModel->ShapeClipping()->Value(i).Value())); aPlanes.Append(Handle(StepGeom_GeometricRepresentationItem)::DownCast(aCameraModel->ShapeClipping()->Value(i).Value()));
@@ -4658,7 +4496,7 @@ Handle(TCollection_HAsciiString) buildClippingPlanes(const Handle(StepGeom_Geome
for (Standard_Integer i = 1; i <= aPlanes.Length(); i++) { for (Standard_Integer i = 1; i <= aPlanes.Length(); i++) {
Handle(StepGeom_Plane) aPlaneEnt = Handle(StepGeom_Plane)::DownCast(aPlanes.Value(i)); Handle(StepGeom_Plane) aPlaneEnt = Handle(StepGeom_Plane)::DownCast(aPlanes.Value(i));
if (!aPlaneEnt.IsNull()) { if (!aPlaneEnt.IsNull()) {
Handle(Geom_Plane) aPlane = StepToGeom::MakePlane(aPlaneEnt, theLocalFactors); Handle(Geom_Plane) aPlane = StepToGeom::MakePlane(aPlaneEnt);
if (!aPlane.IsNull()) { if (!aPlane.IsNull()) {
TDF_Label aPlaneL = theTool->AddClippingPlane(aPlane->Pln(), aPlaneEnt->Name()); TDF_Label aPlaneL = theTool->AddClippingPlane(aPlane->Pln(), aPlaneEnt->Name());
theClippingPlanes.Append(aPlaneL); theClippingPlanes.Append(aPlaneL);
@@ -4668,7 +4506,7 @@ Handle(TCollection_HAsciiString) buildClippingPlanes(const Handle(StepGeom_Geome
} }
} }
else { else {
anExpression->AssignCat(buildClippingPlanes(aPlanes.Value(i), theClippingPlanes, theTool, theLocalFactors)); anExpression->AssignCat(buildClippingPlanes(aPlanes.Value(i), theClippingPlanes, theTool));
} }
anExpression->AssignCat(anOperation); anExpression->AssignCat(anOperation);
} }
@@ -4682,9 +4520,7 @@ Handle(TCollection_HAsciiString) buildClippingPlanes(const Handle(StepGeom_Geome
//function : ReadViews //function : ReadViews
//purpose : //purpose :
//======================================================================= //=======================================================================
Standard_Boolean STEPCAFControl_Reader::ReadViews(const Handle(XSControl_WorkSession)& theWS, Standard_Boolean STEPCAFControl_Reader::ReadViews(const Handle(XSControl_WorkSession)& theWS, const Handle(TDocStd_Document)& theDoc) const
const Handle(TDocStd_Document)& theDoc,
const StepData_Factors& theLocalFactors) const
{ {
const Handle(Interface_InterfaceModel) &aModel = theWS->Model(); const Handle(Interface_InterfaceModel) &aModel = theWS->Model();
Handle(XCAFDoc_ShapeTool) aSTool = XCAFDoc_DocumentTool::ShapeTool(theDoc->Main()); Handle(XCAFDoc_ShapeTool) aSTool = XCAFDoc_DocumentTool::ShapeTool(theDoc->Main());
@@ -4715,16 +4551,15 @@ Standard_Boolean STEPCAFControl_Reader::ReadViews(const Handle(XSControl_WorkSes
} }
aDModel = Handle(StepVisual_DraughtingModel)::DownCast(subs.Value()); aDModel = Handle(StepVisual_DraughtingModel)::DownCast(subs.Value());
} }
StepData_Factors aLocalFactors = theLocalFactors;
if (!aDModel.IsNull()) if (!aDModel.IsNull())
{ {
XSAlgo::AlgoContainer()->PrepareForTransfer(); XSAlgo::AlgoContainer()->PrepareForTransfer();
STEPControl_ActorRead anActor; STEPControl_ActorRead anActor;
anActor.PrepareUnits(aDModel, aTP, aLocalFactors); anActor.PrepareUnits(aDModel, aTP);
} }
anObj->SetName(aCameraModel->Name()); anObj->SetName(aCameraModel->Name());
Handle(Geom_Axis2Placement) anAxis = StepToGeom::MakeAxis2Placement(aCameraModel->ViewReferenceSystem(), aLocalFactors); Handle(Geom_Axis2Placement) anAxis = StepToGeom::MakeAxis2Placement(aCameraModel->ViewReferenceSystem());
anObj->SetViewDirection(anAxis->Direction()); anObj->SetViewDirection(anAxis->Direction());
anObj->SetUpDirection(anAxis->Direction() ^ anAxis->XDirection()); anObj->SetUpDirection(anAxis->Direction() ^ anAxis->XDirection());
Handle(StepVisual_ViewVolume) aViewVolume = aCameraModel->PerspectiveOfVolume(); Handle(StepVisual_ViewVolume) aViewVolume = aCameraModel->PerspectiveOfVolume();
@@ -4734,7 +4569,7 @@ Standard_Boolean STEPCAFControl_Reader::ReadViews(const Handle(XSControl_WorkSes
else if (aViewVolume->ProjectionType() == StepVisual_copParallel) else if (aViewVolume->ProjectionType() == StepVisual_copParallel)
aType = XCAFView_ProjectionType_Parallel; aType = XCAFView_ProjectionType_Parallel;
anObj->SetType(aType); anObj->SetType(aType);
Handle(Geom_CartesianPoint) aPoint = StepToGeom::MakeCartesianPoint(aViewVolume->ProjectionPoint(), aLocalFactors); Handle(Geom_CartesianPoint) aPoint = StepToGeom::MakeCartesianPoint(aViewVolume->ProjectionPoint());
anObj->SetProjectionPoint(aPoint->Pnt()); anObj->SetProjectionPoint(aPoint->Pnt());
anObj->SetZoomFactor(aViewVolume->ViewPlaneDistance()); anObj->SetZoomFactor(aViewVolume->ViewPlaneDistance());
anObj->SetWindowHorizontalSize(aViewVolume->ViewWindow()->SizeInX()); anObj->SetWindowHorizontalSize(aViewVolume->ViewWindow()->SizeInX());
@@ -4751,7 +4586,7 @@ Standard_Boolean STEPCAFControl_Reader::ReadViews(const Handle(XSControl_WorkSes
if (!aClippingCameraModel.IsNull()) { if (!aClippingCameraModel.IsNull()) {
Handle(TCollection_HAsciiString) aClippingExpression; Handle(TCollection_HAsciiString) aClippingExpression;
Handle(XCAFDoc_ClippingPlaneTool) aClippingPlaneTool = XCAFDoc_DocumentTool::ClippingPlaneTool(theDoc->Main()); Handle(XCAFDoc_ClippingPlaneTool) aClippingPlaneTool = XCAFDoc_DocumentTool::ClippingPlaneTool(theDoc->Main());
aClippingExpression = buildClippingPlanes(aClippingCameraModel, aClippingPlanes, aClippingPlaneTool, aLocalFactors); aClippingExpression = buildClippingPlanes(aClippingCameraModel, aClippingPlanes, aClippingPlaneTool);
anObj->SetClippingExpression(aClippingExpression); anObj->SetClippingExpression(aClippingExpression);
} }

View File

@@ -38,7 +38,6 @@ class StepShape_ConnectedFaceSet;
class StepRepr_NextAssemblyUsageOccurrence; class StepRepr_NextAssemblyUsageOccurrence;
class STEPConstruct_Tool; class STEPConstruct_Tool;
class StepDimTol_Datum; class StepDimTol_Datum;
class StepData_Factors;
//! Provides a tool to read STEP file and put it into //! Provides a tool to read STEP file and put it into
@@ -213,8 +212,7 @@ protected:
//! corresponding color assignments in the DECAF document //! corresponding color assignments in the DECAF document
Standard_EXPORT Standard_Boolean ReadColors Standard_EXPORT Standard_Boolean ReadColors
(const Handle(XSControl_WorkSession)& WS, (const Handle(XSControl_WorkSession)& WS,
const Handle(TDocStd_Document)& doc, const Handle(TDocStd_Document)& doc) const;
const StepData_Factors& theLocalFactors) const;
//! Reads names of parts defined in the STEP model and //! Reads names of parts defined in the STEP model and
//! assigns them to corresponding labels in the DECAF document //! assigns them to corresponding labels in the DECAF document
@@ -223,10 +221,7 @@ protected:
//! Reads validation properties assigned to shapes in the STEP //! Reads validation properties assigned to shapes in the STEP
//! model and assigns them to corresponding labels in the DECAF //! model and assigns them to corresponding labels in the DECAF
//! document //! document
Standard_EXPORT Standard_Boolean ReadValProps (const Handle(XSControl_WorkSession)& WS, Standard_EXPORT Standard_Boolean ReadValProps (const Handle(XSControl_WorkSession)& WS, const Handle(TDocStd_Document)& doc, const STEPCAFControl_DataMapOfPDExternFile& PDFileMap) const;
const Handle(TDocStd_Document)& doc,
const STEPCAFControl_DataMapOfPDExternFile& PDFileMap,
const StepData_Factors& theLocalFactors) const;
//! Reads layers of parts defined in the STEP model and //! Reads layers of parts defined in the STEP model and
//! set reference between shape and layers in the DECAF document //! set reference between shape and layers in the DECAF document
@@ -238,21 +233,14 @@ protected:
//! Reads D&GT for instances defined in the STEP model and //! Reads D&GT for instances defined in the STEP model and
//! set reference between shape instances from different assemblyes //! set reference between shape instances from different assemblyes
Standard_EXPORT Standard_Boolean ReadGDTs (const Handle(XSControl_WorkSession)& WS, Standard_EXPORT Standard_Boolean ReadGDTs (const Handle(XSControl_WorkSession)& WS, const Handle(TDocStd_Document)& doc);
const Handle(TDocStd_Document)& doc,
const StepData_Factors& theLocalFactors);
//! Reads materials for instances defined in the STEP model and //! Reads materials for instances defined in the STEP model and
//! set reference between shape instances from different assemblyes //! set reference between shape instances from different assemblyes
Standard_EXPORT Standard_Boolean ReadMaterials (const Handle(XSControl_WorkSession)& WS, Standard_EXPORT Standard_Boolean ReadMaterials (const Handle(XSControl_WorkSession)& WS, const Handle(TDocStd_Document)& doc, const Handle(TColStd_HSequenceOfTransient)& SeqPDS) const;
const Handle(TDocStd_Document)& doc,
const Handle(TColStd_HSequenceOfTransient)& SeqPDS,
const StepData_Factors& theLocalFactors) const;
//! Reads Views for instances defined in the STEP model //! Reads Views for instances defined in the STEP model
Standard_EXPORT Standard_Boolean ReadViews(const Handle(XSControl_WorkSession)& theWS, Standard_EXPORT Standard_Boolean ReadViews(const Handle(XSControl_WorkSession)& theWS, const Handle(TDocStd_Document)& theDoc) const;
const Handle(TDocStd_Document)& theDoc,
const StepData_Factors& theLocalFactors) const;
//! Populates the sub-Label of the passed TDF Label with shape //! Populates the sub-Label of the passed TDF Label with shape
//! data associated with the given STEP Representation Item, //! data associated with the given STEP Representation Item,
@@ -293,26 +281,22 @@ private:
const XCAFDimTolObjects_DatumModifWithValue theXCAFModifWithVal, const XCAFDimTolObjects_DatumModifWithValue theXCAFModifWithVal,
const Standard_Real theModifValue, const Standard_Real theModifValue,
const Handle(TDocStd_Document)& theDoc, const Handle(TDocStd_Document)& theDoc,
const Handle(XSControl_WorkSession)& theWS, const Handle(XSControl_WorkSession)& theWS);
const StepData_Factors& theLocalFactors);
//! Internal method. Read Datums, connected to GeomTolerance theGDTL. //! Internal method. Read Datums, connected to GeomTolerance theGDTL.
Standard_Boolean readDatumsAP242(const Handle(Standard_Transient)& theEnt, Standard_Boolean readDatumsAP242(const Handle(Standard_Transient)& theEnt,
const TDF_Label theGDTL, const TDF_Label theGDTL,
const Handle(TDocStd_Document)& theDoc, const Handle(TDocStd_Document)& theDoc,
const Handle(XSControl_WorkSession)& theWS, const Handle(XSControl_WorkSession)& theWS);
const StepData_Factors& theLocalFactors);
//! Internal method. Read Dimension or GeomTolerance. //! Internal method. Read Dimension or GeomTolerance.
TDF_Label createGDTObjectInXCAF(const Handle(Standard_Transient)& theEnt, TDF_Label createGDTObjectInXCAF(const Handle(Standard_Transient)& theEnt,
const Handle(TDocStd_Document)& theDoc, const Handle(TDocStd_Document)& theDoc,
const Handle(XSControl_WorkSession)& theWS, const Handle(XSControl_WorkSession)& theWS);
const StepData_Factors& theLocalFactors);
//! Prepares units for transfer //! Prepares units for transfer
void prepareUnits(const Handle(StepData_StepModel)& theModel, void prepareUnits(const Handle(StepData_StepModel)& theModel,
const Handle(TDocStd_Document)& theDoc, const Handle(TDocStd_Document)& theDoc) const;
StepData_Factors& theLocalFactors) const;
private: private:

View File

@@ -56,7 +56,6 @@
#include <STEPConstruct_Styles.hxx> #include <STEPConstruct_Styles.hxx>
#include <STEPConstruct_ValidationProps.hxx> #include <STEPConstruct_ValidationProps.hxx>
#include <STEPControl_StepModelType.hxx> #include <STEPControl_StepModelType.hxx>
#include <StepData_Factors.hxx>
#include <StepData_Logical.hxx> #include <StepData_Logical.hxx>
#include <StepData_StepModel.hxx> #include <StepData_StepModel.hxx>
#include <StepDimTol_AngularityTolerance.hxx> #include <StepDimTol_AngularityTolerance.hxx>
@@ -349,21 +348,18 @@ IFSelect_ReturnStatus STEPCAFControl_Writer::Write(const Standard_CString theFil
//purpose : //purpose :
//======================================================================= //=======================================================================
void STEPCAFControl_Writer::prepareUnit(const TDF_Label& theLabel, void STEPCAFControl_Writer::prepareUnit(const TDF_Label& theLabel,
const Handle(StepData_StepModel)& theModel, const Handle(StepData_StepModel)& theModel)
StepData_Factors& theLocalFactors)
{ {
Handle(XCAFDoc_LengthUnit) aLengthAttr; Handle(XCAFDoc_LengthUnit) aLengthAttr;
if (!theLabel.IsNull() && if (!theLabel.IsNull() &&
theLabel.Root().FindAttribute(XCAFDoc_LengthUnit::GetID(), aLengthAttr)) theLabel.Root().FindAttribute(XCAFDoc_LengthUnit::GetID(), aLengthAttr))
{ {
theModel->SetLocalLengthUnit(aLengthAttr->GetUnitValue() * 1000); // convert to mm theModel->SetLocalLengthUnit(aLengthAttr->GetUnitValue() * 1000); // convert to mm
theLocalFactors.SetCascadeUnit(aLengthAttr->GetUnitValue() * 1000);
} }
else else
{ {
XSAlgo::AlgoContainer()->PrepareForTransfer(); // update unit info XSAlgo::AlgoContainer()->PrepareForTransfer(); // update unit info
theModel->SetLocalLengthUnit(UnitsMethods::GetCasCadeLengthUnit()); theModel->SetLocalLengthUnit(UnitsMethods::GetCasCadeLengthUnit());
theLocalFactors.SetCascadeUnit(UnitsMethods::GetCasCadeLengthUnit());
} }
} }
@@ -515,9 +511,8 @@ Standard_Boolean STEPCAFControl_Writer::transfer(STEPControl_Writer& theWriter,
Handle(STEPCAFControl_ActorWrite) anActor = Handle(STEPCAFControl_ActorWrite) anActor =
Handle(STEPCAFControl_ActorWrite)::DownCast(theWriter.WS()->NormAdaptor()->ActorWrite()); Handle(STEPCAFControl_ActorWrite)::DownCast(theWriter.WS()->NormAdaptor()->ActorWrite());
StepData_Factors aLocalFactors;
const Handle(StepData_StepModel) aModel = Handle(StepData_StepModel)::DownCast(theWriter.WS()->Model()); const Handle(StepData_StepModel) aModel = Handle(StepData_StepModel)::DownCast(theWriter.WS()->Model());
prepareUnit(theLabels.First(), aModel, aLocalFactors); // set local length unit to the model prepareUnit(theLabels.First(), aModel); // set local length unit to the model
// translate free top-level shapes of the DECAF document // translate free top-level shapes of the DECAF document
const Standard_Integer aStepSchema = Interface_Static::IVal("write.step.schema"); const Standard_Integer aStepSchema = Interface_Static::IVal("write.step.schema");
TDF_LabelSequence aSubLabels; TDF_LabelSequence aSubLabels;
@@ -619,7 +614,7 @@ Standard_Boolean STEPCAFControl_Writer::transfer(STEPControl_Writer& theWriter,
{ {
// translate final solids // translate final solids
Message_ProgressScope aPS1(aRange, NULL, 2); Message_ProgressScope aPS1(aRange, NULL, 2);
TopoDS_Shape aSass = transferExternFiles(aCurL, theMode, aSubLabels, aLocalFactors, theIsMulti, aPS1.Next()); TopoDS_Shape aSass = transferExternFiles(aCurL, theMode, aSubLabels, theIsMulti, aPS1.Next());
if (aPS1.UserBreak()) if (aPS1.UserBreak())
return Standard_False; return Standard_False;
@@ -658,7 +653,7 @@ Standard_Boolean STEPCAFControl_Writer::transfer(STEPControl_Writer& theWriter,
{ {
if (aStepSchema == 5) if (aStepSchema == 5)
{ {
writeDGTsAP242(theWriter.WS(), aSubLabels, aLocalFactors); writeDGTsAP242(theWriter.WS(), aSubLabels);
} }
else else
{ {
@@ -738,7 +733,6 @@ Standard_Boolean STEPCAFControl_Writer::transfer(STEPControl_Writer& theWriter,
TopoDS_Shape STEPCAFControl_Writer::transferExternFiles(const TDF_Label& theLabel, TopoDS_Shape STEPCAFControl_Writer::transferExternFiles(const TDF_Label& theLabel,
const STEPControl_StepModelType theMode, const STEPControl_StepModelType theMode,
TDF_LabelSequence& theLabels, TDF_LabelSequence& theLabels,
const StepData_Factors& theLocalFactors,
const Standard_CString thePrefix, const Standard_CString thePrefix,
const Message_ProgressRange& theProgress) const Message_ProgressRange& theProgress)
{ {
@@ -821,7 +815,7 @@ TopoDS_Shape STEPCAFControl_Writer::transferExternFiles(const TDF_Label& theLabe
TDF_Label aRefL; TDF_Label aRefL;
if (!XCAFDoc_ShapeTool::GetReferredShape(aCurL, aRefL)) if (!XCAFDoc_ShapeTool::GetReferredShape(aCurL, aRefL))
continue; continue;
TopoDS_Shape aShComp = transferExternFiles(aRefL, theMode, theLabels, theLocalFactors, thePrefix, aPS.Next()); TopoDS_Shape aShComp = transferExternFiles(aRefL, theMode, theLabels, thePrefix, aPS.Next());
aShComp.Location(XCAFDoc_ShapeTool::GetLocation(aCurL)); aShComp.Location(XCAFDoc_ShapeTool::GetLocation(aCurL));
aBuilder.Add(aComp, aShComp); aBuilder.Add(aComp, aShComp);
} }
@@ -2463,8 +2457,7 @@ void STEPCAFControl_Writer::writePresentation(const Handle(XSControl_WorkSession
const Standard_Boolean theHasPlane, const Standard_Boolean theHasPlane,
const gp_Ax2& theAnnotationPlane, const gp_Ax2& theAnnotationPlane,
const gp_Pnt& theTextPosition, const gp_Pnt& theTextPosition,
const Handle(Standard_Transient)& theDimension, const Handle(Standard_Transient)& theDimension)
const StepData_Factors& theLocalFactors)
{ {
if (thePresentation.IsNull()) if (thePresentation.IsNull())
return; return;
@@ -2473,10 +2466,6 @@ void STEPCAFControl_Writer::writePresentation(const Handle(XSControl_WorkSession
// Presentation // Presentation
Handle(StepVisual_TessellatedGeometricSet) aGeomSet = STEPCAFControl_GDTProperty::GetTessellation(thePresentation); Handle(StepVisual_TessellatedGeometricSet) aGeomSet = STEPCAFControl_GDTProperty::GetTessellation(thePresentation);
if (aGeomSet.IsNull())
{
return;
}
Handle(StepVisual_TessellatedAnnotationOccurrence) aTAO = new StepVisual_TessellatedAnnotationOccurrence(); Handle(StepVisual_TessellatedAnnotationOccurrence) aTAO = new StepVisual_TessellatedAnnotationOccurrence();
aTAO->Init(new TCollection_HAsciiString(), myGDTPrsCurveStyle, aGeomSet); aTAO->Init(new TCollection_HAsciiString(), myGDTPrsCurveStyle, aGeomSet);
StepVisual_DraughtingCalloutElement aDCElement; StepVisual_DraughtingCalloutElement aDCElement;
@@ -2519,7 +2508,7 @@ void STEPCAFControl_Writer::writePresentation(const Handle(XSControl_WorkSession
aPrsStyles->SetValue(1, aPrsStyle); aPrsStyles->SetValue(1, aPrsStyle);
// Plane // Plane
Handle(StepGeom_Plane) aPlane = new StepGeom_Plane(); Handle(StepGeom_Plane) aPlane = new StepGeom_Plane();
GeomToStep_MakeAxis2Placement3d anAxisMaker(theAnnotationPlane, theLocalFactors); GeomToStep_MakeAxis2Placement3d anAxisMaker(theAnnotationPlane);
const Handle(StepGeom_Axis2Placement3d)& anAxis = anAxisMaker.Value(); const Handle(StepGeom_Axis2Placement3d)& anAxis = anAxisMaker.Value();
// Set text position to plane origin // Set text position to plane origin
Handle(StepGeom_CartesianPoint) aTextPos = new StepGeom_CartesianPoint(); Handle(StepGeom_CartesianPoint) aTextPos = new StepGeom_CartesianPoint();
@@ -2551,8 +2540,7 @@ Handle(StepDimTol_Datum) STEPCAFControl_Writer::writeDatumAP242(const Handle(XSC
const TDF_LabelSequence& theShapeL, const TDF_LabelSequence& theShapeL,
const TDF_Label& theDatumL, const TDF_Label& theDatumL,
const Standard_Boolean theIsFirstDTarget, const Standard_Boolean theIsFirstDTarget,
const Handle(StepDimTol_Datum)& theWrittenDatum, const Handle(StepDimTol_Datum)& theWrittenDatum)
const StepData_Factors& theLocalFactors)
{ {
// Get working data // Get working data
const Handle(Interface_InterfaceModel)& aModel = theWS->Model(); const Handle(Interface_InterfaceModel)& aModel = theWS->Model();
@@ -2706,7 +2694,7 @@ Handle(StepDimTol_Datum) STEPCAFControl_Writer::writeDatumAP242(const Handle(XSC
// Common for all datum targets // Common for all datum targets
StepBasic_Unit aUnit = GetUnit(aRC); StepBasic_Unit aUnit = GetUnit(aRC);
gp_Ax2 aDTAxis = anObject->GetDatumTargetAxis(); gp_Ax2 aDTAxis = anObject->GetDatumTargetAxis();
GeomToStep_MakeAxis2Placement3d anAxisMaker(aDTAxis, theLocalFactors); GeomToStep_MakeAxis2Placement3d anAxisMaker(aDTAxis);
Handle(StepGeom_Axis2Placement3d) anA2P3D = anAxisMaker.Value(); Handle(StepGeom_Axis2Placement3d) anA2P3D = anAxisMaker.Value();
anA2P3D->SetName(new TCollection_HAsciiString("orientation")); anA2P3D->SetName(new TCollection_HAsciiString("orientation"));
Handle(StepRepr_HArray1OfRepresentationItem) anItems; Handle(StepRepr_HArray1OfRepresentationItem) anItems;
@@ -2800,7 +2788,7 @@ Handle(StepDimTol_Datum) STEPCAFControl_Writer::writeDatumAP242(const Handle(XSC
//Annotation plane and Presentation //Annotation plane and Presentation
writePresentation(theWS, anObject->GetPresentation(), anObject->GetPresentationName(), Standard_True, anObject->HasPlane(), writePresentation(theWS, anObject->GetPresentation(), anObject->GetPresentationName(), Standard_True, anObject->HasPlane(),
anObject->GetPlane(), anObject->GetPointTextAttach(), aSA, theLocalFactors); anObject->GetPlane(), anObject->GetPointTextAttach(), aSA);
return aDatum; return aDatum;
} }
@@ -2813,8 +2801,7 @@ Handle(StepDimTol_Datum) STEPCAFControl_Writer::writeDatumAP242(const Handle(XSC
static void WriteDimValues(const Handle(XSControl_WorkSession)& theWS, static void WriteDimValues(const Handle(XSControl_WorkSession)& theWS,
const Handle(XCAFDimTolObjects_DimensionObject)& theObject, const Handle(XCAFDimTolObjects_DimensionObject)& theObject,
const Handle(StepRepr_RepresentationContext)& theRC, const Handle(StepRepr_RepresentationContext)& theRC,
const StepShape_DimensionalCharacteristic& theDimension, const StepShape_DimensionalCharacteristic& theDimension)
const StepData_Factors& theLocalFactors)
{ {
// Get working data // Get working data
const Handle(Interface_InterfaceModel)& aModel = theWS->Model(); const Handle(Interface_InterfaceModel)& aModel = theWS->Model();
@@ -2941,7 +2928,7 @@ static void WriteDimValues(const Handle(XSControl_WorkSession)& theWS,
Handle(StepGeom_Axis2Placement3d) anOrientation = new StepGeom_Axis2Placement3d(); Handle(StepGeom_Axis2Placement3d) anOrientation = new StepGeom_Axis2Placement3d();
gp_Dir aDir; gp_Dir aDir;
theObject->GetDirection(aDir); theObject->GetDirection(aDir);
GeomToStep_MakeCartesianPoint MkPoint(gp_Pnt(0, 0, 0), theLocalFactors.LengthFactor()); GeomToStep_MakeCartesianPoint MkPoint(gp_Pnt(0, 0, 0));
const Handle(StepGeom_CartesianPoint)& aLoc = MkPoint.Value(); const Handle(StepGeom_CartesianPoint)& aLoc = MkPoint.Value();
Handle(StepGeom_Direction) anAxis = new StepGeom_Direction(); Handle(StepGeom_Direction) anAxis = new StepGeom_Direction();
Handle(TColStd_HArray1OfReal) aCoords = new TColStd_HArray1OfReal(1, 3); Handle(TColStd_HArray1OfReal) aCoords = new TColStd_HArray1OfReal(1, 3);
@@ -3038,14 +3025,13 @@ static void WriteDerivedGeometry(const Handle(XSControl_WorkSession)& theWS,
const Handle(StepRepr_ConstructiveGeometryRepresentation)& theRepr, const Handle(StepRepr_ConstructiveGeometryRepresentation)& theRepr,
Handle(StepRepr_ShapeAspect)& theFirstSA, Handle(StepRepr_ShapeAspect)& theFirstSA,
Handle(StepRepr_ShapeAspect)& theSecondSA, Handle(StepRepr_ShapeAspect)& theSecondSA,
NCollection_Vector<Handle(StepGeom_CartesianPoint)>& thePnts, NCollection_Vector<Handle(StepGeom_CartesianPoint)>& thePnts)
const StepData_Factors& theLocalFactors)
{ {
const Handle(Interface_InterfaceModel)& aModel = theWS->Model(); const Handle(Interface_InterfaceModel)& aModel = theWS->Model();
// First point // First point
if (theObject->HasPoint()) if (theObject->HasPoint())
{ {
GeomToStep_MakeCartesianPoint aPointMaker(theObject->GetPoint(), theLocalFactors.LengthFactor()); GeomToStep_MakeCartesianPoint aPointMaker(theObject->GetPoint());
Handle(StepGeom_CartesianPoint) aPoint = aPointMaker.Value(); Handle(StepGeom_CartesianPoint) aPoint = aPointMaker.Value();
thePnts.Append(aPoint); thePnts.Append(aPoint);
Handle(StepRepr_DerivedShapeAspect) aDSA = new StepRepr_DerivedShapeAspect(); Handle(StepRepr_DerivedShapeAspect) aDSA = new StepRepr_DerivedShapeAspect();
@@ -3066,7 +3052,7 @@ static void WriteDerivedGeometry(const Handle(XSControl_WorkSession)& theWS,
// Second point (for locations) // Second point (for locations)
if (theObject->HasPoint2()) if (theObject->HasPoint2())
{ {
GeomToStep_MakeCartesianPoint aPointMaker(theObject->GetPoint2(), theLocalFactors.LengthFactor()); GeomToStep_MakeCartesianPoint aPointMaker(theObject->GetPoint2());
Handle(StepGeom_CartesianPoint) aPoint = aPointMaker.Value(); Handle(StepGeom_CartesianPoint) aPoint = aPointMaker.Value();
thePnts.Append(aPoint); thePnts.Append(aPoint);
Handle(StepRepr_DerivedShapeAspect) aDSA = new StepRepr_DerivedShapeAspect(); Handle(StepRepr_DerivedShapeAspect) aDSA = new StepRepr_DerivedShapeAspect();
@@ -3094,8 +3080,7 @@ static Handle(StepDimTol_HArray1OfDatumSystemOrReference) WriteDatumSystem(const
const TDF_Label theGeomTolL, const TDF_Label theGeomTolL,
const TDF_LabelSequence& theDatumSeq, const TDF_LabelSequence& theDatumSeq,
const STEPConstruct_DataMapOfAsciiStringTransient& theDatumMap, const STEPConstruct_DataMapOfAsciiStringTransient& theDatumMap,
const Handle(StepRepr_RepresentationContext)& theRC, const Handle(StepRepr_RepresentationContext)& theRC)
const StepData_Factors& theLocalFactors)
{ {
// Get working data // Get working data
const Handle(Interface_InterfaceModel)& aModel = theWS->Model(); const Handle(Interface_InterfaceModel)& aModel = theWS->Model();
@@ -3264,7 +3249,7 @@ static Handle(StepDimTol_HArray1OfDatumSystemOrReference) WriteDatumSystem(const
// Axis // Axis
if (anObject->HasAxis()) if (anObject->HasAxis())
{ {
GeomToStep_MakeAxis2Placement3d anAxisMaker(anObject->GetAxis(), theLocalFactors); GeomToStep_MakeAxis2Placement3d anAxisMaker(anObject->GetAxis());
Handle(StepGeom_Axis2Placement3d) anAxis = anAxisMaker.Value(); Handle(StepGeom_Axis2Placement3d) anAxis = anAxisMaker.Value();
anAxis->SetName(new TCollection_HAsciiString("orientation")); anAxis->SetName(new TCollection_HAsciiString("orientation"));
Handle(StepAP242_GeometricItemSpecificUsage) aGISU = new StepAP242_GeometricItemSpecificUsage(); Handle(StepAP242_GeometricItemSpecificUsage) aGISU = new StepAP242_GeometricItemSpecificUsage();
@@ -3350,8 +3335,7 @@ void STEPCAFControl_Writer::writeGeomTolerance(const Handle(XSControl_WorkSessio
const TDF_LabelSequence& theShapeSeqL, const TDF_LabelSequence& theShapeSeqL,
const TDF_Label& theGeomTolL, const TDF_Label& theGeomTolL,
const Handle(StepDimTol_HArray1OfDatumSystemOrReference)& theDatumSystem, const Handle(StepDimTol_HArray1OfDatumSystemOrReference)& theDatumSystem,
const Handle(StepRepr_RepresentationContext)& theRC, const Handle(StepRepr_RepresentationContext)& theRC)
const StepData_Factors& theLocalFactors)
{ {
// Get working data // Get working data
const Handle(Interface_InterfaceModel)& aModel = theWS->Model(); const Handle(Interface_InterfaceModel)& aModel = theWS->Model();
@@ -3548,7 +3532,7 @@ void STEPCAFControl_Writer::writeGeomTolerance(const Handle(XSControl_WorkSessio
writeToleranceZone(theWS, anObject, aGeomTol, theRC); writeToleranceZone(theWS, anObject, aGeomTol, theRC);
//Annotation plane and Presentation //Annotation plane and Presentation
writePresentation(theWS, anObject->GetPresentation(), anObject->GetPresentationName(), Standard_True, anObject->HasPlane(), writePresentation(theWS, anObject->GetPresentation(), anObject->GetPresentationName(), Standard_True, anObject->HasPlane(),
anObject->GetPlane(), anObject->GetPointTextAttach(), aGeomTol, theLocalFactors); anObject->GetPlane(), anObject->GetPointTextAttach(), aGeomTol);
} }
//======================================================================= //=======================================================================
@@ -3930,8 +3914,7 @@ Standard_Boolean STEPCAFControl_Writer::writeDGTs(const Handle(XSControl_WorkSes
//purpose : //purpose :
//======================================================================= //=======================================================================
Standard_Boolean STEPCAFControl_Writer::writeDGTsAP242(const Handle(XSControl_WorkSession)& theWS, Standard_Boolean STEPCAFControl_Writer::writeDGTsAP242(const Handle(XSControl_WorkSession)& theWS,
const TDF_LabelSequence& theLabels, const TDF_LabelSequence& theLabels)
const StepData_Factors& theLocalFactors)
{ {
(void)theLabels; (void)theLabels;
// Get working data // Get working data
@@ -3987,8 +3970,7 @@ Standard_Boolean STEPCAFControl_Writer::writeDGTsAP242(const Handle(XSControl_Wo
Handle(Standard_Transient) aWrittenDatum; Handle(Standard_Transient) aWrittenDatum;
Standard_Boolean isFirstDT = !aDatumMap.Find(aDatumName, aWrittenDatum); Standard_Boolean isFirstDT = !aDatumMap.Find(aDatumName, aWrittenDatum);
Handle(StepDimTol_Datum) aDatum = writeDatumAP242(theWS, aShapeL, aDatumL, isFirstDT, Handle(StepDimTol_Datum) aDatum = writeDatumAP242(theWS, aShapeL, aDatumL, isFirstDT,
Handle(StepDimTol_Datum)::DownCast(aWrittenDatum), Handle(StepDimTol_Datum)::DownCast(aWrittenDatum));
theLocalFactors);
// Add created Datum into Map // Add created Datum into Map
aDatumMap.Bind(aDatumName, aDatum); aDatumMap.Bind(aDatumName, aDatum);
} }
@@ -4030,7 +4012,7 @@ Standard_Boolean STEPCAFControl_Writer::writeDGTsAP242(const Handle(XSControl_Wo
aSA->Init(new TCollection_HAsciiString(), new TCollection_HAsciiString(), myGDTCommonPDS, StepData_LTrue); aSA->Init(new TCollection_HAsciiString(), new TCollection_HAsciiString(), myGDTCommonPDS, StepData_LTrue);
aModel->AddWithRefs(aSA); aModel->AddWithRefs(aSA);
writePresentation(theWS, anObject->GetPresentation(), anObject->GetPresentationName(), anObject->HasPlane(), writePresentation(theWS, anObject->GetPresentation(), anObject->GetPresentationName(), anObject->HasPlane(),
Standard_False, anObject->GetPlane(), anObject->GetPointTextAttach(), aSA, theLocalFactors); Standard_False, anObject->GetPlane(), anObject->GetPointTextAttach(), aSA);
} }
if (!XCAFDoc_DimTolTool::GetRefShapeLabel(aDimensionL, aFirstShapeL, aSecondShapeL)) if (!XCAFDoc_DimTolTool::GetRefShapeLabel(aDimensionL, aFirstShapeL, aSecondShapeL))
@@ -4102,14 +4084,14 @@ Standard_Boolean STEPCAFControl_Writer::writeDGTsAP242(const Handle(XSControl_Wo
if (anObject->GetType() == XCAFDimTolObjects_DimensionType_DimensionPresentation) if (anObject->GetType() == XCAFDimTolObjects_DimensionType_DimensionPresentation)
{ {
writePresentation(theWS, anObject->GetPresentation(), anObject->GetPresentationName(), anObject->HasPlane(), writePresentation(theWS, anObject->GetPresentation(), anObject->GetPresentationName(), anObject->HasPlane(),
Standard_False, anObject->GetPlane(), anObject->GetPointTextAttach(), aFirstSA, theLocalFactors); Standard_False, anObject->GetPlane(), anObject->GetPointTextAttach(), aFirstSA);
continue; continue;
} }
// Write dimensions // Write dimensions
StepShape_DimensionalCharacteristic aDimension; StepShape_DimensionalCharacteristic aDimension;
if (anObject->HasPoint() || anObject->HasPoint2()) if (anObject->HasPoint() || anObject->HasPoint2())
WriteDerivedGeometry(theWS, anObject, aCGRepr, aFirstSA, aSecondSA, aConnectionPnts, theLocalFactors); WriteDerivedGeometry(theWS, anObject, aCGRepr, aFirstSA, aSecondSA, aConnectionPnts);
XCAFDimTolObjects_DimensionType aDimType = anObject->GetType(); XCAFDimTolObjects_DimensionType aDimType = anObject->GetType();
if (STEPCAFControl_GDTProperty::IsDimensionalLocation(aDimType)) if (STEPCAFControl_GDTProperty::IsDimensionalLocation(aDimType))
{ {
@@ -4183,10 +4165,10 @@ Standard_Boolean STEPCAFControl_Writer::writeDGTsAP242(const Handle(XSControl_Wo
} }
// Write values // Write values
WriteDimValues(theWS, anObject, aRC, aDimension, theLocalFactors); WriteDimValues(theWS, anObject, aRC, aDimension);
//Annotation plane and Presentation //Annotation plane and Presentation
writePresentation(theWS, anObject->GetPresentation(), anObject->GetPresentationName(), Standard_True, anObject->HasPlane(), writePresentation(theWS, anObject->GetPresentation(), anObject->GetPresentationName(), Standard_True, anObject->HasPlane(),
anObject->GetPlane(), anObject->GetPointTextAttach(), aDimension.Value(), theLocalFactors); anObject->GetPlane(), anObject->GetPointTextAttach(), aDimension.Value());
} }
// Write Derived geometry // Write Derived geometry
if (aConnectionPnts.Length() > 0) if (aConnectionPnts.Length() > 0)
@@ -4221,8 +4203,8 @@ Standard_Boolean STEPCAFControl_Writer::writeDGTsAP242(const Handle(XSControl_Wo
XCAFDoc_DimTolTool::GetDatumWithObjectOfTolerLabels(aGeomTolL, aDatumSeq); XCAFDoc_DimTolTool::GetDatumWithObjectOfTolerLabels(aGeomTolL, aDatumSeq);
Handle(StepDimTol_HArray1OfDatumSystemOrReference) aDatumSystem; Handle(StepDimTol_HArray1OfDatumSystemOrReference) aDatumSystem;
if (aDatumSeq.Length() > 0) if (aDatumSeq.Length() > 0)
aDatumSystem = WriteDatumSystem(theWS, aGeomTolL, aDatumSeq, aDatumMap, aRC, theLocalFactors); aDatumSystem = WriteDatumSystem(theWS, aGeomTolL, aDatumSeq, aDatumMap, aRC);
writeGeomTolerance(theWS, aFirstShapeL, aGeomTolL, aDatumSystem, aRC, theLocalFactors); writeGeomTolerance(theWS, aFirstShapeL, aGeomTolL, aDatumSystem, aRC);
} }
// Write Draughting model for Annotation Planes // Write Draughting model for Annotation Planes

View File

@@ -38,7 +38,6 @@ class XSControl_WorkSession;
class TDocStd_Document; class TDocStd_Document;
class STEPCAFControl_ExternFile; class STEPCAFControl_ExternFile;
class TopoDS_Shape; class TopoDS_Shape;
class StepData_Factors;
//! Provides a tool to write DECAF document to the //! Provides a tool to write DECAF document to the
//! STEP file. Besides transfer of shapes (including //! STEP file. Besides transfer of shapes (including
@@ -189,7 +188,6 @@ protected:
TopoDS_Shape transferExternFiles(const TDF_Label& theLabel, TopoDS_Shape transferExternFiles(const TDF_Label& theLabel,
const STEPControl_StepModelType theMode, const STEPControl_StepModelType theMode,
TDF_LabelSequence& theLabelSeq, TDF_LabelSequence& theLabelSeq,
const StepData_Factors& theLocalFactors,
const Standard_CString thePrefix = "", const Standard_CString thePrefix = "",
const Message_ProgressRange& theProgress = Message_ProgressRange()); const Message_ProgressRange& theProgress = Message_ProgressRange());
@@ -211,8 +209,7 @@ protected:
//! Write D&GTs assigned to specified labels, to STEP model, according AP242 //! Write D&GTs assigned to specified labels, to STEP model, according AP242
Standard_Boolean writeDGTsAP242(const Handle(XSControl_WorkSession)& theWS, Standard_Boolean writeDGTsAP242(const Handle(XSControl_WorkSession)& theWS,
const TDF_LabelSequence& theLabels, const TDF_LabelSequence& theLabels);
const StepData_Factors& theLocalFactors);
//! Write materials assigned to specified labels, to STEP model //! Write materials assigned to specified labels, to STEP model
Standard_Boolean writeMaterials(const Handle(XSControl_WorkSession)& theWS, Standard_Boolean writeMaterials(const Handle(XSControl_WorkSession)& theWS,
@@ -236,8 +233,7 @@ protected:
//! If it exists, initializes local length unit from it //! If it exists, initializes local length unit from it
//! Else initializes according to Cascade length unit //! Else initializes according to Cascade length unit
void prepareUnit(const TDF_Label& theLabel, void prepareUnit(const TDF_Label& theLabel,
const Handle(StepData_StepModel)& theModel, const Handle(StepData_StepModel)& theModel);
StepData_Factors& theLocalFactors);
Handle(StepRepr_ShapeAspect) writeShapeAspect(const Handle(XSControl_WorkSession)& theWS, Handle(StepRepr_ShapeAspect) writeShapeAspect(const Handle(XSControl_WorkSession)& theWS,
const TDF_Label theLabel, const TDF_Label theLabel,
@@ -252,15 +248,13 @@ protected:
const Standard_Boolean theHasPlane, const Standard_Boolean theHasPlane,
const gp_Ax2& theAnnotationPlane, const gp_Ax2& theAnnotationPlane,
const gp_Pnt& theTextPosition, const gp_Pnt& theTextPosition,
const Handle(Standard_Transient)& theDimension, const Handle(Standard_Transient)& theDimension);
const StepData_Factors& theLocalFactors);
Handle(StepDimTol_Datum) writeDatumAP242(const Handle(XSControl_WorkSession)& theWS, Handle(StepDimTol_Datum) writeDatumAP242(const Handle(XSControl_WorkSession)& theWS,
const TDF_LabelSequence& theShapeL, const TDF_LabelSequence& theShapeL,
const TDF_Label& theDatumL, const TDF_Label& theDatumL,
const Standard_Boolean isFirstDTarget, const Standard_Boolean isFirstDTarget,
const Handle(StepDimTol_Datum)& theWrittenDatum, const Handle(StepDimTol_Datum)& theWrittenDatum);
const StepData_Factors& theLocalFactors);
void writeToleranceZone(const Handle(XSControl_WorkSession)& theWS, void writeToleranceZone(const Handle(XSControl_WorkSession)& theWS,
const Handle(XCAFDimTolObjects_GeomToleranceObject)& theObject, const Handle(XCAFDimTolObjects_GeomToleranceObject)& theObject,
@@ -271,8 +265,7 @@ protected:
const TDF_LabelSequence& theShapeSeqL, const TDF_LabelSequence& theShapeSeqL,
const TDF_Label& theGeomTolL, const TDF_Label& theGeomTolL,
const Handle(StepDimTol_HArray1OfDatumSystemOrReference)& theDatumSystem, const Handle(StepDimTol_HArray1OfDatumSystemOrReference)& theDatumSystem,
const Handle(StepRepr_RepresentationContext)& theRC, const Handle(StepRepr_RepresentationContext)& theRC);
const StepData_Factors& theLocalFactors);
private: private:

View File

@@ -82,15 +82,6 @@ void STEPConstruct_ContextTool::SetModel (const Handle(StepData_StepModel)& aSte
} }
} }
//=======================================================================
//function : SetGlobalFactor
//purpose :
//=======================================================================
void STEPConstruct_ContextTool::SetGlobalFactor(const StepData_Factors& theGlobalFactor)
{
myGlobalFactor = theGlobalFactor;
}
//======================================================================= //=======================================================================
//function : GetAPD //function : GetAPD
//purpose : //purpose :
@@ -454,7 +445,7 @@ void STEPConstruct_ContextTool::SetSDR (const Handle(StepShape_ShapeDefinitionRe
Handle(StepGeom_Axis2Placement3d) STEPConstruct_ContextTool::GetDefaultAxis () Handle(StepGeom_Axis2Placement3d) STEPConstruct_ContextTool::GetDefaultAxis ()
{ {
if ( myAxis.IsNull() ) { if ( myAxis.IsNull() ) {
GeomToStep_MakeAxis2Placement3d mkax(myGlobalFactor); GeomToStep_MakeAxis2Placement3d mkax;
myAxis = mkax.Value(); myAxis = mkax.Value();
} }
return myAxis; return myAxis;

View File

@@ -23,7 +23,6 @@
#include <TColStd_SequenceOfInteger.hxx> #include <TColStd_SequenceOfInteger.hxx>
#include <STEPConstruct_AP203Context.hxx> #include <STEPConstruct_AP203Context.hxx>
#include <StepData_Factors.hxx>
#include <Standard_Integer.hxx> #include <Standard_Integer.hxx>
#include <TColStd_HSequenceOfTransient.hxx> #include <TColStd_HSequenceOfTransient.hxx>
class StepBasic_ApplicationProtocolDefinition; class StepBasic_ApplicationProtocolDefinition;
@@ -56,8 +55,6 @@ public:
//! entity of that type found in the model //! entity of that type found in the model
Standard_EXPORT void SetModel (const Handle(StepData_StepModel)& aStepModel); Standard_EXPORT void SetModel (const Handle(StepData_StepModel)& aStepModel);
Standard_EXPORT void SetGlobalFactor(const StepData_Factors& theGlobalFactor);
Standard_EXPORT Handle(StepBasic_ApplicationProtocolDefinition) GetAPD(); Standard_EXPORT Handle(StepBasic_ApplicationProtocolDefinition) GetAPD();
Standard_EXPORT void AddAPD (const Standard_Boolean enforce = Standard_False); Standard_EXPORT void AddAPD (const Standard_Boolean enforce = Standard_False);
@@ -142,7 +139,7 @@ private:
Handle(StepBasic_ApplicationProtocolDefinition) theAPD; Handle(StepBasic_ApplicationProtocolDefinition) theAPD;
STEPConstruct_AP203Context theAP203; STEPConstruct_AP203Context theAP203;
Handle(StepGeom_Axis2Placement3d) myAxis; Handle(StepGeom_Axis2Placement3d) myAxis;
StepData_Factors myGlobalFactor;
}; };

View File

@@ -33,8 +33,8 @@
#include <StepBasic_SiUnitAndPlaneAngleUnit.hxx> #include <StepBasic_SiUnitAndPlaneAngleUnit.hxx>
#include <StepBasic_SiUnitAndSolidAngleUnit.hxx> #include <StepBasic_SiUnitAndSolidAngleUnit.hxx>
#include <StepBasic_SiUnitAndVolumeUnit.hxx> #include <StepBasic_SiUnitAndVolumeUnit.hxx>
#include <StepData_GlobalFactors.hxx>
#include <STEPConstruct_UnitContext.hxx> #include <STEPConstruct_UnitContext.hxx>
#include <StepData_Factors.hxx>
#include <StepGeom_GeomRepContextAndGlobUnitAssCtxAndGlobUncertaintyAssCtx.hxx> #include <StepGeom_GeomRepContextAndGlobUnitAssCtxAndGlobUncertaintyAssCtx.hxx>
#include <StepRepr_GlobalUncertaintyAssignedContext.hxx> #include <StepRepr_GlobalUncertaintyAssignedContext.hxx>
#include <StepRepr_GlobalUnitAssignedContext.hxx> #include <StepRepr_GlobalUnitAssignedContext.hxx>
@@ -63,8 +63,7 @@ STEPConstruct_UnitContext::STEPConstruct_UnitContext()
//purpose : //purpose :
//======================================================================= //=======================================================================
void STEPConstruct_UnitContext::Init(const Standard_Real Tol3d, void STEPConstruct_UnitContext::Init(const Standard_Real Tol3d)
const StepData_Factors& theLocalFactors)
{ {
done = Standard_True; done = Standard_True;
@@ -156,7 +155,7 @@ void STEPConstruct_UnitContext::Init(const Standard_Real Tol3d,
Handle(StepBasic_MeasureValueMember) mvs = new StepBasic_MeasureValueMember; Handle(StepBasic_MeasureValueMember) mvs = new StepBasic_MeasureValueMember;
mvs->SetName("LENGTH_MEASURE"); mvs->SetName("LENGTH_MEASURE");
mvs->SetReal ( Tol3d / theLocalFactors.LengthFactor() ); mvs->SetReal ( Tol3d / StepData_GlobalFactors::Intance().LengthFactor() );
StepBasic_Unit Unit; StepBasic_Unit Unit;
Unit.SetValue ( lengthUnit ); Unit.SetValue ( lengthUnit );
theTol3d->Init(mvs, Unit, TolName, TolDesc); theTol3d->Init(mvs, Unit, TolName, TolDesc);
@@ -243,8 +242,7 @@ Standard_Boolean STEPConstruct_UnitContext::SiUnitNameFactor(const Handle(StepBa
// Purpose : // Purpose :
// ========================================================================== // ==========================================================================
Standard_Integer STEPConstruct_UnitContext::ComputeFactors(const Handle(StepRepr_GlobalUnitAssignedContext)& aContext, Standard_Integer STEPConstruct_UnitContext::ComputeFactors(const Handle(StepRepr_GlobalUnitAssignedContext)& aContext)
const StepData_Factors& theLocalFactors)
{ {
Standard_Integer status = 0; Standard_Integer status = 0;
@@ -270,7 +268,7 @@ Standard_Integer STEPConstruct_UnitContext::ComputeFactors(const Handle(StepRepr
for (Standard_Integer i = 1; i <= nbU; i++) { for (Standard_Integer i = 1; i <= nbU; i++) {
Handle(StepBasic_NamedUnit) theNamedUnit = aContext->UnitsValue(i); Handle(StepBasic_NamedUnit) theNamedUnit = aContext->UnitsValue(i);
status = ComputeFactors(theNamedUnit, theLocalFactors); status = ComputeFactors(theNamedUnit);
#ifdef OCCT_DEBUG #ifdef OCCT_DEBUG
if(status == -1) if(status == -1)
std::cout << " -- STEPConstruct_UnitContext:ComputeFactor: Unit item no." << i << " is not recognized" << std::endl; std::cout << " -- STEPConstruct_UnitContext:ComputeFactor: Unit item no." << i << " is not recognized" << std::endl;
@@ -280,8 +278,7 @@ Standard_Integer STEPConstruct_UnitContext::ComputeFactors(const Handle(StepRepr
} }
Standard_Integer STEPConstruct_UnitContext::ComputeFactors(const Handle(StepBasic_NamedUnit)& aUnit, Standard_Integer STEPConstruct_UnitContext::ComputeFactors(const Handle(StepBasic_NamedUnit)& aUnit)
const StepData_Factors& theLocalFactors)
{ {
//:f3 abv 8 Apr 98: ProSTEP TR8 tr8_as_sd_sw: the case of unrecognized entity //:f3 abv 8 Apr 98: ProSTEP TR8 tr8_as_sd_sw: the case of unrecognized entity
@@ -382,7 +379,7 @@ Standard_Integer STEPConstruct_UnitContext::ComputeFactors(const Handle(StepBasi
return 0; return 0;
} }
const Standard_Real aCascadeUnit = theLocalFactors.CascadeUnit(); const Standard_Real aCascadeUnit = StepData_GlobalFactors::Intance().CascadeUnit();
if (aUnit->IsKind(STANDARD_TYPE(StepBasic_ConversionBasedUnitAndLengthUnit))|| if (aUnit->IsKind(STANDARD_TYPE(StepBasic_ConversionBasedUnitAndLengthUnit))||
aUnit->IsKind(STANDARD_TYPE(StepBasic_SiUnitAndLengthUnit))) { aUnit->IsKind(STANDARD_TYPE(StepBasic_SiUnitAndLengthUnit))) {
#ifdef METER #ifdef METER

View File

@@ -24,7 +24,6 @@
#include <Standard_Integer.hxx> #include <Standard_Integer.hxx>
#include <Standard_CString.hxx> #include <Standard_CString.hxx>
#include <StepBasic_SiPrefix.hxx> #include <StepBasic_SiPrefix.hxx>
class StepData_Factors;
class StepGeom_GeomRepContextAndGlobUnitAssCtxAndGlobUncertaintyAssCtx; class StepGeom_GeomRepContextAndGlobUnitAssCtxAndGlobUncertaintyAssCtx;
class StepRepr_GlobalUnitAssignedContext; class StepRepr_GlobalUnitAssignedContext;
class StepBasic_NamedUnit; class StepBasic_NamedUnit;
@@ -46,8 +45,7 @@ public:
//! Creates new context (units are MM and radians, //! Creates new context (units are MM and radians,
//! uncertainty equal to Tol3d) //! uncertainty equal to Tol3d)
Standard_EXPORT void Init (const Standard_Real Tol3d, Standard_EXPORT void Init (const Standard_Real Tol3d);
const StepData_Factors& theLocalFactors);
//! Returns True if Init was called successfully //! Returns True if Init was called successfully
Standard_EXPORT Standard_Boolean IsDone() const; Standard_EXPORT Standard_Boolean IsDone() const;
@@ -57,11 +55,9 @@ public:
//! Computes the length, plane angle and solid angle conversion //! Computes the length, plane angle and solid angle conversion
//! factor . Returns a status, 0 if OK //! factor . Returns a status, 0 if OK
Standard_EXPORT Standard_Integer ComputeFactors (const Handle(StepRepr_GlobalUnitAssignedContext)& aContext, Standard_EXPORT Standard_Integer ComputeFactors (const Handle(StepRepr_GlobalUnitAssignedContext)& aContext);
const StepData_Factors& theLocalFactors);
Standard_EXPORT Standard_Integer ComputeFactors (const Handle(StepBasic_NamedUnit)& aUnit, Standard_EXPORT Standard_Integer ComputeFactors (const Handle(StepBasic_NamedUnit)& aUnit);
const StepData_Factors& theLocalFactors);
//! Computes the uncertainty value (for length) //! Computes the uncertainty value (for length)
Standard_EXPORT Standard_Integer ComputeTolerance (const Handle(StepRepr_GlobalUncertaintyAssignedContext)& aContext); Standard_EXPORT Standard_Integer ComputeTolerance (const Handle(StepRepr_GlobalUncertaintyAssignedContext)& aContext);

View File

@@ -29,7 +29,6 @@
#include <StepBasic_SiUnitAndLengthUnit.hxx> #include <StepBasic_SiUnitAndLengthUnit.hxx>
#include <STEPConstruct_UnitContext.hxx> #include <STEPConstruct_UnitContext.hxx>
#include <STEPConstruct_ValidationProps.hxx> #include <STEPConstruct_ValidationProps.hxx>
#include <StepData_Factors.hxx>
#include <StepData_StepModel.hxx> #include <StepData_StepModel.hxx>
#include <StepGeom_CartesianPoint.hxx> #include <StepGeom_CartesianPoint.hxx>
#include <StepGeom_GeometricRepresentationContextAndGlobalUnitAssignedContext.hxx> #include <StepGeom_GeometricRepresentationContextAndGlobalUnitAssignedContext.hxx>
@@ -624,9 +623,7 @@ TopoDS_Shape STEPConstruct_ValidationProps::GetPropShape (const Handle(StepRepr_
//======================================================================= //=======================================================================
Standard_Boolean STEPConstruct_ValidationProps::GetPropReal (const Handle(StepRepr_RepresentationItem) &item, Standard_Boolean STEPConstruct_ValidationProps::GetPropReal (const Handle(StepRepr_RepresentationItem) &item,
Standard_Real &Val, Standard_Real &Val, Standard_Boolean &isArea) const
Standard_Boolean &isArea,
const StepData_Factors& theLocalFactors) const
{ {
// decode volume & area // decode volume & area
if ( ! item->IsKind(STANDARD_TYPE(StepRepr_MeasureRepresentationItem)) ) if ( ! item->IsKind(STANDARD_TYPE(StepRepr_MeasureRepresentationItem)) )
@@ -647,7 +644,7 @@ Standard_Boolean STEPConstruct_ValidationProps::GetPropReal (const Handle(StepRe
Standard_Real exp = DUE->Exponent(); Standard_Real exp = DUE->Exponent();
Handle(StepBasic_NamedUnit) NU = DUE->Unit(); Handle(StepBasic_NamedUnit) NU = DUE->Unit();
STEPConstruct_UnitContext unit; STEPConstruct_UnitContext unit;
unit.ComputeFactors(NU, theLocalFactors); unit.ComputeFactors(NU);
if(unit.LengthDone()) { if(unit.LengthDone()) {
Standard_Real lengthFactor = unit.LengthFactor(); Standard_Real lengthFactor = unit.LengthFactor();
scale *= pow(lengthFactor,exp); scale *= pow(lengthFactor,exp);
@@ -658,7 +655,7 @@ Standard_Boolean STEPConstruct_ValidationProps::GetPropReal (const Handle(StepRe
Handle(StepBasic_NamedUnit) NU = Unit.NamedUnit(); Handle(StepBasic_NamedUnit) NU = Unit.NamedUnit();
if(!NU.IsNull()) { if(!NU.IsNull()) {
STEPConstruct_UnitContext unit; STEPConstruct_UnitContext unit;
unit.ComputeFactors(NU, theLocalFactors); unit.ComputeFactors(NU);
if(unit.AreaDone()) if(unit.AreaDone())
scale = unit.AreaFactor(); scale = unit.AreaFactor();
if(unit.VolumeDone()) if(unit.VolumeDone())
@@ -686,8 +683,7 @@ Standard_Boolean STEPConstruct_ValidationProps::GetPropReal (const Handle(StepRe
Standard_Boolean STEPConstruct_ValidationProps::GetPropPnt (const Handle(StepRepr_RepresentationItem) &item, Standard_Boolean STEPConstruct_ValidationProps::GetPropPnt (const Handle(StepRepr_RepresentationItem) &item,
const Handle(StepRepr_RepresentationContext) &Context, const Handle(StepRepr_RepresentationContext) &Context,
gp_Pnt &Pnt, gp_Pnt &Pnt) const
const StepData_Factors& theLocalFactors) const
{ {
// centroid // centroid
if ( ! item->IsKind(STANDARD_TYPE(StepGeom_CartesianPoint)) ) if ( ! item->IsKind(STANDARD_TYPE(StepGeom_CartesianPoint)) )
@@ -717,7 +713,7 @@ Standard_Boolean STEPConstruct_ValidationProps::GetPropPnt (const Handle(StepRep
} }
if ( ! theGUAC.IsNull() ) { if ( ! theGUAC.IsNull() ) {
STEPConstruct_UnitContext UnitTool; STEPConstruct_UnitContext UnitTool;
UnitTool.ComputeFactors(theGUAC, theLocalFactors); UnitTool.ComputeFactors(theGUAC);
gp_Pnt zero(0,0,0); gp_Pnt zero(0,0,0);
pos.Scale ( zero, UnitTool.LengthFactor() ); pos.Scale ( zero, UnitTool.LengthFactor() );
} }

View File

@@ -26,7 +26,6 @@
#include <Standard_CString.hxx> #include <Standard_CString.hxx>
#include <TColStd_SequenceOfTransient.hxx> #include <TColStd_SequenceOfTransient.hxx>
class StepBasic_ProductDefinition; class StepBasic_ProductDefinition;
class StepData_Factors;
class XSControl_WorkSession; class XSControl_WorkSession;
class TopoDS_Shape; class TopoDS_Shape;
class StepRepr_RepresentationItem; class StepRepr_RepresentationItem;
@@ -112,16 +111,10 @@ public:
//! If Property is neither Area nor Volume, returns False //! If Property is neither Area nor Volume, returns False
//! Else returns True and isArea indicates whether property //! Else returns True and isArea indicates whether property
//! is area or volume //! is area or volume
Standard_EXPORT Standard_Boolean GetPropReal (const Handle(StepRepr_RepresentationItem)& item, Standard_EXPORT Standard_Boolean GetPropReal (const Handle(StepRepr_RepresentationItem)& item, Standard_Real& Val, Standard_Boolean& isArea) const;
Standard_Real& Val,
Standard_Boolean& isArea,
const StepData_Factors& theLocalFactors) const;
//! Returns value of Centriod property (or False if it is not) //! Returns value of Centriod property (or False if it is not)
Standard_EXPORT Standard_Boolean GetPropPnt (const Handle(StepRepr_RepresentationItem)& item, Standard_EXPORT Standard_Boolean GetPropPnt (const Handle(StepRepr_RepresentationItem)& item, const Handle(StepRepr_RepresentationContext)& Context, gp_Pnt& Pnt) const;
const Handle(StepRepr_RepresentationContext)& Context,
gp_Pnt& Pnt,
const StepData_Factors& theLocalFactors) const;
//! Sets current assembly shape SDR (for FindCDSR calls) //! Sets current assembly shape SDR (for FindCDSR calls)
Standard_EXPORT void SetAssemblyShape (const TopoDS_Shape& shape); Standard_EXPORT void SetAssemblyShape (const TopoDS_Shape& shape);

View File

@@ -41,8 +41,8 @@
#include <STEPConstruct_Assembly.hxx> #include <STEPConstruct_Assembly.hxx>
#include <STEPConstruct_UnitContext.hxx> #include <STEPConstruct_UnitContext.hxx>
#include <STEPControl_ActorRead.hxx> #include <STEPControl_ActorRead.hxx>
#include <StepData_Factors.hxx>
#include <StepData_StepModel.hxx> #include <StepData_StepModel.hxx>
#include <StepData_GlobalFactors.hxx>
#include <StepDimTol_DatumFeature.hxx> #include <StepDimTol_DatumFeature.hxx>
#include <StepDimTol_GeometricTolerance.hxx> #include <StepDimTol_GeometricTolerance.hxx>
#include <StepDimTol_GeoTolAndGeoTolWthDatRefAndModGeoTolAndPosTol.hxx> #include <StepDimTol_GeoTolAndGeoTolWthDatRefAndModGeoTolAndPosTol.hxx>
@@ -296,15 +296,12 @@ Handle(Transfer_Binder) STEPControl_ActorRead::Transfer
const Message_ProgressRange& theProgress) const Message_ProgressRange& theProgress)
{ {
// [BEGIN] Get version of preprocessor (to detect I-Deas case) (ssv; 23.11.2010) // [BEGIN] Get version of preprocessor (to detect I-Deas case) (ssv; 23.11.2010)
StepData_Factors aLocalFactors;
Handle(StepData_StepModel) aStepModel = Handle(StepData_StepModel)::DownCast ( TP->Model() ); Handle(StepData_StepModel) aStepModel = Handle(StepData_StepModel)::DownCast ( TP->Model() );
if (!aStepModel->IsInitializedUnit()) if (!aStepModel->IsInitializedUnit())
{ {
XSAlgo::AlgoContainer()->PrepareForTransfer(); // update unit info XSAlgo::AlgoContainer()->PrepareForTransfer(); // update unit info
aStepModel->SetLocalLengthUnit(UnitsMethods::GetCasCadeLengthUnit()); aStepModel->SetLocalLengthUnit(UnitsMethods::GetCasCadeLengthUnit());
aLocalFactors.SetCascadeUnit(UnitsMethods::GetCasCadeLengthUnit());
} }
aLocalFactors.SetCascadeUnit(aStepModel->LocalLengthUnit());
Interface_EntityIterator anEntIt = aStepModel->Header(); Interface_EntityIterator anEntIt = aStepModel->Header();
for ( anEntIt.Start(); anEntIt.More(); anEntIt.Next() ) { for ( anEntIt.Start(); anEntIt.More(); anEntIt.Next() ) {
DeclareAndCast( HeaderSection_FileName, aFileNameEntity, anEntIt.Value() ); DeclareAndCast( HeaderSection_FileName, aFileNameEntity, anEntIt.Value() );
@@ -326,7 +323,7 @@ Handle(Transfer_Binder) STEPControl_ActorRead::Transfer
} }
// [END] Get version of preprocessor (to detect I-Deas case) (ssv; 23.11.2010) // [END] Get version of preprocessor (to detect I-Deas case) (ssv; 23.11.2010)
Standard_Boolean aTrsfUse = (Interface_Static::IVal("read.step.root.transformation") == 1); Standard_Boolean aTrsfUse = (Interface_Static::IVal("read.step.root.transformation") == 1);
return TransferShape(start, TP, aLocalFactors, Standard_True, aTrsfUse, theProgress); return TransferShape(start, TP, Standard_True, aTrsfUse, theProgress);
} }
@@ -495,7 +492,6 @@ static void getSDR(const Handle(StepRepr_ProductDefinitionShape)& PDS,
Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity
(const Handle(StepBasic_ProductDefinition)& PD, (const Handle(StepBasic_ProductDefinition)& PD,
const Handle(Transfer_TransientProcess)& TP, const Handle(Transfer_TransientProcess)& TP,
const StepData_Factors& theLocalFactors,
const Standard_Boolean theUseTrsf, const Standard_Boolean theUseTrsf,
const Message_ProgressRange& theProgress) const Message_ProgressRange& theProgress)
@@ -581,7 +577,7 @@ static void getSDR(const Handle(StepRepr_ProductDefinitionShape)& PDS,
#endif #endif
Handle(Transfer_Binder) binder; Handle(Transfer_Binder) binder;
Message_ProgressRange aRange = PS.Next(); Message_ProgressRange aRange = PS.Next();
if (!TP->IsBound(NAUO)) binder = TransferEntity(NAUO, TP, theLocalFactors, aRange); if (!TP->IsBound(NAUO)) binder = TransferEntity(NAUO,TP, aRange);
else binder = TP->Find(NAUO); else binder = TP->Find(NAUO);
TopoDS_Shape theResult = TransferBRep::ShapeResult (binder); TopoDS_Shape theResult = TransferBRep::ShapeResult (binder);
@@ -622,7 +618,7 @@ static void getSDR(const Handle(StepRepr_ProductDefinitionShape)& PDS,
Standard_Boolean useTrsf = theUseTrsf && (i <= nbNotAspect); Standard_Boolean useTrsf = theUseTrsf && (i <= nbNotAspect);
Handle(Transfer_Binder) binder = TP->Find(rep); Handle(Transfer_Binder) binder = TP->Find(rep);
if (binder.IsNull()) if (binder.IsNull())
binder = TransferEntity(rep, TP, theLocalFactors, isBound, useTrsf, aPS1.Next()); binder = TransferEntity(rep, TP, isBound, useTrsf, aPS1.Next());
// if SDR is obtained from ShapeAspect and representation items have already been tramnslated, // if SDR is obtained from ShapeAspect and representation items have already been tramnslated,
// this means that that ShapeAspect is used to refer to sub-shape of the main shape // this means that that ShapeAspect is used to refer to sub-shape of the main shape
@@ -672,7 +668,7 @@ static void getSDR(const Handle(StepRepr_ProductDefinitionShape)& PDS,
// SKL for bug 29068: parameter useTrsf is used because if root entity has connection with other // SKL for bug 29068: parameter useTrsf is used because if root entity has connection with other
// by ShapeRepresentationRelationship then result after such transferring need to transform also. // by ShapeRepresentationRelationship then result after such transferring need to transform also.
// This case is from test "bugs modalg_7 bug30196" // This case is from test "bugs modalg_7 bug30196"
binder = TransferEntity(SRR, TP, theLocalFactors, nbrep, useTrsf, aPS1.Next()); binder = TransferEntity(SRR, TP, nbrep, useTrsf, aPS1.Next());
if (! binder.IsNull()) { if (! binder.IsNull()) {
theResult = TransferBRep::ShapeResult (binder); theResult = TransferBRep::ShapeResult (binder);
Result1 = theResult; Result1 = theResult;
@@ -684,7 +680,7 @@ static void getSDR(const Handle(StepRepr_ProductDefinitionShape)& PDS,
{ {
Handle(StepRepr_ConstructiveGeometryRepresentationRelationship) aCSRR = Handle(StepRepr_ConstructiveGeometryRepresentationRelationship) aCSRR =
Handle(StepRepr_ConstructiveGeometryRepresentationRelationship)::DownCast(anitem); Handle(StepRepr_ConstructiveGeometryRepresentationRelationship)::DownCast(anitem);
binder = TransferEntity(aCSRR, TP, theLocalFactors); binder = TransferEntity(aCSRR, TP);
if (! binder.IsNull()) if (! binder.IsNull())
{ {
Result1 = TransferBRep::ShapeResult (binder); Result1 = TransferBRep::ShapeResult (binder);
@@ -719,7 +715,6 @@ static void getSDR(const Handle(StepRepr_ProductDefinitionShape)& PDS,
Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity
(const Handle(StepRepr_NextAssemblyUsageOccurrence)& NAUO, (const Handle(StepRepr_NextAssemblyUsageOccurrence)& NAUO,
const Handle(Transfer_TransientProcess)& TP, const Handle(Transfer_TransientProcess)& TP,
const StepData_Factors& theLocalFactors,
const Message_ProgressRange& theProgress) const Message_ProgressRange& theProgress)
{ {
Handle(TransferBRep_ShapeBinder) shbinder; Handle(TransferBRep_ShapeBinder) shbinder;
@@ -745,7 +740,7 @@ Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity
Handle(StepRepr_Representation) rep = ( SRRReversed ? RR->Rep2() : RR->Rep1() ); Handle(StepRepr_Representation) rep = ( SRRReversed ? RR->Rep2() : RR->Rep1() );
if(rep.IsNull()) if(rep.IsNull())
continue; continue;
iatrsf = ComputeSRRWT ( RR, TP, Trsf, theLocalFactors); iatrsf = ComputeSRRWT ( RR, TP, Trsf );
// find real ProductDefinition used rep // find real ProductDefinition used rep
Interface_EntityIterator subs3 = TP->Graph().Sharings(rep); Interface_EntityIterator subs3 = TP->Graph().Sharings(rep);
for (subs3.Start(); subs3.More(); subs3.Next()) { for (subs3.Start(); subs3.More(); subs3.Next()) {
@@ -781,7 +776,7 @@ Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity
if(!PD.IsNull()) { if(!PD.IsNull()) {
binder = TP->Find(PD); binder = TP->Find(PD);
if (binder.IsNull()) binder = TransferEntity(PD, TP, theLocalFactors, Standard_False, aPS.Next()); if (binder.IsNull()) binder = TransferEntity(PD, TP, Standard_False, aPS.Next());
theResult = TransferBRep::ShapeResult(binder); theResult = TransferBRep::ShapeResult(binder);
if (!theResult.IsNull()) { if (!theResult.IsNull()) {
if (iatrsf) { if (iatrsf) {
@@ -795,7 +790,7 @@ Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity
if ( theResult.IsNull() && !SRR.IsNull() ) { if ( theResult.IsNull() && !SRR.IsNull() ) {
binder = TP->Find(SRR); binder = TP->Find(SRR);
if ( binder.IsNull() ) { if ( binder.IsNull() ) {
binder = TransferEntity(SRR, TP, theLocalFactors, 0, Standard_False, aPS.Next()); binder = TransferEntity(SRR, TP, 0, Standard_False, aPS.Next());
theResult = TransferBRep::ShapeResult (binder); theResult = TransferBRep::ShapeResult (binder);
if (!theResult.IsNull()) if (!theResult.IsNull())
shbinder = new TransferBRep_ShapeBinder (theResult); shbinder = new TransferBRep_ShapeBinder (theResult);
@@ -815,7 +810,6 @@ Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity
Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity( Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity(
const Handle(StepShape_ShapeRepresentation)& sr, const Handle(StepShape_ShapeRepresentation)& sr,
const Handle(Transfer_TransientProcess)& TP, const Handle(Transfer_TransientProcess)& TP,
const StepData_Factors& theLocalFactors,
Standard_Boolean& isBound, Standard_Boolean& isBound,
const Standard_Boolean theUseTrsf, const Standard_Boolean theUseTrsf,
const Message_ProgressRange& theProgress) const Message_ProgressRange& theProgress)
@@ -836,8 +830,7 @@ Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity(
// Compute unit conversion factors and geometric Accuracy // Compute unit conversion factors and geometric Accuracy
Handle(StepRepr_Representation) oldSRContext = mySRContext; //:S4136 Handle(StepRepr_Representation) oldSRContext = mySRContext; //:S4136
StepData_Factors aLocalFactors = theLocalFactors; PrepareUnits(sr,TP);
PrepareUnits(sr, TP, aLocalFactors);
BRep_Builder B; BRep_Builder B;
TopoDS_Compound comp; TopoDS_Compound comp;
@@ -908,7 +901,7 @@ Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity(
if (!subs3.More()) if (!subs3.More())
{ {
Handle(StepGeom_Axis2Placement3d) aCS = Handle(StepGeom_Axis2Placement3d)::DownCast(anitem); Handle(StepGeom_Axis2Placement3d) aCS = Handle(StepGeom_Axis2Placement3d)::DownCast(anitem);
Handle(Geom_Axis2Placement) aTargAP = StepToGeom::MakeAxis2Placement(aCS, aLocalFactors); Handle(Geom_Axis2Placement) aTargAP = StepToGeom::MakeAxis2Placement(aCS);
if (!aTargAP.IsNull()) if (!aTargAP.IsNull())
{ {
const gp_Ax3 ax3Orig(gp_Pnt(0., 0., 0), gp_Vec(0., 0., 1.), gp_Vec(1., 0., 0.)); const gp_Ax3 ax3Orig(gp_Pnt(0., 0., 0), gp_Vec(0., 0., 1.), gp_Vec(1., 0., 0.));
@@ -927,7 +920,7 @@ Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity(
} }
Handle(Transfer_Binder) binder; Handle(Transfer_Binder) binder;
if (!TP->IsBound(anitem)) { if (!TP->IsBound(anitem)) {
binder = TransferShape(anitem, TP, aLocalFactors, isManifold, Standard_False, aRange); binder = TransferShape(anitem, TP, isManifold, Standard_False, aRange);
} }
else { else {
isBound = Standard_True; isBound = Standard_True;
@@ -1050,7 +1043,7 @@ Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity(
shbinder = new TransferBRep_ShapeBinder(comp); shbinder = new TransferBRep_ShapeBinder(comp);
} }
PrepareUnits ( oldSRContext, TP, aLocalFactors); //:S4136 PrepareUnits ( oldSRContext, TP ); //:S4136
TP->Bind(sr, shbinder); TP->Bind(sr, shbinder);
@@ -1069,7 +1062,6 @@ Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity(
Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity
(const Handle(StepShape_ContextDependentShapeRepresentation)& CDSR, (const Handle(StepShape_ContextDependentShapeRepresentation)& CDSR,
const Handle(Transfer_TransientProcess)& TP, const Handle(Transfer_TransientProcess)& TP,
const StepData_Factors& theLocalFactors,
const Message_ProgressRange& theProgress) const Message_ProgressRange& theProgress)
{ {
Handle(TransferBRep_ShapeBinder) shbinder; Handle(TransferBRep_ShapeBinder) shbinder;
@@ -1087,11 +1079,11 @@ Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity
TopoDS_Shape theResult; TopoDS_Shape theResult;
gp_Trsf Trsf; gp_Trsf Trsf;
Standard_Boolean iatrsf = ComputeSRRWT ( SRR, TP, Trsf, theLocalFactors); Standard_Boolean iatrsf = ComputeSRRWT ( SRR, TP, Trsf );
Handle(Transfer_Binder) binder; Handle(Transfer_Binder) binder;
Standard_Boolean isBound = Standard_False; Standard_Boolean isBound = Standard_False;
if (!TP->IsBound(rep)) binder = TransferEntity(rep, TP, theLocalFactors, isBound, Standard_False, theProgress); if (!TP->IsBound(rep)) binder = TransferEntity(rep, TP, isBound, Standard_False, theProgress);
else binder = TP->Find(rep); else binder = TP->Find(rep);
theResult = TransferBRep::ShapeResult(binder); theResult = TransferBRep::ShapeResult(binder);
@@ -1115,7 +1107,6 @@ Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity
Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity( Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity(
const Handle(StepRepr_ShapeRepresentationRelationship)& und, const Handle(StepRepr_ShapeRepresentationRelationship)& und,
const Handle(Transfer_TransientProcess)& TP, const Handle(Transfer_TransientProcess)& TP,
const StepData_Factors& theLocalFactors,
const Standard_Integer nbrep, const Standard_Integer nbrep,
const Standard_Boolean theUseTrsf, const Standard_Boolean theUseTrsf,
const Message_ProgressRange& theProgress) const Message_ProgressRange& theProgress)
@@ -1135,7 +1126,7 @@ Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity(
Standard_Integer nsh = 0; Standard_Integer nsh = 0;
gp_Trsf Trsf; gp_Trsf Trsf;
Standard_Boolean iatrsf = ComputeSRRWT(und, TP, Trsf, theLocalFactors); Standard_Boolean iatrsf = ComputeSRRWT ( und, TP, Trsf );
// Transfert : que faut-il prendre au juste ? // Transfert : que faut-il prendre au juste ?
Message_ProgressScope aPS(theProgress, NULL, 2); Message_ProgressScope aPS(theProgress, NULL, 2);
@@ -1150,7 +1141,7 @@ Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity(
Handle(StepShape_ShapeRepresentation) anitem = Handle(StepShape_ShapeRepresentation)::DownCast(anitemt); Handle(StepShape_ShapeRepresentation) anitem = Handle(StepShape_ShapeRepresentation)::DownCast(anitemt);
Handle(Transfer_Binder) binder; Handle(Transfer_Binder) binder;
Standard_Boolean isBound = Standard_False; Standard_Boolean isBound = Standard_False;
if (!TP->IsBound(anitem)) binder = TransferEntity(anitem, TP, theLocalFactors, isBound, theUseTrsf, aRange); if (!TP->IsBound(anitem)) binder = TransferEntity(anitem, TP, isBound, theUseTrsf, aRange);
else binder = TP->Find(anitem); else binder = TP->Find(anitem);
TopoDS_Shape theResult = TransferBRep::ShapeResult (binder); TopoDS_Shape theResult = TransferBRep::ShapeResult (binder);
if (!theResult.IsNull()) { if (!theResult.IsNull()) {
@@ -1184,8 +1175,7 @@ Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity(
Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity( Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity(
const Handle(StepRepr_ConstructiveGeometryRepresentationRelationship)& theCGRR, const Handle(StepRepr_ConstructiveGeometryRepresentationRelationship)& theCGRR,
const Handle(Transfer_TransientProcess)& theTP, const Handle(Transfer_TransientProcess)& theTP)
const StepData_Factors& theLocalFactors)
{ {
Handle(TransferBRep_ShapeBinder) shbinder; Handle(TransferBRep_ShapeBinder) shbinder;
@@ -1193,7 +1183,6 @@ Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity(
return shbinder; return shbinder;
Standard_Boolean resetUnits = Standard_False; Standard_Boolean resetUnits = Standard_False;
Handle(StepRepr_Representation) oldSRContext = mySRContext; Handle(StepRepr_Representation) oldSRContext = mySRContext;
StepData_Factors aLocalFactors = theLocalFactors;
TopoDS_Compound aComp; TopoDS_Compound aComp;
BRep_Builder aB; BRep_Builder aB;
aB.MakeCompound(aComp); aB.MakeCompound(aComp);
@@ -1205,7 +1194,7 @@ Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity(
continue; continue;
if(mySRContext.IsNull() || aCRepr->ContextOfItems() != mySRContext->ContextOfItems()) if(mySRContext.IsNull() || aCRepr->ContextOfItems() != mySRContext->ContextOfItems())
{ {
PrepareUnits(aCRepr,theTP, aLocalFactors); PrepareUnits(aCRepr,theTP);
resetUnits = Standard_True; resetUnits = Standard_True;
} }
Standard_Integer j =1; Standard_Integer j =1;
@@ -1218,7 +1207,7 @@ Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity(
Handle(StepGeom_Axis2Placement3d)::DownCast(anItem); Handle(StepGeom_Axis2Placement3d)::DownCast(anItem);
if( !aStepAxis.IsNull()) if( !aStepAxis.IsNull())
{ {
Handle(Geom_Axis2Placement) anAxis = StepToGeom::MakeAxis2Placement (aStepAxis, aLocalFactors); Handle(Geom_Axis2Placement) anAxis = StepToGeom::MakeAxis2Placement (aStepAxis);
if(anAxis.IsNull()) if(anAxis.IsNull())
continue; continue;
Handle(Geom_Plane) aPlane = new Geom_Plane(gp_Ax3(anAxis->Ax2())); Handle(Geom_Plane) aPlane = new Geom_Plane(gp_Ax3(anAxis->Ax2()));
@@ -1234,7 +1223,7 @@ Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity(
shbinder = new TransferBRep_ShapeBinder (aComp); shbinder = new TransferBRep_ShapeBinder (aComp);
mySRContext = oldSRContext; mySRContext = oldSRContext;
if(oldSRContext.IsNull() || resetUnits) if(oldSRContext.IsNull() || resetUnits)
PrepareUnits(oldSRContext, theTP, aLocalFactors); PrepareUnits(oldSRContext,theTP);
theTP->Bind(theCGRR, shbinder); theTP->Bind(theCGRR, shbinder);
@@ -1393,7 +1382,6 @@ Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::OldWay
Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity
(const Handle(StepGeom_GeometricRepresentationItem)& start, (const Handle(StepGeom_GeometricRepresentationItem)& start,
const Handle(Transfer_TransientProcess)& TP, const Handle(Transfer_TransientProcess)& TP,
const StepData_Factors& theLocalFactors,
const Standard_Boolean isManifold, const Standard_Boolean isManifold,
const Message_ProgressRange& theProgress) const Message_ProgressRange& theProgress)
{ {
@@ -1412,15 +1400,14 @@ Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity
#endif #endif
//:S4136 //:S4136
StepData_Factors aLocalFactors = theLocalFactors;
Handle(StepRepr_Representation) oldSRContext = mySRContext; Handle(StepRepr_Representation) oldSRContext = mySRContext;
if ( mySRContext.IsNull() ) { // if no context, try to find it (ex: r0701_ug.stp #4790) if ( mySRContext.IsNull() ) { // if no context, try to find it (ex: r0701_ug.stp #4790)
Handle(StepRepr_Representation) context = FindContext ( start, TP ); Handle(StepRepr_Representation) context = FindContext ( start, TP );
if ( context.IsNull() ) { if ( context.IsNull() ) {
TP->AddWarning ( start, "Entity with no unit context; default units taken" ); TP->AddWarning ( start, "Entity with no unit context; default units taken" );
ResetUnits(aLocalFactors); ResetUnits();
} }
else PrepareUnits ( context, TP, aLocalFactors); else PrepareUnits ( context, TP );
} }
myShapeBuilder.SetPrecision(myPrecision); myShapeBuilder.SetPrecision(myPrecision);
myShapeBuilder.SetMaxTol(myMaxTol); myShapeBuilder.SetMaxTol(myMaxTol);
@@ -1434,35 +1421,35 @@ Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity
OCC_CATCH_SIGNALS OCC_CATCH_SIGNALS
Message_ProgressRange aRange = aPS.Next(); Message_ProgressRange aRange = aPS.Next();
if (start->IsKind(STANDARD_TYPE(StepShape_FacetedBrep))) { if (start->IsKind(STANDARD_TYPE(StepShape_FacetedBrep))) {
myShapeBuilder.Init(GetCasted(StepShape_FacetedBrep, start), TP, aLocalFactors, aRange); myShapeBuilder.Init(GetCasted(StepShape_FacetedBrep, start), TP, aRange);
found = Standard_True; found = Standard_True;
} }
else if (start->IsKind(STANDARD_TYPE(StepShape_BrepWithVoids))) { else if (start->IsKind(STANDARD_TYPE(StepShape_BrepWithVoids))) {
myShapeBuilder.Init(GetCasted(StepShape_BrepWithVoids, start), TP, aLocalFactors, aRange); myShapeBuilder.Init(GetCasted(StepShape_BrepWithVoids, start), TP, aRange);
found = Standard_True; found = Standard_True;
} }
else if (start->IsKind(STANDARD_TYPE(StepShape_ManifoldSolidBrep))) { else if (start->IsKind(STANDARD_TYPE(StepShape_ManifoldSolidBrep))) {
myShapeBuilder.Init(GetCasted(StepShape_ManifoldSolidBrep, start), TP, aLocalFactors, aRange); myShapeBuilder.Init(GetCasted(StepShape_ManifoldSolidBrep, start), TP, aRange);
found = Standard_True; found = Standard_True;
} }
else if (start->IsKind(STANDARD_TYPE(StepShape_ShellBasedSurfaceModel))) { else if (start->IsKind(STANDARD_TYPE(StepShape_ShellBasedSurfaceModel))) {
myShapeBuilder.Init(GetCasted(StepShape_ShellBasedSurfaceModel, start), TP, myNMTool, aLocalFactors, aRange); myShapeBuilder.Init(GetCasted(StepShape_ShellBasedSurfaceModel, start), TP, myNMTool, aRange);
found = Standard_True; found = Standard_True;
} }
else if (start->IsKind(STANDARD_TYPE(StepShape_FacetedBrepAndBrepWithVoids))) { else if (start->IsKind(STANDARD_TYPE(StepShape_FacetedBrepAndBrepWithVoids))) {
myShapeBuilder.Init(GetCasted(StepShape_FacetedBrepAndBrepWithVoids, start), TP, aLocalFactors, aRange); myShapeBuilder.Init(GetCasted(StepShape_FacetedBrepAndBrepWithVoids, start), TP, aRange);
found = Standard_True; found = Standard_True;
} }
else if (start->IsKind(STANDARD_TYPE(StepShape_GeometricSet))) { else if (start->IsKind(STANDARD_TYPE(StepShape_GeometricSet))) {
myShapeBuilder.Init(GetCasted(StepShape_GeometricSet, start), TP, aLocalFactors, this, isManifold, aRange); myShapeBuilder.Init(GetCasted(StepShape_GeometricSet, start), TP, this, isManifold, aRange);
found = Standard_True; found = Standard_True;
} }
else if (start->IsKind(STANDARD_TYPE(StepShape_EdgeBasedWireframeModel))) { else if (start->IsKind(STANDARD_TYPE(StepShape_EdgeBasedWireframeModel))) {
myShapeBuilder.Init(GetCasted(StepShape_EdgeBasedWireframeModel, start), TP, aLocalFactors); myShapeBuilder.Init(GetCasted(StepShape_EdgeBasedWireframeModel, start), TP);
found = Standard_True; found = Standard_True;
} }
else if (start->IsKind(STANDARD_TYPE(StepShape_FaceBasedSurfaceModel))) { else if (start->IsKind(STANDARD_TYPE(StepShape_FaceBasedSurfaceModel))) {
myShapeBuilder.Init(GetCasted(StepShape_FaceBasedSurfaceModel, start), TP, aLocalFactors); myShapeBuilder.Init(GetCasted(StepShape_FaceBasedSurfaceModel, start), TP);
found = Standard_True; found = Standard_True;
} }
// TODO: Normally, StepVisual_Tessellated* entities should be processed after // TODO: Normally, StepVisual_Tessellated* entities should be processed after
@@ -1471,19 +1458,19 @@ Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity
else if (start->IsKind(STANDARD_TYPE(StepVisual_TessellatedSolid))) else if (start->IsKind(STANDARD_TYPE(StepVisual_TessellatedSolid)))
{ {
myShapeBuilder.Init(GetCasted(StepVisual_TessellatedSolid, start), TP, myShapeBuilder.Init(GetCasted(StepVisual_TessellatedSolid, start), TP,
aReadTessellatedWhenNoBRepOnly, aHasGeom, aLocalFactors, aRange); aReadTessellatedWhenNoBRepOnly, aHasGeom, aRange);
found = Standard_True; found = Standard_True;
} }
else if (start->IsKind(STANDARD_TYPE(StepVisual_TessellatedShell))) else if (start->IsKind(STANDARD_TYPE(StepVisual_TessellatedShell)))
{ {
myShapeBuilder.Init(GetCasted(StepVisual_TessellatedShell, start), TP, myShapeBuilder.Init(GetCasted(StepVisual_TessellatedShell, start), TP,
aReadTessellatedWhenNoBRepOnly, aHasGeom, aLocalFactors, aRange); aReadTessellatedWhenNoBRepOnly, aHasGeom, aRange);
found = Standard_True; found = Standard_True;
} }
else if (start->IsKind(STANDARD_TYPE(StepVisual_TessellatedFace))) else if (start->IsKind(STANDARD_TYPE(StepVisual_TessellatedFace)))
{ {
myShapeBuilder.Init(GetCasted(StepVisual_TessellatedFace, start), TP, myShapeBuilder.Init(GetCasted(StepVisual_TessellatedFace, start), TP,
aReadTessellatedWhenNoBRepOnly, aHasGeom, aLocalFactors); aReadTessellatedWhenNoBRepOnly, aHasGeom);
found = Standard_True; found = Standard_True;
} }
} }
@@ -1520,7 +1507,7 @@ Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity
chrono.Show(); chrono.Show();
#endif #endif
if ( oldSRContext.IsNull() && ! mySRContext.IsNull() ) //:S4136 if ( oldSRContext.IsNull() && ! mySRContext.IsNull() ) //:S4136
PrepareUnits ( oldSRContext, TP, aLocalFactors); PrepareUnits ( oldSRContext, TP );
TP->Bind(start, shbinder); TP->Bind(start, shbinder);
return shbinder; return shbinder;
} }
@@ -1534,7 +1521,6 @@ Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity
Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity
(const Handle(StepRepr_MappedItem)& mapit, (const Handle(StepRepr_MappedItem)& mapit,
const Handle(Transfer_TransientProcess)& TP, const Handle(Transfer_TransientProcess)& TP,
const StepData_Factors& theLocalFactors,
const Message_ProgressRange& theProgress) const Message_ProgressRange& theProgress)
{ {
Handle(TransferBRep_ShapeBinder) shbinder; Handle(TransferBRep_ShapeBinder) shbinder;
@@ -1552,7 +1538,7 @@ Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity
DownCast(mapit->MappingSource()->MappedRepresentation()); DownCast(mapit->MappingSource()->MappedRepresentation());
Standard_Boolean isBound = Standard_False; Standard_Boolean isBound = Standard_False;
Handle(Transfer_Binder) binder = TP->Find(maprep); Handle(Transfer_Binder) binder = TP->Find(maprep);
if (binder.IsNull()) binder = TransferEntity(maprep, TP, theLocalFactors, isBound, Standard_False, theProgress); if (binder.IsNull()) binder = TransferEntity(maprep,TP,isBound, Standard_False, theProgress);
shbinder = Handle(TransferBRep_ShapeBinder)::DownCast(binder); shbinder = Handle(TransferBRep_ShapeBinder)::DownCast(binder);
if (shbinder.IsNull()) TP->AddWarning(mapit,"No Shape Produced"); if (shbinder.IsNull()) TP->AddWarning(mapit,"No Shape Produced");
else { else {
@@ -1569,7 +1555,7 @@ Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity
Handle(StepGeom_CartesianTransformationOperator3d) CartOp = Handle(StepGeom_CartesianTransformationOperator3d) CartOp =
Handle(StepGeom_CartesianTransformationOperator3d)::DownCast(mapit->MappingTarget()); Handle(StepGeom_CartesianTransformationOperator3d)::DownCast(mapit->MappingTarget());
if ( ! CartOp.IsNull() ) { if ( ! CartOp.IsNull() ) {
ok = StepToGeom::MakeTransformation3d (CartOp, Trsf, theLocalFactors); ok = StepToGeom::MakeTransformation3d (CartOp, Trsf);
} }
else { else {
Handle(StepGeom_Axis2Placement3d) Origin = Handle(StepGeom_Axis2Placement3d) Origin =
@@ -1579,7 +1565,7 @@ Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity
if ( ! Origin.IsNull() && ! Target.IsNull() ) { if ( ! Origin.IsNull() && ! Target.IsNull() ) {
ok = Standard_True; ok = Standard_True;
Handle(StepRepr_Representation) rep = mySRContext; // NOTE: copy of handle ! Handle(StepRepr_Representation) rep = mySRContext; // NOTE: copy of handle !
ComputeTransformation ( Origin, Target, maprep, rep, TP, Trsf, theLocalFactors); ComputeTransformation ( Origin, Target, maprep, rep, TP, Trsf );
ok = Standard_True; ok = Standard_True;
} }
} }
@@ -1601,7 +1587,6 @@ Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity
Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity
(const Handle(StepShape_FaceSurface)& fs, (const Handle(StepShape_FaceSurface)& fs,
const Handle(Transfer_TransientProcess)& TP, const Handle(Transfer_TransientProcess)& TP,
const StepData_Factors& theLocalFactors,
const Message_ProgressRange& theProgress) const Message_ProgressRange& theProgress)
{ {
@@ -1621,16 +1606,15 @@ Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity
// Non-manifold topology is not processed here (ssv; 15.11.2010) // Non-manifold topology is not processed here (ssv; 15.11.2010)
StepToTopoDS_NMTool dummyNMTool; StepToTopoDS_NMTool dummyNMTool;
myTF.Init(fs, myTool, dummyNMTool, theLocalFactors); myTF.Init(fs, myTool, dummyNMTool);
Handle(StepRepr_Representation) oldSRContext = mySRContext; Handle(StepRepr_Representation) oldSRContext = mySRContext;
StepData_Factors aLocalFactors = theLocalFactors;
if (mySRContext.IsNull()) { // if no context, try to find it (ex: r0701_ug.stp #4790) if (mySRContext.IsNull()) { // if no context, try to find it (ex: r0701_ug.stp #4790)
Handle(StepRepr_Representation) context = FindContext(fs, TP); Handle(StepRepr_Representation) context = FindContext(fs, TP);
if (context.IsNull()) { if (context.IsNull()) {
TP->AddWarning(fs, "Entity with no unit context; default units taken"); TP->AddWarning(fs, "Entity with no unit context; default units taken");
ResetUnits(aLocalFactors); ResetUnits();
} }
else PrepareUnits(context, TP, aLocalFactors); else PrepareUnits(context, TP);
} }
// Apply ShapeFix // Apply ShapeFix
@@ -1653,7 +1637,7 @@ Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity
if (oldSRContext.IsNull() && !mySRContext.IsNull()) //:S4136 if (oldSRContext.IsNull() && !mySRContext.IsNull()) //:S4136
PrepareUnits(oldSRContext, TP, aLocalFactors); PrepareUnits(oldSRContext, TP);
TP->Bind(fs, sb); TP->Bind(fs, sb);
return sb; // TP->Find (start); return sb; // TP->Find (start);
} }
@@ -1673,7 +1657,6 @@ Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity
Handle(Transfer_Binder) STEPControl_ActorRead::TransferShape( Handle(Transfer_Binder) STEPControl_ActorRead::TransferShape(
const Handle(Standard_Transient)& start, const Handle(Standard_Transient)& start,
const Handle(Transfer_TransientProcess)& TP, const Handle(Transfer_TransientProcess)& TP,
const StepData_Factors& theLocalFactors,
const Standard_Boolean isManifold, const Standard_Boolean isManifold,
const Standard_Boolean theUseTrsf, const Standard_Boolean theUseTrsf,
const Message_ProgressRange& theProgress) const Message_ProgressRange& theProgress)
@@ -1702,14 +1685,14 @@ Handle(Transfer_Binder) STEPControl_ActorRead::TransferShape(
else if (start->IsKind(STANDARD_TYPE(StepBasic_ProductDefinition))) { else if (start->IsKind(STANDARD_TYPE(StepBasic_ProductDefinition))) {
Handle(StepBasic_ProductDefinition) PD = Handle(StepBasic_ProductDefinition) PD =
Handle(StepBasic_ProductDefinition)::DownCast(start); Handle(StepBasic_ProductDefinition)::DownCast(start);
shbinder = TransferEntity(PD, TP, theLocalFactors, theUseTrsf, theProgress); shbinder = TransferEntity(PD, TP, theUseTrsf, theProgress);
} }
// NextAssemblyUsageOccurrence // NextAssemblyUsageOccurrence
else if (start->IsKind(STANDARD_TYPE(StepRepr_NextAssemblyUsageOccurrence))) { else if (start->IsKind(STANDARD_TYPE(StepRepr_NextAssemblyUsageOccurrence))) {
Handle(StepRepr_NextAssemblyUsageOccurrence) NAUO = Handle(StepRepr_NextAssemblyUsageOccurrence) NAUO =
Handle(StepRepr_NextAssemblyUsageOccurrence)::DownCast(start); Handle(StepRepr_NextAssemblyUsageOccurrence)::DownCast(start);
shbinder = TransferEntity(NAUO, TP, theLocalFactors, theProgress); shbinder = TransferEntity(NAUO, TP, theProgress);
} }
//end skl //end skl
@@ -1717,7 +1700,7 @@ Handle(Transfer_Binder) STEPControl_ActorRead::TransferShape(
else if (start->IsKind(STANDARD_TYPE(StepShape_ShapeRepresentation))) { else if (start->IsKind(STANDARD_TYPE(StepShape_ShapeRepresentation))) {
DeclareAndCast(StepShape_ShapeRepresentation,sr,start); DeclareAndCast(StepShape_ShapeRepresentation,sr,start);
Standard_Boolean isBound = Standard_False; Standard_Boolean isBound = Standard_False;
shbinder = TransferEntity(sr, TP, theLocalFactors, isBound, Standard_False, theProgress); shbinder = TransferEntity(sr,TP,isBound, Standard_False, theProgress);
} }
// -------------------------------------------------------------- // --------------------------------------------------------------
@@ -1727,29 +1710,29 @@ Handle(Transfer_Binder) STEPControl_ActorRead::TransferShape(
else if (start->IsKind(STANDARD_TYPE(StepShape_ContextDependentShapeRepresentation))) { else if (start->IsKind(STANDARD_TYPE(StepShape_ContextDependentShapeRepresentation))) {
DeclareAndCast(StepShape_ContextDependentShapeRepresentation,CDSR,start); DeclareAndCast(StepShape_ContextDependentShapeRepresentation,CDSR,start);
shbinder = TransferEntity(CDSR, TP, theLocalFactors, theProgress); shbinder = TransferEntity(CDSR,TP, theProgress);
} }
else if (start->IsKind (STANDARD_TYPE(StepRepr_ShapeRepresentationRelationship)) ) { else if (start->IsKind (STANDARD_TYPE(StepRepr_ShapeRepresentationRelationship)) ) {
// REPRESENTATION_RELATIONSHIP et la famille // REPRESENTATION_RELATIONSHIP et la famille
DeclareAndCast(StepRepr_ShapeRepresentationRelationship,und,start); DeclareAndCast(StepRepr_ShapeRepresentationRelationship,und,start);
shbinder = TransferEntity(und, TP, theLocalFactors, 0, Standard_False, theProgress); shbinder = TransferEntity(und,TP, 0, Standard_False, theProgress);
} }
else if (start->IsKind (STANDARD_TYPE(StepGeom_GeometricRepresentationItem)) ) { else if (start->IsKind (STANDARD_TYPE(StepGeom_GeometricRepresentationItem)) ) {
// Here starts the entity to be treated : Shape Representation Subtype // Here starts the entity to be treated : Shape Representation Subtype
// It can be also other Root entities // It can be also other Root entities
DeclareAndCast(StepGeom_GeometricRepresentationItem,git,start); DeclareAndCast(StepGeom_GeometricRepresentationItem,git,start);
shbinder = TransferEntity(git, TP, theLocalFactors, isManifold, theProgress); shbinder = TransferEntity(git, TP, isManifold, theProgress);
} }
else if (start->IsKind(STANDARD_TYPE(StepRepr_MappedItem))) { else if (start->IsKind(STANDARD_TYPE(StepRepr_MappedItem))) {
DeclareAndCast(StepRepr_MappedItem,mapit,start); DeclareAndCast(StepRepr_MappedItem,mapit,start);
shbinder= TransferEntity(mapit, TP, theLocalFactors, theProgress); shbinder= TransferEntity(mapit,TP, theProgress);
} }
else if (start->IsKind(STANDARD_TYPE(StepShape_FaceSurface))) { else if (start->IsKind(STANDARD_TYPE(StepShape_FaceSurface))) {
DeclareAndCast(StepShape_FaceSurface,fs,start); DeclareAndCast(StepShape_FaceSurface,fs,start);
shbinder = TransferEntity(fs, TP, theLocalFactors, theProgress); shbinder = TransferEntity(fs,TP, theProgress);
} }
// if (!shbinder.IsNull()) TP->Bind(start,binder); // if (!shbinder.IsNull()) TP->Bind(start,binder);
@@ -1762,14 +1745,13 @@ Handle(Transfer_Binder) STEPControl_ActorRead::TransferShape(
// ============================================================================ // ============================================================================
void STEPControl_ActorRead::PrepareUnits(const Handle(StepRepr_Representation)& rep, void STEPControl_ActorRead::PrepareUnits(const Handle(StepRepr_Representation)& rep,
const Handle(Transfer_TransientProcess)& TP, const Handle(Transfer_TransientProcess)& TP)
StepData_Factors& theLocalFactors)
{ {
mySRContext = rep; mySRContext = rep;
Standard_Integer stat1, stat2 = 0; // sera alimente par STEPControl_Unit Standard_Integer stat1, stat2 = 0; // sera alimente par STEPControl_Unit
if (rep.IsNull()) { if (rep.IsNull()) {
ResetUnits(theLocalFactors); ResetUnits();
return; return;
} }
@@ -1777,7 +1759,7 @@ void STEPControl_ActorRead::PrepareUnits(const Handle(StepRepr_Representation)&
Handle(StepRepr_RepresentationContext) theRepCont = rep->ContextOfItems(); Handle(StepRepr_RepresentationContext) theRepCont = rep->ContextOfItems();
if (theRepCont.IsNull()) { if (theRepCont.IsNull()) {
TP->AddWarning(rep,"Bad RepresentationContext, default unit taken"); TP->AddWarning(rep,"Bad RepresentationContext, default unit taken");
ResetUnits(theLocalFactors); ResetUnits();
return; return;
} }
@@ -1812,12 +1794,13 @@ void STEPControl_ActorRead::PrepareUnits(const Handle(StepRepr_Representation)&
// ---------------------------------------------------- // ----------------------------------------------------
// Decoding and Setting the Values // Decoding and Setting the Values
// ---------------------------------------------------- // ----------------------------------------------------
if (!theGUAC.IsNull()) { if (!theGUAC.IsNull()) {
stat1 = myUnit.ComputeFactors(theGUAC, theLocalFactors); stat1 = myUnit.ComputeFactors(theGUAC);
Standard_Integer anglemode = Interface_Static::IVal("step.angleunit.mode"); Standard_Integer anglemode = Interface_Static::IVal("step.angleunit.mode");
Standard_Real angleFactor = ( anglemode == 0 ? myUnit.PlaneAngleFactor() : Standard_Real angleFactor = ( anglemode == 0 ? myUnit.PlaneAngleFactor() :
anglemode == 1 ? 1. : M_PI/180. ); anglemode == 1 ? 1. : M_PI/180. );
theLocalFactors.InitializeFactors(myUnit.LengthFactor(), StepData_GlobalFactors::Intance().InitializeFactors(myUnit.LengthFactor(),
angleFactor, angleFactor,
myUnit.SolidAngleFactor()); myUnit.SolidAngleFactor());
if (stat1 != 0) TP->AddWarning (theRepCont,myUnit.StatusMessage(stat1)); if (stat1 != 0) TP->AddWarning (theRepCont,myUnit.StatusMessage(stat1));
@@ -1850,9 +1833,9 @@ void STEPControl_ActorRead::PrepareUnits(const Handle(StepRepr_Representation)&
//purpose : //purpose :
//======================================================================= //=======================================================================
void STEPControl_ActorRead::ResetUnits (StepData_Factors& theLocalFactors) void STEPControl_ActorRead::ResetUnits ()
{ {
theLocalFactors.InitializeFactors ( 1, 1, 1 ); StepData_GlobalFactors::Intance().InitializeFactors ( 1, 1, 1 );
myPrecision = Interface_Static::RVal("read.precision.val"); myPrecision = Interface_Static::RVal("read.precision.val");
myMaxTol = Max ( myPrecision, Interface_Static::RVal("read.maxprecision.val") ); myMaxTol = Max ( myPrecision, Interface_Static::RVal("read.maxprecision.val") );
} }
@@ -1868,8 +1851,7 @@ Standard_Boolean STEPControl_ActorRead::ComputeTransformation (const Handle(Step
const Handle(StepRepr_Representation) &OrigContext, const Handle(StepRepr_Representation) &OrigContext,
const Handle(StepRepr_Representation) &TargContext, const Handle(StepRepr_Representation) &TargContext,
const Handle(Transfer_TransientProcess) &TP, const Handle(Transfer_TransientProcess) &TP,
gp_Trsf &Trsf, gp_Trsf &Trsf)
const StepData_Factors& theLocalFactors)
{ {
Trsf = gp_Trsf(); // reinit Trsf = gp_Trsf(); // reinit
if ( Origin.IsNull() || Target.IsNull() ) return Standard_False; if ( Origin.IsNull() || Target.IsNull() ) return Standard_False;
@@ -1910,12 +1892,11 @@ Standard_Boolean STEPControl_ActorRead::ComputeTransformation (const Handle(Step
// translate axis_placements taking units into account // translate axis_placements taking units into account
Handle(StepRepr_Representation) oldSRContext = mySRContext; Handle(StepRepr_Representation) oldSRContext = mySRContext;
StepData_Factors aLocalFactors = theLocalFactors; if ( OrigContext != oldSRContext ) PrepareUnits(OrigContext,TP);
if ( OrigContext != oldSRContext ) PrepareUnits(OrigContext, TP, aLocalFactors); Handle(Geom_Axis2Placement) theOrig = StepToGeom::MakeAxis2Placement (org);
Handle(Geom_Axis2Placement) theOrig = StepToGeom::MakeAxis2Placement (org, aLocalFactors); if ( TargContext != OrigContext ) PrepareUnits(TargContext,TP);
if ( TargContext != OrigContext ) PrepareUnits(TargContext, TP, aLocalFactors); Handle(Geom_Axis2Placement) theTarg = StepToGeom::MakeAxis2Placement (trg);
Handle(Geom_Axis2Placement) theTarg = StepToGeom::MakeAxis2Placement (trg, aLocalFactors); if ( oldSRContext != TargContext ) PrepareUnits(oldSRContext,TP);
if ( oldSRContext != TargContext ) PrepareUnits(oldSRContext, TP, aLocalFactors);
gp_Ax3 ax3Orig(theOrig->Ax2()); gp_Ax3 ax3Orig(theOrig->Ax2());
gp_Ax3 ax3Targ(theTarg->Ax2()); gp_Ax3 ax3Targ(theTarg->Ax2());
@@ -1933,8 +1914,7 @@ Standard_Boolean STEPControl_ActorRead::ComputeTransformation (const Handle(Step
//:j2 abv 22 Oct 98: auxiliary function: reading transformation from SRRWT //:j2 abv 22 Oct 98: auxiliary function: reading transformation from SRRWT
Standard_Boolean STEPControl_ActorRead::ComputeSRRWT (const Handle(StepRepr_RepresentationRelationship) &SRR, Standard_Boolean STEPControl_ActorRead::ComputeSRRWT (const Handle(StepRepr_RepresentationRelationship) &SRR,
const Handle(Transfer_TransientProcess) &TP, const Handle(Transfer_TransientProcess) &TP,
gp_Trsf &Trsf, gp_Trsf &Trsf)
const StepData_Factors& theLocalFactors)
{ {
Trsf = gp_Trsf(); // init Trsf = gp_Trsf(); // init
@@ -1942,16 +1922,16 @@ Standard_Boolean STEPControl_ActorRead::ComputeSRRWT (const Handle(StepRepr_Repr
if ( srwt.IsNull() ) return Standard_False; if ( srwt.IsNull() ) return Standard_False;
StepRepr_Transformation SelectTrans = srwt->TransformationOperator(); StepRepr_Transformation SelectTrans = srwt->TransformationOperator();
StepData_Factors aLocalFactors = theLocalFactors;
// cartesian transformation // cartesian transformation
Handle(StepGeom_CartesianTransformationOperator3d) CartOp = Handle(StepGeom_CartesianTransformationOperator3d) CartOp =
Handle(StepGeom_CartesianTransformationOperator3d)::DownCast(SelectTrans.Value()); Handle(StepGeom_CartesianTransformationOperator3d)::DownCast(SelectTrans.Value());
if ( ! CartOp.IsNull() ) { if ( ! CartOp.IsNull() ) {
// reset units (by Rep2 - ?) // reset units (by Rep2 - ?)
Handle(StepRepr_Representation) oldSRContext = mySRContext; Handle(StepRepr_Representation) oldSRContext = mySRContext;
if ( SRR->Rep2() != oldSRContext ) PrepareUnits(SRR->Rep2(), TP, aLocalFactors); if ( SRR->Rep2() != oldSRContext ) PrepareUnits(SRR->Rep2(),TP);
StepToGeom::MakeTransformation3d (CartOp, Trsf, aLocalFactors); StepToGeom::MakeTransformation3d (CartOp, Trsf);
if ( SRR->Rep2() != oldSRContext ) PrepareUnits(oldSRContext, TP, aLocalFactors); if ( SRR->Rep2() != oldSRContext ) PrepareUnits(oldSRContext,TP);
return Trsf.Form() != gp_Identity; return Trsf.Form() != gp_Identity;
} }
@@ -1965,7 +1945,7 @@ Standard_Boolean STEPControl_ActorRead::ComputeSRRWT (const Handle(StepRepr_Repr
Handle(StepGeom_Axis2Placement3d) Ax2 = Handle(StepGeom_Axis2Placement3d) Ax2 =
Handle(StepGeom_Axis2Placement3d)::DownCast(ItemDef->TransformItem2()); Handle(StepGeom_Axis2Placement3d)::DownCast(ItemDef->TransformItem2());
if ( Ax1.IsNull() || Ax2.IsNull() ) return Standard_False; if ( Ax1.IsNull() || Ax2.IsNull() ) return Standard_False;
return ComputeTransformation ( Ax1, Ax2, SRR->Rep1(), SRR->Rep2(), TP, Trsf, aLocalFactors); return ComputeTransformation ( Ax1, Ax2, SRR->Rep1(), SRR->Rep2(), TP, Trsf);
} }
//======================================================================= //=======================================================================

View File

@@ -46,7 +46,6 @@ class StepShape_FaceSurface;
class TopoDS_Shell; class TopoDS_Shell;
class TopoDS_Compound; class TopoDS_Compound;
class StepRepr_ConstructiveGeometryRepresentationRelationship; class StepRepr_ConstructiveGeometryRepresentationRelationship;
class StepData_Factors;
class STEPControl_ActorRead; class STEPControl_ActorRead;
@@ -76,38 +75,26 @@ public:
Standard_EXPORT Handle(Transfer_Binder) TransferShape ( Standard_EXPORT Handle(Transfer_Binder) TransferShape (
const Handle(Standard_Transient)& start, const Handle(Standard_Transient)& start,
const Handle(Transfer_TransientProcess)& TP, const Handle(Transfer_TransientProcess)& TP,
const StepData_Factors& theLocalFactors,
const Standard_Boolean isManifold = Standard_True, const Standard_Boolean isManifold = Standard_True,
const Standard_Boolean theUseTrsf = Standard_False, const Standard_Boolean theUseTrsf = Standard_False,
const Message_ProgressRange& theProgress = Message_ProgressRange()); const Message_ProgressRange& theProgress = Message_ProgressRange());
//! set units and tolerances context by given ShapeRepresentation //! set units and tolerances context by given ShapeRepresentation
Standard_EXPORT void PrepareUnits (const Handle(StepRepr_Representation)& rep, Standard_EXPORT void PrepareUnits (const Handle(StepRepr_Representation)& rep, const Handle(Transfer_TransientProcess)& TP);
const Handle(Transfer_TransientProcess)& TP,
StepData_Factors& theLocalFactors);
//! reset units and tolerances context to default //! reset units and tolerances context to default
//! (mm, radians, read.precision.val, etc.) //! (mm, radians, read.precision.val, etc.)
Standard_EXPORT void ResetUnits(StepData_Factors& theLocalFactors); Standard_EXPORT void ResetUnits();
//! Computes transformation defined by two axis placements (in MAPPED_ITEM //! Computes transformation defined by two axis placements (in MAPPED_ITEM
//! or ITEM_DEFINED_TRANSFORMATION) taking into account their //! or ITEM_DEFINED_TRANSFORMATION) taking into account their
//! representation contexts (i.e. units, which may be different) //! representation contexts (i.e. units, which may be different)
//! Returns True if transformation is computed and is not an identity. //! Returns True if transformation is computed and is not an identity.
Standard_EXPORT Standard_Boolean ComputeTransformation (const Handle(StepGeom_Axis2Placement3d)& Origin, Standard_EXPORT Standard_Boolean ComputeTransformation (const Handle(StepGeom_Axis2Placement3d)& Origin, const Handle(StepGeom_Axis2Placement3d)& Target, const Handle(StepRepr_Representation)& OrigContext, const Handle(StepRepr_Representation)& TargContext, const Handle(Transfer_TransientProcess)& TP, gp_Trsf& Trsf);
const Handle(StepGeom_Axis2Placement3d)& Target,
const Handle(StepRepr_Representation)& OrigContext,
const Handle(StepRepr_Representation)& TargContext,
const Handle(Transfer_TransientProcess)& TP,
gp_Trsf& Trsf,
const StepData_Factors& theLocalFactors);
//! Computes transformation defined by given //! Computes transformation defined by given
//! REPRESENTATION_RELATIONSHIP_WITH_TRANSFORMATION //! REPRESENTATION_RELATIONSHIP_WITH_TRANSFORMATION
Standard_EXPORT Standard_Boolean ComputeSRRWT (const Handle(StepRepr_RepresentationRelationship)& SRR, Standard_EXPORT Standard_Boolean ComputeSRRWT (const Handle(StepRepr_RepresentationRelationship)& SRR, const Handle(Transfer_TransientProcess)& TP, gp_Trsf& Trsf);
const Handle(Transfer_TransientProcess)& TP,
gp_Trsf& Trsf,
const StepData_Factors& theLocalFactors);
@@ -122,7 +109,6 @@ protected:
Standard_EXPORT Handle(TransferBRep_ShapeBinder) TransferEntity ( Standard_EXPORT Handle(TransferBRep_ShapeBinder) TransferEntity (
const Handle(StepBasic_ProductDefinition)& PD, const Handle(StepBasic_ProductDefinition)& PD,
const Handle(Transfer_TransientProcess)& TP, const Handle(Transfer_TransientProcess)& TP,
const StepData_Factors& theLocalFactors,
const Standard_Boolean theUseTrsf = Standard_False, const Standard_Boolean theUseTrsf = Standard_False,
const Message_ProgressRange& theProgress = Message_ProgressRange()); const Message_ProgressRange& theProgress = Message_ProgressRange());
@@ -130,7 +116,6 @@ protected:
Standard_EXPORT Handle(TransferBRep_ShapeBinder) TransferEntity Standard_EXPORT Handle(TransferBRep_ShapeBinder) TransferEntity
(const Handle(StepRepr_NextAssemblyUsageOccurrence)& NAUO, (const Handle(StepRepr_NextAssemblyUsageOccurrence)& NAUO,
const Handle(Transfer_TransientProcess)& TP, const Handle(Transfer_TransientProcess)& TP,
const StepData_Factors& theLocalFactors,
const Message_ProgressRange& theProgress = Message_ProgressRange()); const Message_ProgressRange& theProgress = Message_ProgressRange());
//! Transfers shape representation entity //! Transfers shape representation entity
@@ -138,7 +123,6 @@ protected:
Standard_EXPORT Handle(TransferBRep_ShapeBinder) TransferEntity ( Standard_EXPORT Handle(TransferBRep_ShapeBinder) TransferEntity (
const Handle(StepShape_ShapeRepresentation)& sr, const Handle(StepShape_ShapeRepresentation)& sr,
const Handle(Transfer_TransientProcess)& TP, const Handle(Transfer_TransientProcess)& TP,
const StepData_Factors& theLocalFactors,
Standard_Boolean& isBound, Standard_Boolean& isBound,
const Standard_Boolean theUseTrsf = Standard_False, const Standard_Boolean theUseTrsf = Standard_False,
const Message_ProgressRange& theProgress = Message_ProgressRange()); const Message_ProgressRange& theProgress = Message_ProgressRange());
@@ -147,7 +131,6 @@ protected:
Standard_EXPORT Handle(TransferBRep_ShapeBinder) TransferEntity Standard_EXPORT Handle(TransferBRep_ShapeBinder) TransferEntity
(const Handle(StepShape_ContextDependentShapeRepresentation)& CDSR, (const Handle(StepShape_ContextDependentShapeRepresentation)& CDSR,
const Handle(Transfer_TransientProcess)& TP, const Handle(Transfer_TransientProcess)& TP,
const StepData_Factors& theLocalFactors,
const Message_ProgressRange& theProgress = Message_ProgressRange()); const Message_ProgressRange& theProgress = Message_ProgressRange());
//! Transfers shape representation relationship entity //! Transfers shape representation relationship entity
@@ -155,7 +138,6 @@ protected:
Standard_EXPORT Handle(TransferBRep_ShapeBinder) TransferEntity ( Standard_EXPORT Handle(TransferBRep_ShapeBinder) TransferEntity (
const Handle(StepRepr_ShapeRepresentationRelationship)& und, const Handle(StepRepr_ShapeRepresentationRelationship)& und,
const Handle(Transfer_TransientProcess)& TP, const Handle(Transfer_TransientProcess)& TP,
const StepData_Factors& theLocalFactors,
const Standard_Integer nbrep = 0, const Standard_Integer nbrep = 0,
const Standard_Boolean theUseTrsf = Standard_False, const Standard_Boolean theUseTrsf = Standard_False,
const Message_ProgressRange& theProgress = Message_ProgressRange()); const Message_ProgressRange& theProgress = Message_ProgressRange());
@@ -164,7 +146,6 @@ protected:
Standard_EXPORT Handle(TransferBRep_ShapeBinder) TransferEntity Standard_EXPORT Handle(TransferBRep_ShapeBinder) TransferEntity
(const Handle(StepGeom_GeometricRepresentationItem)& git, (const Handle(StepGeom_GeometricRepresentationItem)& git,
const Handle(Transfer_TransientProcess)& TP, const Handle(Transfer_TransientProcess)& TP,
const StepData_Factors& theLocalFactors,
const Standard_Boolean isManifold, const Standard_Boolean isManifold,
const Message_ProgressRange& theProgress); const Message_ProgressRange& theProgress);
@@ -172,19 +153,16 @@ protected:
Standard_EXPORT Handle(TransferBRep_ShapeBinder) TransferEntity Standard_EXPORT Handle(TransferBRep_ShapeBinder) TransferEntity
(const Handle(StepRepr_MappedItem)& mapit, (const Handle(StepRepr_MappedItem)& mapit,
const Handle(Transfer_TransientProcess)& TP, const Handle(Transfer_TransientProcess)& TP,
const StepData_Factors& theLocalFactors,
const Message_ProgressRange& theProgress); const Message_ProgressRange& theProgress);
//! Transfers FaceSurface entity //! Transfers FaceSurface entity
Standard_EXPORT Handle(TransferBRep_ShapeBinder) TransferEntity Standard_EXPORT Handle(TransferBRep_ShapeBinder) TransferEntity
(const Handle(StepShape_FaceSurface)& fs, (const Handle(StepShape_FaceSurface)& fs,
const Handle(Transfer_TransientProcess)& TP, const Handle(Transfer_TransientProcess)& TP,
const StepData_Factors& theLocalFactors,
const Message_ProgressRange& theProgress); const Message_ProgressRange& theProgress);
Handle(TransferBRep_ShapeBinder) TransferEntity( const Handle(StepRepr_ConstructiveGeometryRepresentationRelationship)& theCGRR, Handle(TransferBRep_ShapeBinder) TransferEntity( const Handle(StepRepr_ConstructiveGeometryRepresentationRelationship)& theCGRR,
const Handle(Transfer_TransientProcess)& theTP, const Handle(Transfer_TransientProcess)& theTP);
const StepData_Factors& theLocalFactors);
//! Translates file by old way when CDSR are roots . Acts only if "read.step.product_mode" is equal Off. //! Translates file by old way when CDSR are roots . Acts only if "read.step.product_mode" is equal Off.
Standard_EXPORT Handle(TransferBRep_ShapeBinder) OldWay Standard_EXPORT Handle(TransferBRep_ShapeBinder) OldWay

View File

@@ -40,6 +40,7 @@
#include <STEPConstruct_UnitContext.hxx> #include <STEPConstruct_UnitContext.hxx>
#include <STEPControl_ActorWrite.hxx> #include <STEPControl_ActorWrite.hxx>
#include <STEPControl_StepModelType.hxx> #include <STEPControl_StepModelType.hxx>
#include <StepData_GlobalFactors.hxx>
#include <StepData_StepModel.hxx> #include <StepData_StepModel.hxx>
#include <StepGeom_Axis2Placement3d.hxx> #include <StepGeom_Axis2Placement3d.hxx>
#include <StepGeom_GeomRepContextAndGlobUnitAssCtxAndGlobUncertaintyAssCtx.hxx> #include <StepGeom_GeomRepContextAndGlobUnitAssCtxAndGlobUncertaintyAssCtx.hxx>
@@ -546,15 +547,15 @@ Handle(Transfer_Binder) STEPControl_ActorWrite::Transfer (const Handle(Transfer_
Standard_Real aLFactor = model->WriteLengthUnit(); Standard_Real aLFactor = model->WriteLengthUnit();
aLFactor /= model->LocalLengthUnit(); aLFactor /= model->LocalLengthUnit();
Standard_Integer anglemode = Interface_Static::IVal("step.angleunit.mode"); Standard_Integer anglemode = Interface_Static::IVal("step.angleunit.mode");
StepData_Factors aLocalFactors; StepData_GlobalFactors::Intance().InitializeFactors (aLFactor, ( anglemode <= 1 ? 1. : M_PI/180. ), 1. );
aLocalFactors.InitializeFactors(aLFactor, (anglemode <= 1 ? 1. : M_PI / 180.), 1.);
// create SDR // create SDR
STEPConstruct_Part SDRTool; STEPConstruct_Part SDRTool;
SDRTool.MakeSDR ( 0, myContext.GetProductName(), myContext.GetAPD()->Application() ); SDRTool.MakeSDR ( 0, myContext.GetProductName(), myContext.GetAPD()->Application() );
Handle(StepShape_ShapeDefinitionRepresentation) sdr = SDRTool.SDRValue(); Handle(StepShape_ShapeDefinitionRepresentation) sdr = SDRTool.SDRValue();
// transfer shape // transfer shape
Handle(Transfer_Binder) resbind = TransferShape (mapper,sdr, FP, aLocalFactors, 0L, Standard_True, theProgress); Handle(Transfer_Binder) resbind = TransferShape (mapper,sdr,FP, 0L, Standard_True, theProgress);
// Handle(StepShape_ShapeRepresentation) resultat; // Handle(StepShape_ShapeRepresentation) resultat;
// FP->GetTypedTransient (resbind,STANDARD_TYPE(StepShape_ShapeRepresentation),resultat); // FP->GetTypedTransient (resbind,STANDARD_TYPE(StepShape_ShapeRepresentation),resultat);
@@ -664,13 +665,12 @@ static void UpdateMap (const TopoDS_Shape &shape,
static Standard_Boolean transferVertex (const Handle(Transfer_FinderProcess)& FP, static Standard_Boolean transferVertex (const Handle(Transfer_FinderProcess)& FP,
Handle(StepShape_HArray1OfGeometricSetSelect)& aGSS, Handle(StepShape_HArray1OfGeometricSetSelect)& aGSS,
const TopoDS_Shape& aShVrtx, const TopoDS_Shape& aShVrtx,
const Standard_Integer theNum, const Standard_Integer theNum)
const StepData_Factors& theLocalFactors)
{ {
Standard_Boolean IsDone = Standard_False; Standard_Boolean IsDone = Standard_False;
MoniTool_DataMapOfShapeTransient aMap; MoniTool_DataMapOfShapeTransient aMap;
TopoDSToStep_Tool aTool(aMap, Standard_True); TopoDSToStep_Tool aTool(aMap, Standard_True);
TopoDSToStep_MakeStepVertex aMkVrtx ( TopoDS::Vertex(aShVrtx), aTool, FP, theLocalFactors ); TopoDSToStep_MakeStepVertex aMkVrtx ( TopoDS::Vertex(aShVrtx), aTool, FP );
if (!aMkVrtx.IsDone()) if (!aMkVrtx.IsDone())
return IsDone; return IsDone;
@@ -693,7 +693,6 @@ Handle(Transfer_Binder) STEPControl_ActorWrite::TransferShape
(const Handle(Transfer_Finder)& start, (const Handle(Transfer_Finder)& start,
const Handle(StepShape_ShapeDefinitionRepresentation)& SDR0, const Handle(StepShape_ShapeDefinitionRepresentation)& SDR0,
const Handle(Transfer_FinderProcess)& FP, const Handle(Transfer_FinderProcess)& FP,
const StepData_Factors& theLocalFactors,
const Handle(TopTools_HSequenceOfShape)& shapeGroup, const Handle(TopTools_HSequenceOfShape)& shapeGroup,
const Standard_Boolean isManifold, const Standard_Boolean isManifold,
const Message_ProgressRange& theProgress) const Message_ProgressRange& theProgress)
@@ -725,7 +724,7 @@ Handle(Transfer_Binder) STEPControl_ActorWrite::TransferShape
// MODE ASSEMBLY : if Compound, (sub-)assembly // MODE ASSEMBLY : if Compound, (sub-)assembly
if ( IsAssembly(theShape) ) if ( IsAssembly(theShape) )
return TransferCompound(start, SDR0, FP, theLocalFactors, theProgress); return TransferCompound(start, SDR0, FP, theProgress);
Message_ProgressScope aPSRoot(theProgress, NULL, 2); Message_ProgressScope aPSRoot(theProgress, NULL, 2);
@@ -835,7 +834,7 @@ Handle(Transfer_Binder) STEPControl_ActorWrite::TransferShape
Message_ProgressScope aPS (aPSRoot.Next(), NULL, aNMItemsNb); Message_ProgressScope aPS (aPSRoot.Next(), NULL, aNMItemsNb);
for (Standard_Integer i = 1; i <= aNMItemsNb && aPS.More(); i++) { for (Standard_Integer i = 1; i <= aNMItemsNb && aPS.More(); i++) {
Handle(TransferBRep_ShapeMapper) aMapper = TransferBRep::ShapeMapper( FP, RepItemSeq->Value(i) ); Handle(TransferBRep_ShapeMapper) aMapper = TransferBRep::ShapeMapper( FP, RepItemSeq->Value(i) );
TransferShape(aMapper, sdr, FP, theLocalFactors, NonManifoldGroup, Standard_False, aPS.Next()); TransferShape(aMapper, sdr, FP, NonManifoldGroup, Standard_False, aPS.Next());
} }
// Nothing else needed for pure non-manifold topology, return // Nothing else needed for pure non-manifold topology, return
@@ -938,7 +937,7 @@ Handle(Transfer_Binder) STEPControl_ActorWrite::TransferShape
else if (theShape.ShapeType() == TopAbs_COMPSOLID) { else if (theShape.ShapeType() == TopAbs_COMPSOLID) {
FP->AddWarning(start,"NonManifold COMPSOLID was translated like a set of SOLIDs"); FP->AddWarning(start,"NonManifold COMPSOLID was translated like a set of SOLIDs");
if ( GroupMode() > 0) if ( GroupMode() > 0)
return TransferCompound(start, SDR0, FP, theLocalFactors, aPSRoot.Next()); return TransferCompound(start, SDR0, FP, aPSRoot.Next());
else { else {
TopExp_Explorer SolidExp; TopExp_Explorer SolidExp;
for (SolidExp.Init(theShape, TopAbs_SOLID); for (SolidExp.Init(theShape, TopAbs_SOLID);
@@ -1029,7 +1028,7 @@ Handle(Transfer_Binder) STEPControl_ActorWrite::TransferShape
for ( TopoDS_Iterator It ( aSolid ); It.More(); It.Next() ) for ( TopoDS_Iterator It ( aSolid ); It.More(); It.Next() )
if (It.Value().ShapeType() == TopAbs_SHELL) nbShells++; if (It.Value().ShapeType() == TopAbs_SHELL) nbShells++;
if ( nbShells >1 ) { if ( nbShells >1 ) {
TopoDSToStep_MakeBrepWithVoids MkBRepWithVoids(aSolid, FP, theLocalFactors, aPS1.Next()); TopoDSToStep_MakeBrepWithVoids MkBRepWithVoids(aSolid,FP, aPS1.Next());
MkBRepWithVoids.Tolerance() = Tol; MkBRepWithVoids.Tolerance() = Tol;
if (MkBRepWithVoids.IsDone()) if (MkBRepWithVoids.IsDone())
{ {
@@ -1039,7 +1038,7 @@ Handle(Transfer_Binder) STEPControl_ActorWrite::TransferShape
else nbShells = 1; //smth went wrong; let it will be just Manifold else nbShells = 1; //smth went wrong; let it will be just Manifold
} }
if ( nbShells ==1 ) { if ( nbShells ==1 ) {
TopoDSToStep_MakeManifoldSolidBrep MkManifoldSolidBrep(aSolid, FP, theLocalFactors, aPS1.Next()); TopoDSToStep_MakeManifoldSolidBrep MkManifoldSolidBrep(aSolid,FP, aPS1.Next());
MkManifoldSolidBrep.Tolerance() = Tol; MkManifoldSolidBrep.Tolerance() = Tol;
if (MkManifoldSolidBrep.IsDone()) if (MkManifoldSolidBrep.IsDone())
{ {
@@ -1050,7 +1049,7 @@ Handle(Transfer_Binder) STEPControl_ActorWrite::TransferShape
} }
else if (aShape.ShapeType() == TopAbs_SHELL) { else if (aShape.ShapeType() == TopAbs_SHELL) {
TopoDS_Shell aShell = TopoDS::Shell(aShape); TopoDS_Shell aShell = TopoDS::Shell(aShape);
TopoDSToStep_MakeManifoldSolidBrep MkManifoldSolidBrep(aShell, FP, theLocalFactors, aPS1.Next()); TopoDSToStep_MakeManifoldSolidBrep MkManifoldSolidBrep(aShell,FP, aPS1.Next());
MkManifoldSolidBrep.Tolerance() = Tol; MkManifoldSolidBrep.Tolerance() = Tol;
if (MkManifoldSolidBrep.IsDone()) if (MkManifoldSolidBrep.IsDone())
{ {
@@ -1064,7 +1063,7 @@ Handle(Transfer_Binder) STEPControl_ActorWrite::TransferShape
{ {
if (aShape.ShapeType() == TopAbs_SOLID) { if (aShape.ShapeType() == TopAbs_SOLID) {
TopoDS_Solid aSolid = TopoDS::Solid(aShape); TopoDS_Solid aSolid = TopoDS::Solid(aShape);
TopoDSToStep_MakeBrepWithVoids MkBRepWithVoids(aSolid, FP, theLocalFactors, aPS1.Next()); TopoDSToStep_MakeBrepWithVoids MkBRepWithVoids(aSolid,FP, aPS1.Next());
MkBRepWithVoids.Tolerance() = Tol; MkBRepWithVoids.Tolerance() = Tol;
if (MkBRepWithVoids.IsDone()) if (MkBRepWithVoids.IsDone())
{ {
@@ -1089,7 +1088,7 @@ Handle(Transfer_Binder) STEPControl_ActorWrite::TransferShape
} }
if (aShape.ShapeType() == TopAbs_SOLID) { if (aShape.ShapeType() == TopAbs_SOLID) {
TopoDS_Solid aSolid = TopoDS::Solid(aShape); TopoDS_Solid aSolid = TopoDS::Solid(aShape);
TopoDSToStep_MakeFacetedBrep MkFacetedBrep(aSolid, FP, theLocalFactors, aPS1.Next()); TopoDSToStep_MakeFacetedBrep MkFacetedBrep(aSolid,FP, aPS1.Next());
MkFacetedBrep.Tolerance() = Tol; MkFacetedBrep.Tolerance() = Tol;
if (MkFacetedBrep.IsDone()) if (MkFacetedBrep.IsDone())
{ {
@@ -1115,7 +1114,7 @@ Handle(Transfer_Binder) STEPControl_ActorWrite::TransferShape
if (aShape.ShapeType() == TopAbs_SOLID) { if (aShape.ShapeType() == TopAbs_SOLID) {
TopoDS_Solid aSolid = TopoDS::Solid(aShape); TopoDS_Solid aSolid = TopoDS::Solid(aShape);
TopoDSToStep_MakeFacetedBrepAndBrepWithVoids TopoDSToStep_MakeFacetedBrepAndBrepWithVoids
MkFacetedBrepAndBrepWithVoids(aSolid, FP, theLocalFactors, aPS1.Next()); MkFacetedBrepAndBrepWithVoids(aSolid,FP, aPS1.Next());
MkFacetedBrepAndBrepWithVoids.Tolerance() = Tol; MkFacetedBrepAndBrepWithVoids.Tolerance() = Tol;
if (MkFacetedBrepAndBrepWithVoids.IsDone()) if (MkFacetedBrepAndBrepWithVoids.IsDone())
{ {
@@ -1130,7 +1129,7 @@ Handle(Transfer_Binder) STEPControl_ActorWrite::TransferShape
if (aShape.ShapeType() == TopAbs_SOLID) { if (aShape.ShapeType() == TopAbs_SOLID) {
TopoDS_Solid aSolid = TopoDS::Solid(aShape); TopoDS_Solid aSolid = TopoDS::Solid(aShape);
TopoDSToStep_MakeShellBasedSurfaceModel TopoDSToStep_MakeShellBasedSurfaceModel
MkShellBasedSurfaceModel(aSolid, FP, theLocalFactors, aPS1.Next()); MkShellBasedSurfaceModel(aSolid, FP, aPS1.Next());
MkShellBasedSurfaceModel.Tolerance() = Tol; MkShellBasedSurfaceModel.Tolerance() = Tol;
if (MkShellBasedSurfaceModel.IsDone()) if (MkShellBasedSurfaceModel.IsDone())
{ {
@@ -1141,7 +1140,7 @@ Handle(Transfer_Binder) STEPControl_ActorWrite::TransferShape
else if (aShape.ShapeType() == TopAbs_SHELL) { else if (aShape.ShapeType() == TopAbs_SHELL) {
TopoDS_Shell aShell = TopoDS::Shell(aShape); TopoDS_Shell aShell = TopoDS::Shell(aShape);
// Non-manifold topology is stored via NMSSR containing series of SBSM (ssv; 13.11.2010) // Non-manifold topology is stored via NMSSR containing series of SBSM (ssv; 13.11.2010)
TopoDSToStep_MakeShellBasedSurfaceModel MkShellBasedSurfaceModel(aShell, FP, theLocalFactors, aPS1.Next()); TopoDSToStep_MakeShellBasedSurfaceModel MkShellBasedSurfaceModel(aShell, FP, aPS1.Next());
MkShellBasedSurfaceModel.Tolerance() = Tol; MkShellBasedSurfaceModel.Tolerance() = Tol;
if (MkShellBasedSurfaceModel.IsDone()) if (MkShellBasedSurfaceModel.IsDone())
{ {
@@ -1152,7 +1151,7 @@ Handle(Transfer_Binder) STEPControl_ActorWrite::TransferShape
else if (aShape.ShapeType() == TopAbs_FACE) { else if (aShape.ShapeType() == TopAbs_FACE) {
TopoDS_Face aFace = TopoDS::Face(aShape); TopoDS_Face aFace = TopoDS::Face(aShape);
TopoDSToStep_MakeShellBasedSurfaceModel TopoDSToStep_MakeShellBasedSurfaceModel
MkShellBasedSurfaceModel(aFace, FP, theLocalFactors, aPS1.Next()); MkShellBasedSurfaceModel(aFace, FP, aPS1.Next());
MkShellBasedSurfaceModel.Tolerance() = Tol; MkShellBasedSurfaceModel.Tolerance() = Tol;
if (MkShellBasedSurfaceModel.IsDone()) if (MkShellBasedSurfaceModel.IsDone())
{ {
@@ -1164,7 +1163,7 @@ Handle(Transfer_Binder) STEPControl_ActorWrite::TransferShape
} }
case STEPControl_GeometricCurveSet: case STEPControl_GeometricCurveSet:
{ {
TopoDSToStep_MakeGeometricCurveSet MkGeometricCurveSet(aShape, FP, theLocalFactors); TopoDSToStep_MakeGeometricCurveSet MkGeometricCurveSet(aShape,FP);
MkGeometricCurveSet.Tolerance() = Tol; MkGeometricCurveSet.Tolerance() = Tol;
if (MkGeometricCurveSet.IsDone()) { if (MkGeometricCurveSet.IsDone()) {
item = MkGeometricCurveSet.Value(); item = MkGeometricCurveSet.Value();
@@ -1196,7 +1195,7 @@ Handle(Transfer_Binder) STEPControl_ActorWrite::TransferShape
if ( aVertex.ShapeType() != TopAbs_VERTEX ) if ( aVertex.ShapeType() != TopAbs_VERTEX )
continue; continue;
curNb++; curNb++;
transferVertex (FP, aGSS, aVertex, curNb, theLocalFactors); transferVertex (FP, aGSS, aVertex, curNb);
} // end of iteration on compound with vertices. } // end of iteration on compound with vertices.
aGCSet->SetElements(aGSS); aGCSet->SetElements(aGSS);
item = aGCSet; item = aGCSet;
@@ -1353,7 +1352,7 @@ Handle(Transfer_Binder) STEPControl_ActorWrite::TransferShape
repr1->SetValue(2,items->Value(j)); repr1->SetValue(2,items->Value(j));
ShapeRepr1->SetItems(repr1); ShapeRepr1->SetItems(repr1);
STEPConstruct_UnitContext mk1; STEPConstruct_UnitContext mk1;
mk1.Init(Tol, theLocalFactors); mk1.Init(Tol);
ShapeRepr1->SetContextOfItems(mk1.Value()); // la tolerance, voir au debut ShapeRepr1->SetContextOfItems(mk1.Value()); // la tolerance, voir au debut
ShapeRepr1->SetName (new TCollection_HAsciiString("")); ShapeRepr1->SetName (new TCollection_HAsciiString(""));
@@ -1390,7 +1389,7 @@ Handle(Transfer_Binder) STEPControl_ActorWrite::TransferShape
Handle(StepShape_ShapeRepresentation) shapeTessRepr = new StepVisual_TessellatedShapeRepresentation; Handle(StepShape_ShapeRepresentation) shapeTessRepr = new StepVisual_TessellatedShapeRepresentation;
shapeTessRepr->SetItems(itemsTess); shapeTessRepr->SetItems(itemsTess);
STEPConstruct_UnitContext mk1; STEPConstruct_UnitContext mk1;
mk1.Init(Tol, theLocalFactors); mk1.Init(Tol);
shapeTessRepr->SetContextOfItems(mk1.Value()); shapeTessRepr->SetContextOfItems(mk1.Value());
shapeTessRepr->SetName(new TCollection_HAsciiString("")); shapeTessRepr->SetName(new TCollection_HAsciiString(""));
@@ -1413,7 +1412,7 @@ Handle(Transfer_Binder) STEPControl_ActorWrite::TransferShape
// init representation // init representation
STEPConstruct_UnitContext mk; STEPConstruct_UnitContext mk;
mk.Init(Tol, theLocalFactors); mk.Init(Tol);
shapeRep->SetContextOfItems(mk.Value()); // la tolerance, voir au debut shapeRep->SetContextOfItems(mk.Value()); // la tolerance, voir au debut
shapeRep->SetName (new TCollection_HAsciiString("")); shapeRep->SetName (new TCollection_HAsciiString(""));
@@ -1451,7 +1450,6 @@ Handle(Transfer_Binder) STEPControl_ActorWrite::TransferCompound
(const Handle(Transfer_Finder)& start, (const Handle(Transfer_Finder)& start,
const Handle(StepShape_ShapeDefinitionRepresentation)& SDR0, const Handle(StepShape_ShapeDefinitionRepresentation)& SDR0,
const Handle(Transfer_FinderProcess)& FP, const Handle(Transfer_FinderProcess)& FP,
const StepData_Factors& theLocalFactors,
const Message_ProgressRange& theProgress) const Message_ProgressRange& theProgress)
{ {
Handle(TransferBRep_ShapeMapper) mapper = Handle(TransferBRep_ShapeMapper)::DownCast(start); Handle(TransferBRep_ShapeMapper) mapper = Handle(TransferBRep_ShapeMapper)::DownCast(start);
@@ -1537,7 +1535,7 @@ Handle(Transfer_Binder) STEPControl_ActorWrite::TransferCompound
Handle(TransferBRep_ShapeMapper) subs = TransferBRep::ShapeMapper (FP,RepItemSeq->Value(i)); Handle(TransferBRep_ShapeMapper) subs = TransferBRep::ShapeMapper (FP,RepItemSeq->Value(i));
Handle(StepGeom_Axis2Placement3d) AX1; Handle(StepGeom_Axis2Placement3d) AX1;
Handle(Transfer_Binder) bnd = TransferSubShape(subs, SDR0, AX1, FP, theLocalFactors, NonManifoldGroup, isManifold, aPS.Next()); Handle(Transfer_Binder) bnd = TransferSubShape(subs, SDR0, AX1, FP, NonManifoldGroup, isManifold, aPS.Next());
if (!AX1.IsNull()) ItemSeq->Append (AX1); if (!AX1.IsNull()) ItemSeq->Append (AX1);
// copy binders so as to have all roots in upper binder, but do not conflict // copy binders so as to have all roots in upper binder, but do not conflict
@@ -1562,7 +1560,7 @@ Handle(Transfer_Binder) STEPControl_ActorWrite::TransferCompound
shapeRep->SetItems(items); shapeRep->SetItems(items);
Standard_Real Tol = UsedTolerance (mytoler,theShape); Standard_Real Tol = UsedTolerance (mytoler,theShape);
STEPConstruct_UnitContext mk; STEPConstruct_UnitContext mk;
mk.Init(Tol, theLocalFactors); mk.Init(Tol);
shapeRep->SetContextOfItems(mk.Value()); // la tolerance, voir au debut shapeRep->SetContextOfItems(mk.Value()); // la tolerance, voir au debut
shapeRep->SetName (new TCollection_HAsciiString("")); shapeRep->SetName (new TCollection_HAsciiString(""));
@@ -1582,7 +1580,6 @@ Handle(Transfer_Binder) STEPControl_ActorWrite::TransferSubShape
const Handle(StepShape_ShapeDefinitionRepresentation)& SDR0, const Handle(StepShape_ShapeDefinitionRepresentation)& SDR0,
Handle(StepGeom_Axis2Placement3d)& AX1, Handle(StepGeom_Axis2Placement3d)& AX1,
const Handle(Transfer_FinderProcess)& FP, const Handle(Transfer_FinderProcess)& FP,
const StepData_Factors& theLocalFactors,
const Handle(TopTools_HSequenceOfShape)& shapeGroup, const Handle(TopTools_HSequenceOfShape)& shapeGroup,
const Standard_Boolean isManifold, const Standard_Boolean isManifold,
const Message_ProgressRange& theProgress) const Message_ProgressRange& theProgress)
@@ -1629,7 +1626,7 @@ Handle(Transfer_Binder) STEPControl_ActorWrite::TransferSubShape
Handle(Transfer_Binder) resprod = TransientResult(sdr); //KA - OCC7141(skl 10.11.2004) Handle(Transfer_Binder) resprod = TransientResult(sdr); //KA - OCC7141(skl 10.11.2004)
bool isJustTransferred = false; bool isJustTransferred = false;
if ( ! iasdr || resbind.IsNull() ) { if ( ! iasdr || resbind.IsNull() ) {
Handle(Transfer_Binder) resbind1 = TransferShape(mapper, sdr, FP, theLocalFactors, shapeGroup, isManifold, theProgress); Handle(Transfer_Binder) resbind1 = TransferShape(mapper, sdr, FP, shapeGroup, isManifold, theProgress);
if (resbind1.IsNull() || sdr->UsedRepresentation().IsNull()) if (resbind1.IsNull() || sdr->UsedRepresentation().IsNull())
return Handle(Transfer_Binder)(); return Handle(Transfer_Binder)();
resbind = resbind1; resbind = resbind1;
@@ -1645,7 +1642,7 @@ Handle(Transfer_Binder) STEPControl_ActorWrite::TransferSubShape
// sdr->SetUsedRepresentation(resultat); // to be used by MakeItem // sdr->SetUsedRepresentation(resultat); // to be used by MakeItem
// make location for assembly placement // make location for assembly placement
GeomToStep_MakeAxis2Placement3d mkax (aLoc, theLocalFactors); GeomToStep_MakeAxis2Placement3d mkax (aLoc);
const Handle(StepGeom_Axis2Placement3d)& AxLoc = mkax.Value(); const Handle(StepGeom_Axis2Placement3d)& AxLoc = mkax.Value();
AX1 = AxLoc; AX1 = AxLoc;

View File

@@ -28,7 +28,6 @@
class Transfer_Finder; class Transfer_Finder;
class Transfer_Binder; class Transfer_Binder;
class Transfer_FinderProcess; class Transfer_FinderProcess;
class StepData_Factors;
class StepShape_ShapeDefinitionRepresentation; class StepShape_ShapeDefinitionRepresentation;
class StepGeom_Axis2Placement3d; class StepGeom_Axis2Placement3d;
class TopoDS_Shape; class TopoDS_Shape;
@@ -60,7 +59,6 @@ public:
const Handle(StepShape_ShapeDefinitionRepresentation)& SDR, const Handle(StepShape_ShapeDefinitionRepresentation)& SDR,
Handle(StepGeom_Axis2Placement3d)& AX1, Handle(StepGeom_Axis2Placement3d)& AX1,
const Handle(Transfer_FinderProcess)& FP, const Handle(Transfer_FinderProcess)& FP,
const StepData_Factors& theLocalFactors,
const Handle(TopTools_HSequenceOfShape)& shapeGroup = NULL, const Handle(TopTools_HSequenceOfShape)& shapeGroup = NULL,
const Standard_Boolean isManifold = Standard_True, const Standard_Boolean isManifold = Standard_True,
const Message_ProgressRange& theProgress = Message_ProgressRange()); const Message_ProgressRange& theProgress = Message_ProgressRange());
@@ -69,7 +67,6 @@ public:
(const Handle(Transfer_Finder)& start, (const Handle(Transfer_Finder)& start,
const Handle(StepShape_ShapeDefinitionRepresentation)& SDR, const Handle(StepShape_ShapeDefinitionRepresentation)& SDR,
const Handle(Transfer_FinderProcess)& FP, const Handle(Transfer_FinderProcess)& FP,
const StepData_Factors& theLocalFactors,
const Handle(TopTools_HSequenceOfShape)& shapeGroup = NULL, const Handle(TopTools_HSequenceOfShape)& shapeGroup = NULL,
const Standard_Boolean isManifold = Standard_True, const Standard_Boolean isManifold = Standard_True,
const Message_ProgressRange& theProgress = Message_ProgressRange()); const Message_ProgressRange& theProgress = Message_ProgressRange());
@@ -78,7 +75,6 @@ public:
(const Handle(Transfer_Finder)& start, (const Handle(Transfer_Finder)& start,
const Handle(StepShape_ShapeDefinitionRepresentation)& SDR, const Handle(StepShape_ShapeDefinitionRepresentation)& SDR,
const Handle(Transfer_FinderProcess)& FP, const Handle(Transfer_FinderProcess)& FP,
const StepData_Factors& theLocalFactors,
const Message_ProgressRange& theProgress = Message_ProgressRange()); const Message_ProgressRange& theProgress = Message_ProgressRange());
Standard_EXPORT void SetMode (const STEPControl_StepModelType M); Standard_EXPORT void SetMode (const STEPControl_StepModelType M);

View File

@@ -54,8 +54,6 @@ STEPControl_Controller::STEPControl_Controller ()
: XSControl_Controller ("STEP", "step") : XSControl_Controller ("STEP", "step")
{ {
static Standard_Boolean init = Standard_False; static Standard_Boolean init = Standard_False;
static Standard_Mutex aMutex;
aMutex.Lock();
if (!init) { if (!init) {
RWHeaderSection::Init(); RWStepAP214::Init(); RWHeaderSection::Init(); RWStepAP214::Init();
@@ -320,7 +318,6 @@ STEPControl_Controller::STEPControl_Controller ()
init = Standard_True; init = Standard_True;
} }
aMutex.Unlock();
Handle(STEPControl_ActorWrite) ActWrite = new STEPControl_ActorWrite; Handle(STEPControl_ActorWrite) ActWrite = new STEPControl_ActorWrite;
ActWrite->SetGroupMode (Interface_Static::IVal("write.step.assembly")); ActWrite->SetGroupMode (Interface_Static::IVal("write.step.assembly"));

View File

@@ -17,7 +17,6 @@
#include <IFSelect_SelectModelEntities.hxx> #include <IFSelect_SelectModelEntities.hxx>
#include <IFSelect_SelectModelRoots.hxx> #include <IFSelect_SelectModelRoots.hxx>
#include <IFSelect_SelectSignature.hxx> #include <IFSelect_SelectSignature.hxx>
#include <Standard_Mutex.hxx>
#include <StepAP214.hxx> #include <StepAP214.hxx>
#include <StepAP214_Protocol.hxx> #include <StepAP214_Protocol.hxx>
#include <StepData_StepModel.hxx> #include <StepData_StepModel.hxx>
@@ -44,8 +43,6 @@ Handle(StepData_StepModel) STEPEdit::NewModel ()
Handle(IFSelect_Signature) STEPEdit::SignType () Handle(IFSelect_Signature) STEPEdit::SignType ()
{ {
static Standard_Mutex aMutex;
Standard_Mutex::Sentry aSentry(aMutex);
static Handle(StepSelect_StepType) sty; static Handle(StepSelect_StepType) sty;
if (!sty.IsNull()) return sty; if (!sty.IsNull()) return sty;
sty = new StepSelect_StepType; sty = new StepSelect_StepType;

View File

@@ -85,8 +85,6 @@ Standard_Boolean STEPEdit_EditContext::Load
if (modl.IsNull()) return Standard_False; if (modl.IsNull()) return Standard_False;
STEPConstruct_ContextTool ctx (modl); STEPConstruct_ContextTool ctx (modl);
StepData_Factors aLocalFactors;
ctx.SetGlobalFactor(aLocalFactors);
form->LoadValue (1, modl->StringLabel(ctx.GetAPD()) ); form->LoadValue (1, modl->StringLabel(ctx.GetAPD()) );
@@ -113,8 +111,6 @@ Standard_Boolean STEPEdit_EditContext::Apply
if (modl.IsNull()) return Standard_False; if (modl.IsNull()) return Standard_False;
STEPConstruct_ContextTool ctx (modl); STEPConstruct_ContextTool ctx (modl);
StepData_Factors aLocalFactors;
ctx.SetGlobalFactor(aLocalFactors);
ctx.AddAPD(); // on ne sait jamais ctx.AddAPD(); // on ne sait jamais
// ctx.AddPRPC(); // ctx.AddPRPC();

View File

@@ -17,7 +17,6 @@
#include <Interface_EntityIterator.hxx> #include <Interface_EntityIterator.hxx>
#include <Interface_Graph.hxx> #include <Interface_Graph.hxx>
#include <Standard_Mutex.hxx>
#include <Standard_Transient.hxx> #include <Standard_Transient.hxx>
#include <Standard_Type.hxx> #include <Standard_Type.hxx>
#include <StepGeom_CompositeCurve.hxx> #include <StepGeom_CompositeCurve.hxx>
@@ -46,13 +45,10 @@ Standard_Boolean STEPSelections_SelectGSCurves::Explore(const Standard_Integer /
Standard_Boolean isInGeomSet = Standard_False; Standard_Boolean isInGeomSet = Standard_False;
for (subs.Start(); subs.More()&&!isInGeomSet; subs.Next()) for (subs.Start(); subs.More()&&!isInGeomSet; subs.Next())
if(subs.Value()->IsKind(STANDARD_TYPE(StepShape_GeometricSet))){ if(subs.Value()->IsKind(STANDARD_TYPE(StepShape_GeometricSet))){
static Standard_Mutex aMutex;
aMutex.Lock();
if(flag) { if(flag) {
explored.AddItem (subs.Value()); explored.AddItem (subs.Value());
flag =0; flag =0;
} }
aMutex.Unlock();
isInGeomSet = Standard_True; isInGeomSet = Standard_True;
} }
if(isInGeomSet) { if(isInGeomSet) {

View File

@@ -18,7 +18,6 @@
#include <Interface_EntityIterator.hxx> #include <Interface_EntityIterator.hxx>
#include <Interface_HGraph.hxx> #include <Interface_HGraph.hxx>
#include <Interface_Macros.hxx> #include <Interface_Macros.hxx>
#include <Standard_Mutex.hxx>
#include <Standard_Transient.hxx> #include <Standard_Transient.hxx>
#include <Standard_Type.hxx> #include <Standard_Type.hxx>
#include <STEPConstruct_Assembly.hxx> #include <STEPConstruct_Assembly.hxx>
@@ -138,10 +137,9 @@ static void AddInstances(const Handle(Standard_Transient)& start,
Interface_EntityIterator STEPSelections_SelectInstances::RootResult(const Interface_Graph &G) const Interface_EntityIterator STEPSelections_SelectInstances::RootResult(const Interface_Graph &G) const
{ {
static Standard_Mutex aMutex;
Standard_Mutex::Sentry aSentry(aMutex);
if(myGraph.IsNull()||(G.Model()!=myGraph->Graph().Model())) if(myGraph.IsNull()||(G.Model()!=myGraph->Graph().Model()))
{ {
Interface_EntityIterator roots = G.RootEntities(); Interface_EntityIterator roots = G.RootEntities();
myGraph = new Interface_HGraph(G); myGraph = new Interface_HGraph(G);
myEntities.Destroy(); myEntities.Destroy();

View File

@@ -52,13 +52,19 @@
#include <BRepBuilderAPI_MakeEdge.hxx> #include <BRepBuilderAPI_MakeEdge.hxx>
#include <BRepBuilderAPI_MakeVertex.hxx> #include <BRepBuilderAPI_MakeVertex.hxx>
#include <BRepTools.hxx> #include <BRepTools.hxx>
#include <GC_MakeArcOfCircle.hxx>
#include <GC_MakeArcOfEllipse.hxx>
#include <GC_MakeLine.hxx>
#include <Geom2d_Curve.hxx> #include <Geom2d_Curve.hxx>
#include <Geom2d_Line.hxx> #include <Geom2d_Line.hxx>
#include <Geom2d_TrimmedCurve.hxx> #include <Geom2d_TrimmedCurve.hxx>
#include <Geom2dAdaptor_Curve.hxx> #include <Geom2dAdaptor_Curve.hxx>
#include <Geom2dConvert.hxx> #include <Geom2dConvert.hxx>
#include <Geom_BSplineCurve.hxx>
#include <Geom_Curve.hxx> #include <Geom_Curve.hxx>
#include <Geom_Circle.hxx>
#include <Geom_Ellipse.hxx>
#include <Geom_BezierCurve.hxx>
#include <Geom_BSplineCurve.hxx>
#include <Geom_OffsetCurve.hxx> #include <Geom_OffsetCurve.hxx>
#include <Geom_Plane.hxx> #include <Geom_Plane.hxx>
#include <Geom_SphericalSurface.hxx> #include <Geom_SphericalSurface.hxx>
@@ -68,6 +74,7 @@
#include <GeomAdaptor_Curve.hxx> #include <GeomAdaptor_Curve.hxx>
#include <GeomAPI.hxx> #include <GeomAPI.hxx>
#include <GeomAPI_ProjectPointOnCurve.hxx> #include <GeomAPI_ProjectPointOnCurve.hxx>
#include <GeomAPI_ProjectPointOnSurf.hxx>
#include <GeomConvert_CompCurveToBSplineCurve.hxx> #include <GeomConvert_CompCurveToBSplineCurve.hxx>
#include <IntRes2d_IntersectionPoint.hxx> #include <IntRes2d_IntersectionPoint.hxx>
#include <IntRes2d_SequenceOfIntersectionPoint.hxx> #include <IntRes2d_SequenceOfIntersectionPoint.hxx>
@@ -512,6 +519,25 @@ Standard_Boolean ShapeFix_Wire::FixConnected (const Standard_Real prec)
return StatusConnected ( ShapeExtend_DONE ); return StatusConnected ( ShapeExtend_DONE );
} }
//=======================================================================
//function : FixCurves
//purpose :
//=======================================================================
Standard_Boolean ShapeFix_Wire::FixCurves()
{
myStatusConnected = ShapeExtend::EncodeStatus(ShapeExtend_OK);
if (!IsLoaded()) return Standard_False;
Standard_Integer stop = (myClosedMode ? 0 : 1);
for (Standard_Integer anIdx = NbEdges(); anIdx > stop; anIdx--)
{
FixCurves(anIdx);
myStatusConnected |= myLastFixStatus;
}
return StatusConnected(ShapeExtend_DONE);
}
//======================================================================= //=======================================================================
//function : FixEdgeCurves //function : FixEdgeCurves
//purpose : //purpose :
@@ -1299,6 +1325,169 @@ Standard_Boolean ShapeFix_Wire::FixConnected (const Standard_Integer num,
return Standard_True; return Standard_True;
} }
//=======================================================================
//function : FixCurves
//purpose :
//=======================================================================
Standard_Boolean ShapeFix_Wire::FixCurves(const Standard_Integer theIdx)
{
// assume fix curves step should be after fix vertices
myLastFixStatus = ShapeExtend::EncodeStatus(ShapeExtend_OK);
if (!IsLoaded() || NbEdges() <= 0)
return Standard_False;
// action: replacing curves in edges
Handle(ShapeExtend_WireData) anSbwd = WireData();
Standard_Integer anIdx = (theIdx > 0 ? theIdx : anSbwd->NbEdges());
TopoDS_Edge anEdge = anSbwd->Edge(anIdx);
Standard_Real aPrec = BRep_Tool::Tolerance(anEdge);
ShapeAnalysis_Edge aSae;
ShapeAnalysis_Wire aSaw;
Handle(Geom_Curve) aCurve3d;
Standard_Real aCurBounds[3];
Standard_Boolean IsReversed = Standard_False;
aSae.Curve3d(anEdge, aCurve3d, aCurBounds[0], aCurBounds[2], IsReversed);
aCurBounds[1] = (aCurBounds[0] + aCurBounds[2]) / 2;
gp_Pnt anEnds[3];
anEnds[0] = BRep_Tool::Pnt(aSae.FirstVertex(anEdge));
aCurve3d->D0(aCurBounds[1], anEnds[1]);
anEnds[2] = BRep_Tool::Pnt(aSae.LastVertex(anEdge));
gp_Pnt aGeomEnds[2];
aCurve3d->D0(aCurBounds[0], aGeomEnds[0]);
aCurve3d->D0(aCurBounds[2], aGeomEnds[1]);
// TODO: precise, if IsReversed flag should be considered here
Standard_Real aGap0 = Min(anEnds[0].Distance(aGeomEnds[0]), anEnds[0].Distance(aGeomEnds[1]));
Standard_Real aGap2 = Min(anEnds[2].Distance(aGeomEnds[0]), anEnds[2].Distance(aGeomEnds[1]));
if (Max (aGap0, aGap2) < aPrec) // nothing to do
return true;
if (aCurve3d->IsKind(STANDARD_TYPE(Geom_Circle)))
{
Standard_Real anOldR = Handle(Geom_Circle)::DownCast(aCurve3d)->Circ().Radius();
gp_Vec anArcNorm = gp_Vec(anEnds[2], anEnds[0]) / 2;
gp_Pnt aCenter(anEnds[0].XYZ() - anArcNorm.XYZ());
int aSign = anEnds[1].Distance(aCenter) > anOldR ? 1 : -1; // for arc length > PI
Standard_Real aD = anOldR*anOldR - anArcNorm.SquareMagnitude();
aD = abs(aD) < Precision::Confusion() ? 0. : aD;
Standard_Real anArcR = anOldR + aSign * sqrt(aD);
gp_Ax2 aNormal(aCenter, anArcNorm);
Handle(Geom_Circle) anArc = new Geom_Circle(aNormal, anArcR);
GeomAPI_ProjectPointOnCurve projector(anEnds[1], anArc);
anEnds[1] = projector.NearestPoint();
GC_MakeArcOfCircle arc(anEnds[0], anEnds[1], anEnds[2]);
TopoDS_Edge aNewEdge = BRepBuilderAPI_MakeEdge(arc.Value()).Edge();
anSbwd->Set(aNewEdge, theIdx);
return true;
}
else if (aCurve3d->IsKind(STANDARD_TYPE(Geom_Ellipse)))
{
Handle(Geom_Ellipse) anOld = Handle(Geom_Ellipse)::DownCast(aCurve3d);
Handle(Geom_Plane) aPln = new Geom_Plane(anEnds[0], gp_Vec(anEnds[2], anEnds[0]).Crossed(gp_Vec(anEnds[1], anEnds[0])));
GeomAPI_ProjectPointOnSurf aProjector(anOld->Elips().Location(), aPln);
gp_Pnt anOrigin = aProjector.NearestPoint();
aProjector.Init(anOld->Elips().Location().XYZ() + anOld->Elips().XAxis().Direction().XYZ(), aPln);
gp_Ax2 anAx(anOrigin, aPln->Axis().Direction(), aProjector.NearestPoint().XYZ() - anOrigin.XYZ());
// compute angle
Standard_Real aRec = DBL_MAX;
Standard_Real anAngle = 0.;
Standard_Integer aSplNum = 10;
for (Standard_Integer anIdxI = -aSplNum; anIdxI < aSplNum; ++anIdxI)
{
Handle(Geom_Ellipse) anEll = new Geom_Ellipse(anAx, anOld->MajorRadius(), anOld->MinorRadius());
anEll->Rotate(anAx.Axis(), aPrec*anIdxI / anEll->MajorRadius() / aSplNum);
GeomAPI_ProjectPointOnCurve aProjector1(anEnds[0], anEll);
Standard_Real aDist = 0.;
for (Standard_Integer anIdxJ = 0; anIdxJ < 2; ++anIdxJ)
{
aProjector1.Perform(anEnds[anIdxJ *2]);
aDist += std::fmin (aProjector1.Distance(1), aProjector1.Distance(2));
}
if (aDist < aRec)
{
aRec = aDist;
anAngle = aPrec*anIdxI / anEll->MajorRadius() / aSplNum;
}
}
gp_Elips aTemp(anAx, anOld->MajorRadius(), anOld->MinorRadius());
aTemp.Rotate(anAx.Axis(), anAngle);
// compute shift
gp_Vec aX = aTemp.XAxis().Direction();
gp_Vec aY = aTemp.YAxis().Direction();
gp_Pnt2d aP1((anEnds[0].XYZ() - anOrigin.XYZ()).Dot(aX.XYZ()), (anEnds[0].XYZ() - anOrigin.XYZ()).Dot(aY.XYZ()));
gp_Pnt2d aP2((anEnds[2].XYZ() - anOrigin.XYZ()).Dot(aX.XYZ()), (anEnds[2].XYZ() - anOrigin.XYZ()).Dot(aY.XYZ()));
// x = ky + p linear equation
// where (x, y) shift point,
// k, p constant coefficients
Standard_Real k = 1, p = 0;
Standard_Real R = anOld->MajorRadius();
Standard_Real r = anOld->MinorRadius();
k = (R / r) * (R / r) *
(aP1.Y() - aP2.Y()) / (aP2.X() - aP1.X());
p = -(1. / 2) * (R / r) * (R / r) *
(aP1.Y()*aP1.Y() - aP2.Y()*aP2.Y()) / (aP2.X() - aP1.X()) + aP1.X() / 2 + aP2.X() / 2;
// ax^2 + bx + c = 0 square equation
// a, b, c constant coefficients
Standard_Real a = 0., b = 0., c = 0.;
a = R*R + k*k*r*r;
b = 2 * (k*p*r*r - k*aP1.X()*r*r - aP1.Y()*R*R);
c = aP1.X()*aP1.X()*r*r +
aP1.Y()*aP1.Y()*R*R -
r*r*R*R +
p*p*r*r - 2 * aP1.X()*p*r*r;
Standard_Real y1 = (-b - sqrt(b*b - 4 * a*c)) / 2 / a;
Standard_Real y2 = (-b + sqrt(b*b - 4 * a*c)) / 2 / a;
Standard_Real x1 = k*y1 + p;
Standard_Real x2 = k*y2 + p;
gp_Pnt anOri = anOld->Location();
if (x1*x1 + y1*y1 < x2*x2 + y2*y2)
anOri = anOri.XYZ() + aX.XYZ()*x1 + aY.XYZ()*y1;
else
anOri = anOri.XYZ() + aX.XYZ()*x2 + aY.XYZ()*y2;
aTemp.SetLocation(anOri);
GC_MakeArcOfEllipse anArc(aTemp, anEnds[2], anEnds[0], true);
TopoDS_Edge aNewEdge = BRepBuilderAPI_MakeEdge(anArc.Value()).Edge();
anSbwd->Set(aNewEdge, theIdx);
return true;
}
else if (aCurve3d->IsKind(STANDARD_TYPE(Geom_Line)))
{
TopoDS_Edge aNewEdge = BRepBuilderAPI_MakeEdge(anEnds[2], anEnds[0]).Edge();
anSbwd->Set(aNewEdge, theIdx);
return true;
}
else if (aCurve3d->IsKind(STANDARD_TYPE(Geom_BSplineCurve)))
{
Handle(Geom_BSplineCurve) anOld = Handle(Geom_BSplineCurve)::DownCast(aCurve3d);
Standard_Integer f, l;
int p = anEnds[0].Distance(aGeomEnds[0]) < anEnds[1].Distance(aGeomEnds[0]) ? 0 : 2;
anOld->MovePoint(aCurBounds[0], anEnds[p], 1, 1, f, l);
anOld->MovePoint(aCurBounds[2], anEnds[2-p], anOld->NbPoles(), anOld->NbPoles(), f, l);
return true;
}
else if (aCurve3d->IsKind(STANDARD_TYPE(Geom_BezierCurve)))
{
Handle(Geom_BezierCurve) anOld = Handle(Geom_BezierCurve)::DownCast(aCurve3d);
int p = anEnds[0].Distance(aGeomEnds[0]) < anEnds[1].Distance(aGeomEnds[0]) ? 0 : 2;
anOld->SetPole(1, anEnds[p]);
anOld->SetPole(anOld->NbPoles(), anEnds[2-p]);
return true;
}
// TODO: question: the below code works only for other curve types (not line/arc/circle/ellipse/bspline)
// Is it really needed?
myAnalyzer->CheckConnected(theIdx, aPrec);
if (myAnalyzer->LastCheckStatus(ShapeExtend_FAIL))
myLastFixStatus |= ShapeExtend::EncodeStatus(ShapeExtend_FAIL1);
return true;
}
//======================================================================= //=======================================================================
//function : FixSeam //function : FixSeam

View File

@@ -277,6 +277,7 @@ public:
//! flag ClosedMode is True //! flag ClosedMode is True
//! If <prec> is -1 then MaxTolerance() is taken. //! If <prec> is -1 then MaxTolerance() is taken.
Standard_EXPORT Standard_Boolean FixConnected (const Standard_Real prec = -1.0); Standard_EXPORT Standard_Boolean FixConnected (const Standard_Real prec = -1.0);
Standard_EXPORT Standard_Boolean FixCurves();
//! Groups the fixes dealing with 3d and pcurves of the edges. //! Groups the fixes dealing with 3d and pcurves of the edges.
//! The order of the fixes and the default behaviour are: //! The order of the fixes and the default behaviour are:
@@ -346,6 +347,7 @@ public:
//! Tests with starting preci or, if given greater, <prec> //! Tests with starting preci or, if given greater, <prec>
//! If <prec> is -1 then MaxTolerance() is taken. //! If <prec> is -1 then MaxTolerance() is taken.
Standard_EXPORT Standard_Boolean FixConnected (const Standard_Integer num, const Standard_Real prec); Standard_EXPORT Standard_Boolean FixConnected (const Standard_Integer num, const Standard_Real prec);
Standard_EXPORT Standard_Boolean FixCurves(const Standard_Integer num);
//! Fixes a seam edge //! Fixes a seam edge
//! A Seam edge has two pcurves, one for forward. one for reversed //! A Seam edge has two pcurves, one for forward. one for reversed

View File

@@ -13,8 +13,6 @@ StepData_EnumTool.cxx
StepData_EnumTool.hxx StepData_EnumTool.hxx
StepData_ESDescr.cxx StepData_ESDescr.cxx
StepData_ESDescr.hxx StepData_ESDescr.hxx
StepData_Factors.cxx
StepData_Factors.hxx
StepData_Field.cxx StepData_Field.cxx
StepData_Field.hxx StepData_Field.hxx
StepData_FieldList.cxx StepData_FieldList.cxx
@@ -33,6 +31,8 @@ StepData_FreeFormEntity.cxx
StepData_FreeFormEntity.hxx StepData_FreeFormEntity.hxx
StepData_GeneralModule.cxx StepData_GeneralModule.cxx
StepData_GeneralModule.hxx StepData_GeneralModule.hxx
StepData_GlobalFactors.cxx
StepData_GlobalFactors.hxx
StepData_GlobalNodeOfWriterLib.hxx StepData_GlobalNodeOfWriterLib.hxx
StepData_GlobalNodeOfWriterLib_0.cxx StepData_GlobalNodeOfWriterLib_0.cxx
StepData_HArray1OfField.hxx StepData_HArray1OfField.hxx

View File

@@ -11,23 +11,33 @@
// Alternatively, this file may be used under the terms of Open CASCADE // Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement. // commercial license or contractual agreement.
#include <StepData_Factors.hxx> #include <StepData_GlobalFactors.hxx>
// ============================================================================ // ============================================================================
// Method : Consturctor // Method : Consturctor
// Purpose: // Purpose:
// ============================================================================ // ============================================================================
StepData_Factors::StepData_Factors() StepData_GlobalFactors::StepData_GlobalFactors()
:myLengthFactor(1.), myPlaneAngleFactor(1.), :myLengthFactor(1.), myPlaneAngleFactor(1.),
mySolidAngleFactor(1.), myFactRD(1.), mySolidAngleFactor(1.), myFactRD(1.),
myFactDR(1.), myCascadeUnit(1.) myFactDR(1.), myCascadeUnit(1.)
{} {}
// ============================================================================
// Method : Intance
// Purpose:
// ============================================================================
StepData_GlobalFactors& StepData_GlobalFactors::Intance()
{
static StepData_GlobalFactors THE_FACTORS;
return THE_FACTORS;
}
// ============================================================================ // ============================================================================
// Method : InitializeFactors // Method : InitializeFactors
// Purpose: // Purpose:
// ============================================================================ // ============================================================================
void StepData_Factors::InitializeFactors( void StepData_GlobalFactors::InitializeFactors(
const Standard_Real theLengthFactor, const Standard_Real theLengthFactor,
const Standard_Real thePlaneAngleFactor, const Standard_Real thePlaneAngleFactor,
const Standard_Real theSolidAngleFactor) const Standard_Real theSolidAngleFactor)
@@ -43,7 +53,7 @@ void StepData_Factors::InitializeFactors(
// Method : LengthFactor // Method : LengthFactor
// Purpose: // Purpose:
// ============================================================================ // ============================================================================
Standard_Real StepData_Factors::LengthFactor() const Standard_Real StepData_GlobalFactors::LengthFactor()
{ {
return myLengthFactor; return myLengthFactor;
} }
@@ -52,7 +62,7 @@ Standard_Real StepData_Factors::LengthFactor() const
// Method : PlaneAngleFactor // Method : PlaneAngleFactor
// Purpose: // Purpose:
// ============================================================================ // ============================================================================
Standard_Real StepData_Factors::PlaneAngleFactor() const Standard_Real StepData_GlobalFactors::PlaneAngleFactor()
{ {
return myPlaneAngleFactor; return myPlaneAngleFactor;
} }
@@ -61,7 +71,7 @@ Standard_Real StepData_Factors::PlaneAngleFactor() const
// Method : SolidAngleFactor // Method : SolidAngleFactor
// Purpose: // Purpose:
// ============================================================================ // ============================================================================
Standard_Real StepData_Factors::SolidAngleFactor() const Standard_Real StepData_GlobalFactors::SolidAngleFactor()
{ {
return mySolidAngleFactor; return mySolidAngleFactor;
} }
@@ -70,7 +80,7 @@ Standard_Real StepData_Factors::SolidAngleFactor() const
// Method : FactorRadianDegree // Method : FactorRadianDegree
// Purpose: // Purpose:
// ============================================================================ // ============================================================================
Standard_Real StepData_Factors::FactorRadianDegree() const Standard_Real StepData_GlobalFactors::FactorRadianDegree()
{ {
return myFactRD; return myFactRD;
} }
@@ -79,7 +89,7 @@ Standard_Real StepData_Factors::FactorRadianDegree() const
// Method : FactorDegreeRadian // Method : FactorDegreeRadian
// Purpose: // Purpose:
// ============================================================================ // ============================================================================
Standard_Real StepData_Factors::FactorDegreeRadian() const Standard_Real StepData_GlobalFactors::FactorDegreeRadian()
{ {
return myFactDR; return myFactDR;
} }
@@ -88,7 +98,7 @@ Standard_Real StepData_Factors::FactorDegreeRadian() const
// Method : SetCascadeUnit // Method : SetCascadeUnit
// Purpose: // Purpose:
// ============================================================================ // ============================================================================
void StepData_Factors::SetCascadeUnit(const Standard_Real theUnit) void StepData_GlobalFactors::SetCascadeUnit(const Standard_Real theUnit)
{ {
myCascadeUnit = theUnit; myCascadeUnit = theUnit;
} }
@@ -97,7 +107,7 @@ void StepData_Factors::SetCascadeUnit(const Standard_Real theUnit)
// Method : CascadeUnit // Method : CascadeUnit
// Purpose: // Purpose:
// ============================================================================ // ============================================================================
Standard_Real StepData_Factors::CascadeUnit() const Standard_Real StepData_GlobalFactors::CascadeUnit()
{ {
return myCascadeUnit; return myCascadeUnit;
} }

Some files were not shown because too many files have changed in this diff Show More