mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-14 13:30:48 +03:00
Compare commits
20 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
6acb227333 | ||
|
5d0249c145 | ||
|
1a1739b200 | ||
|
fd5c113a03 | ||
|
f74f684b16 | ||
|
621ed3bc36 | ||
|
81d569625e | ||
|
6072d3093c | ||
|
e1b097eb67 | ||
|
92d22d7d62 | ||
|
1b423e3287 | ||
|
cb8519be19 | ||
|
617a2905a9 | ||
|
18559e93cf | ||
|
c2e01cc5cc | ||
|
0acc1ab47c | ||
|
b315a85dd7 | ||
|
411ad1a819 | ||
|
bbf49a300c | ||
|
0bab2704ae |
@@ -124,10 +124,12 @@ void BRepMesh_DefaultRangeSplitter::computeTolerance(
|
||||
const Standard_Real aDiffU = myRangeU.second - myRangeU.first;
|
||||
const Standard_Real aDiffV = myRangeV.second - myRangeV.first;
|
||||
|
||||
// Slightly increase exact resolution so to cover links with approximate
|
||||
// length equal to resolution itself on sub-resolution differences.
|
||||
const Standard_Real aTolerance = BRep_Tool::Tolerance (myDFace->GetFace());
|
||||
const Adaptor3d_Surface& aSurface = GetSurface()->Surface();
|
||||
const Standard_Real aResU = aSurface.UResolution (aTolerance);
|
||||
const Standard_Real aResV = aSurface.VResolution (aTolerance);
|
||||
const Standard_Real aResU = aSurface.UResolution (aTolerance) * 1.1;
|
||||
const Standard_Real aResV = aSurface.VResolution (aTolerance) * 1.1;
|
||||
|
||||
const Standard_Real aDeflectionUV = 1.e-05;
|
||||
myTolerance.first = Max(Min(aDeflectionUV, aResU), 1e-7 * aDiffU);
|
||||
|
@@ -3238,7 +3238,9 @@ Standard_Boolean ChFi3d_ComputeCurves(const Handle(Adaptor3d_Surface)& S1,
|
||||
Pc2->Value(Uf).Coord(x,y);
|
||||
x = Pardeb(3) - x;
|
||||
y = Pardeb(4) - y;
|
||||
if(Abs(x) > tol2d || Abs(y) > tol2d) Pc2->Translate(gp_Vec2d(x,y));
|
||||
|
||||
if(Abs(x) > tol2d || Abs(y) > tol2d)
|
||||
Pc2->Translate(gp_Vec2d(-6.2831853, 0));
|
||||
tolreached = ChFi3d_EvalTolReached(S1,Pc1,S2,Pc2,C3d);
|
||||
return Standard_True;
|
||||
}
|
||||
|
@@ -2708,7 +2708,14 @@ void ChFi3d_Builder::PerformIntersectionAtEnd(const Standard_Integer Index)
|
||||
TopoDS_Edge aLocalEdge = edgesau;
|
||||
if (edgesau.Orientation() != orient)
|
||||
aLocalEdge.Reverse();
|
||||
C2dint1 = BRep_Tool::CurveOnSurface(aLocalEdge,Face[0],ubid,vbid);
|
||||
C2dint1 = BRep_Tool::CurveOnSurface(aLocalEdge, Face[0], ubid, vbid);
|
||||
|
||||
if (C2dint1.IsNull())
|
||||
{
|
||||
//std::swap(Face[0], facesau);
|
||||
C2dint1 = BRep_Tool::CurveOnSurface(aLocalEdge, facesau, ubid, vbid);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -2718,7 +2725,7 @@ void ChFi3d_Builder::PerformIntersectionAtEnd(const Standard_Integer Index)
|
||||
//// for periodic 3d curves ////
|
||||
if (cad.IsPeriodic())
|
||||
{
|
||||
gp_Pnt2d P2d = BRep_Tool::Parameters( Vtx, Face[0] );
|
||||
gp_Pnt2d P2d = BRep_Tool::Parameters(Vtx, facesau);
|
||||
Geom2dAPI_ProjectPointOnCurve Projector( P2d, C2dint1 );
|
||||
par = Projector.LowerDistanceParameter();
|
||||
Standard_Real shift = par-ParVtx;
|
||||
|
@@ -60,6 +60,7 @@ Font_TextFormatter::Font_TextFormatter()
|
||||
myAlignY (Graphic3d_VTA_TOP),
|
||||
myTabSize (8),
|
||||
myWrappingWidth (0.0f),
|
||||
myIsWordWrapping (true),
|
||||
myLastSymbolWidth (0.0f),
|
||||
myMaxSymbolWidth (0.0f),
|
||||
//
|
||||
@@ -249,6 +250,7 @@ void Font_TextFormatter::Format()
|
||||
}
|
||||
}
|
||||
|
||||
Standard_Utf32Char aCharPrev = 0;
|
||||
for (Font_TextFormatter::Iterator aFormatterIt(*this);
|
||||
aFormatterIt.More(); aFormatterIt.Next())
|
||||
{
|
||||
@@ -269,12 +271,30 @@ void Font_TextFormatter::Format()
|
||||
Font_Rect aBndBox;
|
||||
GlyphBoundingBox (aRectIter, aBndBox);
|
||||
const Standard_ShortReal aNextXPos = aBndBox.Right - BottomLeft (aFirstCornerId).x();
|
||||
if (aNextXPos > aMaxLineWidth) // wrap the line and do processing of the symbol
|
||||
Standard_Boolean isCurWordFits = true;
|
||||
if(myIsWordWrapping && IsSeparatorSymbol(aCharPrev))
|
||||
{
|
||||
for (Font_TextFormatter::Iterator aWordIt = aFormatterIt; aWordIt.More(); aWordIt.Next())
|
||||
{
|
||||
if (IsSeparatorSymbol(aWordIt.Symbol()))
|
||||
{
|
||||
break;
|
||||
}
|
||||
float aWordWidthPx = myCorners[aWordIt.SymbolPosition()].x() - myCorners[aRectIter].x();
|
||||
if (aNextXPos + aWordWidthPx > aMaxLineWidth)
|
||||
{
|
||||
isCurWordFits = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (aNextXPos > aMaxLineWidth || !isCurWordFits) // wrap the line and do processing of the symbol
|
||||
{
|
||||
const Standard_Integer aLastRect = aRectIter - 1; // last rect on current line
|
||||
newLine (aLastRect, aMaxLineWidth);
|
||||
}
|
||||
}
|
||||
aCharPrev = aCharThis;
|
||||
}
|
||||
|
||||
myBndWidth = aMaxLineWidth;
|
||||
|
@@ -220,6 +220,12 @@ public:
|
||||
//! Returns text maximum width, zero means that the text is not bounded by width
|
||||
Standard_ShortReal Wrapping() const { return myWrappingWidth; }
|
||||
|
||||
//! returns TRUE when trying not to break words when wrapping text
|
||||
Standard_Boolean WordWrapping () const { return myIsWordWrapping; }
|
||||
|
||||
//! returns TRUE when trying not to break words when wrapping text
|
||||
void SetWordWrapping (const Standard_Boolean theIsWordWrapping) { myIsWordWrapping = theIsWordWrapping; }
|
||||
|
||||
//! @return width of formatted text.
|
||||
inline Standard_ShortReal ResultWidth() const
|
||||
{
|
||||
@@ -274,6 +280,14 @@ public:
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
//! Returns true if the symbol separates words when wrapping is enabled
|
||||
static Standard_Boolean IsSeparatorSymbol (const Standard_Utf32Char& theSymbol)
|
||||
{
|
||||
return theSymbol == '\x0A' // new line
|
||||
|| theSymbol == ' ' // space
|
||||
|| theSymbol == '\x09'; // tab
|
||||
}
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT (Font_TextFormatter, Standard_Transient)
|
||||
|
||||
protected: //! @name class auxiliary methods
|
||||
@@ -288,6 +302,7 @@ protected: //! @name configuration
|
||||
Graphic3d_VerticalTextAlignment myAlignY; //!< vertical alignment style
|
||||
Standard_Integer myTabSize; //!< horizontal tabulation width (number of space symbols)
|
||||
Standard_ShortReal myWrappingWidth; //!< text is wrapped by the width if defined (more 0)
|
||||
Standard_Boolean myIsWordWrapping; //!< if TRUE try not to break words when wrapping text (true by default)
|
||||
Standard_ShortReal myLastSymbolWidth; //!< width of the last symbol
|
||||
Standard_ShortReal myMaxSymbolWidth; //!< maximum symbol width of the formatter string
|
||||
|
||||
|
@@ -25,3 +25,9 @@ GeomConvert_CurveToAnaCurve.hxx
|
||||
GeomConvert_SurfToAnaSurf.cxx
|
||||
GeomConvert_SurfToAnaSurf.hxx
|
||||
GeomConvert_ConvType.hxx
|
||||
GeomConvert_FuncSphereLSDist.cxx
|
||||
GeomConvert_FuncSphereLSDist.hxx
|
||||
GeomConvert_FuncCylinderLSDist.cxx
|
||||
GeomConvert_FuncCylinderLSDist.hxx
|
||||
GeomConvert_FuncConeLSDist.cxx
|
||||
GeomConvert_FuncConeLSDist.hxx
|
||||
|
@@ -13,7 +13,7 @@
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
|
||||
#include <ShapeAnalysis_FuncConeLSDist.hxx>
|
||||
#include <GeomConvert_FuncConeLSDist.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <gp_Vec.hxx>
|
||||
#include <gp_Ax3.hxx>
|
||||
@@ -21,10 +21,10 @@
|
||||
#include <ElSLib.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : ShapeAnalysis_FuncConeLSDist
|
||||
//function : GeomConvert_FuncConeLSDist
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
ShapeAnalysis_FuncConeLSDist::ShapeAnalysis_FuncConeLSDist(
|
||||
GeomConvert_FuncConeLSDist::GeomConvert_FuncConeLSDist(
|
||||
const Handle(TColgp_HArray1OfXYZ)& thePoints,
|
||||
const gp_Dir& theDir):
|
||||
myPoints(thePoints), myDir(theDir)
|
||||
@@ -35,7 +35,7 @@ ShapeAnalysis_FuncConeLSDist::ShapeAnalysis_FuncConeLSDist(
|
||||
//function : NbVariables
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Integer ShapeAnalysis_FuncConeLSDist::NbVariables () const
|
||||
Standard_Integer GeomConvert_FuncConeLSDist::NbVariables () const
|
||||
{
|
||||
return 5;
|
||||
}
|
||||
@@ -44,7 +44,7 @@ Standard_Integer ShapeAnalysis_FuncConeLSDist::NbVariables () const
|
||||
//function : Value
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean ShapeAnalysis_FuncConeLSDist::Value(const math_Vector& X, Standard_Real& F)
|
||||
Standard_Boolean GeomConvert_FuncConeLSDist::Value(const math_Vector& X, Standard_Real& F)
|
||||
{
|
||||
gp_Pnt aLoc(X(1), X(2), X(3));
|
||||
Standard_Real aSemiAngle = X(4), anR = X(5);
|
@@ -12,8 +12,8 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _ShapeAnalysis_FuncConeLSDist_HeaderFile
|
||||
#define _ShapeAnalysis_FuncConeLSDist_HeaderFile
|
||||
#ifndef _GeomConvert_FuncConeLSDist_HeaderFile
|
||||
#define _GeomConvert_FuncConeLSDist_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
@@ -28,16 +28,16 @@
|
||||
//! by least square method.
|
||||
//!
|
||||
//!
|
||||
class ShapeAnalysis_FuncConeLSDist : public math_MultipleVarFunction
|
||||
class GeomConvert_FuncConeLSDist : public math_MultipleVarFunction
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
//! Constructor.
|
||||
Standard_EXPORT ShapeAnalysis_FuncConeLSDist() {};
|
||||
Standard_EXPORT GeomConvert_FuncConeLSDist() {};
|
||||
|
||||
Standard_EXPORT ShapeAnalysis_FuncConeLSDist(const Handle(TColgp_HArray1OfXYZ)& thePoints,
|
||||
Standard_EXPORT GeomConvert_FuncConeLSDist(const Handle(TColgp_HArray1OfXYZ)& thePoints,
|
||||
const gp_Dir& theDir);
|
||||
|
||||
void SetPoints(const Handle(TColgp_HArray1OfXYZ)& thePoints)
|
||||
@@ -63,4 +63,4 @@ private:
|
||||
gp_Dir myDir;
|
||||
|
||||
};
|
||||
#endif // _ShapeAnalysis_FuncConeLSDist_HeaderFile
|
||||
#endif // _GeomConvert_FuncConeLSDist_HeaderFile
|
@@ -13,16 +13,16 @@
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
|
||||
#include <ShapeAnalysis_FuncCylinderLSDist.hxx>
|
||||
#include <GeomConvert_FuncCylinderLSDist.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <gp_Vec.hxx>
|
||||
#include <math_Vector.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : ShapeAnalysis_FuncCylinderLSDist
|
||||
//function : GeomConvert_FuncCylinderLSDist
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
ShapeAnalysis_FuncCylinderLSDist::ShapeAnalysis_FuncCylinderLSDist(
|
||||
GeomConvert_FuncCylinderLSDist::GeomConvert_FuncCylinderLSDist(
|
||||
const Handle(TColgp_HArray1OfXYZ)& thePoints,
|
||||
const gp_Dir& theDir):
|
||||
myPoints(thePoints), myDir(theDir)
|
||||
@@ -33,7 +33,7 @@ ShapeAnalysis_FuncCylinderLSDist::ShapeAnalysis_FuncCylinderLSDist(
|
||||
//function : NbVariables
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Integer ShapeAnalysis_FuncCylinderLSDist::NbVariables () const
|
||||
Standard_Integer GeomConvert_FuncCylinderLSDist::NbVariables () const
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
@@ -42,7 +42,7 @@ Standard_Integer ShapeAnalysis_FuncCylinderLSDist::NbVariables () const
|
||||
//function : Value
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean ShapeAnalysis_FuncCylinderLSDist::Value(const math_Vector& X,Standard_Real& F)
|
||||
Standard_Boolean GeomConvert_FuncCylinderLSDist::Value(const math_Vector& X,Standard_Real& F)
|
||||
{
|
||||
gp_XYZ aLoc(X(1), X(2), X(3));
|
||||
Standard_Real anR2 = X(4)*X(4);
|
||||
@@ -64,7 +64,7 @@ Standard_Boolean ShapeAnalysis_FuncCylinderLSDist::Value(const math_Vector& X,St
|
||||
//function : Gradient
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean ShapeAnalysis_FuncCylinderLSDist::Gradient(const math_Vector& X,math_Vector& G)
|
||||
Standard_Boolean GeomConvert_FuncCylinderLSDist::Gradient(const math_Vector& X,math_Vector& G)
|
||||
|
||||
{
|
||||
gp_XYZ aLoc(X(1), X(2), X(3));
|
||||
@@ -102,7 +102,7 @@ Standard_Boolean ShapeAnalysis_FuncCylinderLSDist::Gradient(const math_Vector& X
|
||||
//function : Values
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean ShapeAnalysis_FuncCylinderLSDist::Values(const math_Vector& X,Standard_Real& F,math_Vector& G)
|
||||
Standard_Boolean GeomConvert_FuncCylinderLSDist::Values(const math_Vector& X,Standard_Real& F,math_Vector& G)
|
||||
{
|
||||
gp_XYZ aLoc(X(1), X(2), X(3));
|
||||
Standard_Real anR = X(4), anR2 = anR * anR;
|
@@ -12,8 +12,8 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _ShapeAnalysis_FuncCylinderLSDist_HeaderFile
|
||||
#define _ShapeAnalysis_FuncCylinderLSDist_HeaderFile
|
||||
#ifndef _GeomConvert_FuncCylinderLSDist_HeaderFile
|
||||
#define _GeomConvert_FuncCylinderLSDist_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
@@ -57,16 +57,16 @@
|
||||
//! dF/dz0 : G3(...) = 2*Sum{[...]*Dz0}
|
||||
//! dF/dR : G4(...) = -4*R*Sum[...]
|
||||
//! [...] = [|(P(i) - Loc)^dir|^2 - R^2]
|
||||
class ShapeAnalysis_FuncCylinderLSDist : public math_MultipleVarFunctionWithGradient
|
||||
class GeomConvert_FuncCylinderLSDist : public math_MultipleVarFunctionWithGradient
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
//! Constructor.
|
||||
Standard_EXPORT ShapeAnalysis_FuncCylinderLSDist() {};
|
||||
Standard_EXPORT GeomConvert_FuncCylinderLSDist() {};
|
||||
|
||||
Standard_EXPORT ShapeAnalysis_FuncCylinderLSDist(const Handle(TColgp_HArray1OfXYZ)& thePoints,
|
||||
Standard_EXPORT GeomConvert_FuncCylinderLSDist(const Handle(TColgp_HArray1OfXYZ)& thePoints,
|
||||
const gp_Dir& theDir);
|
||||
|
||||
void SetPoints(const Handle(TColgp_HArray1OfXYZ)& thePoints)
|
||||
@@ -97,4 +97,4 @@ private:
|
||||
gp_Dir myDir;
|
||||
|
||||
};
|
||||
#endif // _ShapeAnalysis_FuncCylinderLSDist_HeaderFile
|
||||
#endif // _GeomConvert_FuncCylinderLSDist_HeaderFile
|
@@ -15,16 +15,16 @@
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
|
||||
#include <ShapeAnalysis_FuncSphereLSDist.hxx>
|
||||
#include <GeomConvert_FuncSphereLSDist.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <gp_Vec.hxx>
|
||||
#include <math_Vector.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : ShapeAnalysis_FuncSphereLSDist
|
||||
//function : GeomConvert_FuncSphereLSDist
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
ShapeAnalysis_FuncSphereLSDist::ShapeAnalysis_FuncSphereLSDist(const Handle(TColgp_HArray1OfXYZ)& thePoints):
|
||||
GeomConvert_FuncSphereLSDist::GeomConvert_FuncSphereLSDist(const Handle(TColgp_HArray1OfXYZ)& thePoints):
|
||||
myPoints(thePoints)
|
||||
{
|
||||
}
|
||||
@@ -33,7 +33,7 @@ ShapeAnalysis_FuncSphereLSDist::ShapeAnalysis_FuncSphereLSDist(const Handle(TCol
|
||||
//function : NbVariables
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Integer ShapeAnalysis_FuncSphereLSDist::NbVariables () const
|
||||
Standard_Integer GeomConvert_FuncSphereLSDist::NbVariables () const
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
@@ -42,7 +42,7 @@ Standard_Integer ShapeAnalysis_FuncSphereLSDist::NbVariables () const
|
||||
//function : Value
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean ShapeAnalysis_FuncSphereLSDist::Value(const math_Vector& X,Standard_Real& F)
|
||||
Standard_Boolean GeomConvert_FuncSphereLSDist::Value(const math_Vector& X,Standard_Real& F)
|
||||
{
|
||||
gp_XYZ aLoc(X(1), X(2), X(3));
|
||||
Standard_Real anR2 = X(4)*X(4);
|
||||
@@ -62,7 +62,7 @@ Standard_Boolean ShapeAnalysis_FuncSphereLSDist::Value(const math_Vector& X,Stan
|
||||
//function : Gradient
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean ShapeAnalysis_FuncSphereLSDist::Gradient(const math_Vector& X,math_Vector& G)
|
||||
Standard_Boolean GeomConvert_FuncSphereLSDist::Gradient(const math_Vector& X,math_Vector& G)
|
||||
|
||||
{
|
||||
gp_XYZ aLoc(X(1), X(2), X(3));
|
||||
@@ -89,7 +89,7 @@ Standard_Boolean ShapeAnalysis_FuncSphereLSDist::Gradient(const math_Vector& X,m
|
||||
//function : Values
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean ShapeAnalysis_FuncSphereLSDist::Values(const math_Vector& X,Standard_Real& F,math_Vector& G)
|
||||
Standard_Boolean GeomConvert_FuncSphereLSDist::Values(const math_Vector& X,Standard_Real& F,math_Vector& G)
|
||||
{
|
||||
gp_XYZ aLoc(X(1), X(2), X(3));
|
||||
Standard_Real anR = X(4), anR2 = anR * anR;
|
@@ -13,8 +13,8 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _ShapeAnalysis_FuncSphereLSDist_HeaderFile
|
||||
#define _ShapeAnalysis_FuncSphereLSDist_HeaderFile
|
||||
#ifndef _GeomConvert_FuncSphereLSDist_HeaderFile
|
||||
#define _GeomConvert_FuncSphereLSDist_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
@@ -41,16 +41,16 @@
|
||||
//! dF/dR : G4(x0, y0, z0, R) = -4*R*Sum[...]
|
||||
//! [...] = [(x(i) - x0)^2 + (y(i) - y0)^2 + (z(i) - z0)^2 - R^2]
|
||||
//!
|
||||
class ShapeAnalysis_FuncSphereLSDist : public math_MultipleVarFunctionWithGradient
|
||||
class GeomConvert_FuncSphereLSDist : public math_MultipleVarFunctionWithGradient
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
//! Constructor.
|
||||
Standard_EXPORT ShapeAnalysis_FuncSphereLSDist() {};
|
||||
Standard_EXPORT GeomConvert_FuncSphereLSDist() {};
|
||||
|
||||
Standard_EXPORT ShapeAnalysis_FuncSphereLSDist(const Handle(TColgp_HArray1OfXYZ)& thePoints);
|
||||
Standard_EXPORT GeomConvert_FuncSphereLSDist(const Handle(TColgp_HArray1OfXYZ)& thePoints);
|
||||
|
||||
void SetPoints(const Handle(TColgp_HArray1OfXYZ)& thePoints)
|
||||
{
|
||||
@@ -74,4 +74,4 @@ private:
|
||||
Handle(TColgp_HArray1OfXYZ) myPoints;
|
||||
|
||||
};
|
||||
#endif // _ShapeAnalysis_FuncSphereLSDist_HeaderFile
|
||||
#endif // _GeomConvert_FuncSphereLSDist_HeaderFile
|
@@ -47,10 +47,20 @@
|
||||
#include <TColgp_Array1OfPnt.hxx>
|
||||
#include <TColStd_Array1OfReal.hxx>
|
||||
#include <Extrema_ExtElC.hxx>
|
||||
#include <GeomLProp_SLProps.hxx>
|
||||
#include <TColgp_HArray1OfXYZ.hxx>
|
||||
#include <math_Vector.hxx>
|
||||
#include <math_PSO.hxx>
|
||||
#include <math_Powell.hxx>
|
||||
#include <GeomConvert_FuncCylinderLSDist.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : CheckVTrimForRevSurf
|
||||
//purpose :
|
||||
//static method for checking surface of revolution
|
||||
//To avoid two-parts cone-like surface
|
||||
static void CheckVTrimForRevSurf(const Handle(Geom_SurfaceOfRevolution)& aRevSurf,
|
||||
//=======================================================================
|
||||
void GeomConvert_SurfToAnaSurf::CheckVTrimForRevSurf(const Handle(Geom_SurfaceOfRevolution)& aRevSurf,
|
||||
Standard_Real& V1, Standard_Real& V2)
|
||||
{
|
||||
const Handle(Geom_Curve)& aBC = aRevSurf->BasisCurve();
|
||||
@@ -96,10 +106,369 @@ static void CheckVTrimForRevSurf(const Handle(Geom_SurfaceOfRevolution)& aRevSur
|
||||
}
|
||||
|
||||
}
|
||||
//=======================================================================
|
||||
//function : TryCylinderCone
|
||||
//purpose :
|
||||
//static method to try create cylindrical or conical surface
|
||||
//=======================================================================
|
||||
Handle(Geom_Surface) GeomConvert_SurfToAnaSurf::TryCylinerCone(const Handle(Geom_Surface)& theSurf, const Standard_Boolean theVCase,
|
||||
const Handle(Geom_Curve)& theUmidiso, const Handle(Geom_Curve)& theVmidiso,
|
||||
const Standard_Real theU1, const Standard_Real theU2, const Standard_Real theV1, const Standard_Real theV2,
|
||||
const Standard_Real theToler)
|
||||
{
|
||||
Handle(Geom_Surface) aNewSurf;
|
||||
Standard_Real param1, param2, cf1, cf2, cl1, cl2, aGap1, aGap2;
|
||||
Handle(Geom_Curve) firstiso, lastiso;
|
||||
Handle(Geom_Circle) firstisocirc, lastisocirc, midisocirc;
|
||||
gp_Dir isoline;
|
||||
if (theVCase) {
|
||||
param1 = theU1; param2 = theU2;
|
||||
firstiso = theSurf->VIso(theV1);
|
||||
lastiso = theSurf->VIso(theV2);
|
||||
midisocirc = Handle(Geom_Circle)::DownCast(theVmidiso);
|
||||
isoline = Handle(Geom_Line)::DownCast(theUmidiso)->Lin().Direction();
|
||||
}
|
||||
else {
|
||||
param1 = theV1; param2 = theV2;
|
||||
firstiso = theSurf->UIso(theU1);
|
||||
lastiso = theSurf->UIso(theU2);
|
||||
midisocirc = Handle(Geom_Circle)::DownCast(theUmidiso);
|
||||
isoline = Handle(Geom_Line)::DownCast(theVmidiso)->Lin().Direction();
|
||||
}
|
||||
firstisocirc = Handle(Geom_Circle)::DownCast(GeomConvert_CurveToAnaCurve::ComputeCurve(firstiso, theToler,
|
||||
param1, param2, cf1, cl1, aGap1));
|
||||
lastisocirc = Handle(Geom_Circle)::DownCast(GeomConvert_CurveToAnaCurve::ComputeCurve(lastiso, theToler,
|
||||
param1, param2, cf2, cl2, aGap2));
|
||||
if (!firstisocirc.IsNull() || !lastisocirc.IsNull()) {
|
||||
Standard_Real R1, R2, R3;
|
||||
gp_Pnt P1, P2, P3;
|
||||
if (!firstisocirc.IsNull()) {
|
||||
R1 = firstisocirc->Circ().Radius();
|
||||
P1 = firstisocirc->Circ().Location();
|
||||
}
|
||||
else {
|
||||
R1 = 0;
|
||||
P1 = firstiso->Value((firstiso->LastParameter() - firstiso->FirstParameter()) / 2);
|
||||
}
|
||||
R2 = midisocirc->Circ().Radius();
|
||||
P2 = midisocirc->Circ().Location();
|
||||
if (!lastisocirc.IsNull()) {
|
||||
R3 = lastisocirc->Circ().Radius();
|
||||
P3 = lastisocirc->Circ().Location();
|
||||
}
|
||||
else {
|
||||
R3 = 0;
|
||||
P3 = lastiso->Value((lastiso->LastParameter() - lastiso->FirstParameter()) / 2);
|
||||
}
|
||||
//cylinder
|
||||
if (((Abs(R2 - R1)) < theToler) && ((Abs(R3 - R1)) < theToler) &&
|
||||
((Abs(R3 - R2)) < theToler)) {
|
||||
gp_Ax3 Axes(P1, gp_Dir(gp_Vec(P1, P3)));
|
||||
aNewSurf = new Geom_CylindricalSurface(Axes, R1);
|
||||
}
|
||||
//cone
|
||||
else if ((((Abs(R1)) > (Abs(R2))) && ((Abs(R2)) > (Abs(R3)))) ||
|
||||
(((Abs(R3)) > (Abs(R2))) && ((Abs(R2)) > (Abs(R1))))) {
|
||||
Standard_Real radius;
|
||||
gp_Ax3 Axes;
|
||||
Standard_Real semiangle =
|
||||
gp_Vec(isoline).Angle(gp_Vec(P3, P1));
|
||||
if (semiangle > M_PI / 2) semiangle = M_PI - semiangle;
|
||||
if (R1 > R3) {
|
||||
radius = R3;
|
||||
Axes = gp_Ax3(P3, gp_Dir(gp_Vec(P3, P1)));
|
||||
}
|
||||
else {
|
||||
radius = R1;
|
||||
Axes = gp_Ax3(P1, gp_Dir(gp_Vec(P1, P3)));
|
||||
}
|
||||
aNewSurf = new Geom_ConicalSurface(Axes, semiangle, radius);
|
||||
}
|
||||
}
|
||||
return aNewSurf;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetCylByLS
|
||||
//purpose :
|
||||
//static method to create cylinrical surface using least square method
|
||||
//=======================================================================
|
||||
static void GetLSGap(const Handle(TColgp_HArray1OfXYZ)& thePoints, const gp_Ax3& thePos,
|
||||
const Standard_Real theR, Standard_Real& theGap)
|
||||
{
|
||||
theGap = 0.;
|
||||
Standard_Integer i;
|
||||
gp_XYZ aLoc = thePos.Location().XYZ();
|
||||
gp_Dir aDir = thePos.Direction();
|
||||
for (i = thePoints->Lower(); i <= thePoints->Upper(); ++i)
|
||||
{
|
||||
gp_Vec aD(thePoints->Value(i) - aLoc);
|
||||
aD.Cross(aDir);
|
||||
theGap = Max(theGap, Abs((aD.Magnitude() - theR)));
|
||||
}
|
||||
|
||||
}
|
||||
Standard_Boolean GeomConvert_SurfToAnaSurf::GetCylByLS(const Handle(TColgp_HArray1OfXYZ)& thePoints,
|
||||
const Standard_Real theTol,
|
||||
gp_Ax3& thePos, Standard_Real& theR,
|
||||
Standard_Real& theGap)
|
||||
{
|
||||
|
||||
GetLSGap(thePoints, thePos, theR, theGap);
|
||||
if (theGap <= Precision::Confusion())
|
||||
{
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
Standard_Integer i;
|
||||
|
||||
Standard_Integer aNbVar = 4;
|
||||
|
||||
math_Vector aFBnd(1, aNbVar), aLBnd(1, aNbVar), aStartPoint(1, aNbVar);
|
||||
|
||||
Standard_Real aRelDev = 0.2; //Customer can set parameters of sample surface
|
||||
// with relative precision about aRelDev.
|
||||
// For example, if radius of sample surface is R,
|
||||
// it means, that "exact" vaue is in interav
|
||||
//[R - aRelDev*R, R + aRelDev*R]. This intrrval is set
|
||||
// for R as boundary values for dptimization algo.
|
||||
|
||||
aStartPoint(1) = thePos.Location().X();
|
||||
aStartPoint(2) = thePos.Location().Y();
|
||||
aStartPoint(3) = thePos.Location().Z();
|
||||
aStartPoint(4) = theR;
|
||||
Standard_Real aDR = aRelDev * theR;
|
||||
Standard_Real aDXYZ = aDR;
|
||||
for (i = 1; i <= 3; ++i)
|
||||
{
|
||||
aFBnd(i) = aStartPoint(i) - aDXYZ;
|
||||
aLBnd(i) = aStartPoint(i) + aDXYZ;
|
||||
}
|
||||
aFBnd(4) = aStartPoint(4) - aDR;
|
||||
aLBnd(4) = aStartPoint(4) + aDR;
|
||||
|
||||
//
|
||||
Standard_Real aTol = Precision::Confusion();
|
||||
math_MultipleVarFunction* aPFunc;
|
||||
GeomConvert_FuncCylinderLSDist aFuncCyl(thePoints, thePos.Direction());
|
||||
aPFunc = (math_MultipleVarFunction*)&aFuncCyl;
|
||||
//
|
||||
math_Vector aSteps(1, aNbVar);
|
||||
Standard_Integer aNbInt = 10;
|
||||
for (i = 1; i <= aNbVar; ++i)
|
||||
{
|
||||
aSteps(i) = (aLBnd(i) - aFBnd(i)) / aNbInt;
|
||||
}
|
||||
math_PSO aGlobSolver(aPFunc, aFBnd, aLBnd, aSteps);
|
||||
Standard_Real aLSDist;
|
||||
aGlobSolver.Perform(aSteps, aLSDist, aStartPoint);
|
||||
//
|
||||
gp_Pnt aLoc(aStartPoint(1), aStartPoint(2), aStartPoint(3));
|
||||
thePos.SetLocation(aLoc);
|
||||
theR = aStartPoint(4);
|
||||
|
||||
GetLSGap(thePoints, thePos, theR, theGap);
|
||||
if (theGap <= aTol)
|
||||
{
|
||||
return Standard_True;
|
||||
}
|
||||
//
|
||||
math_Matrix aDirMatrix(1, aNbVar, 1, aNbVar, 0.0);
|
||||
for (i = 1; i <= aNbVar; i++)
|
||||
aDirMatrix(i, i) = 1.0;
|
||||
|
||||
//Set search direction for location to be perpendicular to axis to avoid
|
||||
//seaching along axis
|
||||
const gp_Dir aDir = thePos.Direction();
|
||||
gp_Pln aPln(thePos.Location(), aDir);
|
||||
gp_Dir aUDir = aPln.Position().XDirection();
|
||||
gp_Dir aVDir = aPln.Position().YDirection();
|
||||
for (i = 1; i <= 3; ++i)
|
||||
{
|
||||
aDirMatrix(i, 1) = aUDir.Coord(i);
|
||||
aDirMatrix(i, 2) = aVDir.Coord(i);
|
||||
gp_Dir aUVDir(aUDir.XYZ() + aVDir.XYZ());
|
||||
aDirMatrix(i, 3) = aUVDir.Coord(i);
|
||||
}
|
||||
|
||||
math_Powell aSolver(*aPFunc, aTol);
|
||||
aSolver.Perform(*aPFunc, aStartPoint, aDirMatrix);
|
||||
|
||||
if (aSolver.IsDone())
|
||||
{
|
||||
gp_Ax3 aPos2 = thePos;
|
||||
aSolver.Location(aStartPoint);
|
||||
aLoc.SetCoord(aStartPoint(1), aStartPoint(2), aStartPoint(3));
|
||||
aPos2.SetLocation(aLoc);
|
||||
Standard_Real anR2 = aStartPoint(4), aGap2 = 0.;
|
||||
//
|
||||
GetLSGap(thePoints, aPos2, anR2, aGap2);
|
||||
//
|
||||
if (aGap2 < theGap)
|
||||
{
|
||||
theGap = aGap2;
|
||||
thePos = aPos2;
|
||||
theR = anR2;
|
||||
}
|
||||
}
|
||||
if (theGap <= theTol)
|
||||
{
|
||||
return Standard_True;
|
||||
}
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : TryCylinderByGaussField
|
||||
//purpose :
|
||||
//static method to try create cylinrical surface based on its Gauss field
|
||||
//=======================================================================
|
||||
|
||||
Handle(Geom_Surface) GeomConvert_SurfToAnaSurf::TryCylinderByGaussField(const Handle(Geom_Surface)& theSurf,
|
||||
const Standard_Real theU1, const Standard_Real theU2, const Standard_Real theV1, const Standard_Real theV2,
|
||||
const Standard_Real theToler, const Standard_Integer theNbU, const Standard_Integer theNbV,
|
||||
const Standard_Boolean theLeastSquare)
|
||||
{
|
||||
Handle(Geom_Surface) aNewSurf;
|
||||
Standard_Real du = (theU2 - theU1) / theNbU, dv = (theV2 - theV1) / theNbV;
|
||||
Standard_Real aSigmaR = 0.;
|
||||
Standard_Real aTol = 100. * theToler;
|
||||
TColStd_Array1OfReal anRs(1, theNbU*theNbV);
|
||||
Handle(TColgp_HArray1OfXYZ) aPoints;
|
||||
if (theLeastSquare)
|
||||
{
|
||||
aPoints = new TColgp_HArray1OfXYZ(1, theNbU*theNbU);
|
||||
}
|
||||
//
|
||||
GeomLProp_SLProps aProps(theSurf, 2, Precision::Confusion());
|
||||
Standard_Real anAvMaxCurv = 0., anAvMinCurv = 0., anAvR = 0, aSign = 1.;
|
||||
gp_XYZ anAvDir;
|
||||
gp_Dir aMinD, aMaxD;
|
||||
Standard_Integer i, j, n = 0;
|
||||
Standard_Real anU, aV;
|
||||
for (i = 1, anU = theU1 + du / 2.; i <= theNbU; ++i, anU += du)
|
||||
{
|
||||
for (j = 1, aV = theV1 + dv / 2.; j <= theNbV; ++j, aV += dv)
|
||||
{
|
||||
aProps.SetParameters(anU, aV);
|
||||
if (!aProps.IsCurvatureDefined())
|
||||
{
|
||||
return aNewSurf;
|
||||
}
|
||||
if (aProps.IsUmbilic())
|
||||
{
|
||||
return aNewSurf;
|
||||
}
|
||||
++n;
|
||||
Standard_Real aMinCurv = aProps.MinCurvature();
|
||||
Standard_Real aMaxCurv = aProps.MaxCurvature();
|
||||
Standard_Real aGaussCurv = Abs(aProps.GaussianCurvature());
|
||||
Standard_Real aK1 = Sqrt(aGaussCurv);
|
||||
if (aK1 > theToler )
|
||||
{
|
||||
return aNewSurf;
|
||||
}
|
||||
gp_XYZ aD;
|
||||
aProps.CurvatureDirections(aMaxD, aMinD);
|
||||
aMinCurv = Abs(aMinCurv);
|
||||
aMaxCurv = Abs(aMaxCurv);
|
||||
if (aMinCurv > aMaxCurv)
|
||||
{
|
||||
//aMinCurv < 0;
|
||||
aSign = -1.;
|
||||
std::swap(aMinCurv, aMaxCurv);
|
||||
gp_Dir aDummy = aMaxD;
|
||||
aMaxD = aMinD;
|
||||
aMinD = aDummy;
|
||||
}
|
||||
Standard_Real anR = 1. / aMaxCurv;
|
||||
Standard_Real anR2 = anR * anR;
|
||||
anRs(n) = anR;
|
||||
//
|
||||
if (n > 1)
|
||||
{
|
||||
if (Abs(aMaxCurv - anAvMaxCurv / (n - 1)) > aTol / anR2)
|
||||
{
|
||||
return aNewSurf;
|
||||
}
|
||||
if (Abs(aMinCurv - anAvMinCurv / (n - 1)) > aTol)
|
||||
{
|
||||
return aNewSurf;
|
||||
}
|
||||
}
|
||||
aD = aMinD.XYZ();
|
||||
anAvR += anR;
|
||||
anAvDir += aD;
|
||||
anAvMaxCurv += aMaxCurv;
|
||||
anAvMinCurv += aMinCurv;
|
||||
if (theLeastSquare)
|
||||
{
|
||||
aPoints->SetValue(n, aProps.Value().XYZ());
|
||||
}
|
||||
}
|
||||
}
|
||||
anAvMaxCurv /= n;
|
||||
anAvMinCurv /= n;
|
||||
anAvR /= n;
|
||||
anAvDir /= n;
|
||||
//
|
||||
if (Abs(anAvMinCurv) > theToler)
|
||||
{
|
||||
return aNewSurf;
|
||||
}
|
||||
//
|
||||
for (i = 1; i <= n; ++i)
|
||||
{
|
||||
Standard_Real d = (anRs(i) - anAvR);
|
||||
aSigmaR += d * d;
|
||||
}
|
||||
aSigmaR = Sqrt(aSigmaR / n);
|
||||
aTol = 3.*aSigmaR / Sqrt(n);
|
||||
if (aTol > 100. * theToler)
|
||||
{
|
||||
return aNewSurf;
|
||||
}
|
||||
aProps.SetParameters(theU1, theV1);
|
||||
if (!aProps.IsCurvatureDefined())
|
||||
{
|
||||
return aNewSurf;
|
||||
}
|
||||
gp_Dir aNorm = aProps.Normal();
|
||||
gp_Pnt aLoc = aProps.Value();
|
||||
gp_Dir anAxD(anAvDir);
|
||||
gp_Vec aT(aSign*anAvR*aNorm.XYZ());
|
||||
aLoc.Translate(aT);
|
||||
gp_Ax1 anAx1(aLoc, anAxD);
|
||||
gp_Cylinder aCyl;
|
||||
aCyl.SetAxis(anAx1);
|
||||
aCyl.SetRadius(anAvR);
|
||||
|
||||
if (theLeastSquare)
|
||||
{
|
||||
gp_Ax3 aPos = aCyl.Position();
|
||||
Standard_Real anR = aCyl.Radius();
|
||||
Standard_Real aGap = 0.;
|
||||
Standard_Boolean IsDone = GetCylByLS(aPoints, theToler, aPos, anR, aGap);
|
||||
if (IsDone)
|
||||
{
|
||||
aCyl.SetPosition(aPos);
|
||||
aCyl.SetRadius(anR);
|
||||
}
|
||||
}
|
||||
|
||||
aNewSurf = new Geom_CylindricalSurface(aCyl);
|
||||
|
||||
return aNewSurf;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : TryTorusSphere
|
||||
//purpose :
|
||||
// static method to try create toroidal surface.
|
||||
// In case <isTryUMajor> = Standard_True try to use V isoline radius as minor radaius.
|
||||
static Handle(Geom_Surface) TryTorusSphere(const Handle(Geom_Surface)& theSurf,
|
||||
//=======================================================================
|
||||
|
||||
Handle(Geom_Surface) GeomConvert_SurfToAnaSurf::TryTorusSphere(const Handle(Geom_Surface)& theSurf,
|
||||
const Handle(Geom_Circle)& circle,
|
||||
const Handle(Geom_Circle)& otherCircle,
|
||||
const Standard_Real Param1,
|
||||
@@ -181,9 +550,14 @@ static Handle(Geom_Surface) TryTorusSphere(const Handle(Geom_Surface)& theSurf,
|
||||
return newSurface;
|
||||
}
|
||||
|
||||
static Standard_Real ComputeGap(const Handle(Geom_Surface)& theSurf,
|
||||
//=======================================================================
|
||||
//function : ComputeGap
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Real GeomConvert_SurfToAnaSurf::ComputeGap(const Handle(Geom_Surface)& theSurf,
|
||||
const Standard_Real theU1, const Standard_Real theU2, const Standard_Real theV1, const Standard_Real theV2,
|
||||
const Handle(Geom_Surface) theNewSurf, const Standard_Real theTol = RealLast())
|
||||
const Handle(Geom_Surface) theNewSurf, const Standard_Real theTol)
|
||||
{
|
||||
GeomAdaptor_Surface aGAS(theNewSurf);
|
||||
GeomAbs_SurfaceType aSType = aGAS.GetType();
|
||||
@@ -228,7 +602,7 @@ static Standard_Real ComputeGap(const Handle(Geom_Surface)& theSurf,
|
||||
Standard_Real DU2 = DU / 2., DV2 = DV / 2.;
|
||||
for (j = 1; (j < NP) && onSurface; j++) {
|
||||
Standard_Real V = theV1 + DV*(j - 1) + DV2;
|
||||
for (i = 1; i <= NP; i++) {
|
||||
for (i = 1; i < NP; i++) {
|
||||
Standard_Real U = theU1 + DU*(i - 1) + DU2;
|
||||
theSurf->D0(U, V, P3d);
|
||||
|
||||
@@ -384,7 +758,9 @@ Handle(Geom_Surface) GeomConvert_SurfToAnaSurf::ConvertToAnalytical(const Standa
|
||||
//
|
||||
Standard_Real toler = InitialToler;
|
||||
Handle(Geom_Surface) newSurf[5];
|
||||
Standard_Real dd[5] = { -1., -1., -1., -1., -1 };
|
||||
Standard_Real dd[5] = { RealLast(), RealLast(), RealLast(), RealLast(), RealLast() };
|
||||
GeomAbs_SurfaceType aSTypes[5] = { GeomAbs_Plane, GeomAbs_Cylinder,
|
||||
GeomAbs_Cone, GeomAbs_Sphere, GeomAbs_Torus };
|
||||
|
||||
//Check boundaries
|
||||
Standard_Real U1, U2, V1, V2;
|
||||
@@ -481,183 +857,136 @@ Handle(Geom_Surface) GeomConvert_SurfToAnaSurf::ConvertToAnalytical(const Standa
|
||||
//convert middle uiso and viso to canonical representation
|
||||
Standard_Real VMid = 0.5*(V1 + V2);
|
||||
Standard_Real UMid = 0.5*(U1 + U2);
|
||||
Handle(Geom_Surface) TrSurf = aTempS;
|
||||
if(!aDoSegment)
|
||||
TrSurf = new Geom_RectangularTrimmedSurface(aTempS, U1, U2, V1, V2);
|
||||
// Handle(Geom_Surface) TrSurf = aTempS;
|
||||
|
||||
Handle(Geom_Curve) UIso = TrSurf->UIso(UMid);
|
||||
Handle(Geom_Curve) VIso = TrSurf->VIso(VMid);
|
||||
Handle(Geom_Curve) UIso = aTempS->UIso(UMid);
|
||||
Handle(Geom_Curve) VIso = aTempS->VIso(VMid);
|
||||
|
||||
Standard_Real cuf, cul, cvf, cvl, aGap1, aGap2;
|
||||
Handle(Geom_Curve) umidiso = GeomConvert_CurveToAnaCurve::ComputeCurve(UIso, toler, V1, V2, cuf, cul, aGap1);
|
||||
Handle(Geom_Curve) vmidiso = GeomConvert_CurveToAnaCurve::ComputeCurve(VIso, toler, U1, U2, cvf, cvl, aGap2);
|
||||
if (umidiso.IsNull() || vmidiso.IsNull()) {
|
||||
return newSurf[isurf];
|
||||
}
|
||||
|
||||
//
|
||||
Standard_Boolean VCase = Standard_False;
|
||||
|
||||
if (umidiso->IsKind(STANDARD_TYPE(Geom_Circle)) && vmidiso->IsKind(STANDARD_TYPE(Geom_Circle)))
|
||||
if (!umidiso.IsNull() && !vmidiso.IsNull())
|
||||
{
|
||||
aToroidSphere = Standard_True;
|
||||
if (myConvType == GeomConvert_Target && (myTarget == GeomAbs_Cylinder || myTarget == GeomAbs_Cone))
|
||||
|
||||
//
|
||||
Standard_Boolean VCase = Standard_False;
|
||||
|
||||
if (umidiso->IsKind(STANDARD_TYPE(Geom_Circle)) && vmidiso->IsKind(STANDARD_TYPE(Geom_Circle)))
|
||||
{
|
||||
isurf = 1;
|
||||
myGap = dd[isurf];
|
||||
return newSurf[isurf];
|
||||
aToroidSphere = Standard_True;
|
||||
if (myConvType == GeomConvert_Target && (myTarget == GeomAbs_Cylinder || myTarget == GeomAbs_Cone))
|
||||
{
|
||||
isurf = 1;
|
||||
myGap = dd[isurf];
|
||||
return newSurf[isurf];
|
||||
}
|
||||
isurf = 3; // set sphere
|
||||
}
|
||||
isurf = 3; // set sphere
|
||||
}
|
||||
else if (umidiso->IsKind(STANDARD_TYPE(Geom_Line)) && vmidiso->IsKind(STANDARD_TYPE(Geom_Circle))) {
|
||||
aCylinderConus = Standard_True; VCase = Standard_True;
|
||||
if (myConvType == GeomConvert_Target && (myTarget == GeomAbs_Sphere || myTarget == GeomAbs_Torus))
|
||||
else if (umidiso->IsKind(STANDARD_TYPE(Geom_Line)) && vmidiso->IsKind(STANDARD_TYPE(Geom_Circle))) {
|
||||
aCylinderConus = Standard_True; VCase = Standard_True;
|
||||
if (myConvType == GeomConvert_Target && (myTarget == GeomAbs_Sphere || myTarget == GeomAbs_Torus))
|
||||
{
|
||||
isurf = 3;
|
||||
myGap = dd[isurf];
|
||||
return newSurf[isurf];
|
||||
}
|
||||
isurf = 1;// set cylinder
|
||||
}
|
||||
else if (umidiso->IsKind(STANDARD_TYPE(Geom_Circle)) && vmidiso->IsKind(STANDARD_TYPE(Geom_Line)))
|
||||
{
|
||||
isurf = 3;
|
||||
myGap = dd[isurf];
|
||||
return newSurf[isurf];
|
||||
aCylinderConus = Standard_True;
|
||||
if (myConvType == GeomConvert_Target && (myTarget == GeomAbs_Sphere || myTarget == GeomAbs_Torus))
|
||||
{
|
||||
isurf = 3;
|
||||
myGap = dd[isurf];
|
||||
return newSurf[isurf];
|
||||
}
|
||||
isurf = 1;// set cylinder
|
||||
}
|
||||
|
||||
|
||||
//case of torus-sphere
|
||||
if (aToroidSphere) {
|
||||
|
||||
isurf = 3; // Set spherical surface
|
||||
|
||||
Handle(Geom_Circle) Ucircle = Handle(Geom_Circle)::DownCast(umidiso);
|
||||
Handle(Geom_Circle) Vcircle = Handle(Geom_Circle)::DownCast(vmidiso);
|
||||
// torus
|
||||
// try when V isolines is with same radius
|
||||
Handle(Geom_Surface) anObject =
|
||||
TryTorusSphere(mySurf, Vcircle, Ucircle, V1, V2, U1, U2, toler, Standard_True);
|
||||
if (anObject.IsNull()) // try when U isolines is with same radius
|
||||
anObject = TryTorusSphere(mySurf, Ucircle, Vcircle, U1, U2, V1, V2, toler, Standard_False);
|
||||
|
||||
if (!anObject.IsNull())
|
||||
{
|
||||
if (anObject->IsKind(STANDARD_TYPE(Geom_ToroidalSurface)))
|
||||
{
|
||||
isurf = 4; // set torus
|
||||
}
|
||||
newSurf[isurf] = anObject;
|
||||
if (myConvType == GeomConvert_Target && (myTarget != aSTypes[isurf]))
|
||||
{
|
||||
myGap = RealLast();
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
myGap = dd[isurf];
|
||||
}
|
||||
}
|
||||
//case of cone - cylinder
|
||||
else if (aCylinderConus) {
|
||||
isurf = 1; //set cylindrical surface
|
||||
Handle(Geom_Surface) anObject = TryCylinerCone(aTempS, VCase, umidiso, vmidiso,
|
||||
U1, U2, V1, V2, toler);
|
||||
if (!anObject.IsNull())
|
||||
{
|
||||
if (anObject->IsKind(STANDARD_TYPE(Geom_ConicalSurface)))
|
||||
{
|
||||
isurf = 2; // set conical surface
|
||||
}
|
||||
if (myConvType == GeomConvert_Target && (myTarget != aSTypes[isurf]))
|
||||
{
|
||||
myGap = RealLast();
|
||||
return NULL;
|
||||
}
|
||||
newSurf[isurf] = anObject;
|
||||
}
|
||||
else
|
||||
{
|
||||
myGap = dd[isurf];
|
||||
}
|
||||
}
|
||||
isurf = 1;// set cylinder
|
||||
}
|
||||
else if (umidiso->IsKind(STANDARD_TYPE(Geom_Circle)) && vmidiso->IsKind(STANDARD_TYPE(Geom_Line)))
|
||||
//Additional checking for case of cylinder
|
||||
if (!aCylinderConus && !aToroidSphere)
|
||||
{
|
||||
aCylinderConus = Standard_True;
|
||||
if (myConvType == GeomConvert_Target && (myTarget == GeomAbs_Sphere || myTarget == GeomAbs_Torus))
|
||||
{
|
||||
isurf = 3;
|
||||
myGap = dd[isurf];
|
||||
return newSurf[isurf];
|
||||
}
|
||||
isurf = 1;// set cylinder
|
||||
}
|
||||
Standard_Real cl = 0.0;
|
||||
//case of torus-sphere
|
||||
if (aToroidSphere) {
|
||||
|
||||
isurf = 3; // Set spherical surface
|
||||
|
||||
Handle(Geom_Circle) Ucircle = Handle(Geom_Circle)::DownCast(umidiso);
|
||||
Handle(Geom_Circle) Vcircle = Handle(Geom_Circle)::DownCast(vmidiso);
|
||||
// torus
|
||||
// try when V isolines is with same radius
|
||||
Handle(Geom_Surface) anObject =
|
||||
TryTorusSphere(mySurf, Vcircle, Ucircle, V1, V2, U1, U2, toler, Standard_True);
|
||||
if (anObject.IsNull()) // try when U isolines is with same radius
|
||||
anObject = TryTorusSphere(mySurf, Ucircle, Vcircle, U1, U2, V1, V2, toler, Standard_False);
|
||||
|
||||
//Try cylinder using Gauss field
|
||||
Standard_Integer aNbU = 7, aNbV = 7;
|
||||
Standard_Boolean aLeastSquare = Standard_True;
|
||||
Handle(Geom_Surface) anObject = TryCylinderByGaussField(aTempS, U1, U2, V1, V2, toler,
|
||||
aNbU, aNbV, aLeastSquare);
|
||||
if (!anObject.IsNull())
|
||||
{
|
||||
if (anObject->IsKind(STANDARD_TYPE(Geom_ToroidalSurface)))
|
||||
{
|
||||
isurf = 4; // set torus
|
||||
}
|
||||
isurf = 1;
|
||||
newSurf[isurf] = anObject;
|
||||
}
|
||||
else
|
||||
{
|
||||
myGap = dd[isurf];
|
||||
}
|
||||
}
|
||||
//case of cone - cylinder
|
||||
else if (aCylinderConus) {
|
||||
Standard_Real param1, param2, cf1, cf2;
|
||||
Handle(Geom_Curve) firstiso, lastiso;
|
||||
Handle(Geom_Circle) firstisocirc, lastisocirc, midisocirc;
|
||||
gp_Dir isoline;
|
||||
if (VCase) {
|
||||
param1 = U1; param2 = U2;
|
||||
firstiso = TrSurf->VIso(V1);
|
||||
lastiso = TrSurf->VIso(V2);
|
||||
midisocirc = Handle(Geom_Circle)::DownCast(vmidiso);
|
||||
isoline = Handle(Geom_Line)::DownCast(umidiso)->Lin().Direction();
|
||||
}
|
||||
else {
|
||||
param1 = V1; param2 = V2;
|
||||
firstiso = TrSurf->UIso(U1);
|
||||
lastiso = TrSurf->UIso(U2);
|
||||
midisocirc = Handle(Geom_Circle)::DownCast(umidiso);
|
||||
isoline = Handle(Geom_Line)::DownCast(vmidiso)->Lin().Direction();
|
||||
}
|
||||
firstisocirc = Handle(Geom_Circle)::DownCast(GeomConvert_CurveToAnaCurve::ComputeCurve(firstiso, toler, param1, param2, cf1, cl, aGap1));
|
||||
lastisocirc = Handle(Geom_Circle)::DownCast(GeomConvert_CurveToAnaCurve::ComputeCurve(lastiso, toler, param1, param2, cf2, cl, aGap2));
|
||||
if (!firstisocirc.IsNull() || !lastisocirc.IsNull()) {
|
||||
Standard_Real R1, R2, R3;
|
||||
gp_Pnt P1, P2, P3;
|
||||
if (!firstisocirc.IsNull()) {
|
||||
R1 = firstisocirc->Circ().Radius();
|
||||
P1 = firstisocirc->Circ().Location();
|
||||
}
|
||||
else {
|
||||
R1 = 0;
|
||||
P1 = firstiso->Value((firstiso->LastParameter() - firstiso->FirstParameter()) / 2);
|
||||
}
|
||||
R2 = midisocirc->Circ().Radius();
|
||||
P2 = midisocirc->Circ().Location();
|
||||
if (!lastisocirc.IsNull()) {
|
||||
R3 = lastisocirc->Circ().Radius();
|
||||
P3 = lastisocirc->Circ().Location();
|
||||
}
|
||||
else {
|
||||
R3 = 0;
|
||||
P3 = lastiso->Value((lastiso->LastParameter() - lastiso->FirstParameter()) / 2);
|
||||
}
|
||||
//cylinder
|
||||
if (((Abs(R2 - R1)) < toler) && ((Abs(R3 - R1)) < toler) &&
|
||||
((Abs(R3 - R2)) < toler)) {
|
||||
isurf = 1;
|
||||
gp_Ax3 Axes(P1, gp_Dir(gp_Vec(P1, P3)));
|
||||
Handle(Geom_CylindricalSurface) anObject =
|
||||
new Geom_CylindricalSurface(Axes, R1);
|
||||
if (myConvType == GeomConvert_Target && myTarget != GeomAbs_Cylinder)
|
||||
{
|
||||
return newSurf[isurf];
|
||||
}
|
||||
newSurf[isurf] = anObject;
|
||||
}
|
||||
//cone
|
||||
else if ((((Abs(R1)) > (Abs(R2))) && ((Abs(R2)) > (Abs(R3)))) ||
|
||||
(((Abs(R3)) > (Abs(R2))) && ((Abs(R2)) > (Abs(R1))))) {
|
||||
Standard_Real radius;
|
||||
gp_Ax3 Axes;
|
||||
Standard_Real semiangle =
|
||||
gp_Vec(isoline).Angle(gp_Vec(P3, P1));
|
||||
if (semiangle>M_PI / 2) semiangle = M_PI - semiangle;
|
||||
if (R1 > R3) {
|
||||
radius = R3;
|
||||
Axes = gp_Ax3(P3, gp_Dir(gp_Vec(P3, P1)));
|
||||
}
|
||||
else {
|
||||
radius = R1;
|
||||
Axes = gp_Ax3(P1, gp_Dir(gp_Vec(P1, P3)));
|
||||
}
|
||||
Handle(Geom_ConicalSurface) anObject =
|
||||
new Geom_ConicalSurface(Axes, semiangle, radius);
|
||||
isurf = 2;
|
||||
if (myConvType == GeomConvert_Target && myTarget != GeomAbs_Cone)
|
||||
{
|
||||
return newSurf[isurf];
|
||||
}
|
||||
newSurf[isurf] = anObject;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
myGap = dd[isurf];
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
//---------------------------------------------------------------------
|
||||
// verification
|
||||
//---------------------------------------------------------------------
|
||||
GeomAbs_SurfaceType aSTypes[5] = { GeomAbs_Plane, GeomAbs_Cylinder,
|
||||
GeomAbs_Cone, GeomAbs_Sphere, GeomAbs_Torus };
|
||||
Standard_Integer imin = -1;
|
||||
Standard_Real aDmin = RealLast();
|
||||
for (isurf = 0; isurf < 5; ++isurf)
|
||||
{
|
||||
if (newSurf[isurf].IsNull())
|
||||
continue;
|
||||
dd[isurf] = ComputeGap(TrSurf, U1, U2, V1, V2, newSurf[isurf], toler);
|
||||
dd[isurf] = ComputeGap(aTempS, U1, U2, V1, V2, newSurf[isurf], toler);
|
||||
if (dd[isurf] <= toler)
|
||||
{
|
||||
if (myConvType == GeomConvert_Simplest || (myConvType == GeomConvert_Target && myTarget == aSTypes[isurf]))
|
||||
@@ -682,7 +1011,7 @@ Handle(Geom_Surface) GeomConvert_SurfToAnaSurf::ConvertToAnalytical(const Standa
|
||||
return newSurf[imin];
|
||||
}
|
||||
|
||||
return newSurf[0];
|
||||
return NULL;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
|
@@ -25,8 +25,10 @@
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <GeomConvert_ConvType.hxx>
|
||||
#include <GeomAbs_SurfaceType.hxx>
|
||||
#include <TColgp_HArray1OfXYZ.hxx>
|
||||
class Geom_Surface;
|
||||
|
||||
class Geom_SurfaceOfRevolution;
|
||||
class Geom_Circle;
|
||||
|
||||
//! Converts a surface to the analitical form with given
|
||||
//! precision. Conversion is done only the surface is bspline
|
||||
@@ -75,6 +77,48 @@ public:
|
||||
//! Returns true, if surface is canonical
|
||||
Standard_EXPORT static Standard_Boolean IsCanonical (const Handle(Geom_Surface)& S);
|
||||
|
||||
private:
|
||||
//!static method for checking surface of revolution
|
||||
//!To avoid two-parts cone-like surface
|
||||
static void CheckVTrimForRevSurf(const Handle(Geom_SurfaceOfRevolution)& aRevSurf,
|
||||
Standard_Real& V1, Standard_Real& V2);
|
||||
|
||||
//!static method to try create cylindrical or conical surface
|
||||
static Handle(Geom_Surface) TryCylinerCone(const Handle(Geom_Surface)& theSurf, const Standard_Boolean theVCase,
|
||||
const Handle(Geom_Curve)& theUmidiso, const Handle(Geom_Curve)& theVmidiso,
|
||||
const Standard_Real theU1, const Standard_Real theU2, const Standard_Real theV1, const Standard_Real theV2,
|
||||
const Standard_Real theToler);
|
||||
|
||||
//!static method to try create cylinrical surface using least square method
|
||||
static Standard_Boolean GetCylByLS(const Handle(TColgp_HArray1OfXYZ)& thePoints,
|
||||
const Standard_Real theTol,
|
||||
gp_Ax3& thePos, Standard_Real& theR,
|
||||
Standard_Real& theGap);
|
||||
|
||||
//!static method to try create cylinrical surface based on its Gauss field
|
||||
static Handle(Geom_Surface) TryCylinderByGaussField(const Handle(Geom_Surface)& theSurf,
|
||||
const Standard_Real theU1, const Standard_Real theU2, const Standard_Real theV1, const Standard_Real theV2,
|
||||
const Standard_Real theToler, const Standard_Integer theNbU = 20, const Standard_Integer theNbV = 20,
|
||||
const Standard_Boolean theLeastSquare = Standard_False);
|
||||
|
||||
//! static method to try create toroidal surface.
|
||||
//! In case <isTryUMajor> = Standard_True try to use V isoline radius as minor radaius.
|
||||
static Handle(Geom_Surface) TryTorusSphere(const Handle(Geom_Surface)& theSurf,
|
||||
const Handle(Geom_Circle)& circle,
|
||||
const Handle(Geom_Circle)& otherCircle,
|
||||
const Standard_Real Param1,
|
||||
const Standard_Real Param2,
|
||||
const Standard_Real aParam1ToCrv,
|
||||
const Standard_Real aParam2ToCrv,
|
||||
const Standard_Real toler,
|
||||
const Standard_Boolean isTryUMajor);
|
||||
|
||||
static Standard_Real ComputeGap(const Handle(Geom_Surface)& theSurf,
|
||||
const Standard_Real theU1, const Standard_Real theU2, const Standard_Real theV1, const Standard_Real theV2,
|
||||
const Handle(Geom_Surface) theNewSurf, const Standard_Real theTol = RealLast());
|
||||
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
@@ -1547,7 +1547,7 @@ Handle(Graphic3d_ShaderProgram) Graphic3d_ShaderManager::getStdProgramPhong (con
|
||||
}
|
||||
|
||||
Handle(Graphic3d_ShaderProgram) aProgramSrc = new Graphic3d_ShaderProgram();
|
||||
aProgramSrc->SetPBR (theIsPBR);
|
||||
aProgramSrc->SetPBR (theIsPBR); // should be set before defaultGlslVersion()
|
||||
|
||||
TCollection_AsciiString aSrcVert, aSrcVertExtraFunc, aSrcVertExtraMain;
|
||||
TCollection_AsciiString aSrcFrag, aSrcFragGetVertColor, aSrcFragExtraMain;
|
||||
@@ -1987,6 +1987,8 @@ Handle(Graphic3d_ShaderProgram) Graphic3d_ShaderManager::getPBREnvBakingProgram
|
||||
{
|
||||
Standard_ASSERT_RAISE (theIndex >= 0 && theIndex <= 2,"");
|
||||
Handle(Graphic3d_ShaderProgram) aProgramSrc = new Graphic3d_ShaderProgram();
|
||||
aProgramSrc->SetPBR (true); // should be set before defaultGlslVersion()
|
||||
|
||||
Graphic3d_ShaderObject::ShaderVariableList aUniforms, aStageInOuts;
|
||||
|
||||
TCollection_AsciiString aSrcVert = TCollection_AsciiString()
|
||||
@@ -2033,7 +2035,6 @@ Handle(Graphic3d_ShaderProgram) Graphic3d_ShaderManager::getPBREnvBakingProgram
|
||||
aProgramSrc->SetNbLightsMax (0);
|
||||
aProgramSrc->SetNbShadowMaps (0);
|
||||
aProgramSrc->SetNbClipPlanesMax (0);
|
||||
aProgramSrc->SetPBR (true);
|
||||
aProgramSrc->AttachShader (Graphic3d_ShaderObject::CreateFromSource (aSrcVert, Graphic3d_TOS_VERTEX, aUniforms, aStageInOuts));
|
||||
aProgramSrc->AttachShader (Graphic3d_ShaderObject::CreateFromSource (aSrcFrag, Graphic3d_TOS_FRAGMENT, aUniforms, aStageInOuts));
|
||||
return aProgramSrc;
|
||||
|
@@ -82,7 +82,7 @@ void Interface_Static::Standards ()
|
||||
Interface_Static::Init("XSTEP" ,"write.surfacecurve.mode", '&',"eval Off");
|
||||
Interface_Static::Init("XSTEP" ,"write.surfacecurve.mode", '&',"eval On");
|
||||
// Interface_Static::Init("XSTEP" ,"write.surfacecurve.mode", '&',"eval NoAnalytic");
|
||||
Interface_Static::SetIVal ("write.surfacecurve.mode",0);
|
||||
Interface_Static::SetIVal ("write.surfacecurve.mode",1);
|
||||
|
||||
// lastpreci : pour recuperer la derniere valeur codee (cf XSControl)
|
||||
// (0 pour dire : pas codee)
|
||||
|
@@ -625,7 +625,10 @@ void MeshVS_ElementalColorPrsBuilder::Build ( const Handle(Prs3d_Presentation)&
|
||||
}
|
||||
|
||||
aGroup2->AddPrimitiveArray (aFaceTriangles);
|
||||
aSGroup->AddPrimitiveArray (anEdgeSegments);
|
||||
if (anEdgeOn)
|
||||
{
|
||||
aSGroup->AddPrimitiveArray (anEdgeSegments);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -18,6 +18,7 @@
|
||||
#include <Standard_OutOfMemory.hxx>
|
||||
#include <Standard_OutOfRange.hxx>
|
||||
#include <Standard_TypeMismatch.hxx>
|
||||
#include <Standard_Macro.hxx>
|
||||
|
||||
//! Defines an array of values of configurable size.
|
||||
//! For instance, this class allows defining an array of 32-bit or 64-bit integer values with bitness determined in runtime.
|
||||
@@ -63,7 +64,7 @@ public:
|
||||
}
|
||||
|
||||
//! Move constructor
|
||||
NCollection_AliasedArray (NCollection_AliasedArray&& theOther) noexcept
|
||||
NCollection_AliasedArray (NCollection_AliasedArray&& theOther) Standard_Noexcept
|
||||
: myData (theOther.myData), myStride (theOther.myStride), mySize (theOther.mySize), myDeletable (theOther.myDeletable)
|
||||
{
|
||||
theOther.myDeletable = false;
|
||||
|
@@ -17,6 +17,7 @@
|
||||
#include <NCollection_AliasedArray.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <gp_Vec3f.hxx>
|
||||
#include <Standard_Macro.hxx>
|
||||
|
||||
//! Defines an array of 3D nodes of single/double precision configurable at construction time.
|
||||
class Poly_ArrayOfNodes : public NCollection_AliasedArray<>
|
||||
@@ -85,14 +86,14 @@ public:
|
||||
Poly_ArrayOfNodes& operator= (const Poly_ArrayOfNodes& theOther) { return Assign (theOther); }
|
||||
|
||||
//! Move constructor
|
||||
Poly_ArrayOfNodes (Poly_ArrayOfNodes&& theOther) noexcept
|
||||
Poly_ArrayOfNodes (Poly_ArrayOfNodes&& theOther) Standard_Noexcept
|
||||
: NCollection_AliasedArray (std::move (theOther))
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
//! Move assignment operator; @sa Move()
|
||||
Poly_ArrayOfNodes& operator= (Poly_ArrayOfNodes&& theOther) noexcept
|
||||
Poly_ArrayOfNodes& operator= (Poly_ArrayOfNodes&& theOther) Standard_Noexcept
|
||||
{
|
||||
return Move (theOther);
|
||||
}
|
||||
|
@@ -17,6 +17,7 @@
|
||||
#include <NCollection_AliasedArray.hxx>
|
||||
#include <gp_Pnt2d.hxx>
|
||||
#include <gp_Vec2f.hxx>
|
||||
#include <Standard_Macro.hxx>
|
||||
|
||||
//! Defines an array of 2D nodes of single/double precision configurable at construction time.
|
||||
class Poly_ArrayOfUVNodes : public NCollection_AliasedArray<>
|
||||
@@ -85,14 +86,14 @@ public:
|
||||
Poly_ArrayOfUVNodes& operator= (const Poly_ArrayOfUVNodes& theOther) { return Assign (theOther); }
|
||||
|
||||
//! Move constructor
|
||||
Poly_ArrayOfUVNodes (Poly_ArrayOfUVNodes&& theOther) noexcept
|
||||
Poly_ArrayOfUVNodes (Poly_ArrayOfUVNodes&& theOther) Standard_Noexcept
|
||||
: NCollection_AliasedArray (std::move (theOther))
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
//! Move assignment operator; @sa Move()
|
||||
Poly_ArrayOfUVNodes& operator= (Poly_ArrayOfUVNodes&& theOther) noexcept
|
||||
Poly_ArrayOfUVNodes& operator= (Poly_ArrayOfUVNodes&& theOther) Standard_Noexcept
|
||||
{
|
||||
return Move (theOther);
|
||||
}
|
||||
|
@@ -21,6 +21,7 @@
|
||||
#include <NCollection_DataMap.hxx>
|
||||
#include <OSD_FileSystem.hxx>
|
||||
#include <OSD_File.hxx>
|
||||
#include <OSD_Parallel.hxx>
|
||||
#include <OSD_Path.hxx>
|
||||
#include <OSD_Timer.hxx>
|
||||
#include <RWGltf_GltfAccessorLayout.hxx>
|
||||
@@ -45,7 +46,9 @@
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_DRACO
|
||||
#include <Standard_WarningsDisable.hxx>
|
||||
#include <draco/compression/encode.h>
|
||||
#include <Standard_WarningsRestore.hxx>
|
||||
#endif
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(RWGltf_CafWriter, Standard_Transient)
|
||||
@@ -168,6 +171,72 @@ namespace
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef HAVE_DRACO
|
||||
//! Functor for parallel execution of encoding meshes to Draco buffers.
|
||||
class DracoEncodingFunctor
|
||||
{
|
||||
public:
|
||||
|
||||
DracoEncodingFunctor (const Message_ProgressRange& theProgress,
|
||||
draco::Encoder& theDracoEncoder,
|
||||
const std::vector<std::shared_ptr<RWGltf_CafWriter::Mesh>>& theMeshes,
|
||||
std::vector<std::shared_ptr<draco::EncoderBuffer>>& theEncoderBuffers)
|
||||
: myProgress(theProgress, "Draco compression", Max(1, int(theMeshes.size()))),
|
||||
myDracoEncoder(&theDracoEncoder),
|
||||
myRanges(0, int(theMeshes.size()) - 1),
|
||||
myMeshes(&theMeshes),
|
||||
myEncoderBuffers(&theEncoderBuffers)
|
||||
{
|
||||
for (int anIndex = 0; anIndex != int(theMeshes.size()); ++anIndex)
|
||||
{
|
||||
myRanges.SetValue(anIndex, myProgress.Next());
|
||||
}
|
||||
}
|
||||
|
||||
void operator () (int theMeshIndex) const
|
||||
{
|
||||
const std::shared_ptr<RWGltf_CafWriter::Mesh>& aCurrentMesh = myMeshes->at(theMeshIndex);
|
||||
if (aCurrentMesh->NodesVec.empty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Message_ProgressScope aScope(myRanges[theMeshIndex], NULL, 1);
|
||||
|
||||
draco::Mesh aMesh;
|
||||
writeNodesToDracoMesh (aMesh, aCurrentMesh->NodesVec);
|
||||
|
||||
if (!aCurrentMesh->NormalsVec.empty())
|
||||
{
|
||||
writeNormalsToDracoMesh (aMesh, aCurrentMesh->NormalsVec);
|
||||
}
|
||||
|
||||
if (!aCurrentMesh->TexCoordsVec.empty())
|
||||
{
|
||||
writeTexCoordsToDracoMesh (aMesh, aCurrentMesh->TexCoordsVec);
|
||||
}
|
||||
|
||||
writeIndicesToDracoMesh (aMesh, aCurrentMesh->IndicesVec);
|
||||
|
||||
std::shared_ptr<draco::EncoderBuffer> anEncoderBuffer = std::make_shared<draco::EncoderBuffer>();
|
||||
draco::Status aStatus = myDracoEncoder->EncodeMeshToBuffer (aMesh, anEncoderBuffer.get());
|
||||
if (aStatus.ok())
|
||||
{
|
||||
myEncoderBuffers->at(theMeshIndex) = anEncoderBuffer;
|
||||
}
|
||||
|
||||
aScope.Next();
|
||||
}
|
||||
|
||||
private:
|
||||
Message_ProgressScope myProgress;
|
||||
draco::Encoder* myDracoEncoder;
|
||||
NCollection_Array1<Message_ProgressRange> myRanges;
|
||||
const std::vector<std::shared_ptr<RWGltf_CafWriter::Mesh>>* myMeshes;
|
||||
std::vector<std::shared_ptr<draco::EncoderBuffer>>* myEncoderBuffers;
|
||||
};
|
||||
#endif
|
||||
|
||||
//================================================================
|
||||
// Function : Constructor
|
||||
// Purpose :
|
||||
@@ -183,7 +252,8 @@ RWGltf_CafWriter::RWGltf_CafWriter (const TCollection_AsciiString& theFile,
|
||||
myToEmbedTexturesInGlb (true),
|
||||
myToMergeFaces (false),
|
||||
myToSplitIndices16 (false),
|
||||
myBinDataLen64 (0)
|
||||
myBinDataLen64 (0),
|
||||
myToParallel (false)
|
||||
{
|
||||
myCSTrsf.SetOutputLengthUnit (1.0); // meters
|
||||
myCSTrsf.SetOutputCoordinateSystem (RWMesh_CoordinateSystem_glTF);
|
||||
@@ -535,6 +605,8 @@ bool RWGltf_CafWriter::writeBinData (const Handle(TDocStd_Document)& theDocument
|
||||
myBinDataMap.Clear();
|
||||
myBinDataLen64 = 0;
|
||||
|
||||
Message_ProgressScope aScope(theProgress, "Write binary data", myDracoParameters.DracoCompression ? 2 : 1);
|
||||
|
||||
const Handle(OSD_FileSystem)& aFileSystem = OSD_FileSystem::DefaultFileSystem();
|
||||
std::shared_ptr<std::ostream> aBinFile = aFileSystem->OpenOStream (myBinFileNameFull, std::ios::out | std::ios::binary);
|
||||
if (aBinFile.get() == NULL
|
||||
@@ -544,7 +616,7 @@ bool RWGltf_CafWriter::writeBinData (const Handle(TDocStd_Document)& theDocument
|
||||
return false;
|
||||
}
|
||||
|
||||
Message_ProgressScope aPSentryBin (theProgress, "Binary data", 4);
|
||||
Message_ProgressScope aPSentryBin (aScope.Next(), "Binary data", 4);
|
||||
const RWGltf_GltfArrayType anArrTypes[4] =
|
||||
{
|
||||
RWGltf_GltfArrayType_Position,
|
||||
@@ -795,7 +867,6 @@ bool RWGltf_CafWriter::writeBinData (const Handle(TDocStd_Document)& theDocument
|
||||
#ifdef HAVE_DRACO
|
||||
OSD_Timer aDracoTimer;
|
||||
aDracoTimer.Start();
|
||||
int aBuffId = 0;
|
||||
draco::Encoder aDracoEncoder;
|
||||
aDracoEncoder.SetAttributeQuantization (draco::GeometryAttribute::POSITION, myDracoParameters.QuantizePositionBits);
|
||||
aDracoEncoder.SetAttributeQuantization (draco::GeometryAttribute::NORMAL, myDracoParameters.QuantizeNormalBits);
|
||||
@@ -803,38 +874,23 @@ bool RWGltf_CafWriter::writeBinData (const Handle(TDocStd_Document)& theDocument
|
||||
aDracoEncoder.SetAttributeQuantization (draco::GeometryAttribute::COLOR, myDracoParameters.QuantizeColorBits);
|
||||
aDracoEncoder.SetAttributeQuantization (draco::GeometryAttribute::GENERIC, myDracoParameters.QuantizeGenericBits);
|
||||
aDracoEncoder.SetSpeedOptions (myDracoParameters.CompressionLevel, myDracoParameters.CompressionLevel);
|
||||
for (size_t aMeshInd = 0; aMeshInd != aMeshes.size(); ++aMeshInd)
|
||||
|
||||
std::vector<std::shared_ptr<draco::EncoderBuffer>> anEncoderBuffers(aMeshes.size());
|
||||
DracoEncodingFunctor aFunctor (aScope.Next(), aDracoEncoder, aMeshes, anEncoderBuffers);
|
||||
OSD_Parallel::For (0, int(aMeshes.size()), aFunctor, !myToParallel);
|
||||
|
||||
for (size_t aBuffInd = 0; aBuffInd != anEncoderBuffers.size(); ++aBuffInd)
|
||||
{
|
||||
const std::shared_ptr<RWGltf_CafWriter::Mesh>& aCurrentMesh = aMeshes[aMeshInd];
|
||||
if (aCurrentMesh->NodesVec.empty())
|
||||
if (anEncoderBuffers.at(aBuffInd).get() == nullptr)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
draco::Mesh aDracoMesh;
|
||||
writeNodesToDracoMesh (aDracoMesh, aCurrentMesh->NodesVec);
|
||||
if (!aCurrentMesh->NormalsVec.empty())
|
||||
{
|
||||
writeNormalsToDracoMesh (aDracoMesh, aCurrentMesh->NormalsVec);
|
||||
}
|
||||
if (!aCurrentMesh->TexCoordsVec.empty())
|
||||
{
|
||||
writeTexCoordsToDracoMesh (aDracoMesh, aCurrentMesh->TexCoordsVec);
|
||||
}
|
||||
writeIndicesToDracoMesh (aDracoMesh, aCurrentMesh->IndicesVec);
|
||||
|
||||
draco::EncoderBuffer anEncoderBuff;
|
||||
draco::Status aStatus = aDracoEncoder.EncodeMeshToBuffer (aDracoMesh, &anEncoderBuff);
|
||||
if (!aStatus.ok())
|
||||
{
|
||||
Message::SendFail (TCollection_AsciiString("Error: mesh cannot be encoded in draco buffer."));
|
||||
Message::SendFail(TCollection_AsciiString("Error: mesh not encoded in draco buffer."));
|
||||
return false;
|
||||
}
|
||||
|
||||
RWGltf_GltfBufferView aBuffViewDraco;
|
||||
aBuffViewDraco.Id = aBuffId++;
|
||||
aBuffViewDraco.Id = (int)aBuffInd;
|
||||
aBuffViewDraco.ByteOffset = aBinFile->tellp();
|
||||
aBinFile->write (anEncoderBuff.data(), std::streamsize(anEncoderBuff.size()));
|
||||
const draco::EncoderBuffer& anEncoderBuff = *anEncoderBuffers.at(aBuffInd);
|
||||
aBinFile->write(anEncoderBuff.data(), std::streamsize(anEncoderBuff.size()));
|
||||
if (!aBinFile->good())
|
||||
{
|
||||
Message::SendFail (TCollection_AsciiString("File '") + myBinFileNameFull + "' cannot be written");
|
||||
|
@@ -125,6 +125,12 @@ public:
|
||||
//! May reduce binary data size thanks to smaller triangle indexes.
|
||||
void SetSplitIndices16 (bool theToSplit) { myToSplitIndices16 = theToSplit; }
|
||||
|
||||
//! Return TRUE if multithreaded optimizations are allowed; FALSE by default.
|
||||
bool ToParallel() const { return myToParallel; }
|
||||
|
||||
//! Setup multithreaded execution.
|
||||
void SetParallel (bool theToParallel) { myToParallel = theToParallel; }
|
||||
|
||||
//! Return Draco parameters
|
||||
const RWGltf_DracoParameters& CompressionParameters() const { return myDracoParameters; }
|
||||
|
||||
@@ -397,6 +403,7 @@ protected:
|
||||
int64_t myBinDataLen64; //!< length of binary file
|
||||
|
||||
std::vector<RWGltf_GltfBufferView> myBuffViewsDraco; //!< vector of buffers view with compression data
|
||||
Standard_Boolean myToParallel; //!< flag to use multithreading; FALSE by default
|
||||
RWGltf_DracoParameters myDracoParameters; //!< Draco parameters
|
||||
};
|
||||
|
||||
|
@@ -56,14 +56,6 @@ bool RWPly_ConfigurationNode::Load(const Handle(DE_ConfigurationContext)& theRes
|
||||
InternalParameters.FileCS =
|
||||
(RWMesh_CoordinateSystem)(theResource->IntegerVal("file.cs", (int)InternalParameters.SystemCS, aScope) % 2);
|
||||
|
||||
InternalParameters.WritePntSet =
|
||||
theResource->BooleanVal("write.pnt.set", InternalParameters.WritePntSet, aScope);
|
||||
InternalParameters.WriteDistance =
|
||||
theResource->RealVal("write.distance", InternalParameters.WriteDistance, aScope);
|
||||
InternalParameters.WriteDensity =
|
||||
theResource->RealVal("write.density", InternalParameters.WriteDensity, aScope);
|
||||
InternalParameters.WriteTolerance =
|
||||
theResource->RealVal("write.tolerance", InternalParameters.WriteTolerance, aScope);
|
||||
InternalParameters.WriteNormals =
|
||||
theResource->BooleanVal("write.normals", InternalParameters.WriteNormals, aScope);
|
||||
InternalParameters.WriteColors =
|
||||
@@ -118,30 +110,6 @@ TCollection_AsciiString RWPly_ConfigurationNode::Save() const
|
||||
aResult += "!Write parameters:\n";
|
||||
aResult += "!\n";
|
||||
|
||||
aResult += "!\n";
|
||||
aResult += "!Flag for write point cloud instead without triangulation indices\n";
|
||||
aResult += "!Default value: 0(false). Available values: 0(false), 1(true)\n";
|
||||
aResult += aScope + "write.pnt.set :\t " + InternalParameters.WritePntSet + "\n";
|
||||
aResult += "!\n";
|
||||
|
||||
aResult += "!\n";
|
||||
aResult += "!Distance from shape into the range [0, Value]\n";
|
||||
aResult += "!Default value: 0. Available values: [0, Value]\n";
|
||||
aResult += aScope + "write.distance :\t " + InternalParameters.WriteDistance + "\n";
|
||||
aResult += "!\n";
|
||||
|
||||
aResult += "!\n";
|
||||
aResult += "!Density of points to generate randomly on surface\n";
|
||||
aResult += "!Default value: 2.e+100. Available values: [0, inf]\n";
|
||||
aResult += aScope + "write.density :\t " + InternalParameters.WriteDensity + "\n";
|
||||
aResult += "!\n";
|
||||
|
||||
aResult += "!\n";
|
||||
aResult += "!Internal tolerance\n";
|
||||
aResult += "!Default value: 1.e-7. Available values: [0, inf]\n";
|
||||
aResult += aScope + "write.tolerance :\t " + InternalParameters.WriteTolerance + "\n";
|
||||
aResult += "!\n";
|
||||
|
||||
aResult += "!\n";
|
||||
aResult += "!Flag for write normals\n";
|
||||
aResult += "!Default value: 1(true). Available values: 0(false), 1(true)\n";
|
||||
|
@@ -94,10 +94,6 @@ public:
|
||||
RWMesh_CoordinateSystem SystemCS = RWMesh_CoordinateSystem_Zup; //!< System origin coordinate system to perform conversion into during read
|
||||
RWMesh_CoordinateSystem FileCS = RWMesh_CoordinateSystem_Yup; //!< File origin coordinate system to perform conversion during read
|
||||
// Writing
|
||||
bool WritePntSet = false; //!< Flag for write point cloud instead without triangulation indices
|
||||
double WriteDistance = 0.0; //!< Distance from shape into the range [0, Value]
|
||||
double WriteDensity = Precision::Infinite(); //!< Density of points to generate randomly on surface
|
||||
double WriteTolerance = Precision::Confusion(); //!< Internal tolerance
|
||||
bool WriteNormals = true; //!< Flag for write normals
|
||||
bool WriteColors = true; //!< Flag for write colors
|
||||
bool WriteTexCoords = false; //!< Flag for write UV / texture coordinates
|
||||
|
@@ -14,7 +14,6 @@
|
||||
#include <RWPly_Provider.hxx>
|
||||
|
||||
#include <BRep_Builder.hxx>
|
||||
#include <BRepLib_PointCloudShape.hxx>
|
||||
#include <DE_Wrapper.hxx>
|
||||
#include <Message.hxx>
|
||||
#include <RWPly_ConfigurationNode.hxx>
|
||||
@@ -80,122 +79,34 @@ bool RWPly_Provider::Write(const TCollection_AsciiString& thePath,
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
if (aNode->InternalParameters.WritePntSet)
|
||||
TColStd_IndexedDataMapOfStringString aFileInfo;
|
||||
if (!aNode->InternalParameters.WriteAuthor.IsEmpty())
|
||||
{
|
||||
class PointCloudPlyWriter : public BRepLib_PointCloudShape, public RWPly_PlyWriterContext
|
||||
{
|
||||
public:
|
||||
PointCloudPlyWriter(Standard_Real theTol)
|
||||
: BRepLib_PointCloudShape(TopoDS_Shape(), theTol)
|
||||
{}
|
||||
|
||||
void AddFaceColor(const TopoDS_Shape& theFace, const Graphic3d_Vec4ub& theColor)
|
||||
{
|
||||
myFaceColor.Bind(theFace, theColor);
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual void addPoint(const gp_Pnt& thePoint,
|
||||
const gp_Vec& theNorm,
|
||||
const gp_Pnt2d& theUV,
|
||||
const TopoDS_Shape& theFace)
|
||||
{
|
||||
Graphic3d_Vec4ub aColor;
|
||||
myFaceColor.Find(theFace, aColor);
|
||||
RWPly_PlyWriterContext::WriteVertex(thePoint,
|
||||
Graphic3d_Vec3((float)theNorm.X(), (float)theNorm.Y(), (float)theNorm.Z()),
|
||||
Graphic3d_Vec2((float)theUV.X(), (float)theUV.Y()),
|
||||
aColor);
|
||||
}
|
||||
|
||||
private:
|
||||
NCollection_DataMap<TopoDS_Shape, Graphic3d_Vec4ub> myFaceColor;
|
||||
};
|
||||
|
||||
PointCloudPlyWriter aPlyCtx(aNode->InternalParameters.WriteTolerance);
|
||||
aPlyCtx.SetNormals(aNode->InternalParameters.WriteNormals);
|
||||
aPlyCtx.SetColors(aNode->InternalParameters.WriteColors);
|
||||
aPlyCtx.SetTexCoords(aNode->InternalParameters.WriteTexCoords);
|
||||
|
||||
TopoDS_Compound aComp;
|
||||
BRep_Builder().MakeCompound(aComp);
|
||||
for (XCAFPrs_DocumentExplorer aDocExplorer(theDocument, aRootLabels, XCAFPrs_DocumentExplorerFlags_OnlyLeafNodes);
|
||||
aDocExplorer.More(); aDocExplorer.Next())
|
||||
{
|
||||
const XCAFPrs_DocumentNode& aDocNode = aDocExplorer.Current();
|
||||
for (RWMesh_FaceIterator aFaceIter(aDocNode.RefLabel, aDocNode.Location, true, aDocNode.Style); aFaceIter.More(); aFaceIter.Next())
|
||||
{
|
||||
BRep_Builder().Add(aComp, aFaceIter.Face());
|
||||
Graphic3d_Vec4ub aColorVec(255);
|
||||
if (aFaceIter.HasFaceColor())
|
||||
{
|
||||
Graphic3d_Vec4 aColorF = aFaceIter.FaceColor();
|
||||
aColorVec.SetValues((unsigned char)int(aColorF.r() * 255.0f),
|
||||
(unsigned char)int(aColorF.g() * 255.0f),
|
||||
(unsigned char)int(aColorF.b() * 255.0f),
|
||||
(unsigned char)int(aColorF.a() * 255.0f));
|
||||
}
|
||||
aPlyCtx.AddFaceColor(aFaceIter.Face(), aColorVec);
|
||||
}
|
||||
}
|
||||
aPlyCtx.SetShape(aComp);
|
||||
Standard_Integer aNbPoints = aNode->InternalParameters.WriteDensity > 0
|
||||
? aPlyCtx.NbPointsByDensity(aNode->InternalParameters.WriteDensity)
|
||||
: aPlyCtx.NbPointsByTriangulation();
|
||||
if (aNbPoints <= 0)
|
||||
{
|
||||
Message::SendFail() << "Error in the RWPly_Provider during writing the file " <<
|
||||
thePath << "\t: Incorrect number of points";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!aPlyCtx.Open(thePath)
|
||||
|| !aPlyCtx.WriteHeader(aNbPoints, 0, TColStd_IndexedDataMapOfStringString()))
|
||||
{
|
||||
Message::SendFail() << "Error in the RWPly_Provider during writing the file " << thePath;
|
||||
return false;
|
||||
}
|
||||
|
||||
Standard_Boolean isDone = aNode->InternalParameters.WriteDensity > 0
|
||||
? aPlyCtx.GeneratePointsByDensity(aNode->InternalParameters.WriteDensity)
|
||||
: aPlyCtx.GeneratePointsByTriangulation();
|
||||
if (!isDone)
|
||||
{
|
||||
Message::SendFail() << "Error in the RWPly_Provider during writing the file "
|
||||
<< thePath << "\t: Error during generating point process";
|
||||
return false;
|
||||
}
|
||||
aFileInfo.Add("Author", aNode->InternalParameters.WriteAuthor);
|
||||
}
|
||||
else
|
||||
if (!aNode->InternalParameters.WriteComment.IsEmpty())
|
||||
{
|
||||
TColStd_IndexedDataMapOfStringString aFileInfo;
|
||||
if (!aNode->InternalParameters.WriteAuthor.IsEmpty())
|
||||
{
|
||||
aFileInfo.Add("Author", aNode->InternalParameters.WriteAuthor);
|
||||
}
|
||||
if (!aNode->InternalParameters.WriteComment.IsEmpty())
|
||||
{
|
||||
aFileInfo.Add("Comments", aNode->InternalParameters.WriteComment);
|
||||
}
|
||||
RWMesh_CoordinateSystemConverter aConverter;
|
||||
aConverter.SetInputLengthUnit(aNode->GlobalParameters.LengthUnit / 1000);
|
||||
aConverter.SetInputCoordinateSystem(aNode->InternalParameters.SystemCS);
|
||||
aConverter.SetOutputLengthUnit(aNode->InternalParameters.FileLengthUnit);
|
||||
aConverter.SetOutputCoordinateSystem(aNode->InternalParameters.FileCS);
|
||||
|
||||
RWPly_CafWriter aPlyCtx(thePath);
|
||||
aPlyCtx.SetNormals(aNode->InternalParameters.WriteNormals);
|
||||
aPlyCtx.SetColors(aNode->InternalParameters.WriteColors);
|
||||
aPlyCtx.SetTexCoords(aNode->InternalParameters.WriteTexCoords);
|
||||
aPlyCtx.SetPartId(aNode->InternalParameters.WritePartId);
|
||||
aPlyCtx.SetFaceId(aNode->InternalParameters.WriteFaceId);
|
||||
if (!aPlyCtx.Perform(theDocument, aFileInfo, theProgress))
|
||||
{
|
||||
Message::SendFail() << "Error in the RWPly_Provider during writing the file "
|
||||
<< thePath << "\t: Cannot perform the document";
|
||||
return false;
|
||||
}
|
||||
aFileInfo.Add("Comments", aNode->InternalParameters.WriteComment);
|
||||
}
|
||||
RWMesh_CoordinateSystemConverter aConverter;
|
||||
aConverter.SetInputLengthUnit(aNode->GlobalParameters.LengthUnit / 1000);
|
||||
aConverter.SetInputCoordinateSystem(aNode->InternalParameters.SystemCS);
|
||||
aConverter.SetOutputLengthUnit(aNode->InternalParameters.FileLengthUnit);
|
||||
aConverter.SetOutputCoordinateSystem(aNode->InternalParameters.FileCS);
|
||||
|
||||
RWPly_CafWriter aPlyCtx(thePath);
|
||||
aPlyCtx.SetNormals(aNode->InternalParameters.WriteNormals);
|
||||
aPlyCtx.SetColors(aNode->InternalParameters.WriteColors);
|
||||
aPlyCtx.SetTexCoords(aNode->InternalParameters.WriteTexCoords);
|
||||
aPlyCtx.SetPartId(aNode->InternalParameters.WritePartId);
|
||||
aPlyCtx.SetFaceId(aNode->InternalParameters.WriteFaceId);
|
||||
if (!aPlyCtx.Perform(theDocument, aFileInfo, theProgress))
|
||||
{
|
||||
Message::SendFail() << "Error in the RWPly_Provider during writing the file "
|
||||
<< thePath << "\t: Cannot perform the document";
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@@ -99,11 +99,42 @@ namespace
|
||||
return aPoly;
|
||||
}
|
||||
|
||||
protected:
|
||||
void Clear()
|
||||
{
|
||||
myNodes.Clear();
|
||||
myTriangles.Clear();
|
||||
}
|
||||
|
||||
private:
|
||||
NCollection_Vector<gp_XYZ> myNodes;
|
||||
NCollection_Vector<Poly_Triangle> myTriangles;
|
||||
};
|
||||
|
||||
class MultiDomainReader : public Reader
|
||||
{
|
||||
public:
|
||||
//! Add new solid
|
||||
//! Add triangulation to triangulation list for multi-domain case
|
||||
virtual void AddSolid() Standard_OVERRIDE
|
||||
{
|
||||
if (Handle(Poly_Triangulation) aCurrentTri = GetTriangulation())
|
||||
{
|
||||
myTriangulationList.Append(aCurrentTri);
|
||||
}
|
||||
Clear();
|
||||
}
|
||||
|
||||
//! Returns triangulation list for multi-domain case
|
||||
NCollection_Sequence<Handle(Poly_Triangulation)>& ChangeTriangulationList()
|
||||
{
|
||||
return myTriangulationList;
|
||||
}
|
||||
|
||||
private:
|
||||
NCollection_Sequence<Handle(Poly_Triangulation)> myTriangulationList;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
@@ -122,6 +153,22 @@ Handle(Poly_Triangulation) RWStl::ReadFile (const Standard_CString theFile,
|
||||
return aReader.GetTriangulation();
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
//function : ReadFile
|
||||
//purpose :
|
||||
//=============================================================================
|
||||
void RWStl::ReadFile(const Standard_CString theFile,
|
||||
const Standard_Real theMergeAngle,
|
||||
NCollection_Sequence<Handle(Poly_Triangulation)>& theTriangList,
|
||||
const Message_ProgressRange& theProgress)
|
||||
{
|
||||
MultiDomainReader aReader;
|
||||
aReader.SetMergeAngle (theMergeAngle);
|
||||
aReader.Read (theFile, theProgress);
|
||||
theTriangList.Clear();
|
||||
theTriangList.Append (aReader.ChangeTriangulationList());
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
//function : ReadFile
|
||||
//purpose :
|
||||
|
@@ -20,6 +20,7 @@
|
||||
#include <Poly_Triangulation.hxx>
|
||||
#include <Standard_Macro.hxx>
|
||||
#include <Message_ProgressScope.hxx>
|
||||
#include <NCollection_Sequence.hxx>
|
||||
|
||||
//! This class provides methods to read and write triangulation from / to the STL files.
|
||||
class RWStl
|
||||
@@ -61,7 +62,17 @@ public:
|
||||
Standard_EXPORT static Handle(Poly_Triangulation) ReadFile (const Standard_CString theFile,
|
||||
const Standard_Real theMergeAngle,
|
||||
const Message_ProgressRange& theProgress = Message_ProgressRange());
|
||||
|
||||
|
||||
//! Read specified STL file and fills triangulation list for multi-domain case.
|
||||
//! @param[in] theFile file path to read
|
||||
//! @param[in] theMergeAngle maximum angle in radians between triangles to merge equal nodes; M_PI/2 means ignore angle
|
||||
//! @param[out] theTriangList triangulation list for multi-domain case
|
||||
//! @param[in] theProgress progress indicator
|
||||
Standard_EXPORT static void ReadFile(const Standard_CString theFile,
|
||||
const Standard_Real theMergeAngle,
|
||||
NCollection_Sequence<Handle(Poly_Triangulation)>& theTriangList,
|
||||
const Message_ProgressRange& theProgress = Message_ProgressRange());
|
||||
|
||||
//! Read triangulation from a binary STL file
|
||||
//! In case of error, returns Null handle.
|
||||
Standard_EXPORT static Handle(Poly_Triangulation) ReadBinary (const OSD_Path& thePath,
|
||||
|
@@ -180,6 +180,7 @@ Standard_Boolean RWStl_Reader::Read (const char* theFile,
|
||||
}
|
||||
}
|
||||
*aStream >> std::ws; // skip any white spaces
|
||||
AddSolid();
|
||||
}
|
||||
return ! aStream->fail();
|
||||
}
|
||||
@@ -300,6 +301,11 @@ Standard_Boolean RWStl_Reader::ReadAscii (Standard_IStream& theStream,
|
||||
|
||||
// skip header "solid ..."
|
||||
aLine = theBuffer.ReadLine (theStream, aLineLen);
|
||||
// skip empty lines
|
||||
while (aLine && !*aLine)
|
||||
{
|
||||
aLine = theBuffer.ReadLine (theStream, aLineLen);
|
||||
}
|
||||
if (aLine == NULL)
|
||||
{
|
||||
Message::SendFail ("Error: premature end of file");
|
||||
|
@@ -39,7 +39,8 @@ public:
|
||||
Standard_EXPORT RWStl_Reader();
|
||||
|
||||
//! Reads data from STL file (either binary or Ascii).
|
||||
//! This function supports reading multi-domain STL files formed by concatenation of several "plain" files.
|
||||
//! This function supports reading multi-domain STL files formed by concatenation
|
||||
//! of several "plain" files.
|
||||
//! The mesh nodes are not merged between domains.
|
||||
//! Unicode paths can be given in UTF-8 encoding.
|
||||
//! Format is recognized automatically by analysis of the file header.
|
||||
@@ -84,6 +85,9 @@ public:
|
||||
//! Should create new triangle built on specified nodes in the target model.
|
||||
virtual void AddTriangle (Standard_Integer theN1, Standard_Integer theN2, Standard_Integer theN3) = 0;
|
||||
|
||||
//! Callback function to be implemented in descendant.
|
||||
//! Should create a new triangulation for a solid in multi-domain case.
|
||||
virtual void AddSolid() {}
|
||||
public:
|
||||
|
||||
//! Return merge tolerance; M_PI/2 by default - all nodes are merged regardless angle between triangles.
|
||||
|
@@ -3365,17 +3365,17 @@ static void setDimObjectToXCAF(const Handle(Standard_Transient)& theEnt,
|
||||
if (anUnit.IsNull()) continue;
|
||||
if (!(anUnit.CaseNum(anUnit.Value()) == 1)) continue;
|
||||
Handle(StepBasic_NamedUnit) NU = anUnit.NamedUnit();
|
||||
STEPConstruct_UnitContext anUnitCtx;
|
||||
anUnitCtx.ComputeFactors(NU);
|
||||
if (aMWU->IsKind(STANDARD_TYPE(StepBasic_LengthMeasureWithUnit)) ||
|
||||
aMWU->IsKind(STANDARD_TYPE(StepRepr_ReprItemAndLengthMeasureWithUnitAndQRI)))
|
||||
{
|
||||
aVal = aVal * anUnitCtx.LengthFactor();
|
||||
}
|
||||
else if (aMWU->IsKind(STANDARD_TYPE(StepBasic_PlaneAngleMeasureWithUnit)) ||
|
||||
STEPConstruct_UnitContext anUnitCtxUpperBound;
|
||||
anUnitCtxUpperBound.ComputeFactors(NU);
|
||||
if (aMWU->IsKind(STANDARD_TYPE(StepBasic_PlaneAngleMeasureWithUnit)) ||
|
||||
aMWU->IsKind(STANDARD_TYPE(StepRepr_ReprItemAndPlaneAngleMeasureWithUnitAndQRI)))
|
||||
{
|
||||
convertAngleValue(anUnitCtx, aVal);
|
||||
convertAngleValue(anUnitCtxUpperBound, aVal);
|
||||
}
|
||||
else if ((aMWU->IsKind(STANDARD_TYPE(StepBasic_MeasureWithUnit)) && anUnitCtxUpperBound.LengthFactor() > 0.) ||
|
||||
aMWU->IsKind(STANDARD_TYPE(StepRepr_ReprItemAndLengthMeasureWithUnitAndQRI)))
|
||||
{
|
||||
aVal = aVal * anUnitCtxUpperBound.LengthFactor();
|
||||
}
|
||||
aDim3 = aVal;
|
||||
|
||||
@@ -3401,16 +3401,17 @@ static void setDimObjectToXCAF(const Handle(Standard_Transient)& theEnt,
|
||||
if (anUnit.IsNull()) continue;
|
||||
if (!(anUnit.CaseNum(anUnit.Value()) == 1)) continue;
|
||||
NU = anUnit.NamedUnit();
|
||||
anUnitCtx.ComputeFactors(NU);
|
||||
if (aMWU->IsKind(STANDARD_TYPE(StepBasic_LengthMeasureWithUnit)) ||
|
||||
aMWU->IsKind(STANDARD_TYPE(StepRepr_ReprItemAndLengthMeasureWithUnitAndQRI)))
|
||||
{
|
||||
aVal = aVal * anUnitCtx.LengthFactor();
|
||||
}
|
||||
else if (aMWU->IsKind(STANDARD_TYPE(StepBasic_PlaneAngleMeasureWithUnit)) ||
|
||||
STEPConstruct_UnitContext anUnitCtxLowerBound;
|
||||
anUnitCtxLowerBound.ComputeFactors(NU);
|
||||
if (aMWU->IsKind(STANDARD_TYPE(StepBasic_PlaneAngleMeasureWithUnit)) ||
|
||||
aMWU->IsKind(STANDARD_TYPE(StepRepr_ReprItemAndPlaneAngleMeasureWithUnitAndQRI)))
|
||||
{
|
||||
convertAngleValue(anUnitCtx, aVal);
|
||||
convertAngleValue(anUnitCtxLowerBound, aVal);
|
||||
}
|
||||
else if ((aMWU->IsKind(STANDARD_TYPE(StepBasic_MeasureWithUnit)) && anUnitCtxLowerBound.LengthFactor() > 0.) ||
|
||||
aMWU->IsKind(STANDARD_TYPE(StepRepr_ReprItemAndLengthMeasureWithUnitAndQRI)))
|
||||
{
|
||||
aVal = aVal * anUnitCtxLowerBound.LengthFactor();
|
||||
}
|
||||
aDim2 = Abs(aVal);
|
||||
}
|
||||
|
@@ -141,13 +141,18 @@ static Standard_Integer tolerance
|
||||
static Standard_Integer projface
|
||||
(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
|
||||
{
|
||||
if (argc < 4) { di<<"Give FACE name and X Y [Z]\n"; return 1 /* Error */; }
|
||||
if (argc < 4)
|
||||
{
|
||||
di << "Give FACE name and X Y [Z]\n";
|
||||
return 1;
|
||||
}
|
||||
Standard_CString arg1 = argv[1];
|
||||
TopoDS_Shape Shape = DBRep::Get(arg1);
|
||||
if (Shape.IsNull()) { di<<"Shape unknown : "<<arg1<<"\n"; return 1 /* Error */; }
|
||||
if (Shape.ShapeType() != TopAbs_FACE) { di<<"Not a face\n"; return 1 /* Error */; }
|
||||
TopoDS_Face F = TopoDS::Face (Shape);
|
||||
Handle(Geom_Surface) thesurf = BRep_Tool::Surface (F); // pas locface
|
||||
BRepTopAdaptor_FClass2d aClassifier (F, Precision::Confusion());
|
||||
// On y va
|
||||
Standard_Real X,Y,Z,U,V;
|
||||
X = U = Draw::Atof (argv[2]);
|
||||
@@ -167,28 +172,52 @@ static Standard_Integer projface
|
||||
|
||||
GeomAPI_ProjectPointOnSurf proj(P3D, thesurf, uf-du, ul+du, vf-dv, vl+dv);
|
||||
Standard_Integer sol, nPSurf = proj.NbPoints();
|
||||
di<<" Found "<<nPSurf<<" Points\n";
|
||||
Standard_Integer anIndSol = 0, anIndMin = 0;
|
||||
Standard_Real aMinDist = RealLast();
|
||||
for (sol = 1; sol <= nPSurf; sol ++) {
|
||||
di<<"n0 "<<sol<<" Distance "<<proj.Distance(sol);
|
||||
|
||||
proj.Parameters(sol, U,V);
|
||||
di<<" U = "<<U<<" V = "<<V<<"\n";
|
||||
TopAbs_State aStatus = aClassifier.Perform (gp_Pnt2d (U,V));
|
||||
if (aStatus == TopAbs_OUT)
|
||||
continue;
|
||||
|
||||
anIndSol++;
|
||||
Standard_Real aDist = proj.Distance(sol);
|
||||
di << "n0 " << anIndSol << " Distance " << aDist;
|
||||
di << " U = " << U << " V = " << V << "\n";
|
||||
|
||||
if (aDist < aMinDist)
|
||||
{
|
||||
aMinDist = aDist;
|
||||
anIndMin = sol;
|
||||
}
|
||||
|
||||
// reprojection
|
||||
P3D = thesurf->Value (U,V);
|
||||
di<<" => reproj X = "<<P3D.X()<<" Y = "<<P3D.Y()<<" Z = "<<P3D.Z()<<"\n";
|
||||
}
|
||||
// Que donne ShapeTool ?
|
||||
P3D.SetCoord (X,Y,Z);
|
||||
Handle(ShapeAnalysis_Surface) su = new ShapeAnalysis_Surface(thesurf);
|
||||
gp_Pnt2d suval = su->ValueOfUV (P3D,BRep_Tool::Tolerance(F));
|
||||
suval.Coord(U,V);
|
||||
di<<"** ShapeAnalysis_Surface gives U = "<<U<<" V = "<<V<<"\n";
|
||||
P3D = thesurf->Value(U,V);
|
||||
di<<" => reproj X = "<<P3D.X()<<" Y = "<<P3D.Y()<<" Z = "<<P3D.Z()<<"\n";
|
||||
di<<" Found "<<anIndSol<<" Points\n";
|
||||
|
||||
} else {
|
||||
di<<" Point UV U = "<<U<<" V = "<<V<<"\n";
|
||||
gp_Pnt P3D = thesurf->Value(U,V);
|
||||
di<<" => proj X = "<<P3D.X()<<" Y = "<<P3D.Y()<<" Z = "<<P3D.Z()<<"\n";
|
||||
if (anIndMin != 0) //there is at least one suitable solution
|
||||
{
|
||||
di << "** Minimal distance to face = " << aMinDist << "\n";
|
||||
proj.Parameters(anIndMin, U,V);
|
||||
di << "** Solution of minimal distance: U = " << U << " V = " << V << "\n";
|
||||
P3D = thesurf->Value(U,V);
|
||||
di<<" => reproj X = "<<P3D.X()<<" Y = "<<P3D.Y()<<" Z = "<<P3D.Z()<<"\n";
|
||||
}
|
||||
}
|
||||
else //Check 2D point
|
||||
{
|
||||
di << " Point UV U = " << U << " V = " << V << "\n";
|
||||
TopAbs_State aStatus = aClassifier.Perform (gp_Pnt2d (U,V));
|
||||
if (aStatus == TopAbs_OUT)
|
||||
di << "does not belong to the face" << "\n";
|
||||
else
|
||||
{
|
||||
gp_Pnt P3D = thesurf->Value(U,V);
|
||||
di << " => proj X = " << P3D.X() << " Y = " << P3D.Y() << " Z = " << P3D.Z() << "\n";
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -1199,7 +1228,7 @@ Standard_Integer getanacurve(Draw_Interpretor& di,
|
||||
Standard_CString g = SWDRAW::GroupName();
|
||||
|
||||
theCommands.Add ("tolerance","shape [tolmin tolmax:real]", __FILE__,tolerance,g);
|
||||
theCommands.Add ("projface","nom_face X Y [Z]", __FILE__,projface,g);
|
||||
theCommands.Add ("projface","nom_face X Y [Z] - returns the closest orthogonal projection if exists", __FILE__,projface,g);
|
||||
theCommands.Add ("projcurve","nom_edge | curve3d | curve3d first last + X Y Z",
|
||||
__FILE__,projcurve,g);
|
||||
theCommands.Add("projpcurve", "edge face tol x y z [start_param]",
|
||||
|
@@ -81,17 +81,14 @@ Handle(Select3D_SensitiveEntity) Select3D_SensitiveCylinder::GetConnected()
|
||||
Select3D_BndBox3d Select3D_SensitiveCylinder::BoundingBox()
|
||||
{
|
||||
Standard_Real aMaxRad = Max (myBottomRadius, myTopRadius);
|
||||
gp_Pnt aCenterBottom (0, 0, 0);
|
||||
gp_Pnt aCenterTop (0, 0, myHeight);
|
||||
aCenterBottom.Transform (myTrsf);
|
||||
aCenterTop.Transform (myTrsf);
|
||||
const SelectMgr_Vec3 aMinPnt (Min (aCenterBottom.X(), aCenterTop.X()) - aMaxRad,
|
||||
Min (aCenterBottom.Y(), aCenterTop.Y()) - aMaxRad,
|
||||
Min (aCenterBottom.Z(), aCenterTop.Z()) - aMaxRad);
|
||||
const SelectMgr_Vec3 aMaxPnt (Max (aCenterBottom.X(), aCenterTop.X()) + aMaxRad,
|
||||
Max (aCenterBottom.Y(), aCenterTop.Y()) + aMaxRad,
|
||||
Max (aCenterBottom.Z(), aCenterTop.Z()) + aMaxRad);
|
||||
return Select3D_BndBox3d (aMinPnt, aMaxPnt);
|
||||
Graphic3d_Mat4d aTrsf;
|
||||
myTrsf.GetMat4 (aTrsf);
|
||||
|
||||
Select3D_BndBox3d aBox (SelectMgr_Vec3 (-aMaxRad, -aMaxRad, 0),
|
||||
SelectMgr_Vec3 (aMaxRad, aMaxRad, myHeight));
|
||||
aBox.Transform (aTrsf);
|
||||
|
||||
return aBox;
|
||||
}
|
||||
|
||||
//==================================================
|
||||
|
@@ -54,6 +54,18 @@ public:
|
||||
//! Returns center of the cylinder with transformation applied
|
||||
Standard_EXPORT virtual gp_Pnt CenterOfGeometry() const Standard_OVERRIDE;
|
||||
|
||||
//! Returns cylinder transformation
|
||||
const gp_Trsf& Transformation() const { return myTrsf; }
|
||||
|
||||
//! Returns cylinder top radius
|
||||
Standard_Real TopRadius() const { return myTopRadius; }
|
||||
|
||||
//! Returns cylinder bottom radius
|
||||
Standard_Real BottomRadius() const { return myBottomRadius; }
|
||||
|
||||
//! Returns cylinder height
|
||||
Standard_Real Height() const { return myHeight; }
|
||||
|
||||
protected:
|
||||
gp_Trsf myTrsf; //!< cylinder transformation to apply
|
||||
Standard_Real myBottomRadius; //!< cylinder bottom radius
|
||||
|
@@ -13,6 +13,7 @@
|
||||
|
||||
#include <SelectMgr.hxx>
|
||||
|
||||
#include <Geom_Circle.hxx>
|
||||
#include <Graphic3d_ArrayOfPoints.hxx>
|
||||
#include <Graphic3d_AspectMarker3d.hxx>
|
||||
#include <Poly_Triangulation.hxx>
|
||||
@@ -22,6 +23,7 @@
|
||||
#include <TColgp_HArray1OfPnt.hxx>
|
||||
#include <TColgp_SequenceOfPnt.hxx>
|
||||
#include <Select3D_SensitiveBox.hxx>
|
||||
#include <Select3D_SensitiveCylinder.hxx>
|
||||
#include <Select3D_SensitiveEntity.hxx>
|
||||
#include <Select3D_SensitiveFace.hxx>
|
||||
#include <Select3D_SensitivePoint.hxx>
|
||||
@@ -130,6 +132,43 @@ namespace
|
||||
theSeqLines.Append (aPoints);
|
||||
}
|
||||
}
|
||||
|
||||
//! Fill in cylinder polylines.
|
||||
static void addCylinder (Prs3d_NListOfSequenceOfPnt& theSeqLines,
|
||||
const Handle(Select3D_SensitiveCylinder)& theSensCyl)
|
||||
{
|
||||
Handle(TColgp_HSequenceOfPnt) aVertLines[2];
|
||||
aVertLines[0] = new TColgp_HSequenceOfPnt();
|
||||
aVertLines[1] = new TColgp_HSequenceOfPnt();
|
||||
const gp_Trsf& aTrsf = theSensCyl->Transformation();
|
||||
const Standard_Real aHeight = theSensCyl->Height();
|
||||
const Standard_Real anUStep = 0.1;
|
||||
|
||||
for (int aCircNum = 0; aCircNum < 3; aCircNum++)
|
||||
{
|
||||
Standard_Real aRadius = 0.5 * (2 - aCircNum) * theSensCyl->BottomRadius()
|
||||
+ 0.5 * aCircNum * theSensCyl->TopRadius();
|
||||
Geom_Circle aGeom (gp_Ax2(), aRadius);
|
||||
Handle(TColgp_HSequenceOfPnt) aPoints = new TColgp_HSequenceOfPnt();
|
||||
gp_XYZ aVec (0, 0, aHeight * 0.5 * aCircNum);
|
||||
|
||||
if (aCircNum != 1)
|
||||
{
|
||||
aVertLines[0]->Append (gp_Pnt(aGeom.Value (0).Coord() + aVec).Transformed (aTrsf));
|
||||
aVertLines[1]->Append (gp_Pnt(aGeom.Value (M_PI).Coord() + aVec).Transformed (aTrsf));
|
||||
}
|
||||
|
||||
for (Standard_Real anU = 0.0f; anU < (2.0 * M_PI + anUStep); anU += anUStep)
|
||||
{
|
||||
gp_Pnt aCircPnt = aGeom.Value (anU).Coord() + aVec;
|
||||
aCircPnt.Transform (aTrsf);
|
||||
aPoints->Append (aCircPnt);
|
||||
}
|
||||
theSeqLines.Append (aPoints);
|
||||
}
|
||||
theSeqLines.Append (aVertLines[0]);
|
||||
theSeqLines.Append (aVertLines[1]);
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -152,6 +191,10 @@ void SelectMgr::ComputeSensitivePrs (const Handle(Graphic3d_Structure)& thePrs,
|
||||
{
|
||||
addBoundingBox (aSeqLines, aSensBox, theLoc);
|
||||
}
|
||||
else if (Handle(Select3D_SensitiveCylinder) aSensCyl = Handle(Select3D_SensitiveCylinder)::DownCast (anEnt))
|
||||
{
|
||||
addCylinder (aSeqLines, aSensCyl);
|
||||
}
|
||||
else if (Handle(Select3D_SensitiveFace) aFace = Handle(Select3D_SensitiveFace)::DownCast(anEnt))
|
||||
{
|
||||
Handle(TColgp_HArray1OfPnt) aSensPnts;
|
||||
|
@@ -46,9 +46,3 @@ ShapeAnalysis_WireVertex.cxx
|
||||
ShapeAnalysis_WireVertex.hxx
|
||||
ShapeAnalysis_CanonicalRecognition.cxx
|
||||
ShapeAnalysis_CanonicalRecognition.hxx
|
||||
ShapeAnalysis_FuncSphereLSDist.cxx
|
||||
ShapeAnalysis_FuncSphereLSDist.hxx
|
||||
ShapeAnalysis_FuncCylinderLSDist.cxx
|
||||
ShapeAnalysis_FuncCylinderLSDist.hxx
|
||||
ShapeAnalysis_FuncConeLSDist.cxx
|
||||
ShapeAnalysis_FuncConeLSDist.hxx
|
||||
|
@@ -51,9 +51,9 @@
|
||||
#include <BRepLib_FindSurface.hxx>
|
||||
#include <TColgp_HArray1OfXYZ.hxx>
|
||||
#include <math_Vector.hxx>
|
||||
#include <ShapeAnalysis_FuncSphereLSDist.hxx>
|
||||
#include <ShapeAnalysis_FuncCylinderLSDist.hxx>
|
||||
#include <ShapeAnalysis_FuncConeLSDist.hxx>
|
||||
#include <GeomConvert_FuncSphereLSDist.hxx>
|
||||
#include <GeomConvert_FuncCylinderLSDist.hxx>
|
||||
#include <GeomConvert_FuncConeLSDist.hxx>
|
||||
#include <BRepAdaptor_Curve.hxx>
|
||||
#include <GCPnts_AbscissaPoint.hxx>
|
||||
#include <GCPnts_QuasiUniformAbscissa.hxx>
|
||||
@@ -834,9 +834,9 @@ Standard_Boolean ShapeAnalysis_CanonicalRecognition::GetSurfaceByLS(const TopoDS
|
||||
//
|
||||
Standard_Real aTol = Precision::Confusion();
|
||||
math_MultipleVarFunction* aPFunc;
|
||||
ShapeAnalysis_FuncSphereLSDist aFuncSph(aPoints);
|
||||
ShapeAnalysis_FuncCylinderLSDist aFuncCyl(aPoints, thePos.Direction());
|
||||
ShapeAnalysis_FuncConeLSDist aFuncCon(aPoints, thePos.Direction());
|
||||
GeomConvert_FuncSphereLSDist aFuncSph(aPoints);
|
||||
GeomConvert_FuncCylinderLSDist aFuncCyl(aPoints, thePos.Direction());
|
||||
GeomConvert_FuncConeLSDist aFuncCon(aPoints, thePos.Direction());
|
||||
if (theTarget == GeomAbs_Sphere)
|
||||
{
|
||||
aPFunc = (math_MultipleVarFunction*)&aFuncSph;
|
||||
|
@@ -982,84 +982,24 @@ Standard_Boolean ShapeFix_IntersectionTool::FixSelfIntersectWire
|
||||
break;
|
||||
}
|
||||
}
|
||||
if( ModifE1 == ModifE2 ) {
|
||||
if( !ModifE1 && !ModifE2 ) {
|
||||
gp_Pnt P0( (pi1.X()+pi2.X())/2, (pi1.Y()+pi2.Y())/2, (pi1.Z()+pi2.Z())/2 );
|
||||
tolV = Max( (pi1.Distance(pi2)/2)*1.00001, Precision::Confusion() );
|
||||
B.MakeVertex(V,P0,tolV);
|
||||
MaxTolVert = Max(MaxTolVert,tolV);
|
||||
if( !ModifE1 && !ModifE2 ) {
|
||||
Standard_Boolean isEdgeSplit2 = SplitEdge1(sewd, face, num2, param2,
|
||||
V, tolV, boxes);
|
||||
if(isEdgeSplit2) {
|
||||
NbSplit++;
|
||||
num2--;
|
||||
}
|
||||
if(SplitEdge1(sewd, face, num1, param1, V, tolV, boxes)) {
|
||||
NbSplit++;
|
||||
num1--;
|
||||
break;
|
||||
}
|
||||
if(isEdgeSplit2)
|
||||
continue;
|
||||
Standard_Boolean isEdgeSplit2 = SplitEdge1(sewd, face, num2, param2,
|
||||
V, tolV, boxes);
|
||||
if(isEdgeSplit2) {
|
||||
NbSplit++;
|
||||
num2--;
|
||||
}
|
||||
else if (PVF1.Distance(PVF2) < MaxTolVert || PVF1.Distance(PVL2) < MaxTolVert ||
|
||||
PVL1.Distance(PVF2) < MaxTolVert || PVL1.Distance(PVL2) < MaxTolVert)
|
||||
{
|
||||
ShapeBuild_Edge sbe;
|
||||
ShapeAnalysis_Edge sae;
|
||||
Standard_Real dist1 = pi1.Distance(PVF1);
|
||||
Standard_Real dist2 = pi1.Distance(PVL1);
|
||||
TopoDS_Edge NewE1, NewAjE1, edgeAj1;
|
||||
Standard_Integer n;
|
||||
if(dist1 < dist2)
|
||||
{
|
||||
NewE1 = sbe.CopyReplaceVertices(edge1,V,VL1);
|
||||
n = num1 - 1;
|
||||
edgeAj1 = sewd->Edge(n);
|
||||
NewAjE1 = sbe.CopyReplaceVertices(edgeAj1,sae.FirstVertex(edgeAj1),V);
|
||||
}
|
||||
else
|
||||
{
|
||||
NewE1 = sbe.CopyReplaceVertices(edge1,VF1,V);
|
||||
n = num1 + 1;
|
||||
edgeAj1 = sewd->Edge(n);
|
||||
NewAjE1 = sbe.CopyReplaceVertices(edgeAj1,V,sae.LastVertex(edgeAj1));
|
||||
}
|
||||
myContext->Replace(edge1,NewE1);
|
||||
myContext->Replace(edgeAj1,NewAjE1);
|
||||
sewd->Set(NewE1,num1);
|
||||
sewd->Set(NewAjE1,n);
|
||||
boxes.Bind(NewE1,B1);
|
||||
Bnd_Box2d BAj1 = boxes.Find(edgeAj1);
|
||||
boxes.Bind(NewAjE1,BAj1);
|
||||
edge1 = NewE1;
|
||||
|
||||
dist1 = pi2.Distance(PVF2);
|
||||
dist2 = pi2.Distance(PVL2);
|
||||
TopoDS_Edge NewE2, NewAjE2, edgeAj2;
|
||||
if(dist1 < dist2)
|
||||
{
|
||||
NewE2 = sbe.CopyReplaceVertices(edge2,V,VL2);
|
||||
n = num2 - 1;
|
||||
edgeAj2 = sewd->Edge(n);
|
||||
NewAjE2 = sbe.CopyReplaceVertices(edgeAj2,sae.FirstVertex(edgeAj2),V);
|
||||
}
|
||||
else
|
||||
{
|
||||
NewE2 = sbe.CopyReplaceVertices(edge2,VF2,V);
|
||||
n = (num2 + 1 > sewd->NbEdges())?(num2 + 1 - sewd->NbEdges()):(num2 + 1);
|
||||
edgeAj2 = sewd->Edge(n);
|
||||
NewAjE2 = sbe.CopyReplaceVertices(edgeAj2,V,sae.LastVertex(edgeAj2));
|
||||
}
|
||||
myContext->Replace(edge2,NewE2);
|
||||
myContext->Replace(edgeAj2,NewAjE2);
|
||||
sewd->Set(NewE2,num2);
|
||||
sewd->Set(NewAjE2,n);
|
||||
boxes.Bind(NewE2,B2);
|
||||
Bnd_Box2d BAj2 = boxes.Find(edgeAj2);
|
||||
boxes.Bind(NewAjE2,BAj2);
|
||||
edge2 = NewE2;
|
||||
if(SplitEdge1(sewd, face, num1, param1, V, tolV, boxes)) {
|
||||
NbSplit++;
|
||||
num1--;
|
||||
break;
|
||||
}
|
||||
if(isEdgeSplit2)
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if( Tr1.PositionOnCurve() == IntRes2d_Middle &&
|
||||
@@ -1376,29 +1316,6 @@ Standard_Boolean ShapeFix_IntersectionTool::FixSelfIntersectWire
|
||||
if(P01.Distance(PV12)<tolV1) {
|
||||
tolV1 += P01.Distance(PV12);
|
||||
B.UpdateVertex(NewV1,tolV1);
|
||||
TopoDS_Edge NewE = sbe.CopyReplaceVertices(edge2,NewV1,V22);
|
||||
myContext->Replace(edge2,NewE);
|
||||
sewd->Set(NewE,num2+dnum1);
|
||||
boxes.Bind(NewE,B2); // update boxes
|
||||
edge2 = NewE;
|
||||
TopoDS_Edge eprev = sewd->Edge(num2+dnum1-1);
|
||||
if (sae.LastVertex(eprev).IsSame(V12))
|
||||
{
|
||||
TopoDS_Vertex VLprev = sae.LastVertex(eprev);
|
||||
TopoDS_Edge NewEprev =
|
||||
sbe.CopyReplaceVertices(eprev,sae.FirstVertex(eprev),NewV1);
|
||||
myContext->Replace(eprev,NewEprev);
|
||||
sewd->Set(NewEprev,num2+dnum1-1);
|
||||
Bnd_Box2d Bprev = boxes.Find(eprev);
|
||||
boxes.Bind(NewEprev,Bprev); // update boxes
|
||||
|
||||
if(VLprev.Orientation()==NewV1.Orientation()) {
|
||||
myContext->Replace(VLprev,NewV1);
|
||||
}
|
||||
else {
|
||||
myContext->Replace(VLprev,NewV1.Reversed());
|
||||
}
|
||||
}
|
||||
if(V12.Orientation()==NewV1.Orientation()) {
|
||||
myContext->Replace(V12,NewV1);
|
||||
V12 = NewV1;
|
||||
@@ -1408,36 +1325,16 @@ Standard_Boolean ShapeFix_IntersectionTool::FixSelfIntersectWire
|
||||
V12 = TopoDS::Vertex(NewV1.Reversed());
|
||||
}
|
||||
nbReplaced++; //gka 06.09.04
|
||||
akey1 = 1;
|
||||
}
|
||||
if(P01.Distance(PV22)<tolV1) {
|
||||
tolV1 += P01.Distance(PV22);
|
||||
B.UpdateVertex(NewV1,tolV1);
|
||||
TopoDS_Edge NewE = sbe.CopyReplaceVertices(edge2,V12,NewV1);
|
||||
TopoDS_Edge NewE = sbe.CopyReplaceVertices(edge2,NewV1,V22);
|
||||
myContext->Replace(edge2,NewE);
|
||||
sewd->Set(NewE,num2+dnum1);
|
||||
boxes.Bind(NewE,B2); // update boxes
|
||||
edge2 = NewE;
|
||||
Standard_Integer n =
|
||||
(num2+dnum1+1 > sewd->NbEdges())?(num2+dnum1+1 - sewd->NbEdges()):(num2+dnum1+1);
|
||||
TopoDS_Edge enext = sewd->Edge(n);
|
||||
if (sae.FirstVertex(enext).IsSame(V22))
|
||||
{
|
||||
TopoDS_Vertex VFnext = sae.FirstVertex(enext);
|
||||
TopoDS_Edge NewEnext =
|
||||
sbe.CopyReplaceVertices(enext,NewV1,sae.LastVertex(enext));
|
||||
myContext->Replace(enext,NewEnext);
|
||||
sewd->Set(NewEnext,n);
|
||||
Bnd_Box2d Bnext = boxes.Find(enext);
|
||||
boxes.Bind(NewEnext,Bnext); // update boxes
|
||||
|
||||
if(VFnext.Orientation()==NewV1.Orientation()) {
|
||||
myContext->Replace(VFnext,NewV1);
|
||||
}
|
||||
else {
|
||||
myContext->Replace(VFnext,NewV1.Reversed());
|
||||
}
|
||||
}
|
||||
akey1 = 1;
|
||||
}
|
||||
if(P01.Distance(PV22)<tolV1) {
|
||||
tolV1 += P01.Distance(PV22);
|
||||
B.UpdateVertex(NewV1,tolV1);
|
||||
if(V22.Orientation()==NewV1.Orientation()) {
|
||||
myContext->Replace(V22,NewV1);
|
||||
V22 = NewV1;
|
||||
@@ -1447,34 +1344,16 @@ Standard_Boolean ShapeFix_IntersectionTool::FixSelfIntersectWire
|
||||
V22 = TopoDS::Vertex(NewV1.Reversed());
|
||||
}
|
||||
nbReplaced++; //gka 06.09.04
|
||||
TopoDS_Edge NewE = sbe.CopyReplaceVertices(edge2,V12,NewV1);
|
||||
myContext->Replace(edge2,NewE);
|
||||
sewd->Set(NewE,num2+dnum1);
|
||||
boxes.Bind(NewE,B2); // update boxes
|
||||
edge2 = NewE;
|
||||
akey1 = 2;
|
||||
}
|
||||
if(P02.Distance(PV12)<tolV2) {
|
||||
tolV2 += P02.Distance(PV12);
|
||||
B.UpdateVertex(NewV2,tolV2);
|
||||
TopoDS_Edge NewE = sbe.CopyReplaceVertices(edge2,NewV2,V22);
|
||||
myContext->Replace(edge2,NewE);
|
||||
sewd->Set(NewE,num2+dnum1);
|
||||
boxes.Bind(NewE,B2); // update boxes
|
||||
edge2 = NewE;
|
||||
TopoDS_Edge eprev = sewd->Edge(num2+dnum1-1);
|
||||
if (sae.LastVertex(eprev).IsSame(V12))
|
||||
{
|
||||
TopoDS_Vertex VLprev = sae.LastVertex(eprev);
|
||||
TopoDS_Edge NewEprev =
|
||||
sbe.CopyReplaceVertices(eprev,sae.FirstVertex(eprev),NewV2);
|
||||
myContext->Replace(eprev,NewEprev);
|
||||
sewd->Set(NewEprev,num2+dnum1-1);
|
||||
Bnd_Box2d Bprev = boxes.Find(eprev);
|
||||
boxes.Bind(NewEprev,Bprev); // update boxes
|
||||
|
||||
if(VLprev.Orientation()==NewV2.Orientation()) {
|
||||
myContext->Replace(VLprev,NewV2);
|
||||
}
|
||||
else {
|
||||
myContext->Replace(VLprev,NewV2.Reversed());
|
||||
}
|
||||
}
|
||||
if(V12.Orientation()==NewV2.Orientation()) {
|
||||
myContext->Replace(V12,NewV2);
|
||||
V12 = NewV2;
|
||||
@@ -1484,36 +1363,16 @@ Standard_Boolean ShapeFix_IntersectionTool::FixSelfIntersectWire
|
||||
V12 = TopoDS::Vertex(NewV2.Reversed());
|
||||
}
|
||||
nbReplaced++; //gka 06.09.04
|
||||
TopoDS_Edge NewE = sbe.CopyReplaceVertices(edge2,NewV2,V22);
|
||||
myContext->Replace(edge2,NewE);
|
||||
sewd->Set(NewE,num2+dnum1);
|
||||
boxes.Bind(NewE,B2); // update boxes
|
||||
edge2 = NewE;
|
||||
akey2 = 1;
|
||||
}
|
||||
if(P02.Distance(PV22)<tolV2) {
|
||||
tolV2 += P02.Distance(PV22);
|
||||
B.UpdateVertex(NewV2,tolV2);
|
||||
TopoDS_Edge NewE = sbe.CopyReplaceVertices(edge2,V12,NewV2);
|
||||
myContext->Replace(edge2,NewE);
|
||||
sewd->Set(NewE,num2+dnum1);
|
||||
boxes.Bind(NewE,B2); // update boxes
|
||||
edge2 = NewE;
|
||||
Standard_Integer n =
|
||||
(num2+dnum1+1 > sewd->NbEdges())?(num2+dnum1+1 - sewd->NbEdges()):(num2+dnum1+1);
|
||||
TopoDS_Edge enext = sewd->Edge(n);
|
||||
if (sae.FirstVertex(enext).IsSame(V22))
|
||||
{
|
||||
TopoDS_Vertex VFnext = sae.FirstVertex(enext);
|
||||
TopoDS_Edge NewEnext =
|
||||
sbe.CopyReplaceVertices(enext,NewV2,sae.LastVertex(enext));
|
||||
myContext->Replace(enext,NewEnext);
|
||||
sewd->Set(NewEnext,n);
|
||||
Bnd_Box2d Bnext = boxes.Find(enext);
|
||||
boxes.Bind(NewEnext,Bnext); // update boxes
|
||||
|
||||
if(VFnext.Orientation()==NewV2.Orientation()) {
|
||||
myContext->Replace(VFnext,NewV2);
|
||||
}
|
||||
else {
|
||||
myContext->Replace(VFnext,NewV2.Reversed());
|
||||
}
|
||||
}
|
||||
if(V22.Orientation()==NewV2.Orientation()) {
|
||||
myContext->Replace(V22,NewV2);
|
||||
V22 = NewV2;
|
||||
@@ -1523,6 +1382,11 @@ Standard_Boolean ShapeFix_IntersectionTool::FixSelfIntersectWire
|
||||
V22 = TopoDS::Vertex(NewV2.Reversed());
|
||||
}
|
||||
nbReplaced++; //gka 06.09.04
|
||||
TopoDS_Edge NewE = sbe.CopyReplaceVertices(edge2,V12,NewV2);
|
||||
myContext->Replace(edge2,NewE);
|
||||
sewd->Set(NewE,num2+dnum1);
|
||||
boxes.Bind(NewE,B2); // update boxes
|
||||
edge2 = NewE;
|
||||
akey2 = 2;
|
||||
}
|
||||
Standard_Integer dnum2=0, numseg2=num2+dnum1;
|
||||
@@ -1567,11 +1431,6 @@ Standard_Boolean ShapeFix_IntersectionTool::FixSelfIntersectWire
|
||||
}
|
||||
}
|
||||
}
|
||||
if( akey1>0 || akey2>0 ) {
|
||||
if( UnionVertexes(sewd, edge1, edge2, num2+dnum1, boxes, B2) )
|
||||
nbReplaced ++;
|
||||
}
|
||||
|
||||
// remove segment
|
||||
sewd->Remove(numseg2);
|
||||
sewd->Remove(numseg1);
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -18,6 +18,7 @@
|
||||
#include <Standard_Std.hxx>
|
||||
#include <Standard_Stream.hxx>
|
||||
#include <Standard_Transient.hxx>
|
||||
#include <Standard_Macro.hxx>
|
||||
|
||||
class Standard_Transient;
|
||||
|
||||
@@ -71,7 +72,7 @@ namespace opencascade {
|
||||
}
|
||||
|
||||
//! Move constructor
|
||||
handle (handle&& theHandle) noexcept : entity(theHandle.entity)
|
||||
handle (handle&& theHandle) Standard_Noexcept : entity(theHandle.entity)
|
||||
{
|
||||
theHandle.entity = 0;
|
||||
}
|
||||
@@ -112,7 +113,7 @@ namespace opencascade {
|
||||
}
|
||||
|
||||
//! Move operator
|
||||
handle& operator= (handle&& theHandle) noexcept
|
||||
handle& operator= (handle&& theHandle) Standard_Noexcept
|
||||
{
|
||||
std::swap (this->entity, theHandle.entity);
|
||||
return *this;
|
||||
|
@@ -315,5 +315,21 @@
|
||||
#define Standard_ATOMIC(theType) theType
|
||||
#endif
|
||||
|
||||
//! @def Standard_Noexcept
|
||||
//! Definition of Standard_Noexcept:
|
||||
//! if noexcept is accessible, Standard_Noexcept is "noexcept" and "throw()" otherwise.
|
||||
#ifdef _MSC_VER
|
||||
#if _MSC_VER >= 1900
|
||||
#define Standard_Noexcept noexcept
|
||||
#else
|
||||
#define Standard_Noexcept throw()
|
||||
#endif
|
||||
#else
|
||||
#if __cplusplus >= 201103L
|
||||
#define Standard_Noexcept noexcept
|
||||
#else
|
||||
#define Standard_Noexcept throw()
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@@ -390,15 +390,23 @@ void StdSelect_BRepSelectionTool::ComputeSensitive (const TopoDS_Shape& theShape
|
||||
{
|
||||
if (!aGeomPlanes[0].IsNull()
|
||||
&& !aGeomPlanes[1].IsNull()
|
||||
&& aGeomPlanes[0]->Position().Direction().IsEqual (aGeomCyl->Position().Direction(), Precision::Angular())
|
||||
&& aGeomPlanes[1]->Position().Direction().IsEqual (aGeomCyl->Position().Direction(), Precision::Angular()))
|
||||
&& aGeomPlanes[0]->Position().Direction().IsParallel (aGeomCyl->Position().Direction(), Precision::Angular())
|
||||
&& aGeomPlanes[1]->Position().Direction().IsParallel (aGeomCyl->Position().Direction(), Precision::Angular()))
|
||||
{
|
||||
const gp_Cylinder aCyl = BRepAdaptor_Surface (*aFaces[aConIndex]).Cylinder();
|
||||
const Standard_Real aRad = aCyl.Radius();
|
||||
const Standard_Real aHeight = aGeomPlanes[0]->Location().Transformed (*aGeomPlanesLoc[0])
|
||||
.Distance (aGeomPlanes[1]->Location().Transformed (*aGeomPlanesLoc[1]));
|
||||
|
||||
gp_Trsf aTrsf;
|
||||
aTrsf.SetTransformation (aCyl.Position(), gp_Ax3());
|
||||
gp_Ax3 aPos = aCyl.Position();
|
||||
if (aGeomPlanes[0]->Position().IsCoplanar (aGeomPlanes[1]->Position(), Precision::Angular(), Precision::Angular()))
|
||||
{
|
||||
// cylinders created as a prism have an inverse vector of the cylindrical surface
|
||||
aPos.SetDirection (aPos.Direction().Reversed());
|
||||
}
|
||||
aTrsf.SetTransformation (aPos, gp_Ax3());
|
||||
|
||||
Handle(Select3D_SensitiveCylinder) aSensSCyl = new Select3D_SensitiveCylinder (theOwner, aRad, aRad, aHeight, aTrsf);
|
||||
theSelection->Add (aSensSCyl);
|
||||
break;
|
||||
|
@@ -26,6 +26,7 @@
|
||||
#include <Standard_Real.hxx>
|
||||
#include <Standard_OStream.hxx>
|
||||
#include <Standard_IStream.hxx>
|
||||
#include <Standard_Macro.hxx>
|
||||
class TCollection_ExtendedString;
|
||||
|
||||
//! Class defines a variable-length sequence of 8-bit characters.
|
||||
@@ -74,7 +75,7 @@ public:
|
||||
Standard_EXPORT TCollection_AsciiString(const TCollection_AsciiString& astring);
|
||||
|
||||
//! Move constructor
|
||||
TCollection_AsciiString (TCollection_AsciiString&& theOther) noexcept
|
||||
TCollection_AsciiString (TCollection_AsciiString&& theOther) Standard_Noexcept
|
||||
: mystring (theOther.mystring),
|
||||
mylength (theOther.mylength)
|
||||
{
|
||||
@@ -276,7 +277,7 @@ void operator = (const TCollection_AsciiString& fromwhere)
|
||||
Standard_EXPORT void Swap (TCollection_AsciiString& theOther);
|
||||
|
||||
//! Move assignment operator
|
||||
TCollection_AsciiString& operator= (TCollection_AsciiString&& theOther) noexcept { Swap (theOther); return *this; }
|
||||
TCollection_AsciiString& operator= (TCollection_AsciiString&& theOther) Standard_Noexcept { Swap (theOther); return *this; }
|
||||
|
||||
//! Frees memory allocated by AsciiString.
|
||||
Standard_EXPORT ~TCollection_AsciiString();
|
||||
|
@@ -31,6 +31,7 @@
|
||||
#include <Standard_Real.hxx>
|
||||
#include <Standard_OStream.hxx>
|
||||
#include <Standard_PCharacter.hxx>
|
||||
#include <Standard_Macro.hxx>
|
||||
class TCollection_AsciiString;
|
||||
|
||||
|
||||
@@ -98,7 +99,7 @@ public:
|
||||
Standard_EXPORT TCollection_ExtendedString(const TCollection_ExtendedString& astring);
|
||||
|
||||
//! Move constructor
|
||||
TCollection_ExtendedString (TCollection_ExtendedString&& theOther) noexcept
|
||||
TCollection_ExtendedString (TCollection_ExtendedString&& theOther) Standard_Noexcept
|
||||
: mystring (theOther.mystring),
|
||||
mylength (theOther.mylength)
|
||||
{
|
||||
@@ -153,7 +154,7 @@ void operator = (const TCollection_ExtendedString& fromwhere)
|
||||
Standard_EXPORT void Swap (TCollection_ExtendedString& theOther);
|
||||
|
||||
//! Move assignment operator
|
||||
TCollection_ExtendedString& operator= (TCollection_ExtendedString&& theOther) noexcept { Swap (theOther); return *this; }
|
||||
TCollection_ExtendedString& operator= (TCollection_ExtendedString&& theOther) Standard_Noexcept { Swap (theOther); return *this; }
|
||||
|
||||
//! Frees memory allocated by ExtendedString.
|
||||
Standard_EXPORT ~TCollection_ExtendedString();
|
||||
|
@@ -6,7 +6,6 @@ TKLCAF
|
||||
TKV3d
|
||||
TKBRep
|
||||
TKG3d
|
||||
TKTopAlgo
|
||||
TKXDE
|
||||
TKService
|
||||
CSF_RapidJSON
|
||||
|
@@ -21,6 +21,7 @@
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
#include <Standard_Handle.hxx>
|
||||
|
||||
#include <Standard_Macro.hxx>
|
||||
class TopLoc_SListNodeOfItemLocation;
|
||||
class TopLoc_ItemLocation;
|
||||
|
||||
@@ -69,13 +70,13 @@ public:
|
||||
}
|
||||
|
||||
//! Move constructor
|
||||
TopLoc_SListOfItemLocation (TopLoc_SListOfItemLocation&& theOther) noexcept
|
||||
TopLoc_SListOfItemLocation (TopLoc_SListOfItemLocation&& theOther) Standard_Noexcept
|
||||
: myNode(std::move (theOther.myNode))
|
||||
{
|
||||
}
|
||||
|
||||
//! Move operator
|
||||
TopLoc_SListOfItemLocation& operator= (TopLoc_SListOfItemLocation&& theOther) noexcept
|
||||
TopLoc_SListOfItemLocation& operator= (TopLoc_SListOfItemLocation&& theOther) Standard_Noexcept
|
||||
{
|
||||
myNode = std::move (theOther.myNode);
|
||||
return *this;
|
||||
|
@@ -22,6 +22,7 @@
|
||||
#include <AIS_Shape.hxx>
|
||||
#include <Aspect_Grid.hxx>
|
||||
#include <Draw.hxx>
|
||||
#include <Message.hxx>
|
||||
#include <ViewerTest_ContinuousRedrawer.hxx>
|
||||
#include <ViewerTest_V3dView.hxx>
|
||||
#include <ViewerTest.hxx>
|
||||
|
@@ -2500,6 +2500,11 @@ static int VDrawText (Draw_Interpretor& theDI,
|
||||
}
|
||||
aTextFormatter->SetWrapping ((Standard_ShortReal)Draw::Atof(theArgVec[++anArgIt]));
|
||||
}
|
||||
else if (aParam == "-wordwrapping")
|
||||
{
|
||||
const bool isWordWrapping = Draw::ParseOnOffNoIterator(theArgsNb, theArgVec, anArgIt);
|
||||
aTextFormatter->SetWordWrapping(isWordWrapping);
|
||||
}
|
||||
else if (aParam == "-aspect"
|
||||
&& anArgIt + 1 < theArgsNb)
|
||||
{
|
||||
@@ -6925,6 +6930,7 @@ vdrawtext name text
|
||||
[-zoom {0|1}]=0
|
||||
[-height height]=16
|
||||
[-wrapping width]=40
|
||||
[-wordwrapping {0|1}]=1
|
||||
[-aspect {regular|bold|italic|boldItalic}]=regular
|
||||
[-font font]=Times
|
||||
[-2d] [-perspos {X Y Z}]={0 0 0}
|
||||
|
@@ -515,7 +515,7 @@ static void rescaleDimensionRefLabels(const TDF_LabelSequence& theRefLabels,
|
||||
if (aL.FindAttribute(TNaming_NamedShape::GetID(), aNS))
|
||||
{
|
||||
TopoDS_Shape aShape = aNS->Get();
|
||||
theBRepTrsf.Perform(aShape, Standard_True);
|
||||
theBRepTrsf.Perform(aShape, Standard_True, Standard_True);
|
||||
if (!theBRepTrsf.IsDone())
|
||||
{
|
||||
Standard_SStream aSS;
|
||||
@@ -664,7 +664,7 @@ Standard_Boolean XCAFDoc_Editor::RescaleGeometry(const TDF_Label& theLabel,
|
||||
if (aNodeType == XCAFDoc_AssemblyGraph::NodeType_Part)
|
||||
{
|
||||
const TopoDS_Shape aShape = aShapeTool->GetShape(aLabel);
|
||||
aBRepTrsf.Perform(aShape, Standard_True);
|
||||
aBRepTrsf.Perform(aShape, Standard_True, Standard_True);
|
||||
if (!aBRepTrsf.IsDone())
|
||||
{
|
||||
Standard_SStream aSS;
|
||||
|
@@ -1836,7 +1836,7 @@ void XDEDRAW::Init(Draw_Interpretor& di)
|
||||
"Doc [-names]: Prints number of assembly instances",
|
||||
__FILE__, XDumpNomenclature, g);
|
||||
di.Add("XRescaleGeometry",
|
||||
"Doc -scale factor [-root label]: Applies geometrical scale to assembly",
|
||||
"Doc factor [-root label] [-force]: Applies geometrical scale to assembly",
|
||||
__FILE__, XRescaleGeometry, g);
|
||||
|
||||
// Specialized commands
|
||||
|
@@ -19,7 +19,10 @@
|
||||
#include <DDocStd.hxx>
|
||||
#include <Draw.hxx>
|
||||
#include <gp_Trsf.hxx>
|
||||
#include <Message.hxx>
|
||||
#include <NCollection_DataMap.hxx>
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
#include <TDF_ChildIterator.hxx>
|
||||
#include <TDF_Tool.hxx>
|
||||
#include <TDocStd_Document.hxx>
|
||||
#include <TopoDS_Compound.hxx>
|
||||
@@ -934,59 +937,140 @@ static Standard_Integer updateAssemblies(Draw_Interpretor& di, Standard_Integer
|
||||
return 0;
|
||||
}
|
||||
|
||||
static Standard_Integer XGetProperties(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
|
||||
static Standard_Integer XGetProperties(Draw_Interpretor& theDI,
|
||||
Standard_Integer theArgc,
|
||||
const char** theArgv)
|
||||
{
|
||||
if (argc != 3)
|
||||
if (theArgc < 2)
|
||||
{
|
||||
di << "Syntax error: wrong number of arguments\nUse: " << argv[0] << " Doc Label\n";
|
||||
theDI.PrintHelp(theArgv[0]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
Handle(TDocStd_Document) aDoc;
|
||||
DDocStd::GetDocument(argv[1], aDoc);
|
||||
DDocStd::GetDocument(theArgv[1], aDoc);
|
||||
if (aDoc.IsNull())
|
||||
{
|
||||
di << "Syntax error: " << argv[1] << " is not a document\n";
|
||||
theDI << "Syntax error: " << theArgv[1] << " is not a document\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
TDF_Label aLabel;
|
||||
TDF_Tool::Label(aDoc->GetData(), argv[2], aLabel);
|
||||
|
||||
// Get XDE shape tool
|
||||
Handle(XCAFDoc_ShapeTool) aShapeTool = XCAFDoc_DocumentTool::ShapeTool(aDoc->Main());
|
||||
|
||||
Handle(TDataStd_NamedData) aNamedData = aShapeTool->GetNamedProperties(aLabel);
|
||||
|
||||
if (aNamedData.IsNull())
|
||||
NCollection_IndexedDataMap<TCollection_AsciiString, Handle(TDataStd_NamedData)> aNameDataMap;
|
||||
for (Standard_Integer anInd = 2; anInd < theArgc; anInd++)
|
||||
{
|
||||
di << argv[2] << " has no properties\n";
|
||||
return 0;
|
||||
}
|
||||
|
||||
aNamedData->LoadDeferredData();
|
||||
if (aNamedData->HasIntegers())
|
||||
{
|
||||
TColStd_DataMapOfStringInteger anIntProperties = aNamedData->GetIntegersContainer();
|
||||
for (TColStd_DataMapIteratorOfDataMapOfStringInteger anIter(anIntProperties); anIter.More(); anIter.Next())
|
||||
TDF_Label aLabel;
|
||||
const TCollection_AsciiString anEntry = theArgv[anInd];
|
||||
TDF_Tool::Label(aDoc->GetData(), anEntry, aLabel);
|
||||
if (aLabel.IsNull())
|
||||
{
|
||||
di << anIter.Key() << " : " << anIter.Value() << "\n";
|
||||
TopoDS_Shape aShape = DBRep::Get(theArgv[anInd]);
|
||||
if (!aShape.IsNull())
|
||||
{
|
||||
aLabel = aShapeTool->FindShape(aShape);
|
||||
}
|
||||
}
|
||||
if (!aLabel.IsNull())
|
||||
{
|
||||
Handle(TDataStd_NamedData) aNamedData = aShapeTool->GetNamedProperties(aLabel);
|
||||
if (!aNamedData.IsNull())
|
||||
{
|
||||
aNameDataMap.Add(anEntry, aNamedData);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Message::SendWarning() << "Warning: incorrect argument [" << theArgv[anInd] << "]" << " is not a label";
|
||||
}
|
||||
}
|
||||
if (aNamedData->HasReals())
|
||||
if (theArgc == 2)
|
||||
{
|
||||
TDataStd_DataMapOfStringReal aRealProperties = aNamedData->GetRealsContainer();
|
||||
for (TDataStd_DataMapIteratorOfDataMapOfStringReal anIter(aRealProperties); anIter.More(); anIter.Next())
|
||||
for (TDF_ChildIterator anIter(aShapeTool->Label(), Standard_True);
|
||||
anIter.More(); anIter.Next())
|
||||
{
|
||||
di << anIter.Key() << " : " << anIter.Value() << "\n";
|
||||
const TDF_Label& aLabel = anIter.Value();
|
||||
TCollection_AsciiString anEntry;
|
||||
TDF_Tool::Entry(aLabel, anEntry);
|
||||
Handle(TDataStd_NamedData) aNamedData = aShapeTool->GetNamedProperties(aLabel);
|
||||
if (!aNamedData.IsNull())
|
||||
{
|
||||
aNameDataMap.Add(anEntry, aNamedData);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (aNamedData->HasStrings())
|
||||
for (NCollection_IndexedDataMap<TCollection_AsciiString, Handle(TDataStd_NamedData)>::Iterator aNamedDataIter(aNameDataMap);
|
||||
aNamedDataIter.More(); aNamedDataIter.Next())
|
||||
{
|
||||
TDataStd_DataMapOfStringString aStringProperties = aNamedData->GetStringsContainer();
|
||||
for (TDataStd_DataMapIteratorOfDataMapOfStringString anIter(aStringProperties); anIter.More(); anIter.Next())
|
||||
if (theArgc != 3)
|
||||
{
|
||||
di << anIter.Key() << " : " << anIter.Value() << "\n";
|
||||
theDI << "Property for [" << aNamedDataIter.Key() << "]:\n";
|
||||
}
|
||||
const Handle(TDataStd_NamedData)& aNamedData = aNamedDataIter.Value();
|
||||
aNamedData->LoadDeferredData();
|
||||
if (aNamedData->HasIntegers())
|
||||
{
|
||||
const TColStd_DataMapOfStringInteger& anIntProperties = aNamedData->GetIntegersContainer();
|
||||
for (TColStd_DataMapIteratorOfDataMapOfStringInteger anIter(anIntProperties); anIter.More(); anIter.Next())
|
||||
{
|
||||
theDI << anIter.Key() << " : " << anIter.Value() << "\n";
|
||||
}
|
||||
}
|
||||
if (aNamedData->HasReals())
|
||||
{
|
||||
const TDataStd_DataMapOfStringReal& aRealProperties = aNamedData->GetRealsContainer();
|
||||
for (TDataStd_DataMapIteratorOfDataMapOfStringReal anIter(aRealProperties); anIter.More(); anIter.Next())
|
||||
{
|
||||
theDI << anIter.Key() << " : " << anIter.Value() << "\n";
|
||||
}
|
||||
}
|
||||
if (aNamedData->HasStrings())
|
||||
{
|
||||
const TDataStd_DataMapOfStringString& aStringProperties = aNamedData->GetStringsContainer();
|
||||
for (TDataStd_DataMapIteratorOfDataMapOfStringString anIter(aStringProperties); anIter.More(); anIter.Next())
|
||||
{
|
||||
theDI << anIter.Key() << " : " << anIter.Value() << "\n";
|
||||
}
|
||||
}
|
||||
if (aNamedData->HasBytes())
|
||||
{
|
||||
const TDataStd_DataMapOfStringByte& aByteProperties = aNamedData->GetBytesContainer();
|
||||
for (TDataStd_DataMapOfStringByte::Iterator anIter(aByteProperties); anIter.More(); anIter.Next())
|
||||
{
|
||||
theDI << anIter.Key() << " : " << anIter.Value() << "\n";
|
||||
}
|
||||
}
|
||||
if (aNamedData->HasArraysOfIntegers())
|
||||
{
|
||||
const TDataStd_DataMapOfStringHArray1OfInteger& anArrayIntegerProperties =
|
||||
aNamedData->GetArraysOfIntegersContainer();
|
||||
for (TDataStd_DataMapOfStringHArray1OfInteger::Iterator anIter(anArrayIntegerProperties);
|
||||
anIter.More(); anIter.Next())
|
||||
{
|
||||
TCollection_AsciiString aMessage(anIter.Key() + " : ");
|
||||
for (TColStd_HArray1OfInteger::Iterator anSubIter(anIter.Value()->Array1());
|
||||
anSubIter.More(); anSubIter.Next())
|
||||
{
|
||||
aMessage += " ";
|
||||
aMessage += anSubIter.Value();
|
||||
}
|
||||
theDI << aMessage << "\n";
|
||||
}
|
||||
}
|
||||
if (aNamedData->HasArraysOfReals())
|
||||
{
|
||||
const TDataStd_DataMapOfStringHArray1OfReal& anArrayRealsProperties =
|
||||
aNamedData->GetArraysOfRealsContainer();
|
||||
for (TDataStd_DataMapOfStringHArray1OfReal::Iterator anIter(anArrayRealsProperties);
|
||||
anIter.More(); anIter.Next())
|
||||
{
|
||||
TCollection_AsciiString aMessage(anIter.Key() + " : ");
|
||||
for (TColStd_HArray1OfReal::Iterator anSubIter(anIter.Value()->Array1());
|
||||
anSubIter.More(); anSubIter.Next())
|
||||
{
|
||||
aMessage += " ";
|
||||
aMessage += anSubIter.Value();
|
||||
}
|
||||
theDI << aMessage << "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1142,7 +1226,7 @@ void XDEDRAW_Shapes::InitCommands(Draw_Interpretor& di)
|
||||
di.Add ("XUpdateAssemblies","Doc \t: updates assembly compounds",
|
||||
__FILE__, updateAssemblies, g);
|
||||
|
||||
di.Add("XGetProperties", "Doc Label \t: prints named properties assigned to the Label",
|
||||
di.Add("XGetProperties", "Doc [label1, label2, ...] [shape1, shape2, ...]\t: prints named properties assigned to the all document's shape labels or chosen labels of shapes",
|
||||
__FILE__, XGetProperties, g);
|
||||
|
||||
di.Add ("XAutoNaming","Doc [0|1]\t: Disable/enable autonaming to Document",
|
||||
|
@@ -383,6 +383,7 @@ static Standard_Integer WriteGltf (Draw_Interpretor& theDI,
|
||||
RWMesh_CoordinateSystem aSystemCoordSys = RWMesh_CoordinateSystem_Zup;
|
||||
bool toForceUVExport = false, toEmbedTexturesInGlb = true;
|
||||
bool toMergeFaces = false, toSplitIndices16 = false;
|
||||
bool isParallel = false;
|
||||
RWMesh_NameFormat aNodeNameFormat = RWMesh_NameFormat_InstanceOrProduct;
|
||||
RWMesh_NameFormat aMeshNameFormat = RWMesh_NameFormat_Product;
|
||||
RWGltf_DracoParameters aDracoParameters;
|
||||
@@ -556,6 +557,10 @@ static Standard_Integer WriteGltf (Draw_Interpretor& theDI,
|
||||
{
|
||||
aDracoParameters.UnifiedQuantization = Draw::ParseOnOffIterator(theNbArgs, theArgVec, anArgIter);
|
||||
}
|
||||
else if (anArgCase == "-parallel")
|
||||
{
|
||||
isParallel = Draw::ParseOnOffIterator(theNbArgs, theArgVec, anArgIter);
|
||||
}
|
||||
else
|
||||
{
|
||||
Message::SendFail() << "Syntax error at '" << theArgVec[anArgIter] << "'";
|
||||
@@ -587,6 +592,7 @@ static Standard_Integer WriteGltf (Draw_Interpretor& theDI,
|
||||
aWriter.SetToEmbedTexturesInGlb (toEmbedTexturesInGlb);
|
||||
aWriter.SetMergeFaces (toMergeFaces);
|
||||
aWriter.SetSplitIndices16 (toSplitIndices16);
|
||||
aWriter.SetParallel(isParallel);
|
||||
aWriter.SetCompressionParameters(aDracoParameters);
|
||||
aWriter.ChangeCoordinateSystemConverter().SetInputLengthUnit (aScaleFactorM);
|
||||
aWriter.ChangeCoordinateSystemConverter().SetInputCoordinateSystem (aSystemCoordSys);
|
||||
@@ -626,6 +632,7 @@ static Standard_Integer readstl(Draw_Interpretor& theDI,
|
||||
{
|
||||
TCollection_AsciiString aShapeName, aFilePath;
|
||||
bool toCreateCompOfTris = false;
|
||||
bool anIsMulti = false;
|
||||
double aMergeAngle = M_PI / 2.0;
|
||||
for (Standard_Integer anArgIter = 1; anArgIter < theArgc; ++anArgIter)
|
||||
{
|
||||
@@ -648,6 +655,15 @@ static Standard_Integer readstl(Draw_Interpretor& theDI,
|
||||
++anArgIter;
|
||||
}
|
||||
}
|
||||
else if (anArg == "-multi")
|
||||
{
|
||||
anIsMulti = true;
|
||||
if (anArgIter + 1 < theArgc
|
||||
&& Draw::ParseOnOff (theArgv[anArgIter + 1], anIsMulti))
|
||||
{
|
||||
++anArgIter;
|
||||
}
|
||||
}
|
||||
else if (anArg == "-mergeangle"
|
||||
|| anArg == "-smoothangle"
|
||||
|| anArg == "-nomergeangle"
|
||||
@@ -689,15 +705,46 @@ static Standard_Integer readstl(Draw_Interpretor& theDI,
|
||||
TopoDS_Shape aShape;
|
||||
if (!toCreateCompOfTris)
|
||||
{
|
||||
// Read STL file to the triangulation.
|
||||
Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator (theDI, 1);
|
||||
Handle(Poly_Triangulation) aTriangulation = RWStl::ReadFile (aFilePath.ToCString(), aMergeAngle, aProgress->Start());
|
||||
Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator (theDI,1);
|
||||
if(anIsMulti)
|
||||
{
|
||||
NCollection_Sequence<Handle(Poly_Triangulation)> aTriangList;
|
||||
// Read STL file to the triangulation list.
|
||||
RWStl::ReadFile(aFilePath.ToCString(),aMergeAngle,aTriangList,aProgress->Start());
|
||||
BRep_Builder aB;
|
||||
TopoDS_Face aFace;
|
||||
if (aTriangList.Size() == 1)
|
||||
{
|
||||
aB.MakeFace (aFace);
|
||||
aB.UpdateFace (aFace,aTriangList.First());
|
||||
aShape = aFace;
|
||||
}
|
||||
else
|
||||
{
|
||||
TopoDS_Compound aCmp;
|
||||
aB.MakeCompound (aCmp);
|
||||
|
||||
NCollection_Sequence<Handle(Poly_Triangulation)>::Iterator anIt (aTriangList);
|
||||
for (; anIt.More(); anIt.Next())
|
||||
{
|
||||
aB.MakeFace (aFace);
|
||||
aB.UpdateFace (aFace,anIt.Value());
|
||||
aB.Add (aCmp,aFace);
|
||||
}
|
||||
aShape = aCmp;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Read STL file to the triangulation.
|
||||
Handle(Poly_Triangulation) aTriangulation = RWStl::ReadFile (aFilePath.ToCString(),aMergeAngle,aProgress->Start());
|
||||
|
||||
TopoDS_Face aFace;
|
||||
BRep_Builder aB;
|
||||
aB.MakeFace (aFace);
|
||||
aB.UpdateFace (aFace, aTriangulation);
|
||||
aShape = aFace;
|
||||
TopoDS_Face aFace;
|
||||
BRep_Builder aB;
|
||||
aB.MakeFace (aFace);
|
||||
aB.UpdateFace (aFace,aTriangulation);
|
||||
aShape = aFace;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2409,7 +2456,7 @@ void XSDRAWSTLVRML::InitCommands (Draw_Interpretor& theCommands)
|
||||
"\n\t\t: [-meshNameFormat {empty|product|instance|instOrProd|prodOrInst|prodAndInst|verbose}]=product"
|
||||
"\n\t\t: [-draco]=0 [-compressionLevel {0-10}]=7 [-quantizePositionBits Value]=14 [-quantizeNormalBits Value]=10"
|
||||
"\n\t\t: [-quantizeTexcoordBits Value]=12 [-quantizeColorBits Value]=8 [-quantizeGenericBits Value]=12"
|
||||
"\n\t\t: [-unifiedQuantization]=0"
|
||||
"\n\t\t: [-unifiedQuantization]=0 [-parallel]=0"
|
||||
"\n\t\t: Write XDE document into glTF file."
|
||||
"\n\t\t: -trsfFormat preferred transformation format"
|
||||
"\n\t\t: -systemCoordSys system coordinate system; Zup when not specified"
|
||||
@@ -2419,7 +2466,7 @@ void XSDRAWSTLVRML::InitCommands (Draw_Interpretor& theCommands)
|
||||
"\n\t\t: -texturesSeparate write textures to separate files"
|
||||
"\n\t\t: -nodeNameFormat name format for Nodes"
|
||||
"\n\t\t: -meshNameFormat name format for Meshes"
|
||||
"\n\t\t: -draco use Draco compression 3D geometric meshes"
|
||||
"\n\t\t: -draco use Draco compression 3D geometric meshes"
|
||||
"\n\t\t: -compressionLevel draco compression level [0-10] (by default 7), a value of 0 will apply sequential encoding and preserve face order"
|
||||
"\n\t\t: -quantizePositionBits quantization bits for position attribute when using Draco compression (by default 14)"
|
||||
"\n\t\t: -quantizeNormalBits quantization bits for normal attribute when using Draco compression (by default 10)"
|
||||
@@ -2427,7 +2474,8 @@ void XSDRAWSTLVRML::InitCommands (Draw_Interpretor& theCommands)
|
||||
"\n\t\t: -quantizeColorBits quantization bits for color attribute when using Draco compression (by default 8)"
|
||||
"\n\t\t: -quantizeGenericBits quantization bits for skinning attribute (joint indices and joint weights)"
|
||||
"\n and custom attributes when using Draco compression (by default 12)"
|
||||
"\n\t\t: -unifiedQuantization quantization is applied on each primitive separately if this option is false",
|
||||
"\n\t\t: -unifiedQuantization quantization is applied on each primitive separately if this option is false"
|
||||
"\n\t\t: -parallel use multithreading for Draco compression",
|
||||
__FILE__, WriteGltf, g);
|
||||
theCommands.Add ("writegltf",
|
||||
"writegltf shape file",
|
||||
@@ -2435,11 +2483,12 @@ void XSDRAWSTLVRML::InitCommands (Draw_Interpretor& theCommands)
|
||||
theCommands.Add ("writevrml", "shape file [version VRML#1.0/VRML#2.0 (1/2): 2 by default] [representation shaded/wireframe/both (0/1/2): 1 by default]",__FILE__,writevrml,g);
|
||||
theCommands.Add ("writestl", "shape file [ascii/binary (0/1) : 1 by default] [InParallel (0/1) : 0 by default]",__FILE__,writestl,g);
|
||||
theCommands.Add ("readstl",
|
||||
"readstl shape file [-brep] [-mergeAngle Angle]"
|
||||
"readstl shape file [-brep] [-mergeAngle Angle] [-multi]"
|
||||
"\n\t\t: Reads STL file and creates a new shape with specified name."
|
||||
"\n\t\t: When -brep is specified, creates a Compound of per-triangle Faces."
|
||||
"\n\t\t: Single triangulation-only Face is created otherwise (default)."
|
||||
"\n\t\t: -mergeAngle specifies maximum angle in degrees between triangles to merge equal nodes; disabled by default.",
|
||||
"\n\t\t: -mergeAngle specifies maximum angle in degrees between triangles to merge equal nodes; disabled by default."
|
||||
"\n\t\t: -multi creates a face per solid in multi-domain files; ignored when -brep is set.",
|
||||
__FILE__, readstl, g);
|
||||
theCommands.Add ("loadvrml" , "shape file",__FILE__,loadvrml,g);
|
||||
theCommands.Add ("ReadObj",
|
||||
|
@@ -10,7 +10,7 @@ stepread [locate_data_file bug27894_usd_raises_Standard_NullObject.stp] a *
|
||||
renamevar a_1 a
|
||||
unifysamedom result a
|
||||
|
||||
checknbshapes result -m UnifySameDomain -face 12 -edge 29
|
||||
checknbshapes result -m UnifySameDomain -face 12 -edge 30
|
||||
|
||||
checkshape result
|
||||
|
||||
|
@@ -9,7 +9,7 @@ unifysamedom result a
|
||||
|
||||
checkshape result
|
||||
|
||||
checknbshapes result -solid 1 -shell 1 -face 21 -wire 22 -edge 58 -vertex 38
|
||||
checknbshapes result -solid 1 -shell 1 -face 21 -wire 22 -edge 57 -vertex 37
|
||||
|
||||
set tolres [checkmaxtol result]
|
||||
|
||||
|
22
tests/bugs/heal/bug33006
Normal file
22
tests/bugs/heal/bug33006
Normal file
@@ -0,0 +1,22 @@
|
||||
puts "========================================="
|
||||
puts "OCC33006: UnifySameDomain raises exceptio"
|
||||
puts "========================================="
|
||||
puts ""
|
||||
|
||||
restore [locate_data_file bug33006.brep] a
|
||||
|
||||
unifysamedom result a
|
||||
|
||||
checkshape result
|
||||
|
||||
checknbshapes result -t -solid 1 -shell 1 -face 3 -wire 4 -edge 11 -vertex 4
|
||||
|
||||
set tolres [checkmaxtol result]
|
||||
|
||||
if { ${tolres} > 0.004416} {
|
||||
puts "Error: bad tolerance of result"
|
||||
}
|
||||
|
||||
checkprops result -s 77917.5 -v 195647
|
||||
|
||||
checkview -display result -2d -path ${imagedir}/${test_image}.png
|
@@ -7,7 +7,6 @@ puts ""
|
||||
#######################################
|
||||
|
||||
restore [locate_data_file bug23018_f-ext.brep] f
|
||||
param write.surfacecurve.mode 1
|
||||
brepiges f ${imagedir}/bug23018_f-ext.igs
|
||||
set info [entity 6]
|
||||
regexp {Starting +Point +: +\x28([-0-9.+eE]+),([-0-9.+eE]+),([-0-9.+eE]+)\x29} ${info} full x1 y1 z1
|
||||
|
17
tests/bugs/mesh/bug33060
Normal file
17
tests/bugs/mesh/bug33060
Normal file
@@ -0,0 +1,17 @@
|
||||
puts "========"
|
||||
puts "0033060: Mesh - Sub-precisional links provoke f a i l u r e on face"
|
||||
puts "========"
|
||||
puts ""
|
||||
|
||||
restore [locate_data_file bug33060.brep] result
|
||||
|
||||
tclean result
|
||||
|
||||
checkview -display result -3d -path ${imagedir}/${test_image}.png
|
||||
|
||||
set log [tricheck result]
|
||||
if { [llength $log] != 0 } {
|
||||
puts "Error : Invalid mesh"
|
||||
} else {
|
||||
puts "Mesh is OK"
|
||||
}
|
13
tests/bugs/modalg_7/bug26920
Normal file
13
tests/bugs/modalg_7/bug26920
Normal file
@@ -0,0 +1,13 @@
|
||||
puts "========"
|
||||
puts "0026920: BRepBuidlerAPI_MakeFillet crash 2"
|
||||
puts "========"
|
||||
|
||||
restore C:/WORK/opencascade/bugs/CR26920/bug26920.brep b1
|
||||
explode b1 e
|
||||
fillet result b1 0.25 b1_15
|
||||
|
||||
checkprops result -s 1653.78
|
||||
checkshape result
|
||||
|
||||
checknbshapes result -vertex 20 -edge 31 -wire 13 -face 13 -shell 1 -solid 1 -compsolid 0 -compound 1 -shape 80
|
||||
checkview -display result -2d -path ${imagedir}/${test_image}.png
|
30
tests/bugs/modalg_8/bug33080
Normal file
30
tests/bugs/modalg_8/bug33080
Normal file
@@ -0,0 +1,30 @@
|
||||
puts "================================"
|
||||
puts "OCC33080: Wrong projection point"
|
||||
puts "================================"
|
||||
puts ""
|
||||
|
||||
restore [locate_data_file bug33080.brep] a
|
||||
|
||||
set log [projface a -0.21115 1.17515 1.4504]
|
||||
|
||||
regexp {n0 1 Distance ([0-9+-.eE]*)} $log full dist
|
||||
|
||||
if { $dist > 0.1240364 } {
|
||||
puts "Error distance: projection is wrong"
|
||||
}
|
||||
|
||||
regexp {U = ([0-9+-.eE]*)} $log full uparam
|
||||
|
||||
if { $uparam < 869.174321 || $uparam > 869.174322 } {
|
||||
puts "Error point: projection is wrong"
|
||||
}
|
||||
|
||||
regexp {V = ([0-9+-.eE]*)} $log full vparam
|
||||
|
||||
if { $vparam < 732.602489 || $vparam > 732.602490 } {
|
||||
puts "Error point: projection is wrong"
|
||||
}
|
||||
|
||||
if {![regexp "Found 1 Points" $log]} {
|
||||
puts "Error number of points: projection is wrong"
|
||||
}
|
32
tests/bugs/step/bug33095
Normal file
32
tests/bugs/step/bug33095
Normal file
@@ -0,0 +1,32 @@
|
||||
puts "======="
|
||||
puts "0033095: Data Exchange, Step Import - Wrong PMI values when loading a *.stp file in m"
|
||||
puts "======="
|
||||
|
||||
pload OCAF
|
||||
|
||||
catch { Close D_mm }
|
||||
catch { Close D_m }
|
||||
|
||||
# Read file in mm
|
||||
ReadStep D_mm [locate_data_file bug33095_cad_with_pmi.stp]
|
||||
set plusMinusTol_mm [XGetDimensionPlusMinusTol D_mm 0:1:4:77]
|
||||
|
||||
# Read file in m
|
||||
XNewDoc D_m
|
||||
XSetLengthUnit D_m m
|
||||
ReadStep D_m [locate_data_file bug33095_cad_with_pmi.stp]
|
||||
set plusMinusTol_m [XGetDimensionPlusMinusTol D_m 0:1:4:77]
|
||||
|
||||
# Checking
|
||||
regexp {lower +([-0-9.+eE]+) +upper +([-0-9.+eE]+)} $plusMinusTol_m full lower_m upper_m
|
||||
regexp {lower +([-0-9.+eE]+) +upper +([-0-9.+eE]+)} $plusMinusTol_mm full lower_mm upper_mm
|
||||
|
||||
set lower_m_to_mm [expr {$lower_m * 1000}]
|
||||
set upper_m_to_mm [expr {$upper_m * 1000}]
|
||||
|
||||
if {[expr {abs($lower_m_to_mm - $lower_mm)}] > 1e-2} {
|
||||
puts "Error: incorrect scaling lower toleranse value"
|
||||
}
|
||||
if {[expr {abs($upper_m_to_mm - $upper_mm)}] > 1e-2} {
|
||||
puts "Error: incorrect scaling upper toleranse value"
|
||||
}
|
44
tests/bugs/stlvrml/bug31080
Normal file
44
tests/bugs/stlvrml/bug31080
Normal file
@@ -0,0 +1,44 @@
|
||||
puts "========"
|
||||
puts "0031080: Data Exchange, STL reader - improve API for reading multi-domain STL files"
|
||||
puts "========"
|
||||
puts ""
|
||||
|
||||
pload ALL
|
||||
|
||||
# create two boxes with mesh
|
||||
box b1 5 5 5
|
||||
box b2 5 5 5
|
||||
ttranslate b2 10 10 10
|
||||
incmesh b1 0.1
|
||||
incmesh b2 0.1
|
||||
|
||||
# write each box to Ascii STL
|
||||
writestl b1 $imagedir/${casename}_1.stl 0
|
||||
writestl b2 $imagedir/${casename}_2.stl 0
|
||||
|
||||
set aTmpStl "${imagedir}/${casename}_cat.stl"
|
||||
file delete $aTmpStl
|
||||
set file_res [open $aTmpStl a+]
|
||||
|
||||
# cat each stl files content to file_res
|
||||
set file_stl [open $imagedir/${casename}_1.stl r]
|
||||
set buffer [read $file_stl];
|
||||
puts $file_res $buffer
|
||||
close $file_stl
|
||||
|
||||
set file_stl [open $imagedir/${casename}_2.stl r]
|
||||
set buffer [read $file_stl];
|
||||
puts $file_res $buffer
|
||||
close $file_stl
|
||||
close $file_res
|
||||
|
||||
# load multi-domain STL
|
||||
readstl result ${imagedir}/${casename}_cat.stl -multi
|
||||
|
||||
vinit
|
||||
vdisplay result -dispmode 1
|
||||
vfit
|
||||
|
||||
checknbshapes result -face 2 -compound 1
|
||||
checktrinfo result -tri 24 -nod 16
|
||||
checkview -screenshot -3d -path ${imagedir}/${test_image}.png
|
15
tests/bugs/xde/bug33100
Normal file
15
tests/bugs/xde/bug33100
Normal file
@@ -0,0 +1,15 @@
|
||||
puts "0033100: Modeling Algorithms - XCAFDoc_Editor::RescaleGeometry does not rescale triangulations"
|
||||
|
||||
pload DCAF
|
||||
Close d -silent
|
||||
ReadStep d [locate_data_file "bug33100_window.step"]
|
||||
|
||||
XGetOneShape a d
|
||||
set ref_diag [eval distpp [bounding a]]
|
||||
|
||||
XRescaleGeometry d 1000
|
||||
|
||||
XGetOneShape a d
|
||||
set diag [eval distpp [bounding a]]
|
||||
|
||||
checkreal "bounding box diagonal" $diag [expr $ref_diag * 1000] 0 0.001
|
18
tests/cr/base/B10
Normal file
18
tests/cr/base/B10
Normal file
@@ -0,0 +1,18 @@
|
||||
cylinder surf 1
|
||||
trimv surf surf -10 10
|
||||
plane pp 0 0 0 1 0 1
|
||||
intersect ii surf pp
|
||||
extsurf surf ii 0 0 1
|
||||
trimv surf surf -1 1
|
||||
convert surf surf
|
||||
mkface f surf
|
||||
getanasurf asurf f cyl 1.e-7
|
||||
if {[isdraw asurf]} {
|
||||
set log [dump asurf]
|
||||
if { [regexp {CylindricalSurface} $log ] != 1 } {
|
||||
puts "Error: surface is not a cylindrical surface"
|
||||
}
|
||||
} else {
|
||||
puts "Error: required surface is not got"
|
||||
}
|
||||
|
13
tests/de_mesh/gltf_write/bull_parallel
Normal file
13
tests/de_mesh/gltf_write/bull_parallel
Normal file
@@ -0,0 +1,13 @@
|
||||
puts "========"
|
||||
puts "0032867: Data Exchange - Implement Draco compression for writing glTF"
|
||||
puts "Test case exporting model into glb (binary glTF) file."
|
||||
puts "========"
|
||||
|
||||
Close D0 -silent
|
||||
ReadGltf D0 [locate_data_file bug32867_bull.glb]
|
||||
|
||||
set aGltfFile1 "${imagedir}/${casename}_tmp1.glb"
|
||||
|
||||
WriteGltf D0 "$aGltfFile1" -draco on -parallel
|
||||
|
||||
ReadGltf D "$aGltfFile1"
|
@@ -145,10 +145,6 @@ provider.IGES.OCC.write.layer : 1
|
||||
provider.PLY.OCC.file.length.unit : 1
|
||||
provider.PLY.OCC.system.cs : 0
|
||||
provider.PLY.OCC.file.cs : 1
|
||||
provider.PLY.OCC.write.pnt.set : 0
|
||||
provider.PLY.OCC.write.distance : 0
|
||||
provider.PLY.OCC.write.density : 2e+100
|
||||
provider.PLY.OCC.write.tolerance : 1e-07
|
||||
provider.PLY.OCC.write.normals : 1
|
||||
provider.PLY.OCC.write.colors : 1
|
||||
provider.PLY.OCC.write.tex.coords : 0
|
||||
|
@@ -12,45 +12,45 @@ set ref_data {
|
||||
0:1:1:2:2 Shape.5
|
||||
0:1:4:1 GeomTolerance.5.1 ( N "Feature Control Frame (4)" T 12 TV 0, V 0.254 )
|
||||
0:1:1:2:7 Shape.10
|
||||
0:1:4:6 Dimension.10.1 ( N "linear distance" T 2, V 20.827999999999996, VL 2.54, VU 2.54, P 0 )
|
||||
0:1:4:6 Dimension.10.1 ( N "linear distance" T 2, V 20.827999999999996, VL 64.515999999999991, VU 64.515999999999991, P 0 )
|
||||
0:1:1:2:19 Shape.22
|
||||
0:1:4:39 Dimension.22.1 ( N "diameter" T 15, V 11.1252, VL 2.54, VU 2.54, P 0 )
|
||||
0:1:4:39 Dimension.22.1 ( N "diameter" T 15, V 11.1252, VL 64.515999999999991, VU 64.515999999999991, P 0 )
|
||||
0:1:4:35 GeomTolerance.22.1 ( N "Feature Control Frame (40)" T 10 TV 1, V 1.27, MR 1 )
|
||||
0:1:4:36 Datum.22.1.1 ( N "Feature Control Frame (40)" )
|
||||
0:1:4:37 Datum.22.1.2 ( N "Feature Control Frame (40)", M 15 )
|
||||
0:1:4:38 Datum.22.1.3 ( N "Feature Control Frame (40)", M 15 )
|
||||
0:1:1:2:20 Shape.23
|
||||
0:1:4:39 Dimension.23.1 ( N "diameter" T 15, V 11.1252, VL 2.54, VU 2.54, P 0 )
|
||||
0:1:4:39 Dimension.23.1 ( N "diameter" T 15, V 11.1252, VL 64.515999999999991, VU 64.515999999999991, P 0 )
|
||||
0:1:4:35 GeomTolerance.23.1 ( N "Feature Control Frame (40)" T 10 TV 1, V 1.27, MR 1 )
|
||||
0:1:4:36 Datum.23.1.1 ( N "Feature Control Frame (40)" )
|
||||
0:1:4:37 Datum.23.1.2 ( N "Feature Control Frame (40)", M 15 )
|
||||
0:1:4:38 Datum.23.1.3 ( N "Feature Control Frame (40)", M 15 )
|
||||
0:1:1:2:21 Shape.24
|
||||
0:1:4:39 Dimension.24.1 ( N "diameter" T 15, V 11.1252, VL 2.54, VU 2.54, P 0 )
|
||||
0:1:4:39 Dimension.24.1 ( N "diameter" T 15, V 11.1252, VL 64.515999999999991, VU 64.515999999999991, P 0 )
|
||||
0:1:4:35 GeomTolerance.24.1 ( N "Feature Control Frame (40)" T 10 TV 1, V 1.27, MR 1 )
|
||||
0:1:4:36 Datum.24.1.1 ( N "Feature Control Frame (40)" )
|
||||
0:1:4:37 Datum.24.1.2 ( N "Feature Control Frame (40)", M 15 )
|
||||
0:1:4:38 Datum.24.1.3 ( N "Feature Control Frame (40)", M 15 )
|
||||
0:1:1:2:22 Shape.25
|
||||
0:1:4:39 Dimension.25.1 ( N "diameter" T 15, V 11.1252, VL 2.54, VU 2.54, P 0 )
|
||||
0:1:4:39 Dimension.25.1 ( N "diameter" T 15, V 11.1252, VL 64.515999999999991, VU 64.515999999999991, P 0 )
|
||||
0:1:4:35 GeomTolerance.25.1 ( N "Feature Control Frame (40)" T 10 TV 1, V 1.27, MR 1 )
|
||||
0:1:4:36 Datum.25.1.1 ( N "Feature Control Frame (40)" )
|
||||
0:1:4:37 Datum.25.1.2 ( N "Feature Control Frame (40)", M 15 )
|
||||
0:1:4:38 Datum.25.1.3 ( N "Feature Control Frame (40)", M 15 )
|
||||
0:1:1:2:28 Shape.31
|
||||
0:1:4:6 Dimension.31.1 ( N "linear distance" T 2, V 20.827999999999996, VL 2.54, VU 2.54, P 0 )
|
||||
0:1:4:6 Dimension.31.1 ( N "linear distance" T 2, V 20.827999999999996, VL 64.515999999999991, VU 64.515999999999991, P 0 )
|
||||
0:1:4:2 GeomTolerance.31.1 ( N "Feature Control Frame (24)" T 12 TV 0, V 0.76200000000000001 )
|
||||
0:1:4:3 Datum.31.1.1 ( N "Feature Control Frame (24)" )
|
||||
0:1:4:4 Datum.31.1.2 ( N "Feature Control Frame (24)" )
|
||||
0:1:4:5 Datum.31.1.3 ( N "Feature Control Frame (24)" )
|
||||
0:1:1:2:39 Shape.42
|
||||
0:1:4:14 Dimension.42.1 ( N "diameter" T 15, V 50.799999999999997, VL 2.54, VU 2.54, P 0 )
|
||||
0:1:4:14 Dimension.42.1 ( N "diameter" T 15, V 50.799999999999997, VL 64.515999999999991, VU 64.515999999999991, P 0 )
|
||||
0:1:4:15 GeomTolerance.42.1 ( N "Feature Control Frame (16)" T 10 TV 1, V 1.524 )
|
||||
0:1:4:16 Datum.42.1.1 ( N "Feature Control Frame (16)" )
|
||||
0:1:4:17 Datum.42.1.2 ( N "Feature Control Frame (16)" )
|
||||
0:1:4:18 Datum.42.1.3 ( N "Feature Control Frame (16)" )
|
||||
0:1:1:2:40 Shape.43
|
||||
0:1:4:14 Dimension.43.1 ( N "diameter" T 15, V 50.799999999999997, VL 2.54, VU 2.54, P 0 )
|
||||
0:1:4:14 Dimension.43.1 ( N "diameter" T 15, V 50.799999999999997, VL 64.515999999999991, VU 64.515999999999991, P 0 )
|
||||
0:1:4:15 GeomTolerance.43.1 ( N "Feature Control Frame (16)" T 10 TV 1, V 1.524 )
|
||||
0:1:4:16 Datum.43.1.1 ( N "Feature Control Frame (16)" )
|
||||
0:1:4:17 Datum.43.1.2 ( N "Feature Control Frame (16)" )
|
||||
@@ -58,7 +58,7 @@ set ref_data {
|
||||
0:1:1:2:48 Shape.51
|
||||
0:1:4:30 Dimension.51.1 ( N "linear distance" T 2, V 19.049999999999997, P 0 )
|
||||
0:1:1:2:49 Shape.52
|
||||
0:1:4:19 Dimension.52.1 ( N "diameter" T 15, V 38.099999999999994, VL 2.54, VU 2.54, P 0 )
|
||||
0:1:4:19 Dimension.52.1 ( N "diameter" T 15, V 38.099999999999994, VL 64.515999999999991, VU 64.515999999999991, P 0 )
|
||||
0:1:4:20 GeomTolerance.52.1 ( N "Feature Control Frame (18)" T 10 TV 1, V 2.032 )
|
||||
0:1:4:21 Datum.52.1.1 ( N "Feature Control Frame (18)" )
|
||||
0:1:4:22 Datum.52.1.2 ( N "Feature Control Frame (18)" )
|
||||
@@ -68,7 +68,7 @@ set ref_data {
|
||||
0:1:4:27 Datum.52.2.2 ( N "Feature Control Frame (20)" )
|
||||
0:1:4:28 Datum.52.2.3 ( N "Feature Control Frame (20)" )
|
||||
0:1:1:2:50 Shape.53
|
||||
0:1:4:19 Dimension.53.1 ( N "diameter" T 15, V 38.099999999999994, VL 2.54, VU 2.54, P 0 )
|
||||
0:1:4:19 Dimension.53.1 ( N "diameter" T 15, V 38.099999999999994, VL 64.515999999999991, VU 64.515999999999991, P 0 )
|
||||
0:1:4:24 Dimension.53.2 ( N "linear distance" T 2, V 38.099999999999994, P 0 )
|
||||
0:1:4:20 GeomTolerance.53.1 ( N "Feature Control Frame (18)" T 10 TV 1, V 2.032 )
|
||||
0:1:4:21 Datum.53.1.1 ( N "Feature Control Frame (18)" )
|
||||
@@ -79,49 +79,49 @@ set ref_data {
|
||||
0:1:4:27 Datum.53.2.2 ( N "Feature Control Frame (20)" )
|
||||
0:1:4:28 Datum.53.2.3 ( N "Feature Control Frame (20)" )
|
||||
0:1:1:2:51 Shape.54
|
||||
0:1:4:29 Dimension.54.1 ( N "diameter" T 15, V 15.875, VL 2.54, VU 2.54, P 0 )
|
||||
0:1:4:29 Dimension.54.1 ( N "diameter" T 15, V 15.875, VL 64.515999999999991, VU 64.515999999999991, P 0 )
|
||||
0:1:4:31 GeomTolerance.54.1 ( N "Feature Control Frame (36)" T 10 TV 1, V 1.27, MR 1 )
|
||||
0:1:4:32 Datum.54.1.1 ( N "Feature Control Frame (36)" )
|
||||
0:1:4:33 Datum.54.1.2 ( N "Feature Control Frame (36)" )
|
||||
0:1:4:34 Datum.54.1.3 ( N "Feature Control Frame (36)" )
|
||||
0:1:1:2:52 Shape.55
|
||||
0:1:4:29 Dimension.55.1 ( N "diameter" T 15, V 15.875, VL 2.54, VU 2.54, P 0 )
|
||||
0:1:4:29 Dimension.55.1 ( N "diameter" T 15, V 15.875, VL 64.515999999999991, VU 64.515999999999991, P 0 )
|
||||
0:1:4:31 GeomTolerance.55.1 ( N "Feature Control Frame (36)" T 10 TV 1, V 1.27, MR 1 )
|
||||
0:1:4:32 Datum.55.1.1 ( N "Feature Control Frame (36)" )
|
||||
0:1:4:33 Datum.55.1.2 ( N "Feature Control Frame (36)" )
|
||||
0:1:4:34 Datum.55.1.3 ( N "Feature Control Frame (36)" )
|
||||
0:1:1:2:53 Shape.56
|
||||
0:1:4:29 Dimension.56.1 ( N "diameter" T 15, V 15.875, VL 2.54, VU 2.54, P 0 )
|
||||
0:1:4:29 Dimension.56.1 ( N "diameter" T 15, V 15.875, VL 64.515999999999991, VU 64.515999999999991, P 0 )
|
||||
0:1:4:31 GeomTolerance.56.1 ( N "Feature Control Frame (36)" T 10 TV 1, V 1.27, MR 1 )
|
||||
0:1:4:32 Datum.56.1.1 ( N "Feature Control Frame (36)" )
|
||||
0:1:4:33 Datum.56.1.2 ( N "Feature Control Frame (36)" )
|
||||
0:1:4:34 Datum.56.1.3 ( N "Feature Control Frame (36)" )
|
||||
0:1:1:2:54 Shape.57
|
||||
0:1:4:29 Dimension.57.1 ( N "diameter" T 15, V 15.875, VL 2.54, VU 2.54, P 0 )
|
||||
0:1:4:29 Dimension.57.1 ( N "diameter" T 15, V 15.875, VL 64.515999999999991, VU 64.515999999999991, P 0 )
|
||||
0:1:4:31 GeomTolerance.57.1 ( N "Feature Control Frame (36)" T 10 TV 1, V 1.27, MR 1 )
|
||||
0:1:4:32 Datum.57.1.1 ( N "Feature Control Frame (36)" )
|
||||
0:1:4:33 Datum.57.1.2 ( N "Feature Control Frame (36)" )
|
||||
0:1:4:34 Datum.57.1.3 ( N "Feature Control Frame (36)" )
|
||||
0:1:1:2:55 Shape.58
|
||||
0:1:4:29 Dimension.58.1 ( N "diameter" T 15, V 15.875, VL 2.54, VU 2.54, P 0 )
|
||||
0:1:4:29 Dimension.58.1 ( N "diameter" T 15, V 15.875, VL 64.515999999999991, VU 64.515999999999991, P 0 )
|
||||
0:1:4:31 GeomTolerance.58.1 ( N "Feature Control Frame (36)" T 10 TV 1, V 1.27, MR 1 )
|
||||
0:1:4:32 Datum.58.1.1 ( N "Feature Control Frame (36)" )
|
||||
0:1:4:33 Datum.58.1.2 ( N "Feature Control Frame (36)" )
|
||||
0:1:4:34 Datum.58.1.3 ( N "Feature Control Frame (36)" )
|
||||
0:1:1:2:56 Shape.59
|
||||
0:1:4:29 Dimension.59.1 ( N "diameter" T 15, V 15.875, VL 2.54, VU 2.54, P 0 )
|
||||
0:1:4:29 Dimension.59.1 ( N "diameter" T 15, V 15.875, VL 64.515999999999991, VU 64.515999999999991, P 0 )
|
||||
0:1:4:31 GeomTolerance.59.1 ( N "Feature Control Frame (36)" T 10 TV 1, V 1.27, MR 1 )
|
||||
0:1:4:32 Datum.59.1.1 ( N "Feature Control Frame (36)" )
|
||||
0:1:4:33 Datum.59.1.2 ( N "Feature Control Frame (36)" )
|
||||
0:1:4:34 Datum.59.1.3 ( N "Feature Control Frame (36)" )
|
||||
0:1:1:2:57 Shape.60
|
||||
0:1:4:29 Dimension.60.1 ( N "diameter" T 15, V 15.875, VL 2.54, VU 2.54, P 0 )
|
||||
0:1:4:29 Dimension.60.1 ( N "diameter" T 15, V 15.875, VL 64.515999999999991, VU 64.515999999999991, P 0 )
|
||||
0:1:4:31 GeomTolerance.60.1 ( N "Feature Control Frame (36)" T 10 TV 1, V 1.27, MR 1 )
|
||||
0:1:4:32 Datum.60.1.1 ( N "Feature Control Frame (36)" )
|
||||
0:1:4:33 Datum.60.1.2 ( N "Feature Control Frame (36)" )
|
||||
0:1:4:34 Datum.60.1.3 ( N "Feature Control Frame (36)" )
|
||||
0:1:1:2:58 Shape.61
|
||||
0:1:4:29 Dimension.61.1 ( N "diameter" T 15, V 15.875, VL 2.54, VU 2.54, P 0 )
|
||||
0:1:4:29 Dimension.61.1 ( N "diameter" T 15, V 15.875, VL 64.515999999999991, VU 64.515999999999991, P 0 )
|
||||
0:1:4:31 GeomTolerance.61.1 ( N "Feature Control Frame (36)" T 10 TV 1, V 1.27, MR 1 )
|
||||
0:1:4:32 Datum.61.1.1 ( N "Feature Control Frame (36)" )
|
||||
0:1:4:33 Datum.61.1.2 ( N "Feature Control Frame (36)" )
|
||||
@@ -137,28 +137,28 @@ set ref_data {
|
||||
0:1:1:2:129 Shape.132
|
||||
0:1:4:1 GeomTolerance.132.1 ( N "Feature Control Frame (4)" T 12 TV 0, V 0.254 )
|
||||
0:1:1:2:134 Shape.137
|
||||
0:1:4:40 Dimension.137.1 ( N "diameter" T 15, V 27.050999999999998, VL 2.54, VU 2.54, P 0 )
|
||||
0:1:4:40 Dimension.137.1 ( N "diameter" T 15, V 27.050999999999998, VL 64.515999999999991, VU 64.515999999999991, P 0 )
|
||||
0:1:4:41 GeomTolerance.137.1 ( N "Feature Control Frame (30)" T 9 TV 1, V 0.254 )
|
||||
0:1:4:42 Datum.137.1.1 ( N "Feature Control Frame (30)" )
|
||||
0:1:1:2:135 Shape.138
|
||||
0:1:4:40 Dimension.138.1 ( N "diameter" T 15, V 27.050999999999998, VL 2.54, VU 2.54, P 0 )
|
||||
0:1:4:40 Dimension.138.1 ( N "diameter" T 15, V 27.050999999999998, VL 64.515999999999991, VU 64.515999999999991, P 0 )
|
||||
0:1:4:41 GeomTolerance.138.1 ( N "Feature Control Frame (30)" T 9 TV 1, V 0.254 )
|
||||
0:1:4:42 Datum.138.1.1 ( N "Feature Control Frame (30)" )
|
||||
0:1:1:2:153 Shape.156
|
||||
0:1:4:7 Dimension.156.1 ( N "diameter" T 15, V 11.1252, VL 2.54, VU 2.54, P 0 )
|
||||
0:1:4:7 Dimension.156.1 ( N "diameter" T 15, V 11.1252, VL 64.515999999999991, VU 64.515999999999991, P 0 )
|
||||
0:1:4:9 GeomTolerance.156.1 ( N "Feature Control Frame (10)" T 9 TV 1, V 0.254 )
|
||||
0:1:4:10 Datum.156.1.1 ( N "Feature Control Frame (10)" )
|
||||
0:1:1:2:154 Shape.157
|
||||
0:1:4:7 Dimension.157.1 ( N "diameter" T 15, V 11.1252, VL 2.54, VU 2.54, P 0 )
|
||||
0:1:4:7 Dimension.157.1 ( N "diameter" T 15, V 11.1252, VL 64.515999999999991, VU 64.515999999999991, P 0 )
|
||||
0:1:4:9 GeomTolerance.157.1 ( N "Feature Control Frame (10)" T 9 TV 1, V 0.254 )
|
||||
0:1:4:10 Datum.157.1.1 ( N "Feature Control Frame (10)" )
|
||||
0:1:1:2:155 Shape.158
|
||||
0:1:4:8 Dimension.158.1 ( N "diameter" T 15, V 11.1252, VL 2.54, VU 2.54, P 0 )
|
||||
0:1:4:8 Dimension.158.1 ( N "diameter" T 15, V 11.1252, VL 64.515999999999991, VU 64.515999999999991, P 0 )
|
||||
0:1:4:11 GeomTolerance.158.1 ( N "Feature Control Frame (11)" T 10 TV 1, V 0.50800000000000001 )
|
||||
0:1:4:12 Datum.158.1.1 ( N "Feature Control Frame (11)" )
|
||||
0:1:4:13 Datum.158.1.2 ( N "Feature Control Frame (11)" )
|
||||
0:1:1:2:156 Shape.159
|
||||
0:1:4:8 Dimension.159.1 ( N "diameter" T 15, V 11.1252, VL 2.54, VU 2.54, P 0 )
|
||||
0:1:4:8 Dimension.159.1 ( N "diameter" T 15, V 11.1252, VL 64.515999999999991, VU 64.515999999999991, P 0 )
|
||||
0:1:4:11 GeomTolerance.159.1 ( N "Feature Control Frame (11)" T 10 TV 1, V 0.50800000000000001 )
|
||||
0:1:4:12 Datum.159.1.1 ( N "Feature Control Frame (11)" )
|
||||
0:1:4:13 Datum.159.1.2 ( N "Feature Control Frame (11)" )
|
||||
|
@@ -10,9 +10,9 @@ set ref_data {
|
||||
NbOfDatumTarget : 2
|
||||
|
||||
0:1:1:2:2 Shape.5
|
||||
0:1:4:14 Dimension.5.1 ( N "linear distance" T 2, V 127, VL 2.54, VU 2.54, P 0 )
|
||||
0:1:4:14 Dimension.5.1 ( N "linear distance" T 2, V 127, VL 64.515999999999991, VU 64.515999999999991, P 0 )
|
||||
0:1:1:2:8 Shape.11
|
||||
0:1:4:14 Dimension.11.1 ( N "linear distance" T 2, V 127, VL 2.54, VU 2.54, P 0 )
|
||||
0:1:4:14 Dimension.11.1 ( N "linear distance" T 2, V 127, VL 64.515999999999991, VU 64.515999999999991, P 0 )
|
||||
0:1:1:2:9 Shape.12
|
||||
0:1:4:1 GeomTolerance.12.1 ( N "Feature Control Frame (11)" T 13 TV 0, V 0.127 )
|
||||
0:1:1:2:66 Shape.69
|
||||
@@ -57,9 +57,9 @@ set ref_data {
|
||||
0:1:4:7 GeomTolerance.203.1 ( N "Feature Control Frame (4)" T 2 TV 0, V 0.050799999999999998 )
|
||||
0:1:4:8 Datum.203.1.1 ( N "Feature Control Frame (4)" )
|
||||
0:1:1:2:206 Shape.209
|
||||
0:1:4:11 Dimension.209.1 ( N "linear distance" T 2, V 254, VL 2.54, VU 2.54, P 0 )
|
||||
0:1:4:11 Dimension.209.1 ( N "linear distance" T 2, V 254, VL 64.515999999999991, VU 64.515999999999991, P 0 )
|
||||
0:1:1:2:207 Shape.210
|
||||
0:1:4:11 Dimension.210.1 ( N "linear distance" T 2, V 254, VL 2.54, VU 2.54, P 0 )
|
||||
0:1:4:11 Dimension.210.1 ( N "linear distance" T 2, V 254, VL 64.515999999999991, VU 64.515999999999991, P 0 )
|
||||
0:1:1:3:1 Shape.211
|
||||
0:1:4:1 GeomTolerance.211.1 ( N "Feature Control Frame (11)" T 13 TV 0, V 0.127 )
|
||||
}
|
||||
|
@@ -1,5 +1,3 @@
|
||||
puts "TODO OCC29040 ALL: Error: the history of the removed edges is incorrect"
|
||||
|
||||
puts "======="
|
||||
puts "0028913"
|
||||
puts "======="
|
||||
|
@@ -1,5 +1,3 @@
|
||||
puts "TODO OCC29040 ALL: Error: the history of the removed edges is incorrect"
|
||||
|
||||
puts "======="
|
||||
puts "0028913"
|
||||
puts "======="
|
||||
|
@@ -4,21 +4,30 @@ puts ""
|
||||
puts "==========="
|
||||
|
||||
pload MODELING VISUALIZATION
|
||||
vinit View1
|
||||
vinit View1 -width 500
|
||||
vclear
|
||||
vaxo
|
||||
|
||||
box b1 10 0 360 10 180 40
|
||||
box b1 10 0 460 10 180 40
|
||||
vdisplay b1
|
||||
vdrawtext t1 "Top text on plane yOz\n(not wrapped)" -pos 10 5 400 -color green -plane 1 0 0 0 1 0 -valign top -font SansFont -zoom 1
|
||||
vdrawtext t1 "Top text on plane yOz\n(not wrapped)" -pos 10 5 500 -color green -plane 1 0 0 0 1 0 -valign top -font SansFont -zoom 1
|
||||
|
||||
box b2 10 0 240 10 130 60
|
||||
box b2 10 0 340 10 130 60
|
||||
vdisplay b2
|
||||
vdrawtext t2 "Top text on plane yOz\n(wrapping=120)" -pos 10 5 300 -color green -wrapping 120 -plane 1 0 0 0 1 0 -valign top -font SansFont -zoom 1
|
||||
vdrawtext t2 "Top text on plane yOz\n(wrapping=120)" -pos 10 5 400 -color green -wrapping 120 -plane 1 0 0 0 1 0 -valign top -font SansFont -zoom 1
|
||||
|
||||
box b3 10 0 60 10 60 150
|
||||
box b3 10 0 160 10 60 150
|
||||
vdisplay b3
|
||||
vdrawtext t3 "Top text on plane yOz\n(wrapping=50)" -pos 10 5 200 -color green -wrapping 50 -plane 1 0 0 0 1 0 -valign top -font SansFont -zoom 1
|
||||
vdrawtext t3 "Top text on plane yOz\n(wrapping=50)" -pos 10 5 300 -color green -wrapping 50 -plane 1 0 0 0 1 0 -valign top -font SansFont -zoom 1
|
||||
|
||||
box b4 10 200 400 10 130 100
|
||||
vdisplay b4
|
||||
vdrawtext t4 "Top text on plane yOz\n(wrapping=120, word wrapping disabled)" -pos 10 205 500 -color green -wrapping 120 -plane 1 0 0 0 1 0 -valign top -font SansFont -zoom 1 -wordwrapping 0
|
||||
|
||||
box b5 10 200 160 10 60 200
|
||||
vdisplay b5
|
||||
vdrawtext t5 "Top text on plane yOz\n(wrapping=50, word wrapping disabled)" -pos 10 205 350 -color green -wrapping 50 -plane 1 0 0 0 1 0 -valign top -font SansFont -zoom 1 -wordwrapping 0
|
||||
|
||||
|
||||
vright
|
||||
vfit
|
||||
|
19
tests/pipe/bugs/bug24049
Normal file
19
tests/pipe/bugs/bug24049
Normal file
@@ -0,0 +1,19 @@
|
||||
puts "============="
|
||||
puts "OCC24049: Modeling Algorithms - cras-h in BRepOffsetAPI_MakePipe"
|
||||
puts "============="
|
||||
puts ""
|
||||
|
||||
pload MODELING
|
||||
|
||||
restore [locate_data_file bug24049_spine.brep] spine
|
||||
|
||||
mkedge spine spine
|
||||
wire spine spine
|
||||
|
||||
circle profile 27378.59961 -1139.028442 -621 0 0 -1 -1 0 -0 6.349999904633
|
||||
mkedge profile profile
|
||||
|
||||
pipe pipe spine profile 2
|
||||
checkshape pipe
|
||||
|
||||
puts "TEST COMPLETED"
|
26
tests/vselect/bugs/bug33084
Normal file
26
tests/vselect/bugs/bug33084
Normal file
@@ -0,0 +1,26 @@
|
||||
puts "============="
|
||||
puts "0033084: Visualization - Cylindrical prism is selectable only by its base when extruded in some directions"
|
||||
puts "============="
|
||||
|
||||
pload MODELING VISUALIZATION
|
||||
profile p1 c 1 360 ww
|
||||
mkplane f p1
|
||||
prism pr1 f 0 0 2
|
||||
prism pr2 f 0 0 -2
|
||||
ttranslate pr1 1 1 1
|
||||
ttranslate pr2 -1 -1 -1
|
||||
|
||||
vinit View1
|
||||
vclear
|
||||
vaxo
|
||||
vdisplay -dispmode 1 pr1 pr2
|
||||
vfit
|
||||
vsensdis
|
||||
|
||||
vdump $imagedir/${casename}_prism_sensitive_prs.png
|
||||
|
||||
vmoveto 130 330
|
||||
if { ![string match "*Select3D_SensitiveCylinder*" [vstate -entities]] } { puts "Error: cylinder should be detected" }
|
||||
|
||||
vmoveto 270 130
|
||||
if { ![string match "*Select3D_SensitiveCylinder*" [vstate -entities]] } { puts "Error: cylinder should be detected" }
|
@@ -676,7 +676,7 @@ if {[regexp "VOLUME_EXACTLY" $CompareDocumentsMode] || [regexp "ALL" $CompareDoc
|
||||
# Perform sewing of resulting shape. If amount of closed shells of resulting shape is not equal to amount of
|
||||
# closed shells of initial shape increace tolerance and perform sewing again
|
||||
set nbClosedShells_Second 0
|
||||
set toler 0.005
|
||||
set toler 0.00001
|
||||
set IsSewingPerformedCorrectly 0
|
||||
XGetOneShape Shape_Second D_Second
|
||||
for {set k 0} {$k < 5} {incr k} {
|
||||
|
Reference in New Issue
Block a user