removed references to OCC<7
This commit is contained in:
@@ -356,12 +356,7 @@ private:
|
||||
// writer.SetColorMode(Standard_False);
|
||||
writer.Transfer(hDoc, STEPControl_AsIs);
|
||||
|
||||
// edit STEP header
|
||||
#if OCC_VERSION_HEX >= 0x060500
|
||||
APIHeaderSection_MakeHeader makeHeader(writer.ChangeWriter().Model());
|
||||
#else
|
||||
APIHeaderSection_MakeHeader makeHeader(writer.Writer().Model());
|
||||
#endif
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
|
||||
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/Part")->GetGroup("STEP");
|
||||
|
||||
|
||||
@@ -73,11 +73,7 @@
|
||||
# include <TopoDS_Iterator.hxx>
|
||||
# include <APIHeaderSection_MakeHeader.hxx>
|
||||
# include <OSD_Exception.hxx>
|
||||
#if OCC_VERSION_HEX >= 0x060500
|
||||
# include <TDataXtd_Shape.hxx>
|
||||
# else
|
||||
# include <TDataStd_Shape.hxx>
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#include <Base/Console.h>
|
||||
|
||||
@@ -75,11 +75,7 @@
|
||||
# include <TopoDS_Iterator.hxx>
|
||||
# include <APIHeaderSection_MakeHeader.hxx>
|
||||
# include <OSD_Exception.hxx>
|
||||
#if OCC_VERSION_HEX >= 0x060500
|
||||
# include <TDataXtd_Shape.hxx>
|
||||
# else
|
||||
# include <TDataStd_Shape.hxx>
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#include <boost/algorithm/string.hpp>
|
||||
|
||||
@@ -56,11 +56,7 @@
|
||||
# include <TopoDS_Iterator.hxx>
|
||||
# include <APIHeaderSection_MakeHeader.hxx>
|
||||
# include <OSD_Exception.hxx>
|
||||
#if OCC_VERSION_HEX >= 0x060500
|
||||
# include <TDataXtd_Shape.hxx>
|
||||
# else
|
||||
# include <TDataStd_Shape.hxx>
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#include "ImportOCAFAssembly.h"
|
||||
|
||||
@@ -71,11 +71,7 @@
|
||||
# include <XSControl_TransferReader.hxx>
|
||||
# include <XSControl_WorkSession.hxx>
|
||||
|
||||
#if OCC_VERSION_HEX >= 0x060500
|
||||
# include <TDataXtd_Shape.hxx>
|
||||
# else
|
||||
# include <TDataStd_Shape.hxx>
|
||||
# endif
|
||||
#if OCC_VERSION_HEX >= 0x070500
|
||||
# include <Message_ProgressRange.hxx>
|
||||
# include <RWGltf_CafWriter.hxx>
|
||||
@@ -644,11 +640,8 @@ private:
|
||||
writer.Transfer(hDoc, STEPControl_AsIs);
|
||||
|
||||
// edit STEP header
|
||||
#if OCC_VERSION_HEX >= 0x060500
|
||||
APIHeaderSection_MakeHeader makeHeader(writer.ChangeWriter().Model());
|
||||
#else
|
||||
APIHeaderSection_MakeHeader makeHeader(writer.Writer().Model());
|
||||
#endif
|
||||
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
|
||||
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/Part")->GetGroup("STEP");
|
||||
|
||||
|
||||
@@ -196,15 +196,9 @@ ColMat<double, 3> FaceUnwrapper::interpolateFlatFace(const TopoDS_Face& face)
|
||||
// extract xyz poles, knots, weights, degree
|
||||
const Handle(Geom_Surface) &_surface = BRep_Tool::Surface(face);
|
||||
const Handle(Geom_BSplineSurface) &_bspline = Handle(Geom_BSplineSurface)::DownCast(_surface);
|
||||
#if OCC_VERSION_HEX < 0x070000
|
||||
TColStd_Array1OfReal _uknots(1, _bspline->NbUPoles() + _bspline->UDegree() + 1);
|
||||
TColStd_Array1OfReal _vknots(1, _bspline->NbVPoles() + _bspline->VDegree() + 1);
|
||||
_bspline->UKnotSequence(_uknots);
|
||||
_bspline->VKnotSequence(_vknots);
|
||||
#else
|
||||
|
||||
const TColStd_Array1OfReal &_uknots = _bspline->UKnotSequence();
|
||||
const TColStd_Array1OfReal &_vknots = _bspline->VKnotSequence();
|
||||
#endif
|
||||
|
||||
Eigen::VectorXd weights;
|
||||
weights.resize(_bspline->NbUPoles() * _bspline->NbVPoles());
|
||||
|
||||
@@ -1172,11 +1172,7 @@ private:
|
||||
aPlane = new Geom_Plane(p, d);
|
||||
}
|
||||
|
||||
BRepBuilderAPI_MakeFace Face(aPlane, 0.0, length, 0.0, width
|
||||
#if OCC_VERSION_HEX >= 0x060502
|
||||
, Precision::Confusion()
|
||||
#endif
|
||||
);
|
||||
BRepBuilderAPI_MakeFace Face(aPlane, 0.0, length, 0.0, width, Precision::Confusion() );
|
||||
return Py::asObject(new TopoShapeFacePy(new TopoShape((Face.Face()))));
|
||||
}
|
||||
catch (Standard_DomainError&) {
|
||||
|
||||
@@ -495,10 +495,8 @@ eRefType AttachEngine::getShapeType(const TopoDS_Shape& sh)
|
||||
case GeomAbs_BezierCurve:
|
||||
case GeomAbs_BSplineCurve:
|
||||
case GeomAbs_OtherCurve:
|
||||
#if OCC_VERSION_HEX >= 0x070000
|
||||
case GeomAbs_OffsetCurve:
|
||||
#endif
|
||||
return rtCurve;
|
||||
return rtCurve;
|
||||
}
|
||||
}break;
|
||||
case TopAbs_WIRE:
|
||||
|
||||
@@ -52,12 +52,7 @@ BRepOffsetAPI_MakeOffsetFix::BRepOffsetAPI_MakeOffsetFix()
|
||||
|
||||
BRepOffsetAPI_MakeOffsetFix::BRepOffsetAPI_MakeOffsetFix(const GeomAbs_JoinType Join, const Standard_Boolean IsOpenResult)
|
||||
{
|
||||
#if OCC_VERSION_HEX >= 0x060900
|
||||
mkOffset.Init(Join, IsOpenResult);
|
||||
#else
|
||||
(void)IsOpenResult;
|
||||
mkOffset.Init(Join);
|
||||
#endif
|
||||
}
|
||||
|
||||
BRepOffsetAPI_MakeOffsetFix::~BRepOffsetAPI_MakeOffsetFix()
|
||||
|
||||
@@ -142,7 +142,6 @@ PyObject* BRepOffsetAPI_MakePipeShellPy::setSpineSupport(PyObject *args)
|
||||
|
||||
PyObject* BRepOffsetAPI_MakePipeShellPy::setAuxiliarySpine(PyObject *args)
|
||||
{
|
||||
#if OCC_VERSION_HEX >= 0x060700
|
||||
PyObject *spine, *curv, *keep;
|
||||
if (!PyArg_ParseTuple(args, "O!O!O!",&Part::TopoShapePy::Type,&spine
|
||||
,&PyBool_Type,&curv
|
||||
@@ -178,31 +177,6 @@ PyObject* BRepOffsetAPI_MakePipeShellPy::setAuxiliarySpine(PyObject *args)
|
||||
PyErr_SetString(PartExceptionOCCError, e.GetMessageString());
|
||||
return nullptr;
|
||||
}
|
||||
#else
|
||||
PyObject *spine, *curv, *keep;
|
||||
if (!PyArg_ParseTuple(args, "O!O!O!",&Part::TopoShapePy::Type,&spine
|
||||
,&PyBool_Type,&curv
|
||||
,&PyBool_Type,&keep))
|
||||
return 0;
|
||||
|
||||
try {
|
||||
const TopoDS_Shape& s = static_cast<Part::TopoShapePy*>(spine)->getTopoShapePtr()->getShape();
|
||||
if (s.IsNull() || s.ShapeType() != TopAbs_WIRE) {
|
||||
PyErr_SetString(PyExc_TypeError, "spine is not a wire");
|
||||
return 0;
|
||||
}
|
||||
|
||||
this->getBRepOffsetAPI_MakePipeShellPtr()->SetMode(
|
||||
TopoDS::Wire(s),
|
||||
PyObject_IsTrue(curv) ? Standard_True : Standard_False,
|
||||
PyObject_IsTrue(keep) ? Standard_True : Standard_False);
|
||||
Py_Return;
|
||||
}
|
||||
catch (Standard_Failure& e) {
|
||||
PyErr_SetString(PartExceptionOCCError, e.GetMessageString());
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
PyObject* BRepOffsetAPI_MakePipeShellPy::add(PyObject *args, PyObject *kwds)
|
||||
@@ -440,14 +414,8 @@ PyObject* BRepOffsetAPI_MakePipeShellPy::setMaxDegree(PyObject *args)
|
||||
return nullptr;
|
||||
|
||||
try {
|
||||
#if OCC_VERSION_HEX >= 0x060800
|
||||
this->getBRepOffsetAPI_MakePipeShellPtr()->SetMaxDegree(degree);
|
||||
Py_Return;
|
||||
#else
|
||||
(void)args;
|
||||
PyErr_SetString(PyExc_RuntimeError, "requires OCC >= 6.8");
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
catch (Standard_Failure& e) {
|
||||
PyErr_SetString(PartExceptionOCCError, e.GetMessageString());
|
||||
@@ -462,14 +430,8 @@ PyObject* BRepOffsetAPI_MakePipeShellPy::setMaxSegments(PyObject *args)
|
||||
return nullptr;
|
||||
|
||||
try {
|
||||
#if OCC_VERSION_HEX >= 0x060800
|
||||
this->getBRepOffsetAPI_MakePipeShellPtr()->SetMaxSegments(nbseg);
|
||||
Py_Return;
|
||||
#else
|
||||
(void)args;
|
||||
PyErr_SetString(PyExc_RuntimeError, "requires OCC >= 6.8");
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
catch (Standard_Failure& e) {
|
||||
PyErr_SetString(PartExceptionOCCError, e.GetMessageString());
|
||||
@@ -484,13 +446,8 @@ PyObject* BRepOffsetAPI_MakePipeShellPy::setForceApproxC1(PyObject *args)
|
||||
return nullptr;
|
||||
|
||||
try {
|
||||
#if OCC_VERSION_HEX >= 0x060700
|
||||
this->getBRepOffsetAPI_MakePipeShellPtr()->SetForceApproxC1(PyObject_IsTrue(obj) ? Standard_True : Standard_False);
|
||||
Py_Return;
|
||||
#else
|
||||
PyErr_SetString(PyExc_RuntimeError, "requires OCC >= 6.7");
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
catch (Standard_Failure& e) {
|
||||
PyErr_SetString(PartExceptionOCCError, e.GetMessageString());
|
||||
|
||||
@@ -112,34 +112,6 @@ App::DocumentObjectExecReturn *MultiFuse::execute(void)
|
||||
if (s.size() >= 2) {
|
||||
try {
|
||||
std::vector<ShapeHistory> history;
|
||||
#if OCC_VERSION_HEX <= 0x060800
|
||||
TopoDS_Shape resShape = s.front();
|
||||
if (resShape.IsNull())
|
||||
throw NullShapeException("Input shape is null");
|
||||
for (std::vector<TopoDS_Shape>::iterator it = s.begin()+1; it != s.end(); ++it) {
|
||||
if (it->IsNull())
|
||||
throw NullShapeException("Input shape is null");
|
||||
|
||||
// Let's call algorithm computing a fuse operation:
|
||||
BRepAlgoAPI_Fuse mkFuse(resShape, *it);
|
||||
// Let's check if the fusion has been successful
|
||||
if (!mkFuse.IsDone())
|
||||
throw BooleanException("Fusion failed");
|
||||
resShape = mkFuse.Shape();
|
||||
|
||||
ShapeHistory hist1 = buildHistory(mkFuse, TopAbs_FACE, resShape, mkFuse.Shape1());
|
||||
ShapeHistory hist2 = buildHistory(mkFuse, TopAbs_FACE, resShape, mkFuse.Shape2());
|
||||
if (history.empty()) {
|
||||
history.push_back(hist1);
|
||||
history.push_back(hist2);
|
||||
}
|
||||
else {
|
||||
for (std::vector<ShapeHistory>::iterator jt = history.begin(); jt != history.end(); ++jt)
|
||||
*jt = joinHistory(*jt, hist1);
|
||||
history.push_back(hist2);
|
||||
}
|
||||
}
|
||||
#else
|
||||
BRepAlgoAPI_Fuse mkFuse;
|
||||
TopTools_ListOfShape shapeArguments,shapeTools;
|
||||
const TopoDS_Shape& shape = s.front();
|
||||
@@ -163,7 +135,6 @@ App::DocumentObjectExecReturn *MultiFuse::execute(void)
|
||||
for (std::vector<TopoDS_Shape>::iterator it = s.begin(); it != s.end(); ++it) {
|
||||
history.push_back(buildHistory(mkFuse, TopAbs_FACE, resShape, *it));
|
||||
}
|
||||
#endif
|
||||
if (resShape.IsNull())
|
||||
throw Base::RuntimeError("Resulting shape is null");
|
||||
|
||||
|
||||
@@ -51,9 +51,7 @@ short Section::mustExecute() const
|
||||
BRepAlgoAPI_BooleanOperation* Section::makeOperation(const TopoDS_Shape& base, const TopoDS_Shape& tool) const
|
||||
{
|
||||
// Let's call algorithm computing a section operation:
|
||||
#if OCC_VERSION_HEX < 0x060900
|
||||
return new BRepAlgoAPI_Section(base, tool);
|
||||
#else
|
||||
|
||||
bool approx = Approximation.getValue();
|
||||
std::unique_ptr<BRepAlgoAPI_Section> mkSection(new BRepAlgoAPI_Section());
|
||||
mkSection->Init1(base);
|
||||
@@ -63,5 +61,4 @@ BRepAlgoAPI_BooleanOperation* Section::makeOperation(const TopoDS_Shape& base, c
|
||||
if (!mkSection->IsDone())
|
||||
throw Base::RuntimeError("Section failed");
|
||||
return mkSection.release();
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -143,13 +143,7 @@ PyObject* Geometry2dPy::transform(PyObject *args)
|
||||
double a23 = static_cast<double>(Py::Float(list.getItem(5)));
|
||||
|
||||
gp_Trsf mat;
|
||||
mat.SetValues(a11, a12, 0, a13,
|
||||
a21, a22, 0, a23,
|
||||
0 , 0, 1, 0
|
||||
#if OCC_VERSION_HEX < 0x060800
|
||||
, 0.00001,0.00001
|
||||
#endif
|
||||
); //precision was removed in OCCT CR0025194
|
||||
mat.SetValues(a11, a12, 0, a13, a21, a22, 0, a23, 0, 0, 1, 0);
|
||||
gp_Trsf2d trf(mat);
|
||||
|
||||
getGeometry2dPtr()->handle()->Transform(trf);
|
||||
|
||||
@@ -462,11 +462,7 @@ void Geometry::transform(const Base::Matrix4D& mat)
|
||||
gp_Trsf trf;
|
||||
trf.SetValues(mat[0][0],mat[0][1],mat[0][2],mat[0][3],
|
||||
mat[1][0],mat[1][1],mat[1][2],mat[1][3],
|
||||
mat[2][0],mat[2][1],mat[2][2],mat[2][3]
|
||||
#if OCC_VERSION_HEX < 0x060800
|
||||
, 0.00001,0.00001
|
||||
#endif
|
||||
); //precision was removed in OCCT CR0025194
|
||||
mat[2][0],mat[2][1],mat[2][2],mat[2][3]);
|
||||
handle()->Transform(trf);
|
||||
}
|
||||
|
||||
@@ -2138,11 +2134,8 @@ void GeomArcOfConic::setXAxisDir(const Base::Vector3d& newdir)
|
||||
Handle(Geom_TrimmedCurve) curve = Handle(Geom_TrimmedCurve)::DownCast(handle());
|
||||
Handle(Geom_Conic) c = Handle(Geom_Conic)::DownCast( curve->BasisCurve() );
|
||||
assert(!c.IsNull());
|
||||
#if OCC_VERSION_HEX >= 0x060504
|
||||
|
||||
if (newdir.Sqr() < Precision::SquareConfusion())
|
||||
#else
|
||||
if (newdir.Length() < Precision::Confusion())
|
||||
#endif
|
||||
return;//zero vector was passed. Keep the old orientation.
|
||||
|
||||
try {
|
||||
@@ -2722,11 +2715,7 @@ Base::Vector3d GeomEllipse::getMajorAxisDir() const
|
||||
*/
|
||||
void GeomEllipse::setMajorAxisDir(Base::Vector3d newdir)
|
||||
{
|
||||
#if OCC_VERSION_HEX >= 0x060504
|
||||
if (newdir.Sqr() < Precision::SquareConfusion())
|
||||
#else
|
||||
if (newdir.Length() < Precision::Confusion())
|
||||
#endif
|
||||
return;//zero vector was passed. Keep the old orientation.
|
||||
try {
|
||||
gp_Ax2 pos = myCurve->Position();
|
||||
@@ -2941,11 +2930,7 @@ void GeomArcOfEllipse::setMajorAxisDir(Base::Vector3d newdir)
|
||||
{
|
||||
Handle(Geom_Ellipse) c = Handle(Geom_Ellipse)::DownCast( myCurve->BasisCurve() );
|
||||
assert(!c.IsNull());
|
||||
#if OCC_VERSION_HEX >= 0x060504
|
||||
if (newdir.Sqr() < Precision::SquareConfusion())
|
||||
#else
|
||||
if (newdir.Length() < Precision::Confusion())
|
||||
#endif
|
||||
return;//zero vector was passed. Keep the old orientation.
|
||||
try {
|
||||
gp_Ax2 pos = c->Position();
|
||||
@@ -3379,11 +3364,7 @@ void GeomArcOfHyperbola::setMajorAxisDir(Base::Vector3d newdir)
|
||||
{
|
||||
Handle(Geom_Hyperbola) c = Handle(Geom_Hyperbola)::DownCast( myCurve->BasisCurve() );
|
||||
assert(!c.IsNull());
|
||||
#if OCC_VERSION_HEX >= 0x060504
|
||||
if (newdir.Sqr() < Precision::SquareConfusion())
|
||||
#else
|
||||
if (newdir.Length() < Precision::Confusion())
|
||||
#endif
|
||||
return;//zero vector was passed. Keep the old orientation.
|
||||
|
||||
try {
|
||||
@@ -4239,11 +4220,7 @@ TopoDS_Shape GeomSurface::toShape() const
|
||||
Handle(Geom_Surface) s = Handle(Geom_Surface)::DownCast(handle());
|
||||
Standard_Real u1,u2,v1,v2;
|
||||
s->Bounds(u1,u2,v1,v2);
|
||||
BRepBuilderAPI_MakeFace mkBuilder(s, u1, u2, v1, v2
|
||||
#if OCC_VERSION_HEX >= 0x060502
|
||||
, Precision::Confusion()
|
||||
#endif
|
||||
);
|
||||
BRepBuilderAPI_MakeFace mkBuilder(s, u1, u2, v1, v2, Precision::Confusion() );
|
||||
return mkBuilder.Shape();
|
||||
}
|
||||
|
||||
@@ -4255,7 +4232,6 @@ bool GeomSurface::tangentU(double u, double v, gp_Dir& dirU) const
|
||||
prop.TangentU(dirU);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -5555,13 +5531,11 @@ std::unique_ptr<GeomCurve> makeFromCurveAdaptor(const Adaptor3d_Curve& adapt)
|
||||
geoCurve.reset(new GeomBSplineCurve(adapt.BSpline()));
|
||||
break;
|
||||
}
|
||||
#if OCC_VERSION_HEX >= 0x070000
|
||||
case GeomAbs_OffsetCurve:
|
||||
{
|
||||
geoCurve.reset(new GeomOffsetCurve(adapt.OffsetCurve()));
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
case GeomAbs_OtherCurve:
|
||||
default:
|
||||
break;
|
||||
|
||||
@@ -136,11 +136,7 @@ PyObject* GeometrySurfacePy::toShape(PyObject *args)
|
||||
s->Bounds(u1,u2,v1,v2);
|
||||
if (!PyArg_ParseTuple(args, "|dddd", &u1,&u2,&v1,&v2))
|
||||
return nullptr;
|
||||
BRepBuilderAPI_MakeFace mkBuilder(s, u1, u2, v1, v2
|
||||
#if OCC_VERSION_HEX >= 0x060502
|
||||
, Precision::Confusion()
|
||||
#endif
|
||||
);
|
||||
BRepBuilderAPI_MakeFace mkBuilder(s, u1, u2, v1, v2, Precision::Confusion() );
|
||||
TopoDS_Shape sh = mkBuilder.Shape();
|
||||
return new TopoShapeFacePy(new TopoShape(sh));
|
||||
}
|
||||
|
||||
@@ -243,222 +243,16 @@ int Part::ImportStepParts(App::Document *pcDoc, const char* Name)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if OCC_VERSION_HEX < 0x070000
|
||||
static void findStyledSR (const Handle(StepVisual_StyledItem) &style,
|
||||
Handle(StepShape_ShapeRepresentation)& aSR)
|
||||
{
|
||||
// search Shape Representation for component styled item
|
||||
for (Standard_Integer j=1; j <= style->NbStyles(); j++) {
|
||||
Handle(StepVisual_PresentationStyleByContext) PSA =
|
||||
Handle(StepVisual_PresentationStyleByContext)::DownCast(style->StylesValue ( j ));
|
||||
if (PSA.IsNull())
|
||||
continue;
|
||||
StepVisual_StyleContextSelect aStyleCntxSlct = PSA->StyleContext();
|
||||
Handle(StepShape_ShapeRepresentation) aCurrentSR =
|
||||
Handle(StepShape_ShapeRepresentation)::DownCast(aStyleCntxSlct.Representation());
|
||||
if (aCurrentSR.IsNull())
|
||||
continue;
|
||||
aSR = aCurrentSR;
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
bool Part::ReadColors (const Handle(XSControl_WorkSession) &WS, std::map<int, Quantity_Color>& hash_col)
|
||||
{
|
||||
#if OCC_VERSION_HEX >= 0x070000
|
||||
(void)WS;
|
||||
(void)hash_col;
|
||||
return Standard_False;
|
||||
#else
|
||||
STEPConstruct_Styles Styles (WS);
|
||||
if (!Styles.LoadStyles()) {
|
||||
#ifdef FC_DEBUG
|
||||
std::cout << "Warning: no styles are found in the model" << std::endl;
|
||||
#endif
|
||||
return Standard_False;
|
||||
}
|
||||
// searching for invisible items in the model
|
||||
Handle(TColStd_HSequenceOfTransient) aHSeqOfInvisStyle = new TColStd_HSequenceOfTransient;
|
||||
Styles.LoadInvisStyles( aHSeqOfInvisStyle );
|
||||
|
||||
// parse and search for color attributes
|
||||
Standard_Integer nb = Styles.NbStyles();
|
||||
for (Standard_Integer i=1; i <= nb; i++) {
|
||||
Handle(StepVisual_StyledItem) style = Styles.Style (i);
|
||||
if (style.IsNull()) continue;
|
||||
|
||||
Standard_Boolean IsVisible = Standard_True;
|
||||
// check the visibility of styled item.
|
||||
for (Standard_Integer si = 1; si <= aHSeqOfInvisStyle->Length(); si++) {
|
||||
if (style != aHSeqOfInvisStyle->Value(si))
|
||||
continue;
|
||||
// found that current style is invisible.
|
||||
#ifdef FC_DEBUG
|
||||
std::cout << "Warning: item No " << i << "(" << style->Item()->DynamicType()->Name() << ") is invisible" << std::endl;
|
||||
#endif
|
||||
IsVisible = Standard_False;
|
||||
break;
|
||||
}
|
||||
|
||||
Handle(StepVisual_Colour) SurfCol, BoundCol, CurveCol;
|
||||
// check if it is component style
|
||||
Standard_Boolean IsComponent = Standard_False;
|
||||
if (!Styles.GetColors (style, SurfCol, BoundCol, CurveCol, IsComponent) && IsVisible)
|
||||
continue;
|
||||
|
||||
// find shape
|
||||
TopoDS_Shape S = STEPConstruct::FindShape(Styles.TransientProcess(), style->Item());
|
||||
//TopAbs_ShapeEnum type = S.ShapeType();
|
||||
Standard_Boolean isSkipSHUOstyle = Standard_False;
|
||||
// take shape with real location.
|
||||
while (IsComponent) {
|
||||
// take SR of NAUO
|
||||
Handle(StepShape_ShapeRepresentation) aSR;
|
||||
findStyledSR(style, aSR);
|
||||
// search for SR along model
|
||||
if (aSR.IsNull())
|
||||
break;
|
||||
// Handle(Interface_InterfaceModel) Model = WS->Model();
|
||||
Handle(XSControl_TransferReader) TR = WS->TransferReader();
|
||||
Handle(Transfer_TransientProcess) TP = TR->TransientProcess();
|
||||
Interface_EntityIterator subs = WS->HGraph()->Graph().Sharings( aSR );
|
||||
Handle(StepShape_ShapeDefinitionRepresentation) aSDR;
|
||||
for (subs.Start(); subs.More(); subs.Next()) {
|
||||
aSDR = Handle(StepShape_ShapeDefinitionRepresentation)::DownCast(subs.Value());
|
||||
if (aSDR.IsNull())
|
||||
continue;
|
||||
StepRepr_RepresentedDefinition aPDSselect = aSDR->Definition();
|
||||
Handle(StepRepr_ProductDefinitionShape) PDS =
|
||||
Handle(StepRepr_ProductDefinitionShape)::DownCast(aPDSselect.PropertyDefinition());
|
||||
if (PDS.IsNull())
|
||||
continue;
|
||||
StepRepr_CharacterizedDefinition aCharDef = PDS->Definition();
|
||||
|
||||
Handle(StepRepr_AssemblyComponentUsage) ACU =
|
||||
Handle(StepRepr_AssemblyComponentUsage)::DownCast(aCharDef.ProductDefinitionRelationship());
|
||||
// PTV 10.02.2003 skip styled item that refer to SHUO
|
||||
if (ACU->IsKind(STANDARD_TYPE(StepRepr_SpecifiedHigherUsageOccurrence))) {
|
||||
isSkipSHUOstyle = Standard_True;
|
||||
break;
|
||||
}
|
||||
Handle(StepRepr_NextAssemblyUsageOccurrence) NAUO =
|
||||
Handle(StepRepr_NextAssemblyUsageOccurrence)::DownCast(ACU);
|
||||
if (NAUO.IsNull())
|
||||
continue;
|
||||
|
||||
TopoDS_Shape aSh;
|
||||
// PTV 10.02.2003 to find component of assembly CORRECTLY
|
||||
STEPConstruct_Tool Tool( WS );
|
||||
// Handle(Transfer_Binder) binder = TP->Find(NAUO);
|
||||
// if (binder.IsNull() || ! binder->HasResult())
|
||||
// continue;
|
||||
// aSh = TransferBRep::ShapeResult ( TP, binder );
|
||||
if (!aSh.IsNull()) {
|
||||
S = aSh;
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (isSkipSHUOstyle)
|
||||
continue; // skip styled item which refer to SHUO
|
||||
|
||||
if ( S.IsNull() ) {
|
||||
#ifdef FC_DEBUG
|
||||
std::cout << "Warning: item No " << i << "(" << style->Item()->DynamicType()->Name() << ") is not mapped to shape" << std::endl;
|
||||
#endif
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!SurfCol.IsNull()) {
|
||||
Quantity_Color col;
|
||||
Styles.DecodeColor (SurfCol, col);
|
||||
//Base::Console().Message("%d: (%.2f,%.2f,%.2f)\n",col.Name(),col.Red(),col.Green(),col.Blue());
|
||||
hash_col[S.HashCode(INT_MAX)] = col;
|
||||
}
|
||||
if (!BoundCol.IsNull()) {
|
||||
Quantity_Color col;
|
||||
Styles.DecodeColor (BoundCol, col);
|
||||
//Base::Console().Message("%d: (%.2f,%.2f,%.2f)\n",col.Name(),col.Red(),col.Green(),col.Blue());
|
||||
hash_col[S.HashCode(INT_MAX)] = col;
|
||||
}
|
||||
if (!CurveCol.IsNull()) {
|
||||
Quantity_Color col;
|
||||
Styles.DecodeColor (CurveCol, col);
|
||||
//Base::Console().Message("%d: (%.2f,%.2f,%.2f)\n",col.Name(),col.Red(),col.Green(),col.Blue());
|
||||
hash_col[S.HashCode(INT_MAX)] = col;
|
||||
}
|
||||
if (!IsVisible) {
|
||||
// sets the invisibility for shape.
|
||||
}
|
||||
}
|
||||
|
||||
return Standard_True;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool Part::ReadNames (const Handle(XSControl_WorkSession) &WS)
|
||||
{
|
||||
#if OCC_VERSION_HEX >= 0x070000
|
||||
(void)WS;
|
||||
return Standard_False;
|
||||
#else
|
||||
// get starting data
|
||||
Handle(Interface_InterfaceModel) Model = WS->Model();
|
||||
Handle(XSControl_TransferReader) TR = WS->TransferReader();
|
||||
Handle(Transfer_TransientProcess) TP = TR->TransientProcess();
|
||||
|
||||
STEPConstruct_Tool Tool ( WS );
|
||||
|
||||
// iterate on model to find all SDRs and CDSRs
|
||||
Standard_Integer nb = Model->NbEntities();
|
||||
Handle(Standard_Type) tNAUO = STANDARD_TYPE(StepRepr_NextAssemblyUsageOccurrence);
|
||||
Handle(Standard_Type) tPD = STANDARD_TYPE(StepBasic_ProductDefinition);
|
||||
Handle(TCollection_HAsciiString) name;
|
||||
for (Standard_Integer i = 1; i <= nb; i++) {
|
||||
Handle(Standard_Transient) enti = Model->Value(i);
|
||||
|
||||
// get description of NAUO
|
||||
if (enti->DynamicType() == tNAUO) {
|
||||
Handle(StepRepr_NextAssemblyUsageOccurrence) NAUO =
|
||||
Handle(StepRepr_NextAssemblyUsageOccurrence)::DownCast(enti);
|
||||
if (NAUO.IsNull()) continue;
|
||||
Interface_EntityIterator subs = WS->Graph().Sharings(NAUO);
|
||||
for (subs.Start(); subs.More(); subs.Next()) {
|
||||
Handle(StepRepr_ProductDefinitionShape) PDS =
|
||||
Handle(StepRepr_ProductDefinitionShape)::DownCast(subs.Value());
|
||||
if (PDS.IsNull()) continue;
|
||||
Handle(StepBasic_ProductDefinitionRelationship) PDR = PDS->Definition().ProductDefinitionRelationship();
|
||||
if (PDR.IsNull()) continue;
|
||||
if (PDR->HasDescription() &&
|
||||
PDR->Description()->Length() >0 ) name = PDR->Description();
|
||||
else if (PDR->Name()->Length() >0) name = PDR->Name();
|
||||
else name = PDR->Id();
|
||||
}
|
||||
|
||||
// find proper label
|
||||
TCollection_ExtendedString str ( name->String() );
|
||||
Base::Console().Message("Name: %s\n",name->String().ToCString());
|
||||
}
|
||||
|
||||
// for PD get name of associated product
|
||||
if (enti->DynamicType() == tPD) {
|
||||
Handle(StepBasic_ProductDefinition) PD =
|
||||
Handle(StepBasic_ProductDefinition)::DownCast(enti);
|
||||
if (PD.IsNull()) continue;
|
||||
Handle(StepBasic_Product) Prod = PD->Formation()->OfProduct();
|
||||
if (Prod->Name()->UsefullLength()>0) name = Prod->Name();
|
||||
else name = Prod->Id();
|
||||
|
||||
TCollection_ExtendedString str ( name->String() );
|
||||
Base::Console().Message("Name: %s\n",name->String().ToCString());
|
||||
}
|
||||
// set a name to the document
|
||||
//TCollection_ExtendedString str ( name->String() );
|
||||
//TDataStd_Name::Set ( L, str );
|
||||
}
|
||||
|
||||
return Standard_True;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -27,9 +27,7 @@
|
||||
# include <Standard_Failure.hxx>
|
||||
# include <Standard_AbortiveTransaction.hxx>
|
||||
# include <Standard_ConstructionError.hxx>
|
||||
# if OCC_VERSION_HEX >= 0x060500
|
||||
# include <Standard_DefineException.hxx>
|
||||
# endif
|
||||
# include <Standard_DimensionError.hxx>
|
||||
# include <Standard_DimensionMismatch.hxx>
|
||||
# include <Standard_DivideByZero.hxx>
|
||||
|
||||
@@ -184,10 +184,7 @@
|
||||
#include <ShapeFix_ShapeTolerance.hxx>
|
||||
|
||||
#include <BRepOffset_MakeOffset.hxx>
|
||||
|
||||
#if OCC_VERSION_HEX >= 0x060600
|
||||
#include <BRepClass3d.hxx>
|
||||
#endif
|
||||
#if OCC_VERSION_HEX < 0x070600
|
||||
#include <Adaptor3d_HCurve.hxx>
|
||||
#include <Adaptor3d_HCurveOnSurface.hxx>
|
||||
@@ -231,15 +228,11 @@
|
||||
#include <BRepLProp_SurfaceTool.hxx>
|
||||
#include <BRepGProp_Face.hxx>
|
||||
#include <BRepClass_FaceClassifier.hxx>
|
||||
#if OCC_VERSION_HEX >= 0x060600
|
||||
#include <BRepClass3d.hxx>
|
||||
#endif
|
||||
#include <BRepClass3d_SolidClassifier.hxx>
|
||||
#include <BRepExtrema_DistShapeShape.hxx>
|
||||
#include <BRepExtrema_MapOfIntegerPackedMapOfInteger.hxx>
|
||||
#if OCC_VERSION_HEX >= 0x060801
|
||||
#include <BRepExtrema_ShapeProximity.hxx>
|
||||
#endif
|
||||
#include <BRepFeat_SplitShape.hxx>
|
||||
#include <BRepFeat_MakePrism.hxx>
|
||||
#include <BRepFilletAPI_MakeChamfer.hxx>
|
||||
@@ -507,18 +500,14 @@
|
||||
#include <ShapeAnalysis_FreeBoundsProperties.hxx>
|
||||
#include <ShapeAnalysis_FreeBoundData.hxx>
|
||||
|
||||
#if OCC_VERSION_HEX >= 0x060600
|
||||
# include <BOPAlgo_ArgumentAnalyzer.hxx>
|
||||
# include <BOPAlgo_ListOfCheckResult.hxx>
|
||||
#endif
|
||||
|
||||
#if OCC_VERSION_HEX >= 0x070300
|
||||
# include <BRepAlgoAPI_Defeaturing.hxx>
|
||||
#endif
|
||||
|
||||
#if OCC_VERSION_HEX >= 0x060800
|
||||
#include <OSD_OpenFile.hxx>
|
||||
#endif
|
||||
|
||||
#endif // __OpenCascadeAll__
|
||||
|
||||
|
||||
@@ -188,12 +188,10 @@ App::DocumentObject *Feature::getSubObject(const char *subname,
|
||||
// instance or do simply nothing. For now the error message is degraded to a log message.
|
||||
std::ostringstream str;
|
||||
Standard_CString msg = e.GetMessageString();
|
||||
#if OCC_VERSION_HEX >= 0x070000
|
||||
|
||||
// Avoid name mangling
|
||||
str << e.DynamicType()->get_type_name() << " ";
|
||||
#else
|
||||
str << typeid(e).name() << " ";
|
||||
#endif
|
||||
|
||||
if (msg) {str << msg;}
|
||||
else {str << "No OCCT Exception Message";}
|
||||
str << ": " << getFullName();
|
||||
|
||||
@@ -324,11 +324,7 @@ App::DocumentObjectExecReturn *Plane::execute(void)
|
||||
gp_Pnt pnt(0.0,0.0,0.0);
|
||||
gp_Dir dir(0.0,0.0,1.0);
|
||||
Handle(Geom_Plane) aPlane = new Geom_Plane(pnt, dir);
|
||||
BRepBuilderAPI_MakeFace mkFace(aPlane, 0.0, L, 0.0, W
|
||||
#if OCC_VERSION_HEX >= 0x060502
|
||||
, Precision::Confusion()
|
||||
#endif
|
||||
);
|
||||
BRepBuilderAPI_MakeFace mkFace(aPlane, 0.0, L, 0.0, W, Precision::Confusion());
|
||||
|
||||
const char *error=nullptr;
|
||||
switch (mkFace.Error())
|
||||
@@ -346,11 +342,6 @@ App::DocumentObjectExecReturn *Plane::execute(void)
|
||||
case BRepBuilderAPI_ParametersOutOfRange:
|
||||
error = "parameters out of range";
|
||||
break;
|
||||
#if OCC_VERSION_HEX < 0x060500
|
||||
case BRepBuilderAPI_SurfaceNotC2:
|
||||
error = "surface not C2";
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
error = "unknown error";
|
||||
break;
|
||||
|
||||
@@ -43,9 +43,7 @@
|
||||
# include <gp_GTrsf.hxx>
|
||||
# include <gp_Trsf.hxx>
|
||||
|
||||
#if OCC_VERSION_HEX >= 0x060800
|
||||
# include <OSD_OpenFile.hxx>
|
||||
#endif
|
||||
|
||||
#endif // _PreComp_
|
||||
|
||||
@@ -248,11 +246,8 @@ void PropertyPartShape::Restore(Base::XMLReader &reader)
|
||||
static Standard_Boolean BRepTools_Write(const TopoDS_Shape& Sh, const Standard_CString File)
|
||||
{
|
||||
std::ofstream os;
|
||||
#if OCC_VERSION_HEX >= 0x060800
|
||||
OSD_OpenStream(os, File, std::ios::out);
|
||||
#else
|
||||
os.open(File, std::ios::out);
|
||||
#endif
|
||||
|
||||
if (!os.rdbuf()->is_open())
|
||||
return Standard_False;
|
||||
|
||||
|
||||
@@ -632,11 +632,7 @@ Handle (Poly_Triangulation) Part::Tools::triangulationOfFace(const TopoDS_Face&
|
||||
selectRange(v1, v2);
|
||||
|
||||
Handle(Geom_Surface) surface = BRep_Tool::Surface(face);
|
||||
BRepBuilderAPI_MakeFace mkBuilder(surface, u1, u2, v1, v2
|
||||
#if OCC_VERSION_HEX >= 0x060502
|
||||
, Precision::Confusion()
|
||||
#endif
|
||||
);
|
||||
BRepBuilderAPI_MakeFace mkBuilder(surface, u1, u2, v1, v2, Precision::Confusion() );
|
||||
|
||||
TopoDS_Shape shape = mkBuilder.Shape();
|
||||
shape.Location(loc);
|
||||
|
||||
@@ -176,10 +176,8 @@
|
||||
# include <BRepAlgo_Fuse.hxx>
|
||||
#endif
|
||||
|
||||
#if OCC_VERSION_HEX >= 0x060600
|
||||
# include <BOPAlgo_ArgumentAnalyzer.hxx>
|
||||
# include <BOPAlgo_ListOfCheckResult.hxx>
|
||||
#endif
|
||||
|
||||
#if OCC_VERSION_HEX >= 0x070300
|
||||
# include <BRepAlgoAPI_Defeaturing.hxx>
|
||||
@@ -239,10 +237,6 @@ const char* BRepBuilderAPI_FaceErrorText(BRepBuilderAPI_FaceError et)
|
||||
return "Curve projection failed";
|
||||
case BRepBuilderAPI_ParametersOutOfRange:
|
||||
return "Parameters out of range";
|
||||
#if OCC_VERSION_HEX < 0x060500
|
||||
case BRepBuilderAPI_SurfaceNotC2:
|
||||
return "Surface not C2-continuous";
|
||||
#endif
|
||||
default:
|
||||
return "Unknown creation error";
|
||||
}
|
||||
@@ -627,16 +621,11 @@ void TopoShape::convertTogpTrsf(const Base::Matrix4D& mtrx, gp_Trsf& trsf)
|
||||
{
|
||||
trsf.SetValues(mtrx[0][0],mtrx[0][1],mtrx[0][2],mtrx[0][3],
|
||||
mtrx[1][0],mtrx[1][1],mtrx[1][2],mtrx[1][3],
|
||||
mtrx[2][0],mtrx[2][1],mtrx[2][2],mtrx[2][3]
|
||||
#if OCC_VERSION_HEX < 0x060800
|
||||
, 0.00001,0.00001
|
||||
#endif
|
||||
); //precision was removed in OCCT CR0025194
|
||||
mtrx[2][0],mtrx[2][1],mtrx[2][2],mtrx[2][3]);
|
||||
}
|
||||
|
||||
void TopoShape::convertToMatrix(const gp_Trsf& trsf, Base::Matrix4D& mtrx)
|
||||
{
|
||||
#if OCC_VERSION_HEX >= 0x070000
|
||||
// https://www.opencascade.com/doc/occt-7.0.0/refman/html/classgp___trsf.html
|
||||
// VectorialPart() already includes the scale factor
|
||||
gp_Mat m = trsf.VectorialPart();
|
||||
@@ -659,29 +648,6 @@ void TopoShape::convertToMatrix(const gp_Trsf& trsf, Base::Matrix4D& mtrx)
|
||||
mtrx[0][3] = p.X();
|
||||
mtrx[1][3] = p.Y();
|
||||
mtrx[2][3] = p.Z();
|
||||
#else
|
||||
gp_Mat m = trsf._CSFDB_Getgp_Trsfmatrix();
|
||||
gp_XYZ p = trsf._CSFDB_Getgp_Trsfloc();
|
||||
Standard_Real scale = trsf._CSFDB_Getgp_Trsfscale();
|
||||
|
||||
// set Rotation matrix
|
||||
mtrx[0][0] = scale * m._CSFDB_Getgp_Matmatrix(0,0);
|
||||
mtrx[0][1] = scale * m._CSFDB_Getgp_Matmatrix(0,1);
|
||||
mtrx[0][2] = scale * m._CSFDB_Getgp_Matmatrix(0,2);
|
||||
|
||||
mtrx[1][0] = scale * m._CSFDB_Getgp_Matmatrix(1,0);
|
||||
mtrx[1][1] = scale * m._CSFDB_Getgp_Matmatrix(1,1);
|
||||
mtrx[1][2] = scale * m._CSFDB_Getgp_Matmatrix(1,2);
|
||||
|
||||
mtrx[2][0] = scale * m._CSFDB_Getgp_Matmatrix(2,0);
|
||||
mtrx[2][1] = scale * m._CSFDB_Getgp_Matmatrix(2,1);
|
||||
mtrx[2][2] = scale * m._CSFDB_Getgp_Matmatrix(2,2);
|
||||
|
||||
// set pos vector
|
||||
mtrx[0][3] = p._CSFDB_Getgp_XYZx();
|
||||
mtrx[1][3] = p._CSFDB_Getgp_XYZy();
|
||||
mtrx[2][3] = p._CSFDB_Getgp_XYZz();
|
||||
#endif
|
||||
}
|
||||
|
||||
Base::Matrix4D TopoShape::convert(const gp_Trsf& trsf) {
|
||||
@@ -872,7 +838,7 @@ void TopoShape::importBrep(const char *FileName)
|
||||
// read brep-file
|
||||
BRep_Builder aBuilder;
|
||||
TopoDS_Shape aShape;
|
||||
#if OCC_VERSION_HEX >= 0x060300 && OCC_VERSION_HEX < 0x070500
|
||||
#if OCC_VERSION_HEX < 0x070500
|
||||
Handle(Message_ProgressIndicator) pi = new ProgressIndicator(100);
|
||||
pi->NewScope(100, "Reading BREP file...");
|
||||
pi->Show();
|
||||
@@ -894,7 +860,7 @@ void TopoShape::importBrep(std::istream& str, int indicator)
|
||||
// read brep-file
|
||||
BRep_Builder aBuilder;
|
||||
TopoDS_Shape aShape;
|
||||
#if OCC_VERSION_HEX >= 0x060300 && OCC_VERSION_HEX < 0x070500
|
||||
#if OCC_VERSION_HEX < 0x070500
|
||||
if (indicator) {
|
||||
Handle(Message_ProgressIndicator) pi = new ProgressIndicator(100);
|
||||
pi->NewScope(100, "Reading BREP file...");
|
||||
@@ -1095,18 +1061,11 @@ void TopoShape::dump(std::ostream& out) const
|
||||
void TopoShape::exportStl(const char *filename, double deflection) const
|
||||
{
|
||||
StlAPI_Writer writer;
|
||||
#if OCC_VERSION_HEX < 0x060801
|
||||
if (deflection > 0) {
|
||||
writer.RelativeMode() = false;
|
||||
writer.SetDeflection(deflection);
|
||||
}
|
||||
#else
|
||||
BRepMesh_IncrementalMesh aMesh(this->_Shape, deflection,
|
||||
/*isRelative*/ Standard_False,
|
||||
/*theAngDeflection*/
|
||||
defaultAngularDeflection(deflection),
|
||||
/*isInParallel*/ true);
|
||||
#endif
|
||||
writer.Write(this->_Shape,encodeFilename(filename).c_str());
|
||||
}
|
||||
|
||||
@@ -1652,31 +1611,23 @@ bool TopoShape::analyze(bool runBopCheck, std::ostream& str) const
|
||||
return false; // errors detected
|
||||
}
|
||||
else if (runBopCheck) {
|
||||
// Copied from TaskCheckGeometryResults::goBOPSingleCheck
|
||||
#if OCC_VERSION_HEX >= 0x060600
|
||||
|
||||
TopoDS_Shape BOPCopy = BRepBuilderAPI_Copy(this->_Shape).Shape();
|
||||
BOPAlgo_ArgumentAnalyzer BOPCheck;
|
||||
// BOPCheck.StopOnFirstFaulty() = true; //this doesn't run any faster but gives us less results.
|
||||
BOPCheck.SetShape1(BOPCopy);
|
||||
//all settings are false by default. so only turn on what we want.
|
||||
BOPCheck.ArgumentTypeMode() = true;
|
||||
BOPCheck.SelfInterMode() = true;
|
||||
BOPCheck.SmallEdgeMode() = true;
|
||||
BOPCheck.RebuildFaceMode() = true;
|
||||
#if OCC_VERSION_HEX >= 0x060700
|
||||
BOPCheck.ContinuityMode() = true;
|
||||
#endif
|
||||
#if OCC_VERSION_HEX >= 0x060900
|
||||
BOPCheck.SetParallelMode(true); //this doesn't help for speed right now(occt 6.9.1).
|
||||
BOPCheck.SetRunParallel(true); //performance boost, use all available cores
|
||||
BOPCheck.TangentMode() = true; //these 4 new tests add about 5% processing time.
|
||||
BOPCheck.MergeVertexMode() = true;
|
||||
BOPCheck.CurveOnSurfaceMode() = true;
|
||||
BOPCheck.MergeEdgeMode() = true;
|
||||
#endif
|
||||
|
||||
BOPCheck.Perform();
|
||||
|
||||
if (!BOPCheck.HasFaulty())
|
||||
return true;
|
||||
|
||||
@@ -1688,25 +1639,17 @@ bool TopoShape::analyze(bool runBopCheck, std::ostream& str) const
|
||||
for (; BOPResultsIt.More(); BOPResultsIt.Next()) {
|
||||
const BOPAlgo_CheckResult ¤t = BOPResultsIt.Value();
|
||||
|
||||
#if OCC_VERSION_HEX < 0x070000
|
||||
const BOPCol_ListOfShape &faultyShapes1 = current.GetFaultyShapes1();
|
||||
BOPCol_ListIteratorOfListOfShape faultyShapes1It(faultyShapes1);
|
||||
#else
|
||||
const TopTools_ListOfShape &faultyShapes1 = current.GetFaultyShapes1();
|
||||
TopTools_ListIteratorOfListOfShape faultyShapes1It(faultyShapes1);
|
||||
#endif
|
||||
for (;faultyShapes1It.More(); faultyShapes1It.Next()) {
|
||||
const TopoDS_Shape &faultyShape = faultyShapes1It.Value();
|
||||
str << "Error in " << shapeEnumToString[faultyShape.ShapeType()] << ": ";
|
||||
str << bopEnumToString[current.GetCheckStatus()] << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
#endif // 0x060600
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -871,7 +871,6 @@ Py::Object TopoShapeEdgePy::getCurve() const
|
||||
curve = new BSplineCurvePy(bspline);
|
||||
break;
|
||||
}
|
||||
#if OCC_VERSION_HEX >= 0x070000
|
||||
case GeomAbs_OffsetCurve:
|
||||
{
|
||||
Standard_Real first, last;
|
||||
@@ -886,7 +885,6 @@ Py::Object TopoShapeEdgePy::getCurve() const
|
||||
throw Py::RuntimeError("Failed to convert to offset curve");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
case GeomAbs_OtherCurve:
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -233,11 +233,7 @@ int TopoShapeFacePy::PyInit(PyObject* args, PyObject* /*kwd*/)
|
||||
return -1;
|
||||
}
|
||||
|
||||
BRepBuilderAPI_MakeFace mkFace(S
|
||||
#if OCC_VERSION_HEX >= 0x060502
|
||||
, Precision::Confusion()
|
||||
#endif
|
||||
);
|
||||
BRepBuilderAPI_MakeFace mkFace(S, Precision::Confusion());
|
||||
if (bound) {
|
||||
Py::List list(bound);
|
||||
for (Py::List::iterator it = list.begin(); it != list.end(); ++it) {
|
||||
@@ -301,11 +297,6 @@ int TopoShapeFacePy::PyInit(PyObject* args, PyObject* /*kwd*/)
|
||||
case BRepBuilderAPI_ParametersOutOfRange:
|
||||
Standard_Failure::Raise("Parameters out of range");
|
||||
break;
|
||||
#if OCC_VERSION_HEX < 0x060500
|
||||
case BRepBuilderAPI_SurfaceNotC2:
|
||||
Standard_Failure::Raise("Surface not C2");
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
Standard_Failure::Raise("Unknown failure");
|
||||
break;
|
||||
@@ -847,11 +838,6 @@ PyObject* TopoShapeFacePy::cutHoles(PyObject *args)
|
||||
case BRepBuilderAPI_ParametersOutOfRange:
|
||||
Standard_Failure::Raise("Parameters out of range");
|
||||
break;
|
||||
#if OCC_VERSION_HEX < 0x060500
|
||||
case BRepBuilderAPI_SurfaceNotC2:
|
||||
Standard_Failure::Raise("Surface not C2");
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
Standard_Failure::Raise("Unknown failure");
|
||||
break;
|
||||
|
||||
@@ -38,9 +38,7 @@
|
||||
# include <BRepProj_Projection.hxx>
|
||||
# include <BRepTools.hxx>
|
||||
# include <BRepExtrema_DistShapeShape.hxx>
|
||||
#if OCC_VERSION_HEX >= 0x060801
|
||||
# include <BRepExtrema_ShapeProximity.hxx>
|
||||
#endif
|
||||
# include <BRepExtrema_SupportType.hxx>
|
||||
# include <BRepBndLib.hxx>
|
||||
# include <BRep_Tool.hxx>
|
||||
@@ -182,14 +180,9 @@ PyObject* TopoShapePy::copy(PyObject *args)
|
||||
}
|
||||
|
||||
if (!shape.IsNull()) {
|
||||
#if OCC_VERSION_HEX >= 0x070000
|
||||
BRepBuilderAPI_Copy c(shape,
|
||||
PyObject_IsTrue(copyGeom) ? Standard_True : Standard_False,
|
||||
PyObject_IsTrue(copyMesh) ? Standard_True : Standard_False);
|
||||
#else
|
||||
BRepBuilderAPI_Copy c(shape,
|
||||
PyObject_IsTrue(copyGeom) ? Standard_True : Standard_False);
|
||||
#endif
|
||||
static_cast<TopoShapePy*>(cpy)->getTopoShapePtr()->setShape(c.Shape());
|
||||
}
|
||||
return cpy;
|
||||
@@ -2488,10 +2481,8 @@ PyObject* _getSupportIndex(const char* suppStr, TopoShape* ts, TopoDS_Shape supp
|
||||
|
||||
PyObject* TopoShapePy::proximity(PyObject *args)
|
||||
{
|
||||
#if OCC_VERSION_HEX >= 0x060801
|
||||
#if OCC_VERSION_HEX >= 0x060901
|
||||
typedef BRepExtrema_MapOfIntegerPackedMapOfInteger BRepExtrema_OverlappedSubShapes;
|
||||
#endif
|
||||
|
||||
PyObject* ps2;
|
||||
Standard_Real tol = Precision::Confusion();
|
||||
if (!PyArg_ParseTuple(args, "O!|d",&(TopoShapePy::Type), &ps2, &tol))
|
||||
@@ -2577,11 +2568,7 @@ PyObject* TopoShapePy::proximity(PyObject *args)
|
||||
tuple.setItem(0, overlappssindex1);
|
||||
tuple.setItem(1, overlappssindex2);
|
||||
return Py::new_reference_to(tuple); //face indexes
|
||||
#else
|
||||
(void)args;
|
||||
PyErr_SetString(PyExc_NotImplementedError, "proximity requires OCCT >= 6.8.1");
|
||||
return 0;
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
PyObject* TopoShapePy::distToShape(PyObject *args)
|
||||
|
||||
@@ -167,11 +167,8 @@ PyObject* TopoShapeShellPy::getFreeEdges(PyObject *args)
|
||||
return nullptr;
|
||||
ShapeAnalysis_Shell as;
|
||||
as.LoadShells(getTopoShapePtr()->getShape());
|
||||
#if OCC_VERSION_HEX < 0x060500
|
||||
as.CheckOrientedShells(getTopoShapePtr()->getShape(), Standard_True);
|
||||
#else
|
||||
as.CheckOrientedShells(getTopoShapePtr()->getShape(), Standard_True, Standard_True);
|
||||
#endif
|
||||
|
||||
TopoDS_Compound comp = as.FreeEdges();
|
||||
return new TopoShapeCompoundPy(new TopoShape(comp));
|
||||
}
|
||||
@@ -182,11 +179,8 @@ PyObject* TopoShapeShellPy::getBadEdges(PyObject *args)
|
||||
return nullptr;
|
||||
ShapeAnalysis_Shell as;
|
||||
as.LoadShells(getTopoShapePtr()->getShape());
|
||||
#if OCC_VERSION_HEX < 0x060500
|
||||
as.CheckOrientedShells(getTopoShapePtr()->getShape(), Standard_True);
|
||||
#else
|
||||
as.CheckOrientedShells(getTopoShapePtr()->getShape(), Standard_True, Standard_True);
|
||||
#endif
|
||||
|
||||
TopoDS_Compound comp = as.BadEdges();
|
||||
return new TopoShapeCompoundPy(new TopoShape(comp));
|
||||
}
|
||||
|
||||
@@ -28,9 +28,7 @@
|
||||
# include <BRepGProp.hxx>
|
||||
# include <BRepTools.hxx>
|
||||
# include <BRepOffset_MakeOffset.hxx>
|
||||
#if OCC_VERSION_HEX >= 0x060600
|
||||
# include <BRepClass3d.hxx>
|
||||
#endif
|
||||
# include <GProp_GProps.hxx>
|
||||
# include <GProp_PrincipalProps.hxx>
|
||||
# include <BRepBuilderAPI_MakeSolid.hxx>
|
||||
@@ -219,11 +217,7 @@ Py::Object TopoShapeSolidPy::getOuterShell(void) const
|
||||
TopoDS_Shell shell;
|
||||
const TopoDS_Shape& shape = getTopoShapePtr()->getShape();
|
||||
if (!shape.IsNull() && shape.ShapeType() == TopAbs_SOLID)
|
||||
#if OCC_VERSION_HEX >= 0x060600
|
||||
shell = BRepClass3d::OuterShell(TopoDS::Solid(shape));
|
||||
#else
|
||||
shell = BRepTools::OuterShell(TopoDS::Solid(shape));
|
||||
#endif
|
||||
return Py::Object(new TopoShapeShellPy(new TopoShape(shell)),true);
|
||||
}
|
||||
|
||||
|
||||
@@ -24,23 +24,11 @@
|
||||
#ifndef PART_ENCODEFILENAME_H
|
||||
#define PART_ENCODEFILENAME_H
|
||||
|
||||
#if (OCC_VERSION_HEX < 0x060800 && defined(_WIN32))
|
||||
#include <QString>
|
||||
#endif
|
||||
|
||||
namespace Part
|
||||
{
|
||||
inline std::string encodeFilename(std::string fn)
|
||||
{
|
||||
#if (OCC_VERSION_HEX < 0x060800 && defined(_WIN32))
|
||||
// Workaround to support latin1 characters in path until OCCT supports
|
||||
// conversion from UTF8 to wchar_t on windows
|
||||
// http://tracker.dev.opencascade.org/view.php?id=22484
|
||||
QByteArray str8bit = QString::fromUtf8(fn.c_str()).toLocal8Bit();
|
||||
return std::string(str8bit.constData());
|
||||
#else
|
||||
return fn;
|
||||
#endif
|
||||
}
|
||||
|
||||
} //namespace Part
|
||||
|
||||
@@ -1250,16 +1250,6 @@ void Part::BRepBuilderAPI_RefineModel::Build()
|
||||
}
|
||||
}
|
||||
myShape = mkSolid.Solid();
|
||||
|
||||
#if OCC_VERSION_HEX <= 0x060700
|
||||
// With occ 6.7 and older it can happen that a solid is flipped.
|
||||
// In this case it must be reversed
|
||||
GProp_GProps props;
|
||||
BRepGProp::VolumeProperties(myShape, props);
|
||||
if (props.Mass() < 0) {
|
||||
myShape.Reverse();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else if (myShape.ShapeType() == TopAbs_SHELL) {
|
||||
const TopoDS_Shell& shell = TopoDS::Shell(myShape);
|
||||
|
||||
@@ -64,7 +64,7 @@ def addCommands():
|
||||
|
||||
def generalFuseIsAvailable():
|
||||
"""generalFuseIsAvailable(): returns True if FreeCAD's Part.Shape.generalFuse is functional.
|
||||
True if Part.OCC_VERSION >= 6.9.0."""
|
||||
True if Part.OCC_VERSION >= 7.0.0."""
|
||||
import Part
|
||||
if not hasattr(Part, "OCC_VERSION"):
|
||||
return False
|
||||
@@ -74,4 +74,4 @@ def generalFuseIsAvailable():
|
||||
match = re.match(r"([0-9]+)\.([0-9]+)\.([0-9]+)",ver_string)
|
||||
major,minor,rev = match.groups()
|
||||
major = int(major); minor = int(minor); rev = int(rev)
|
||||
return (major,minor,rev)>=(6,9,0)
|
||||
return (major,minor,rev)>=(7,0,0)
|
||||
|
||||
@@ -784,11 +784,7 @@ void CmdPartCompSplitFeatures::languageChange()
|
||||
bool CmdPartCompSplitFeatures::isActive(void)
|
||||
{
|
||||
if (getActiveGuiDocument())
|
||||
#if OCC_VERSION_HEX < 0x060900
|
||||
return false;
|
||||
#else
|
||||
return true;
|
||||
#endif
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -437,18 +437,6 @@ bool CmdPartDefeaturing::isActive(void)
|
||||
}
|
||||
|
||||
|
||||
// {
|
||||
// if (getActiveGuiDocument())
|
||||
// #if OCC_VERSION_HEX < 0x060900
|
||||
// return false;
|
||||
// #else
|
||||
// return true;
|
||||
// #endif
|
||||
// else
|
||||
// return false;
|
||||
// }
|
||||
|
||||
|
||||
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
|
||||
void CreateSimplePartCommands(void)
|
||||
|
||||
@@ -152,10 +152,8 @@
|
||||
#include <ShapeFix_Face.hxx>
|
||||
#include <ShapeFix_Wireframe.hxx>
|
||||
|
||||
#if OCC_VERSION_HEX >= 0x060600
|
||||
# include <BOPAlgo_ArgumentAnalyzer.hxx>
|
||||
# include <BOPAlgo_ListOfCheckResult.hxx>
|
||||
#endif
|
||||
|
||||
// Boost
|
||||
#include <boost_signals2.hpp>
|
||||
|
||||
@@ -38,11 +38,8 @@
|
||||
# include <BRepCheck_ListIteratorOfListOfStatus.hxx>
|
||||
# include <BRepBuilderAPI_Copy.hxx>
|
||||
# include <BRepTools_ShapeSet.hxx>
|
||||
|
||||
# if OCC_VERSION_HEX >= 0x060600
|
||||
# include <BOPAlgo_ArgumentAnalyzer.hxx>
|
||||
# include <BOPAlgo_ListOfCheckResult.hxx>
|
||||
# endif
|
||||
# include <BOPAlgo_ArgumentAnalyzer.hxx>
|
||||
# include <BOPAlgo_ListOfCheckResult.hxx>
|
||||
|
||||
# include <TopoDS.hxx>
|
||||
# include <TopoDS_Compound.hxx>
|
||||
@@ -177,7 +174,7 @@ QVector<QString> buildBOPCheckResultVector()
|
||||
return results;
|
||||
}
|
||||
|
||||
#if OCC_VERSION_HEX >= 0x060600
|
||||
|
||||
QString getBOPCheckString(const BOPAlgo_CheckStatus &status)
|
||||
{
|
||||
static QVector<QString> strings = buildBOPCheckResultVector();
|
||||
@@ -186,7 +183,7 @@ QString getBOPCheckString(const BOPAlgo_CheckStatus &status)
|
||||
index = 0;
|
||||
return strings.at(index);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
ResultEntry::ResultEntry()
|
||||
{
|
||||
@@ -425,9 +422,7 @@ void TaskCheckGeometryResults::goCheck()
|
||||
#if OCC_VERSION_HEX < 0x070500
|
||||
Handle(Message_ProgressIndicator) theProgress = new BOPProgressIndicator(tr("Check geometry"), Gui::getMainWindow());
|
||||
theProgress->NewScope("BOP check...");
|
||||
#if OCC_VERSION_HEX >= 0x060900
|
||||
theProgress->Show();
|
||||
#endif
|
||||
#else
|
||||
Handle(Message_ProgressIndicator) theProgress = new BOPProgressIndicator(tr("Check geometry"), Gui::getMainWindow());
|
||||
Message_ProgressRange theRange(theProgress->Start());
|
||||
@@ -647,8 +642,6 @@ int TaskCheckGeometryResults::goBOPSingleCheck(const TopoDS_Shape& shapeIn, Resu
|
||||
bool mergeEdgeMode = group->GetBool("MergeEdgeMode", true);
|
||||
bool curveOnSurfaceMode = group->GetBool("CurveOnSurfaceMode", true);
|
||||
|
||||
//ArgumentAnalyser was moved at version 6.6. no back port for now.
|
||||
#if OCC_VERSION_HEX >= 0x060600
|
||||
//Reference use: src/BOPTest/BOPTest_CheckCommands.cxx
|
||||
|
||||
//I don't why we need to make a copy, but it doesn't work without it.
|
||||
@@ -661,35 +654,30 @@ int TaskCheckGeometryResults::goBOPSingleCheck(const TopoDS_Shape& shapeIn, Resu
|
||||
//this is left for another time.
|
||||
TopoDS_Shape BOPCopy = BRepBuilderAPI_Copy(shapeIn).Shape();
|
||||
BOPAlgo_ArgumentAnalyzer BOPCheck;
|
||||
#if OCC_VERSION_HEX >= 0x060900
|
||||
#if OCC_VERSION_HEX < 0x070500
|
||||
BOPCheck.SetProgressIndicator(theProgress);
|
||||
#elif OCC_VERSION_HEX < 0x070600
|
||||
BOPCheck.SetProgressIndicator(theScope);
|
||||
#else
|
||||
Q_UNUSED(theScope)
|
||||
#endif // 0x070500
|
||||
#else
|
||||
Q_UNUSED(theProgress);
|
||||
#endif
|
||||
// BOPCheck.StopOnFirstFaulty() = true; //this doesn't run any faster but gives us less results.
|
||||
|
||||
#if OCC_VERSION_HEX < 0x070500
|
||||
BOPCheck.SetProgressIndicator(theProgress);
|
||||
#elif OCC_VERSION_HEX < 0x070600
|
||||
BOPCheck.SetProgressIndicator(theScope);
|
||||
#else
|
||||
Q_UNUSED(theScope)
|
||||
#endif // 0x070500
|
||||
|
||||
|
||||
BOPCheck.SetShape1(BOPCopy);
|
||||
//all settings are false by default. so only turn on what we want.
|
||||
BOPCheck.ArgumentTypeMode() = argumentTypeMode;
|
||||
BOPCheck.SelfInterMode() = selfInterMode;
|
||||
BOPCheck.SmallEdgeMode() = smallEdgeMode;
|
||||
BOPCheck.RebuildFaceMode() = rebuildFaceMode;
|
||||
#if OCC_VERSION_HEX >= 0x060700
|
||||
BOPCheck.ContinuityMode() = continuityMode;
|
||||
#endif
|
||||
#if OCC_VERSION_HEX >= 0x060900
|
||||
|
||||
BOPCheck.SetParallelMode(!runSingleThreaded); //this doesn't help for speed right now(occt 6.9.1).
|
||||
BOPCheck.SetRunParallel(!runSingleThreaded); //performance boost, use all available cores
|
||||
BOPCheck.TangentMode() = tangentMode; //these 4 new tests add about 5% processing time.
|
||||
BOPCheck.MergeVertexMode() = mergeVertexMode;
|
||||
BOPCheck.MergeEdgeMode() = mergeEdgeMode;
|
||||
BOPCheck.CurveOnSurfaceMode() = curveOnSurfaceMode;
|
||||
#endif
|
||||
|
||||
#ifdef FC_DEBUG
|
||||
Base::TimeInfo start_time;
|
||||
@@ -721,14 +709,9 @@ int TaskCheckGeometryResults::goBOPSingleCheck(const TopoDS_Shape& shapeIn, Resu
|
||||
for (; BOPResultsIt.More(); BOPResultsIt.Next())
|
||||
{
|
||||
const BOPAlgo_CheckResult ¤t = BOPResultsIt.Value();
|
||||
|
||||
#if OCC_VERSION_HEX < 0x070000
|
||||
const BOPCol_ListOfShape &faultyShapes1 = current.GetFaultyShapes1();
|
||||
BOPCol_ListIteratorOfListOfShape faultyShapes1It(faultyShapes1);
|
||||
#else
|
||||
const TopTools_ListOfShape &faultyShapes1 = current.GetFaultyShapes1();
|
||||
TopTools_ListIteratorOfListOfShape faultyShapes1It(faultyShapes1);
|
||||
#endif
|
||||
|
||||
for (;faultyShapes1It.More(); faultyShapes1It.Next())
|
||||
{
|
||||
const TopoDS_Shape &faultyShape = faultyShapes1It.Value();
|
||||
@@ -767,9 +750,6 @@ int TaskCheckGeometryResults::goBOPSingleCheck(const TopoDS_Shape& shapeIn, Resu
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -950,12 +950,9 @@ void ViewProviderPartExt::updateVisual()
|
||||
deflection = Precision::Confusion();
|
||||
|
||||
// create or use the mesh on the data structure
|
||||
#if OCC_VERSION_HEX >= 0x060600
|
||||
Standard_Real AngDeflectionRads = AngularDeflection.getValue() / 180.0 * M_PI;
|
||||
BRepMesh_IncrementalMesh(cShape, deflection, Standard_False, AngDeflectionRads, Standard_True);
|
||||
#else
|
||||
BRepMesh_IncrementalMesh(cShape, deflection);
|
||||
#endif
|
||||
|
||||
// We must reset the location here because the transformation data
|
||||
// are set in the placement property
|
||||
TopLoc_Location aLoc;
|
||||
|
||||
@@ -494,11 +494,7 @@ void ProfileBased::getUpToFace(TopoDS_Face& upToFace,
|
||||
BRepAdaptor_Surface adapt(upToFace, Standard_False);
|
||||
// use the placement of the adapter, not of the upToFace
|
||||
loc = TopLoc_Location(adapt.Trsf());
|
||||
BRepBuilderAPI_MakeFace mkFace(adapt.Surface().Surface()
|
||||
#if OCC_VERSION_HEX >= 0x060502
|
||||
, Precision::Confusion()
|
||||
#endif
|
||||
);
|
||||
BRepBuilderAPI_MakeFace mkFace(adapt.Surface().Surface(), Precision::Confusion());
|
||||
if (!mkFace.IsDone())
|
||||
throw Base::ValueError("SketchBased: Up To Face: Failed to create unlimited face");
|
||||
upToFace = TopoDS::Face(mkFace.Shape());
|
||||
@@ -687,12 +683,7 @@ bool ProfileBased::checkLineCrossesFace(const gp_Lin& line, const TopoDS_Face& f
|
||||
if (intersector.IsDone()) {
|
||||
for (int i = 1; i <= intersector.NbExt(); i++) {
|
||||
|
||||
|
||||
#if OCC_VERSION_HEX >= 0x060500
|
||||
if (intersector.SquareDistance(i) < Precision::Confusion()) {
|
||||
#else
|
||||
if (intersector.Value(i) < Precision::Confusion()) {
|
||||
#endif
|
||||
if (intersector.IsParallel()) {
|
||||
// A line that is coincident with the axis produces three intersections
|
||||
// 1 with the line itself and 2 with the adjacent edges
|
||||
|
||||
@@ -98,9 +98,7 @@
|
||||
# include <TopoDS.hxx>
|
||||
# include <Precision.hxx>
|
||||
|
||||
#if OCC_VERSION_HEX >= 0x060800
|
||||
# include <OSD_OpenFile.hxx>
|
||||
#endif
|
||||
|
||||
#endif // _PreComp_
|
||||
#endif
|
||||
|
||||
@@ -121,12 +121,8 @@ void ViewProviderAddSub::updateAddSubShapeIndicator() {
|
||||
Standard_Real deflection = ((xMax-xMin)+(yMax-yMin)+(zMax-zMin))/300.0 * Deviation.getValue();
|
||||
|
||||
// create or use the mesh on the data structure
|
||||
#if OCC_VERSION_HEX >= 0x060600
|
||||
Standard_Real AngDeflectionRads = AngularDeflection.getValue() / 180.0 * M_PI;
|
||||
BRepMesh_IncrementalMesh(cShape, deflection, Standard_False, AngDeflectionRads, Standard_True);
|
||||
#else
|
||||
BRepMesh_IncrementalMesh(cShape, deflection);
|
||||
#endif
|
||||
|
||||
// We must reset the location here because the transformation data
|
||||
// are set in the placement property
|
||||
TopLoc_Location aLoc;
|
||||
|
||||
@@ -214,12 +214,9 @@ void ViewProviderTransformed::showRejectedShape(TopoDS_Shape shape)
|
||||
|
||||
// create or use the mesh on the data structure
|
||||
// Note: This DOES have an effect on shape
|
||||
#if OCC_VERSION_HEX >= 0x060600
|
||||
Standard_Real AngDeflectionRads = AngularDeflection.getValue() / 180.0 * M_PI;
|
||||
BRepMesh_IncrementalMesh(shape, deflection, Standard_False, AngDeflectionRads, Standard_True);
|
||||
#else
|
||||
BRepMesh_IncrementalMesh(shape, deflection);
|
||||
#endif
|
||||
|
||||
// We must reset the location here because the transformation data
|
||||
// are set in the placement property
|
||||
TopLoc_Location aLoc;
|
||||
|
||||
@@ -860,11 +860,7 @@ struct WireJoiner {
|
||||
int rcount = 0;
|
||||
|
||||
for (auto& info : edges) {
|
||||
#if OCC_VERSION_HEX >= 0x070000
|
||||
if (BRep_Tool::IsClosed(info.edge))
|
||||
#else
|
||||
if (info.p1.SquareDistance(info.p2) < tol)
|
||||
#endif
|
||||
{
|
||||
auto wire = BRepBuilderAPI_MakeWire(info.edge).Wire();
|
||||
Area::showShape(wire, "closed");
|
||||
|
||||
@@ -3463,7 +3463,6 @@ bool Sketch::updateGeometry()
|
||||
for(auto it3 = occtknots.begin() ; it3 != occtknots.end(); ++it3)
|
||||
knots.push_back(*it3);
|
||||
|
||||
#if OCC_VERSION_HEX >= 0x060900
|
||||
int index = 0;
|
||||
for(std::vector<int>::const_iterator it5 = mybsp.knotpointGeoids.begin(); it5 != mybsp.knotpointGeoids.end(); ++it5, index++) {
|
||||
if( *it5 != GeoEnum::GeoUndef) {
|
||||
@@ -3488,8 +3487,6 @@ bool Sketch::updateGeometry()
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
} catch (Base::Exception &e) {
|
||||
Base::Console().Error("Updating geometry: Error build geometry(%d): %s\n",
|
||||
|
||||
@@ -5204,12 +5204,10 @@ int SketchObject::exposeInternalGeometry(int GeoId)
|
||||
else {
|
||||
controlpointgeoids[0] = currentgeoid+incrgeo+1;
|
||||
}
|
||||
|
||||
incrgeo++;
|
||||
}
|
||||
}
|
||||
|
||||
#if OCC_VERSION_HEX >= 0x060900
|
||||
index=0;
|
||||
|
||||
for(it=knotgeoids.begin(), itb=knotpoints.begin(); it!=knotgeoids.end() && itb!=knotpoints.end(); ++it, ++itb, index++) {
|
||||
@@ -5239,21 +5237,8 @@ int SketchObject::exposeInternalGeometry(int GeoId)
|
||||
incrgeo++;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
Q_UNUSED(isfirstweightconstrained);
|
||||
// constraint the first weight to allow for seamless weight modification and proper visualization
|
||||
/*if(!isfirstweightconstrained) {
|
||||
|
||||
Sketcher::Constraint *newConstr = new Sketcher::Constraint();
|
||||
newConstr->Type = Sketcher::Radius;
|
||||
newConstr->First = controlpointgeoids[0];
|
||||
newConstr->FirstPos = Sketcher::PointPos::none;
|
||||
newConstr->setValue( round(distance_p0_p1/6)); // 1/6 is just an estimation for acceptable general visualization
|
||||
|
||||
icon.push_back(newConstr);
|
||||
|
||||
}*/
|
||||
|
||||
this->addGeometry(igeo,true);
|
||||
this->addConstraints(icon);
|
||||
@@ -5750,10 +5735,6 @@ bool SketchObject::modifyBSplineKnotMultiplicity(int GeoId, int knotIndex, int m
|
||||
{
|
||||
Base::StateLocker lock(managedoperation, true); // no need to check input data validity as this is an sketchobject managed operation.
|
||||
|
||||
#if OCC_VERSION_HEX < 0x060900
|
||||
THROWMT(Base::NotImplementedError, QT_TRANSLATE_NOOP("Exceptions", "This version of OCE/OCC does not support knot operation. You need 6.9.0 or higher."))
|
||||
#endif
|
||||
|
||||
if (GeoId < 0 || GeoId > getHighestCurveIndex())
|
||||
THROWMT(Base::ValueError,QT_TRANSLATE_NOOP("Exceptions", "BSpline Geometry Index (GeoID) is out of bounds."))
|
||||
|
||||
@@ -5927,10 +5908,6 @@ bool SketchObject::insertBSplineKnot(int GeoId, double param, int multiplicity)
|
||||
{
|
||||
Base::StateLocker lock(managedoperation, true); // TODO: Check if this is still valid: no need to check input data validity as this is an sketchobject managed operation.
|
||||
|
||||
#if OCC_VERSION_HEX < 0x060900
|
||||
THROWMT(Base::NotImplementedError, QT_TRANSLATE_NOOP("Exceptions", "This version of OCE/OCC does not support knot operation. You need 6.9.0 or higher."))
|
||||
#endif
|
||||
|
||||
// handling unacceptable cases
|
||||
if (GeoId < 0 || GeoId > getHighestCurveIndex())
|
||||
THROWMT(Base::ValueError,QT_TRANSLATE_NOOP("Exceptions", "BSpline Geometry Index (GeoID) is out of bounds."));
|
||||
@@ -6634,11 +6611,7 @@ void SketchObject::rebuildExternalGeometry(void)
|
||||
gp_Trsf mov;
|
||||
mov.SetValues(invMat[0][0],invMat[0][1],invMat[0][2],invMat[0][3],
|
||||
invMat[1][0],invMat[1][1],invMat[1][2],invMat[1][3],
|
||||
invMat[2][0],invMat[2][1],invMat[2][2],invMat[2][3]
|
||||
#if OCC_VERSION_HEX < 0x060800
|
||||
, 0.00001, 0.00001
|
||||
#endif
|
||||
); //precision was removed in OCCT CR0025194
|
||||
invMat[2][0],invMat[2][1],invMat[2][2],invMat[2][3]);
|
||||
|
||||
gp_Ax3 sketchAx3(gp_Pnt(Pos.x,Pos.y,Pos.z),
|
||||
gp_Dir(dN.x,dN.y,dN.z),
|
||||
@@ -7727,32 +7700,6 @@ double SketchObject::calculateAngleViaPoint(int GeoId1, int GeoId2, double px, d
|
||||
}
|
||||
else
|
||||
throw Base::ValueError("Null geometry in calculateAngleViaPoint");
|
||||
|
||||
/*
|
||||
// OCC-based calculation. It is faster, but it was removed due to problems
|
||||
// with reversed geometry (clockwise arcs). More info in "Sketch: how to
|
||||
// handle reversed external arcs?" forum thread
|
||||
// http://forum.freecadweb.org/viewtopic.php?f=10&t=9130&sid=1b994fa1236db5ac2371eeb9a53de23f
|
||||
|
||||
const Part::GeomCurve &g1 = *(dynamic_cast<const Part::GeomCurve*>(this->getGeometry(GeoId1)));
|
||||
const Part::GeomCurve &g2 = *(dynamic_cast<const Part::GeomCurve*>(this->getGeometry(GeoId2)));
|
||||
Base::Vector3d p(px, py, 0.0);
|
||||
|
||||
double u1 = 0.0;
|
||||
double u2 = 0.0;
|
||||
if (! g1.closestParameterToBasicCurve(p, u1) ) throw Base::ValueError("SketchObject::calculateAngleViaPoint: closestParameter(curve1) failed!");
|
||||
if (! g2.closestParameterToBasicCurve(p, u2) ) throw Base::ValueError("SketchObject::calculateAngleViaPoint: closestParameter(curve2) failed!");
|
||||
|
||||
gp_Dir tan1, tan2;
|
||||
if (! g1.tangent(u1,tan1) ) throw Base::ValueError("SketchObject::calculateAngleViaPoint: tangent1 failed!");
|
||||
if (! g2.tangent(u2,tan2) ) throw Base::ValueError("SketchObject::calculateAngleViaPoint: tangent2 failed!");
|
||||
|
||||
assert(abs(tan1.Z())<0.0001);
|
||||
assert(abs(tan2.Z())<0.0001);
|
||||
|
||||
double ang = atan2(-tan2.X()*tan1.Y()+tan2.Y()*tan1.X(), tan2.X()*tan1.X() + tan2.Y()*tan1.Y());
|
||||
return ang;
|
||||
*/
|
||||
}
|
||||
|
||||
void SketchObject::constraintsRenamed(const std::map<App::ObjectIdentifier, App::ObjectIdentifier> &renamed)
|
||||
|
||||
@@ -653,15 +653,6 @@ void CmdSketcherIncreaseKnotMultiplicity::activated(int iMsg)
|
||||
{
|
||||
Q_UNUSED(iMsg);
|
||||
|
||||
#if OCC_VERSION_HEX < 0x060900
|
||||
QMessageBox::warning(Gui::getMainWindow(),
|
||||
QObject::tr("Wrong OCE/OCC version"),
|
||||
QObject::tr("This version of OCE/OCC "
|
||||
"does not support knot operation. "
|
||||
"You need 6.9.0 or higher"));
|
||||
return;
|
||||
#endif
|
||||
|
||||
// get the selection
|
||||
std::vector<Gui::SelectionObject> selection;
|
||||
selection = getSelection().getSelectionEx(nullptr, Sketcher::SketchObject::getClassTypeId());
|
||||
@@ -800,15 +791,6 @@ void CmdSketcherDecreaseKnotMultiplicity::activated(int iMsg)
|
||||
{
|
||||
Q_UNUSED(iMsg);
|
||||
|
||||
#if OCC_VERSION_HEX < 0x060900
|
||||
QMessageBox::warning(Gui::getMainWindow(),
|
||||
QObject::tr("Wrong OCE/OCC version"),
|
||||
QObject::tr("This version of OCE/OCC "
|
||||
"does not support knot operation. "
|
||||
"You need 6.9.0 or higher"));
|
||||
return;
|
||||
#endif
|
||||
|
||||
// get the selection
|
||||
std::vector<Gui::SelectionObject> selection;
|
||||
selection = getSelection().getSelectionEx(nullptr, Sketcher::SketchObject::getClassTypeId());
|
||||
@@ -1175,15 +1157,6 @@ void CmdSketcherInsertKnot::activated(int iMsg)
|
||||
{
|
||||
Q_UNUSED(iMsg);
|
||||
|
||||
#if OCC_VERSION_HEX < 0x060900
|
||||
QMessageBox::warning(Gui::getMainWindow(),
|
||||
QObject::tr("Wrong OCE/OCC version"),
|
||||
QObject::tr("This version of OCE/OCC "
|
||||
"does not support knot operation. "
|
||||
"You need 6.9.0 or higher"));
|
||||
return;
|
||||
#endif
|
||||
|
||||
// get the selection
|
||||
std::vector<Gui::SelectionObject> selection;
|
||||
selection = getSelection().getSelectionEx(nullptr, Sketcher::SketchObject::getClassTypeId());
|
||||
|
||||
@@ -143,11 +143,7 @@ App::DocumentObjectExecReturn *Extend::execute(void)
|
||||
approx.Init(approxPoints, ParType, DegMin, DegMax, Continuity, Tol3d);
|
||||
|
||||
Handle(Geom_BSplineSurface) surface(approx.Surface());
|
||||
BRepBuilderAPI_MakeFace mkFace(surface
|
||||
#if OCC_VERSION_HEX >= 0x060502
|
||||
, Precision::Confusion()
|
||||
#endif
|
||||
);
|
||||
BRepBuilderAPI_MakeFace mkFace(surface, Precision::Confusion());
|
||||
|
||||
Shape.setValue(mkFace.Face());
|
||||
|
||||
|
||||
@@ -92,11 +92,7 @@ App::DocumentObjectExecReturn *Sections::execute(void)
|
||||
if (aSurf.IsNull())
|
||||
return new App::DocumentObjectExecReturn("Failed to create surface from sections.");
|
||||
|
||||
BRepBuilderAPI_MakeFace mkFace(aSurf
|
||||
#if OCC_VERSION_HEX >= 0x060502
|
||||
, Precision::Confusion()
|
||||
#endif
|
||||
);
|
||||
BRepBuilderAPI_MakeFace mkFace(aSurf, Precision::Confusion() );
|
||||
|
||||
Shape.setValue(mkFace.Face());
|
||||
return StdReturn;
|
||||
|
||||
Reference in New Issue
Block a user