Clean Mod/Part. remove old OCC <7.3 and #if 0 code.

This commit is contained in:
Andrew
2023-03-13 16:50:25 +01:00
committed by wwmayer
parent 53de24ae2d
commit 1eaf8a724e
15 changed files with 21 additions and 1442 deletions

View File

@@ -736,21 +736,15 @@ private:
if (file.hasExtension("stp") || file.hasExtension("step")) {
// create new document and add Import feature
App::Document *pcDoc = App::GetApplication().newDocument();
#if 1
ImportStepParts(pcDoc,EncodedName.c_str());
#else
Part::ImportStep *pcFeature = (Part::ImportStep *)pcDoc->addObject("Part::ImportStep",file.fileNamePure().c_str());
pcFeature->FileName.setValue(Name);
#endif
pcDoc->recompute();
}
#if 1
else if (file.hasExtension("igs") || file.hasExtension("iges")) {
App::Document *pcDoc = App::GetApplication().newDocument();
ImportIgesParts(pcDoc,EncodedName.c_str());
pcDoc->recompute();
}
#endif
else {
TopoShape shape;
shape.read(EncodedName.c_str());
@@ -788,21 +782,14 @@ private:
}
if (file.hasExtension("stp") || file.hasExtension("step")) {
#if 1
ImportStepParts(pcDoc,EncodedName.c_str());
#else
// add Import feature
Part::ImportStep *pcFeature = (Part::ImportStep *)pcDoc->addObject("Part::ImportStep",file.fileNamePure().c_str());
pcFeature->FileName.setValue(Name);
#endif
pcDoc->recompute();
}
#if 1
else if (file.hasExtension("igs") || file.hasExtension("iges")) {
ImportIgesParts(pcDoc,EncodedName.c_str());
pcDoc->recompute();
}
#endif
else {
TopoShape shape;
shape.read(EncodedName.c_str());
@@ -1833,50 +1820,6 @@ private:
}
Py::Object makeLoft(const Py::Tuple& args)
{
#if 0
PyObject *pcObj;
if (!PyArg_ParseTuple(args.ptr(), "O", &pcObj))
throw Py::Exception;
NCollection_List<Handle(Geom_Curve)> theSections;
Py::Sequence list(pcObj);
for (Py::Sequence::iterator it = list.begin(); it != list.end(); ++it) {
if (PyObject_TypeCheck((*it).ptr(), &(Part::GeometryCurvePy::Type))) {
Handle(Geom_Curve) hCurve = Handle(Geom_Curve)::DownCast(
static_cast<GeometryCurvePy*>((*it).ptr())->getGeomCurvePtr()->handle());
theSections.Append(hCurve);
}
}
//populate section generator
GeomFill_SectionGenerator aSecGenerator;
for (NCollection_List<Handle(Geom_Curve)>::Iterator anIt(theSections); anIt.More(); anIt.Next()) {
const Handle(Geom_Curve)& aCurve = anIt.Value();
aSecGenerator.AddCurve (aCurve);
}
aSecGenerator.Perform (Precision::PConfusion());
Handle(GeomFill_Line) aLine = new GeomFill_Line (theSections.Size());
//parameters
const Standard_Integer aMinDeg = 1, aMaxDeg = BSplCLib::MaxDegree(), aNbIt = 0;
Standard_Real aTol3d = 1e-4, aTol2d = Precision::Parametric (aTol3d);
//algorithm
GeomFill_AppSurf anAlgo (aMinDeg, aMaxDeg, aTol3d, aTol2d, aNbIt);
anAlgo.Perform (aLine, aSecGenerator);
if (!anAlgo.IsDone()) {
PyErr_SetString(PartExceptionOCCError, "Failed to create loft surface");
return 0;
}
Handle(Geom_BSplineSurface) aRes;
aRes = new Geom_BSplineSurface(anAlgo.SurfPoles(), anAlgo.SurfWeights(),
anAlgo.SurfUKnots(), anAlgo.SurfVKnots(), anAlgo.SurfUMults(), anAlgo.SurfVMults(),
anAlgo.UDegree(), anAlgo.VDegree());
return new BSplineSurfacePy(new GeomBSplineSurface(aRes));
#else
PyObject *pcObj;
PyObject *psolid=Py_False;
PyObject *pruled=Py_False;
@@ -1907,7 +1850,7 @@ private:
Standard_Boolean anIsClosed = Base::asBoolean(pclosed);
TopoDS_Shape aResult = myShape.makeLoft(profiles, anIsSolid, anIsRuled, anIsClosed, degMax);
return Py::asObject(new TopoShapePy(new TopoShape(aResult)));
#endif
}
Py::Object makeSplitShape(const Py::Tuple& args)
{

View File

@@ -120,19 +120,6 @@ void CrossSection::sliceNonSolid(double d, const TopoDS_Shape& shape, std::list<
void CrossSection::sliceSolid(double d, const TopoDS_Shape& shape, std::list<TopoDS_Wire>& wires) const
{
#if 0
gp_Pln slicePlane(a,b,c,-d);
BRepBuilderAPI_MakeFace mkFace(slicePlane);
TopoDS_Face face = mkFace.Face();
BRepAlgoAPI_Common mkInt(shape, face);
if (mkInt.IsDone()) {
// sort and repair the wires
TopTools_IndexedMapOfShape mapOfWires;
TopExp::MapShapes(mkInt.Shape(), TopAbs_WIRE, mapOfWires);
connectWires(mapOfWires, wires);
}
#else
gp_Pln slicePlane(a,b,c,-d);
BRepBuilderAPI_MakeFace mkFace(slicePlane);
TopoDS_Face face = mkFace.Face();
@@ -166,7 +153,6 @@ void CrossSection::sliceSolid(double d, const TopoDS_Shape& shape, std::list<Top
}
}
}
#endif
}
void CrossSection::connectEdges (const std::list<TopoDS_Edge>& edges, std::list<TopoDS_Wire>& wires) const

View File

@@ -74,7 +74,6 @@ int Part::ImportIgesParts(App::Document *pcDoc, const char* FileName)
// check file conformity and output stats
aReader.PrintCheckLoad(Standard_True,IFSelect_GeneralInfo);
#if 1
std::string aName = fi.fileNamePure();
#if OCC_VERSION_HEX < 0x070500
Handle(Message_ProgressIndicator) pi = new ProgressIndicator(100);
@@ -119,79 +118,6 @@ int Part::ImportIgesParts(App::Document *pcDoc, const char* FileName)
("Part::Feature", name.c_str()));
pcFeature->Shape.setValue(comp);
}
#else
// put all other free-flying shapes into a single compound
Standard_Boolean emptyComp = Standard_True;
BRep_Builder builder;
TopoDS_Compound comp;
builder.MakeCompound(comp);
// get all entities
Handle(TColStd_HSequenceOfTransient) aRootList=aReader.GiveList("xst-transferrable-roots");
Base::SequencerLauncher seq("Reading IGES file...", aRootList->Length());
Standard_Integer j;
for (j=1; j<=aRootList->Length(); j++) {
seq.next();
Handle(IGESData_IGESEntity) igesEntity = Handle(IGESData_IGESEntity)::DownCast(aRootList->Value(j));
if (igesEntity.IsNull()) continue;
// clear any old shape
aReader.ClearShapes();
#ifdef _DEBUG
std::string type = igesEntity->DynamicType()->Name();
(void)type;
#endif
// is it a group, singular sub-figure or solid?
if (igesEntity->IsKind(STANDARD_TYPE(IGESBasic_Group)) ||
igesEntity->IsKind(STANDARD_TYPE(IGESBasic_SingularSubfigure)) ||
igesEntity->IsKind(STANDARD_TYPE(IGESSolid_ManifoldSolid))) {
try {
if (aReader.TransferEntity(igesEntity)) {
if (aReader.NbShapes()>0) {
// get the shape
std::string aName = fi.fileNamePure();
if (igesEntity->HasShortLabel()) {
Handle(TCollection_HAsciiString) aLabel=igesEntity->ShortLabel();
aName = aLabel->ToCString();
}
TopoDS_Shape aShape=aReader.OneShape();
App::DocumentObject* obj = pcDoc->addObject("Part::Feature", aName.c_str());
obj->Label.setValue(aName);
static_cast<Part::Feature*>(obj)->Shape.setValue(aShape);
int iColor;
if (igesEntity->RankColor()>-1) {
iColor = igesEntity->RankColor();
}
}
}
}
catch (Standard_Failure) {
}
}
// normal shapes
else {
try {
if (aReader.TransferEntity(igesEntity)) {
if (aReader.NbShapes()>0) {
TopoDS_Shape aShape=aReader.OneShape();
builder.Add(comp, aShape);
emptyComp = Standard_False;
}
}
}
catch (Standard_Failure) {
}
}
}
if (!emptyComp) {
std::string name = fi.fileNamePure();
Part::Feature *pcFeature = static_cast<Part::Feature*>(pcDoc->addObject
("Part::Feature", name.c_str()));
pcFeature->Shape.setValue(comp);
}
#endif
}
catch (Standard_Failure& e) {
throw Base::CADKernelError(e.GetMessageString());

View File

@@ -107,15 +107,10 @@
#include <BRepAdaptor_Surface.hxx>
#include <BRepAlgo.hxx>
#if OCC_VERSION_HEX < 0x070300
# include <BRepAlgo_Fuse.hxx>
#endif
#include <BRepAlgo_NormalProjection.hxx>
#include <BRepAlgoAPI_Common.hxx>
#include <BRepAlgoAPI_Cut.hxx>
#if OCC_VERSION_HEX >= 0x070300
# include <BRepAlgoAPI_Defeaturing.hxx>
#endif
#include <BRepAlgoAPI_Fuse.hxx>
#include <BRepAlgoAPI_Section.hxx>

View File

@@ -130,14 +130,8 @@ App::DocumentObject *Feature::getSubObject(const char *subname,
mat *= Placement.getValue().toMatrix();
if(!pyObj) {
#if 0
if(subname==0 || *subname==0 || Shape.getShape().hasSubShape(subname))
return const_cast<Feature*>(this);
return nullptr;
#else
// TopoShape::hasSubShape is kind of slow, let's cut outself some slack here.
return const_cast<Feature*>(this);
#endif
}
try {
@@ -296,25 +290,16 @@ static TopoShape _getTopoShape(const App::DocumentObject *obj, const char *subna
}
if(_ShapeCache.getShape(obj,shape,subname)) {
if(noElementMap) {
// shape.resetElementMap();
// shape.Tag = 0;
// shape.Hasher.reset();
}
}
App::DocumentObject *linked = nullptr;
App::DocumentObject *owner = nullptr;
Base::Matrix4D linkMat;
// App::StringHasherRef hasher;
// long tag;
{
Base::PyGILStateLocker lock;
owner = obj->getSubObject(subname,shape.isNull()?&pyobj:nullptr,&mat,false);
if(!owner)
return shape;
// tag = owner->getID();
// hasher = owner->getDocument()->getStringHasher();
linked = owner->getLinkedObject(true,&linkMat,false);
if(pmat) {
if(resolveLink && obj!=owner)
@@ -335,11 +320,6 @@ static TopoShape _getTopoShape(const App::DocumentObject *obj, const char *subna
if(!shape.isNull()) {
if(obj->getDocument() != linked->getDocument())
_ShapeCache.setShape(obj,shape,subname);
if(noElementMap) {
// shape.resetElementMap();
// shape.Tag = 0;
// shape.Hasher.reset();
}
Py_DECREF(pyobj);
return shape;
}
@@ -363,11 +343,6 @@ static TopoShape _getTopoShape(const App::DocumentObject *obj, const char *subna
_ShapeCache.setShape(obj,shape,subname);
}
if(!shape.isNull()) {
if(noElementMap) {
// shape.resetElementMap();
// shape.Tag = 0;
// shape.Hasher.reset();
}
return shape;
}
}
@@ -386,7 +361,6 @@ static TopoShape _getTopoShape(const App::DocumentObject *obj, const char *subna
shape.transformShape(mat*linkMat,false,true);
else
shape.transformShape(linkMat,false,true);
// shape.reTagElementMap(tag,hasher);
} else {
@@ -406,8 +380,6 @@ static TopoShape _getTopoShape(const App::DocumentObject *obj, const char *subna
linked = link->getTrueLinkedObject(false,&baseMat);
if(linked && linked!=owner) {
baseShape = Feature::getTopoShape(linked,nullptr,false,nullptr,nullptr,false,false);
// if(!link->getShowElementValue())
// baseShape.reTagElementMap(owner->getID(),owner->getDocument()->getStringHasher());
}
}
for(auto &sub : owner->getSubObjects()) {
@@ -444,7 +416,6 @@ static TopoShape _getTopoShape(const App::DocumentObject *obj, const char *subna
shape = baseShape.makeTransform(mat,(TopoShape::indexPostfix()+childName).c_str());
else {
shape = baseShape.makeTransform(mat);
// shape.reTagElementMap(subObj->getID(),subObj->getDocument()->getStringHasher());
}
}
shapes.push_back(shape);
@@ -456,8 +427,6 @@ static TopoShape _getTopoShape(const App::DocumentObject *obj, const char *subna
if(shapes.empty())
return shape;
// shape.Tag = tag;
// shape.Hasher = hasher;
shape.makeCompound(shapes);
}
@@ -466,16 +435,10 @@ static TopoShape _getTopoShape(const App::DocumentObject *obj, const char *subna
if(owner!=obj) {
scaled = shape.transformShape(mat,false,true);
if(owner->getDocument()!=obj->getDocument()) {
// shape.reTagElementMap(obj->getID(),obj->getDocument()->getStringHasher());
_ShapeCache.setShape(obj,shape,subname);
}else if(scaled)
_ShapeCache.setShape(obj,shape,subname);
}
if(noElementMap) {
// shape.resetElementMap();
// shape.Tag = 0;
// shape.Hasher.reset();
}
return shape;
}
@@ -701,15 +664,6 @@ template<> PyObject* Part::FeaturePython::getPyObject() {
template class PartExport FeaturePythonT<Part::Feature>;
}
// ----------------------------------------------------------------
/*
#include <GProp_GProps.hxx>
#include <BRepGProp.hxx>
#include <gce_MakeLin.hxx>
#include <BRepIntCurveSurface_Inter.hxx>
#include <IntCurveSurface_IntersectionPoint.hxx>
#include <gce_MakeDir.hxx>
*/
std::vector<Part::cutFaces> Part::findAllFacesCutBy(
const TopoDS_Shape& shape, const TopoDS_Shape& face, const gp_Dir& dir)
{
@@ -768,37 +722,6 @@ bool Part::checkIntersection(const TopoDS_Shape& first, const TopoDS_Shape& seco
if (quick && !first_bb.IsOut(second_bb))
return true; // assumed intersection
// Try harder
// This has been disabled because of:
// https://www.freecadweb.org/tracker/view.php?id=3065
//extrema method
/*BRepExtrema_DistShapeShape extrema(first, second);
if (!extrema.IsDone())
return true;
if (extrema.Value() > Precision::Confusion())
return false;
if (extrema.InnerSolution())
return true;
//here we should have touching shapes.
if (touch_is_intersection)
{
//non manifold condition. 1 has to be a face
for (int index = 1; index < extrema.NbSolution() + 1; ++index)
{
if (extrema.SupportTypeShape1(index) == BRepExtrema_IsInFace || extrema.SupportTypeShape2(index) == BRepExtrema_IsInFace)
return true;
}
return false;
}
else
return false;*/
//boolean method.
if (touch_is_intersection) {
// If both shapes fuse to a single solid, then they intersect
BRepAlgoAPI_Fuse mkFuse(first, second);

View File

@@ -144,16 +144,11 @@
# include <XSControl_TransferWriter.hxx>
# include <XSControl_WorkSession.hxx>
#if OCC_VERSION_HEX < 0x070300
# include <BRepAlgo_Fuse.hxx>
#endif
# include <BOPAlgo_ArgumentAnalyzer.hxx>
# include <BOPAlgo_ListOfCheckResult.hxx>
#if OCC_VERSION_HEX >= 0x070300
# include <BRepAlgoAPI_Defeaturing.hxx>
#endif
#if OCC_VERSION_HEX < 0x070600
# include <BRepAdaptor_HCurve.hxx>
@@ -1773,11 +1768,6 @@ TopoDS_Shape TopoShape::cut(const std::vector<TopoDS_Shape>& shapes, Standard_Re
{
if (this->_Shape.IsNull())
return this->_Shape;
#if OCC_VERSION_HEX < 0x060900
(void)shapes;
(void)tolerance;
throw Base::RuntimeError("Multi cut is available only in OCC 6.9.0 and up.");
#else
BRepAlgoAPI_Cut mkCut;
mkCut.SetRunParallel(true);
TopTools_ListOfShape shapeArguments,shapeTools;
@@ -1802,7 +1792,6 @@ TopoDS_Shape TopoShape::cut(const std::vector<TopoDS_Shape>& shapes, Standard_Re
TopoDS_Shape resShape = mkCut.Shape();
return makeShell(resShape);
#endif
}
TopoDS_Shape TopoShape::common(TopoDS_Shape shape) const
@@ -1819,11 +1808,6 @@ TopoDS_Shape TopoShape::common(const std::vector<TopoDS_Shape>& shapes, Standard
{
if (this->_Shape.IsNull())
return this->_Shape;
#if OCC_VERSION_HEX < 0x060900
(void)shapes;
(void)tolerance;
throw Base::RuntimeError("Multi common is available only in OCC 6.9.0 and up.");
#else
BRepAlgoAPI_Common mkCommon;
mkCommon.SetRunParallel(true);
TopTools_ListOfShape shapeArguments,shapeTools;
@@ -1848,7 +1832,6 @@ TopoDS_Shape TopoShape::common(const std::vector<TopoDS_Shape>& shapes, Standard
TopoDS_Shape resShape = mkCommon.Shape();
return makeShell(resShape);
#endif
}
TopoDS_Shape TopoShape::fuse(TopoDS_Shape shape) const
@@ -1865,27 +1848,9 @@ TopoDS_Shape TopoShape::fuse(const std::vector<TopoDS_Shape>& shapes, Standard_R
{
if (this->_Shape.IsNull())
Standard_Failure::Raise("Base shape is null");
#if OCC_VERSION_HEX <= 0x060800
if (tolerance > 0.0)
Standard_Failure::Raise("Fuzzy Booleans are not supported in this version of OCCT");
TopoDS_Shape resShape = this->_Shape;
if (resShape.IsNull())
throw Base::ValueError("Object shape is null");
for (std::vector<TopoDS_Shape>::const_iterator it = shapes.begin(); it != shapes.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 Base::RuntimeError("Fusion failed");
resShape = mkFuse.Shape();
}
#else
BRepAlgoAPI_Fuse mkFuse;
# if OCC_VERSION_HEX >= 0x060900
mkFuse.SetRunParallel(true);
# endif
TopTools_ListOfShape shapeArguments,shapeTools;
shapeArguments.Append(this->_Shape);
for (std::vector<TopoDS_Shape>::const_iterator it = shapes.begin(); it != shapes.end(); ++it) {
@@ -1906,7 +1871,6 @@ TopoDS_Shape TopoShape::fuse(const std::vector<TopoDS_Shape>& shapes, Standard_R
throw Base::RuntimeError("Multi fuse failed");
TopoDS_Shape resShape = mkFuse.Shape();
#endif
return makeShell(resShape);
}
@@ -1916,12 +1880,8 @@ TopoDS_Shape TopoShape::oldFuse(TopoDS_Shape shape) const
Standard_Failure::Raise("Base shape is null");
if (shape.IsNull())
Standard_Failure::Raise("Tool shape is null");
#if OCC_VERSION_HEX < 0x070300
BRepAlgo_Fuse mkFuse(this->_Shape, shape);
return mkFuse.Shape();
#else
throw Standard_Failure("BRepAlgo_Fuse is deprecated since OCCT 7.3");
#endif
}
TopoDS_Shape TopoShape::section(TopoDS_Shape shape, Standard_Boolean approximate) const
@@ -1930,16 +1890,11 @@ TopoDS_Shape TopoShape::section(TopoDS_Shape shape, Standard_Boolean approximate
Standard_Failure::Raise("Base shape is null");
if (shape.IsNull())
Standard_Failure::Raise("Tool shape is null");
#if OCC_VERSION_HEX < 0x060900
BRepAlgoAPI_Section mkSection(this->_Shape, shape);
(void)approximate;
#else
BRepAlgoAPI_Section mkSection;
mkSection.Init1(this->_Shape);
mkSection.Init2(shape);
mkSection.Approximation(approximate);
mkSection.Build();
#endif
if (!mkSection.IsDone())
throw Base::RuntimeError("Section failed");
return mkSection.Shape();
@@ -1951,12 +1906,7 @@ TopoDS_Shape TopoShape::section(const std::vector<TopoDS_Shape>& shapes,
{
if (this->_Shape.IsNull())
Standard_Failure::Raise("Base shape is null");
#if OCC_VERSION_HEX < 0x060900
(void)shapes;
(void)tolerance;
(void)approximate;
throw Base::RuntimeError("Multi section is available only in OCC 6.9.0 and up.");
#else
BRepAlgoAPI_Section mkSection;
mkSection.SetRunParallel(true);
mkSection.Approximation(approximate);
@@ -1982,7 +1932,6 @@ TopoDS_Shape TopoShape::section(const std::vector<TopoDS_Shape>& shapes,
TopoDS_Shape resShape = mkSection.Shape();
return resShape;
#endif
}
std::list<TopoDS_Wire> TopoShape::slice(const Base::Vector3d& dir, double d) const
@@ -2020,12 +1969,7 @@ TopoDS_Shape TopoShape::generalFuse(const std::vector<TopoDS_Shape> &sOthers, St
{
if (this->_Shape.IsNull())
Standard_Failure::Raise("Base shape is null");
#if OCC_VERSION_HEX < 0x060900
(void)sOthers;
(void)tolerance;
(void)mapInOut;
throw Base::AttributeError("GFA is available only in OCC 6.9.0 and up.");
#else
BRepAlgoAPI_BuilderAlgo mkGFA;
mkGFA.SetRunParallel(true);
TopTools_ListOfShape GFAArguments;
@@ -2042,9 +1986,7 @@ TopoDS_Shape TopoShape::generalFuse(const std::vector<TopoDS_Shape> &sOthers, St
mkGFA.SetArguments(GFAArguments);
if (tolerance > 0.0)
mkGFA.SetFuzzyValue(tolerance);
#if OCC_VERSION_HEX >= 0x070000
mkGFA.SetNonDestructive(Standard_True);
#endif
mkGFA.Build();
if (!mkGFA.IsDone())
throw BooleanException("MultiFusion failed");
@@ -2055,7 +1997,6 @@ TopoDS_Shape TopoShape::generalFuse(const std::vector<TopoDS_Shape> &sOthers, St
}
}
return resShape;
#endif
}
TopoDS_Shape TopoShape::makePipe(const TopoDS_Shape& profile) const
@@ -2108,43 +2049,6 @@ TopoDS_Shape TopoShape::makePipeShell(const TopTools_ListOfShape& profiles,
return mkPipeShell.Shape();
}
#if 0
TopoDS_Shape TopoShape::makeTube() const
{
// http://opencascade.blogspot.com/2009/11/surface-modeling-part3.html
if (this->_Shape.IsNull())
Standard_Failure::Raise("Cannot sweep along empty spine");
if (this->_Shape.ShapeType() != TopAbs_EDGE)
Standard_Failure::Raise("Spine shape is not an edge");
const TopoDS_Edge& path_edge = TopoDS::Edge(this->_Shape);
BRepAdaptor_Curve path_adapt(path_edge);
double umin = path_adapt.FirstParameter();
double umax = path_adapt.LastParameter();
Handle(Geom_Curve) hPath = path_adapt.Curve().Curve();
// Apply placement of the shape to the curve
TopLoc_Location loc1 = path_edge.Location();
hPath = Handle(Geom_Curve)::DownCast(hPath->Transformed(loc1.Transformation()));
if (hPath.IsNull())
Standard_Failure::Raise("Invalid curve in path edge");
GeomFill_Pipe mkTube(hPath, radius);
mkTube.Perform(tol, Standard_False, GeomAbs_C1, BSplCLib::MaxDegree(), 1000);
const Handle(Geom_Surface)& surf = mkTube.Surface();
double u1,u2,v1,v2;
surf->Bounds(u1,u2,v1,v2);
BRepBuilderAPI_MakeFace mkBuilder(surf, umin, umax, v1, v2
#if OCC_VERSION_HEX >= 0x060502
, Precision::Confusion()
#endif
);
return mkBuilder.Face();
}
#else
static Handle(Law_Function) CreateBsFunction (const Standard_Real theFirst, const Standard_Real theLast, const Standard_Real theRadius)
{
(void)theRadius;
@@ -2170,7 +2074,9 @@ TopoDS_Shape TopoShape::makeTube(double radius, double tol, int cont, int maxdeg
Standard_Failure::Raise("Cannot sweep along empty spine");
#if OCC_VERSION_HEX >= 0x070600
Handle(Adaptor3d_Curve) myPath;
if (this->_Shape.ShapeType() == TopAbs_EDGE) {
const TopoDS_Edge& path_edge = TopoDS::Edge(this->_Shape);
myPath = new BRepAdaptor_Curve(path_edge);
@@ -2183,14 +2089,7 @@ TopoDS_Shape TopoShape::makeTube(double radius, double tol, int cont, int maxdeg
myPath = new BRepAdaptor_HCurve(path_adapt);
}
#endif
//else if (this->_Shape.ShapeType() == TopAbs_WIRE) {
// const TopoDS_Wire& path_wire = TopoDS::Wire(this->_Shape);
// BRepAdaptor_CompCurve path_adapt(path_wire);
// myPath = new BRepAdaptor_HCompCurve(path_adapt);
//}
//else {
// Standard_Failure::Raise("Spine shape is neither an edge nor a wire");
//}
else {
Standard_Failure::Raise("Spine shape is not an edge");
}
@@ -2214,17 +2113,14 @@ TopoDS_Shape TopoShape::makeTube(double radius, double tol, int cont, int maxdeg
Standard_Real u1,u2,v1,v2;
mySurface->Bounds(u1,u2,v1,v2);
BRepBuilderAPI_MakeFace mkBuilder(mySurface, u1, u2, v1, v2
#if OCC_VERSION_HEX >= 0x060502
, Precision::Confusion()
#endif
BRepBuilderAPI_MakeFace mkBuilder(mySurface, u1, u2, v1, v2 , Precision::Confusion()
);
return mkBuilder.Shape();
}
return TopoDS_Shape();
}
#endif
TopoDS_Shape TopoShape::makeSweep(const TopoDS_Shape& profile, double tol, int fillMode) const
{
@@ -2271,11 +2167,7 @@ TopoDS_Shape TopoShape::makeSweep(const TopoDS_Shape& profile, double tol, int f
mkSweep.Perform(tol, Standard_False, GeomAbs_C1, BSplCLib::MaxDegree(), 1000);
const Handle(Geom_Surface)& surf = mkSweep.Surface();
BRepBuilderAPI_MakeFace mkBuilder(surf, umin, umax, vmin, vmax
#if OCC_VERSION_HEX >= 0x060502
, Precision::Confusion()
#endif
);
BRepBuilderAPI_MakeFace mkBuilder(surf, umin, umax, vmin, vmax , Precision::Confusion());
return mkBuilder.Face();
}
@@ -2285,7 +2177,6 @@ TopoDS_Shape TopoShape::makeTorus(Standard_Real radius1, Standard_Real radius2,
{
// https://forum.freecadweb.org/viewtopic.php?f=3&t=1445
// https://forum.freecadweb.org/viewtopic.php?f=3&t=52719
#if 1
// Build a torus
gp_Circ circle;
circle.SetRadius(radius2);
@@ -2310,15 +2201,6 @@ TopoDS_Shape TopoShape::makeTorus(Standard_Real radius1, Standard_Real radius2,
BRepPrimAPI_MakeRevol mkRevol(mkFace.Face(), gp_Ax1(gp_Pnt(0,0,0), gp_Dir(0,0,1)),
Base::toRadians<double>(angle3), Standard_True);
return mkRevol.Shape();
#else
(void)isSolid;
BRepPrimAPI_MakeTorus mkTorus(radius1,
radius2,
Base::toRadians<double>(angle1),
Base::toRadians<double>(angle2),
Base::toRadians<double>(angle3));
return mkTorus.Solid();
#endif
}
TopoDS_Shape TopoShape::makeHelix(Standard_Real pitch, Standard_Real height,
@@ -2721,18 +2603,11 @@ TopoDS_Shape TopoShape::makeOffsetShape(double offset, double tol, bool intersec
}
}
#if OCC_VERSION_HEX < 0x070200
BRepOffsetAPI_MakeOffsetShape mkOffset(inputShape, offset, tol, BRepOffset_Mode(offsetMode),
intersection ? Standard_True : Standard_False,
selfInter ? Standard_True : Standard_False,
GeomAbs_JoinType(join));
#else
BRepOffsetAPI_MakeOffsetShape mkOffset;
mkOffset.PerformByJoin(inputShape, offset, tol, BRepOffset_Mode(offsetMode),
intersection ? Standard_True : Standard_False,
selfInter ? Standard_True : Standard_False,
GeomAbs_JoinType(join));
#endif
if (!mkOffset.IsDone())
Standard_Failure::Raise("BRepOffsetAPI_MakeOffsetShape not done");
@@ -2833,10 +2708,6 @@ TopoDS_Shape TopoShape::makeOffset2D(double offset, short joinType, bool fill, b
{
if (_Shape.IsNull())
throw Base::ValueError("makeOffset2D: input shape is null!");
#if OCC_VERSION_HEX < 0x060900
if (allowOpenResult)
throw Base::AttributeError("openResult argument is not supported on OCC < 6.9.0.");
#endif
// OUTLINE OF MAKEOFFSET2D
// * Prepare shapes to process
@@ -3155,19 +3026,11 @@ TopoDS_Shape TopoShape::makeThickSolid(const TopTools_ListOfShape& remFace,
double offset, double tol, bool intersection,
bool selfInter, short offsetMode, short join) const
{
#if OCC_VERSION_HEX < 0x070200
BRepOffsetAPI_MakeThickSolid mkThick(this->_Shape, remFace, offset, tol, BRepOffset_Mode(offsetMode),
intersection ? Standard_True : Standard_False,
selfInter ? Standard_True : Standard_False,
GeomAbs_JoinType(join));
#else
BRepOffsetAPI_MakeThickSolid mkThick;
mkThick.MakeThickSolidByJoin(this->_Shape, remFace, offset, tol, BRepOffset_Mode(offsetMode),
intersection ? Standard_True : Standard_False,
selfInter ? Standard_True : Standard_False,
GeomAbs_JoinType(join));
#endif
return mkThick.Shape();
}
@@ -3925,10 +3788,6 @@ TopoDS_Shape TopoShape::defeaturing(const std::vector<TopoDS_Shape>& s) const
{
if (this->_Shape.IsNull())
Standard_Failure::Raise("Base shape is null");
#if OCC_VERSION_HEX < 0x070300
(void)s;
throw Base::RuntimeError("Defeaturing is available only in OCC 7.3.0 and up.");
#else
BRepAlgoAPI_Defeaturing defeat;
defeat.SetRunParallel(true);
defeat.SetShape(this->_Shape);
@@ -3943,13 +3802,7 @@ TopoDS_Shape TopoShape::defeaturing(const std::vector<TopoDS_Shape>& s) const
const char* cstr2 = resultstr.c_str();
throw Base::RuntimeError(cstr2);
}
// if (defeat.HasWarnings()) {
// // warnings treatment
// Standard_SStream aSStream;
// defeat.DumpWarnings(aSStream);
// }
return defeat.Shape();
#endif
}
/**

View File

@@ -309,8 +309,6 @@ PyObject* TopoShapePy::writeInventor(PyObject * args, PyObject * keywds)
getTopoShapePtr()->exportFaceSet(dev, angle, faceColors, result);
getTopoShapePtr()->exportLineSet(result);
}
// NOTE: Cleaning the triangulation may cause problems on some algorithms like BOP
//BRepTools::Clean(getTopoShapePtr()->getShape()); // remove triangulation
return Py::new_reference_to(Py::String(result.str()));
}
@@ -1633,11 +1631,7 @@ PyObject* TopoShapePy::makeChamfer(PyObject *args)
if (edge.ShapeType() == TopAbs_EDGE) {
//Add edge to fillet algorithm
const TopoDS_Face& face = TopoDS::Face(mapEdgeFace.FindFromKey(edge).First());
#if OCC_VERSION_HEX > 0x070300
mkChamfer.Add(radius, radius, TopoDS::Edge(edge), face);
#else
mkChamfer.Add(radius, TopoDS::Edge(edge), face);
#endif
}
}
}
@@ -2671,7 +2665,6 @@ PyObject* TopoShapePy::optimalBoundingBox(PyObject *args)
return nullptr;
try {
#if OCC_VERSION_HEX >= 0x070200
TopoDS_Shape shape = this->getTopoShapePtr()->getShape();
Bnd_Box bounds;
BRepBndLib::AddOptimal(shape, bounds,
@@ -2691,9 +2684,6 @@ PyObject* TopoShapePy::optimalBoundingBox(PyObject *args)
Py::BoundingBox pybox(box);
return Py::new_reference_to(pybox);
#else
throw Py::RuntimeError("Need OCCT 7.2.0 or higher");
#endif
}
catch (const Standard_Failure& e) {
throw Py::RuntimeError(e.GetMessageString());
@@ -2727,53 +2717,6 @@ PyObject* TopoShapePy::defeaturing(PyObject *args)
}
}
// End of Methods, Start of Attributes
#if 0 // see ComplexGeoDataPy::Matrix which does the same
Py::Object TopoShapePy::getLocation(void) const
{
const TopLoc_Location& loc = getTopoShapePtr()->getShape().Location();
gp_Trsf trf = (gp_Trsf)loc;
Base::Matrix4D mat;
mat[0][0] = trf.Value(1,1);
mat[0][1] = trf.Value(1,2);
mat[0][2] = trf.Value(1,3);
mat[0][3] = trf.Value(1,4);
mat[1][0] = trf.Value(2,1);
mat[1][1] = trf.Value(2,2);
mat[1][2] = trf.Value(2,3);
mat[1][3] = trf.Value(2,4);
mat[2][0] = trf.Value(3,1);
mat[2][1] = trf.Value(3,2);
mat[2][2] = trf.Value(3,3);
mat[2][3] = trf.Value(3,4);
return Py::asObject(new Base::MatrixPy(mat));
}
void TopoShapePy::setLocation(Py::Object o)
{
PyObject* p = o.ptr();
if (PyObject_TypeCheck(p, &(Base::MatrixPy::Type))) {
Base::Matrix4D mat = static_cast<Base::MatrixPy*>(p)->value();
Base::Rotation rot(mat);
Base::Vector3d axis;
double angle;
rot.getValue(axis, angle);
gp_Trsf trf;
trf.SetRotation(gp_Ax1(gp_Pnt(), gp_Dir(axis.x, axis.y, axis.z)), angle);
trf.SetTranslationPart(gp_Vec(mat[0][3],mat[1][3],mat[2][3]));
TopLoc_Location loc(trf);
getTopoShapePtr()->getShape().Location(loc);
}
else {
std::string error = std::string("type must be 'Matrix', not ");
error += p->ob_type->tp_name;
throw Py::TypeError(error);
}
}
#endif
Py::String TopoShapePy::getShapeType() const
{

View File

@@ -1,713 +0,0 @@
/***************************************************************************
* Copyright (c) 2002 Jürgen Riegel <juergen.riegel@web.de> *
* *
* This file is part of the FreeCAD CAx development system. *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Library General Public License (LGPL) *
* as published by the Free Software Foundation; either version 2 of *
* the License, or (at your option) any later version. *
* for detail see the LICENCE text file. *
* *
* FreeCAD is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with FreeCAD; if not, write to the Free Software *
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
* USA *
* *
***************************************************************************/
#include "PreCompiled.h"
#if 0
#ifndef _PreComp_
# include <assert.h>
# include <sstream>
# include <BRepTools.hxx>
# include <BRep_Builder.hxx>
# include <BRepCheck_Analyzer.hxx>
# include <BRepCheck_Result.hxx>
# include <BRepCheck_ListIteratorOfListOfStatus.hxx>
# include <IGESControl_Controller.hxx>
# include <IGESControl_Writer.hxx>
# include <IGESControl_Reader.hxx>
# include <STEPControl_Writer.hxx>
# include <STEPControl_Reader.hxx>
# include <StlAPI_Writer.hxx>
# include <Interface_Static.hxx>
# include <TopoDS_Iterator.hxx>
#endif
#include <Base/Exception.h>
#include <Base/FileInfo.h>
#include <Base/Console.h>
#include <Base/Sequencer.h>
#include "TopologyPy.h"
# include <BRepOffsetAPI_MakeOffsetShape.hxx>
# include <BRepAlgoAPI_Cut.hxx>
#include <BRepAlgoAPI_Section.hxx>
# include <GeomAPI_IntSS.hxx>
using Base::Console;
using namespace Part;
//===========================================================================
// TopoShapePyOld - Wrapper for the TopoDS classes
//===========================================================================
//--------------------------------------------------------------------------
// Type structure
//--------------------------------------------------------------------------
PyTypeObject TopoShapePyOld::Type = {
PyObject_HEAD_INIT(&PyType_Type)
0, /*ob_size*/
"Part.Shape", /*tp_name*/
sizeof(TopoShapePyOld), /*tp_basicsize*/
0, /*tp_itemsize*/
/* methods */
PyDestructor, /*tp_dealloc*/
0, /*tp_print*/
__getattr, /*tp_getattr*/
__setattr, /*tp_setattr*/
0, /*tp_compare*/
__repr, /*tp_repr*/
0, /*tp_as_number*/
0, /*tp_as_sequence*/
0, /*tp_as_mapping*/
0, /*tp_hash*/
0, /*tp_call */
0, /*tp_str */
0, /*tp_getattro*/
0, /*tp_setattro*/
/* --- Functions to access object as input/output buffer ---------*/
0, /* tp_as_buffer */
/* --- Flags to define presence of optional/expanded features */
Py_TPFLAGS_HAVE_CLASS, /*tp_flags */
"About shape", /*tp_doc */
0, /*tp_traverse */
0, /*tp_clear */
0, /*tp_richcompare */
0, /*tp_weaklistoffset */
0, /*tp_iter */
0, /*tp_iternext */
TopoShapePyOld::Methods, /*tp_methods */
0, /*tp_members */
0, /*tp_getset */
&Base::PyObjectBase::Type, /*tp_base */
0, /*tp_dict */
0, /*tp_descr_get */
0, /*tp_descr_set */
0, /*tp_dictoffset */
PyInit, /*tp_init */
0, /*tp_alloc */
PyMake, /*tp_new */
0, /*tp_free Low-level free-memory routine */
0, /*tp_is_gc For PyObject_IS_GC */
0, /*tp_bases */
0, /*tp_mro method resolution order */
0, /*tp_cache */
0, /*tp_subclasses */
0 /*tp_weaklist */
};
//--------------------------------------------------------------------------
// Methods structure
//--------------------------------------------------------------------------
PyMethodDef TopoShapePyOld::Methods[] = {
{"hasChild", (PyCFunction) shasChild, Py_NEWARGS},
{"isNull", (PyCFunction) sisNull, Py_NEWARGS},
{"isValid", (PyCFunction) sisValid, Py_NEWARGS},
{"analyze", (PyCFunction) sanalyze, Py_NEWARGS},
{"importIGES", (PyCFunction) simportIGES, Py_NEWARGS},
{"exportIGES", (PyCFunction) sexportIGES, Py_NEWARGS},
{"importSTEP", (PyCFunction) simportSTEP, Py_NEWARGS},
{"exportSTEP", (PyCFunction) sexportSTEP, Py_NEWARGS},
{"importBREP", (PyCFunction) simportBREP, Py_NEWARGS},
{"exportBREP", (PyCFunction) sexportBREP, Py_NEWARGS},
{"exportSTL", (PyCFunction) sexportSTL, Py_NEWARGS},
{NULL, NULL} /* Sentinel */
};
PyObject *TopoShapePyOld::PyMake(PyTypeObject *ignored, PyObject *args, PyObject *kwds) // Python wrapper
{
return new TopoShapePyOld();
}
int TopoShapePyOld::PyInit(PyObject* self, PyObject* args, PyObject*)
{
PyObject *pcObj=0;
if (!PyArg_ParseTuple(args, "|O!", &(TopoShapePyOld::Type), &pcObj)) // convert args: Python->C
return -1; // NULL triggers exception
if ( pcObj )
{
TopoShapePyOld* pcShape = (TopoShapePyOld*)pcObj;
((TopoShapePyOld*)self)->_cTopoShape = pcShape->_cTopoShape;
}
return 0;
}
//--------------------------------------------------------------------------
// Parents structure
//--------------------------------------------------------------------------
PyParentObject TopoShapePyOld::Parents[] = {&Base::PyObjectBase::Type,&TopoShapePyOld::Type, NULL};
//--------------------------------------------------------------------------
// constructor
//--------------------------------------------------------------------------
TopoShapePyOld::TopoShapePyOld(PyTypeObject *T)
: Base::PyObjectBase(0,T)
{
Base::Console().Log("Create TopoShape: %p \n",this);
}
TopoShapePyOld::TopoShapePyOld(const TopoDS_Shape &cShape, PyTypeObject *T)
: PyObjectBase( 0,T), _cTopoShape(cShape)
{
Console().Log("Create TopoShape %p\n",this);
}
//--------------------------------------------------------------------------
// TopoShapePyOld destructor
//--------------------------------------------------------------------------
TopoShapePyOld::~TopoShapePyOld() // Everything handled in parent
{
Console().Log("Destroy TopoShape %p\n",this);
}
//--------------------------------------------------------------------------
// TopoShapePyOld Attributes
//--------------------------------------------------------------------------
PyObject *TopoShapePyOld::_getattr(const char *attr) // __getattr__ function: note only need to handle new state
{
try{
// Access the number of attributes at this label
if (Base::streq(attr, "AttributeCount"))
{
return Py_BuildValue("i", 1);
}else
_getattr_up(PyObjectBase); // send to parent
}catch(...){
Console().Log("Exception in TopoShapePyOld::_getattr()\n");
return 0;
}
}
int TopoShapePyOld::_setattr(const char *attr, PyObject *value) // __setattr__ function: note only need to handle new state
{
if (Base::streq(attr, "Real")) // settable new state
;
else
return PyObjectBase::_setattr(attr, value); // send up to parent
return 0;
}
//--------------------------------------------------------------------------
// PartFeaturePy representation
//--------------------------------------------------------------------------
PyObject *TopoShapePyOld::_repr(void)
{
std::stringstream a;
a << "TopoShape: [ ";
a << "]" << std::endl;
return Py_BuildValue("s", a.str().c_str());
}
//--------------------------------------------------------------------------
// Python wrappers
//--------------------------------------------------------------------------
PyObject *TopoShapePyOld::hasChild(PyObject *args)
{
if (!PyArg_ParseTuple(args, "" ))
return NULL;
Py_Return;
}
PyObject *TopoShapePyOld::isNull(PyObject *args)
{
if (!PyArg_ParseTuple(args, "" ))
return NULL;
return Py_BuildValue("O", (_cTopoShape.IsNull() ? Py_True : Py_False));
}
PyObject *TopoShapePyOld::isValid(PyObject *args)
{
if (!PyArg_ParseTuple(args, "" ))
return NULL;
if ( !_cTopoShape.IsNull() )
{
BRepCheck_Analyzer aChecker(_cTopoShape);
return Py_BuildValue("O", (aChecker.IsValid() ? Py_True : Py_False));
}
return Py_BuildValue("O", Py_False);
}
PyObject *TopoShapePyOld::analyze(PyObject *args)
{
if (!PyArg_ParseTuple(args, "" ))
return NULL;
if ( !_cTopoShape.IsNull() )
{
BRepCheck_Analyzer aChecker(_cTopoShape);
if (!aChecker.IsValid())
{
TopoDS_Iterator it(_cTopoShape);
for (;it.More(); it.Next())
{
if (!aChecker.IsValid(it.Value()))
{
const Handle(BRepCheck_Result)& result = aChecker.Result(it.Value());
const BRepCheck_ListOfStatus& status = result->StatusOnShape(it.Value());
BRepCheck_ListIteratorOfListOfStatus it(status);
while ( it.More() )
{
BRepCheck_Status& val = it.Value();
switch (val)
{
case BRepCheck_NoError:
PyErr_SetString(PyExc_StandardError, "No error");
break;
case BRepCheck_InvalidPointOnCurve:
PyErr_SetString(PyExc_StandardError, "Invalid point on curve");
break;
case BRepCheck_InvalidPointOnCurveOnSurface:
PyErr_SetString(PyExc_StandardError, "Invalid point on curve on surface");
break;
case BRepCheck_InvalidPointOnSurface:
PyErr_SetString(PyExc_StandardError, "Invalid point on surface");
break;
case BRepCheck_No3DCurve:
PyErr_SetString(PyExc_StandardError, "No 3D curve");
break;
case BRepCheck_Multiple3DCurve:
PyErr_SetString(PyExc_StandardError, "Multiple 3D curve");
break;
case BRepCheck_Invalid3DCurve:
PyErr_SetString(PyExc_StandardError, "Invalid 3D curve");
break;
case BRepCheck_NoCurveOnSurface:
PyErr_SetString(PyExc_StandardError, "No curve on surface");
break;
case BRepCheck_InvalidCurveOnSurface:
PyErr_SetString(PyExc_StandardError, "Invalid curve on surface");
break;
case BRepCheck_InvalidCurveOnClosedSurface:
PyErr_SetString(PyExc_StandardError, "Invalid curve on closed surface");
break;
case BRepCheck_InvalidSameRangeFlag:
PyErr_SetString(PyExc_StandardError, "Invalid same-range flag");
break;
case BRepCheck_InvalidSameParameterFlag:
PyErr_SetString(PyExc_StandardError, "Invalid same-parameter flag");
break;
case BRepCheck_InvalidDegeneratedFlag:
PyErr_SetString(PyExc_StandardError, "Invalid degenerated flag");
break;
case BRepCheck_FreeEdge:
PyErr_SetString(PyExc_StandardError, "Free edge");
break;
case BRepCheck_InvalidMultiConnexity:
PyErr_SetString(PyExc_StandardError, "Invalid multi-connexity");
break;
case BRepCheck_InvalidRange:
PyErr_SetString(PyExc_StandardError, "Invalid range");
break;
case BRepCheck_EmptyWire:
PyErr_SetString(PyExc_StandardError, "Empty wire");
break;
case BRepCheck_RedundantEdge:
PyErr_SetString(PyExc_StandardError, "Redundant edge");
break;
case BRepCheck_SelfIntersectingWire:
PyErr_SetString(PyExc_StandardError, "Self-intersecting wire");
break;
case BRepCheck_NoSurface:
PyErr_SetString(PyExc_StandardError, "No surface");
break;
case BRepCheck_InvalidWire:
PyErr_SetString(PyExc_StandardError, "Invalid wires");
break;
case BRepCheck_RedundantWire:
PyErr_SetString(PyExc_StandardError, "Redundant wires");
break;
case BRepCheck_IntersectingWires:
PyErr_SetString(PyExc_StandardError, "Intersecting wires");
break;
case BRepCheck_InvalidImbricationOfWires:
PyErr_SetString(PyExc_StandardError, "Invalid imbrication of wires");
break;
case BRepCheck_EmptyShell:
PyErr_SetString(PyExc_StandardError, "Empty shell");
break;
case BRepCheck_RedundantFace:
PyErr_SetString(PyExc_StandardError, "Redundant face");
break;
case BRepCheck_UnorientableShape:
PyErr_SetString(PyExc_StandardError, "Unorientable shape");
break;
case BRepCheck_NotClosed:
PyErr_SetString(PyExc_StandardError, "Not closed");
break;
case BRepCheck_NotConnected:
PyErr_SetString(PyExc_StandardError, "Not connected");
break;
case BRepCheck_SubshapeNotInShape:
PyErr_SetString(PyExc_StandardError, "Sub-shape not in shape");
break;
case BRepCheck_BadOrientation:
PyErr_SetString(PyExc_StandardError, "Bad orientation");
break;
case BRepCheck_BadOrientationOfSubshape:
PyErr_SetString(PyExc_StandardError, "Bad orientation of sub-shape");
break;
case BRepCheck_InvalidToleranceValue:
PyErr_SetString(PyExc_StandardError, "Invalid tolerance value");
break;
case BRepCheck_CheckFail:
PyErr_SetString(PyExc_StandardError, "Check failed");
break;
}
if (PyErr_Occurred())
PyErr_Print();
it.Next();
}
}
}
}
}
Py_Return;
}
#if 0 // need a define for version of OCC
//#include <Message_ProgressIndicator.hxx>
//#include <Message_ProgressScale.hxx>
#include <MoniTool_ProgressIndicator.hxx>
#include <MoniTool_ProgressScale.hxx>
#include <Transfer_FinderProcess.hxx>
#include <TCollection_HAsciiString.hxx>
#include <Transfer_TransientProcess.hxx>
#include <IGESData_IGESEntity.hxx>
#include <XSControl_TransferReader.hxx>
#include <XSControl_WorkSession.hxx>
#include <Interface_InterfaceModel.hxx>
class ProgressIndicator : public MoniTool_ProgressIndicator
//class ProgressIndicator : public Message_ProgressIndicator
{
public:
ProgressIndicator() {}
virtual ~ProgressIndicator()
{
Base::Sequencer().stop();
}
virtual void Reset()
{
}
virtual Standard_Boolean UserBreak()
{
return Base::Sequencer().wasCanceled();
}
virtual Standard_Boolean Show(const Standard_Boolean force = Standard_True)
{
Standard_Real min, max, step; Standard_Boolean isInf;
GetScale(min, max, step, isInf);
Standard_Real val = GetValue();
Standard_Integer scopes = GetNbScopes();
const MoniTool_ProgressScale& scale = GetScope(scopes);
Handle(TCollection_HAsciiString) name = scale.GetName();
if ( val < 2.0 )
Base::Sequencer().start(name->ToCString(), (unsigned long)max);
else
Base::Sequencer().next();
return false;
}
};
#endif
PyObject *TopoShapePyOld::importIGES(PyObject *args)
{
char* filename;
if (!PyArg_ParseTuple(args, "s", &filename ))
return NULL;
PY_TRY {
// checking for the file
Base::FileInfo File(filename);
if(!File.isReadable()) {
PyErr_SetString(PartExceptionOCCError,"File to read does not exist or is not readable");
return NULL;
}
// read iges file
IGESControl_Reader aReader;
if (aReader.ReadFile((const Standard_CString)filename) != IFSelect_RetDone) {
PyErr_SetString(PartExceptionOCCError,"Reading IGES failed");
return NULL;
}
#if 0
// get all root shapes
Handle(TColStd_HSequenceOfTransient) aList=aReader.GiveList("xst-transferrable-roots");
for (Standard_Integer j=1; j<=aList->Length(); j++) {
Handle(IGESData_IGESEntity) igesEntity=Handle(IGESData_IGESEntity)::DownCast(aList->Value(j));
// get names
Handle(TCollection_HAsciiString) name = igesEntity->NameValue();
if ( !name.IsNull() ) {
const char* cname = name->ToCString();
}
if (igesEntity->HasShortLabel()) {
name = igesEntity->ShortLabel();
if ( !name.IsNull() ) {
const char* cname = name->ToCString();
}
}
const char* type = igesEntity->DynamicType()->Name();
}
//Standard_Integer val = Interface_Static::IVal("read.iges.bspline.continuity");
//Interface_Static::SetIVal("read.iges.bspline.continuity", 2);
//Standard_Integer ic = Interface_Static::IVal("read.precision.mode");
//Standard_Real rp = Interface_Static::RVal("read.precision.val");
//Handle(TColStd_HSequenceOfTransient) aList;
//aList = aReader.GiveList ("iges-type(114)");
//int ct = aList->Length();
//Reader.TransferList(aList);
//ct = aReader.NbShapes();
#endif
// one shape that contains all subshapes
aReader.TransferRoots();
//ct = aReader.NbShapes();
_cTopoShape = aReader.OneShape();
} PY_CATCH;
Py_Return;
}
PyObject *TopoShapePyOld::exportIGES(PyObject *args)
{
char* filename;
if (!PyArg_ParseTuple(args, "s", &filename ))
return NULL;
PY_TRY {
#if 0
// An OCC example
IGESControl_Controller::Init();
IGESControl_Writer writer( Interface_Static::CVal( "XSTEP.iges.unit" ),
Interface_Static::IVal( "XSTEP.iges.writebrep.mode" ) );
writer.AddShape ( _cTopoShape );
writer.ComputeModel();
writer.Write( (const Standard_CString)filename );
#endif
// write iges file
IGESControl_Controller::Init();
IGESControl_Writer aWriter;
#if 0
Handle(Transfer_FinderProcess) proc = aWriter.TransferProcess();
Handle(MoniTool_ProgressIndicator) prog = new ProgressIndicator();
proc->SetProgress(prog);
Standard_CString byvalue = Interface_Static::CVal("write.iges.header.author");
Interface_Static::SetCVal ("write.iges.header.author", "FreeCAD");
//Interface_Static::SetCVal ("write.iges.header.company", "FreeCAD");
#endif
aWriter.AddShape(_cTopoShape);
#if 0
aWriter.ComputeModel();
#endif
if (aWriter.Write((const Standard_CString)filename) != IFSelect_RetDone) {
PyErr_SetString(PartExceptionOCCError,"Writing IGES failed");
return NULL;
}
} PY_CATCH;
Py_Return;
}
PyObject *TopoShapePyOld::importSTEP(PyObject *args)
{
char* filename;
if (!PyArg_ParseTuple(args, "s", &filename ))
return NULL;
PY_TRY {
// checking for the file
Base::FileInfo File(filename);
if(!File.isReadable()) {
PyErr_SetString(PartExceptionOCCError,"File to read does not exist or is not readable");
return NULL;
}
// read step file
STEPControl_Reader aReader;
if (aReader.ReadFile((const Standard_CString)filename) != IFSelect_RetDone) {
PyErr_SetString(PartExceptionOCCError,"Reading STEP failed");
return NULL;
}
#if 0 // Some interesting stuff
Handle(TColStd_HSequenceOfTransient) aList=aReader.GiveList("xst-transferrable-roots");
for (Standard_Integer j=1; j<=aList->Length(); j++) {
Handle(IGESData_IGESEntity) igesEntity=Handle(IGESData_IGESEntity)::DownCast(aList->Value(j));
// get names
Handle(TCollection_HAsciiString) name = igesEntity->NameValue();
if ( !name.IsNull() ) {
const char* cname = name->ToCString();
}
if (igesEntity->HasShortLabel()) {
name = igesEntity->ShortLabel();
if ( !name.IsNull() ) {
const char* cname = name->ToCString();
}
}
const char* type = igesEntity->DynamicType()->Name();
}
#endif
aReader.TransferRoots();
_cTopoShape = aReader.OneShape();
#if 0 // Some interesting stuff
Handle(XSControl_WorkSession) ws = aReader.WS();
//SetModel( reader.StepModel() );
Handle(XSControl_TransferReader) tr = ws->TransferReader();
Handle(Standard_Transient) ent = tr->EntityFromShapeResult(_cTopoShape, 3);
if ( ! ent.IsNull() ) {
//printf( "Name of STEP-Model: %s\n", ws->Model()->StringLabel(ent)->String() );
}
TopTools_IndexedMapOfShape smap;
TopExp::MapShapes( _cTopoShape, smap);
for ( Standard_Integer k = 1; k <= smap.Extent(); k++ ) {
const TopoDS_Shape& tsh = smap(k);
Handle(Standard_Transient) ent = tr->EntityFromShapeResult(tsh, 3);
if ( ! ent.IsNull() ) {
//printf( "Part %s ", ws->Model()->StringLabel(ent)->String() );
//printf( "is a %s\n", ws->Model()->TypeName(ent) );
//MoniTool_DataMapOfShapeTransient map;
//map.Bind(tsh, ws->Model()->StringLabel(ent)->ShallowCopy() );
}
}
#endif
} PY_CATCH;
Py_Return;
}
PyObject *TopoShapePyOld::exportSTEP(PyObject *args)
{
char* filename;
if (!PyArg_ParseTuple(args, "s", &filename))
return NULL;
PY_TRY {
// write step file
STEPControl_Writer aWriter;
//FIXME: Does not work this way!!!
if (aWriter.Transfer(_cTopoShape, STEPControl_AsIs)) {
PyErr_SetString(PartExceptionOCCError,"Transferring STEP failed");
return NULL;
}
if (aWriter.Write((const Standard_CString)filename) != IFSelect_RetDone) {
PyErr_SetString(PartExceptionOCCError,"Writing STEP failed");
return NULL;
}
} PY_CATCH;
Py_Return;
}
PyObject *TopoShapePyOld::importBREP(PyObject *args)
{
char* filename;
if (!PyArg_ParseTuple(args, "s", &filename ))
return NULL;
PY_TRY {
// checking for the file
Base::FileInfo File(filename);
if(!File.isReadable()) {
PyErr_SetString(PartExceptionOCCError,"File to read does not exist or is not readable");
return NULL;
}
// read brep file
BRep_Builder aBuilder;
if (!BRepTools::Read(_cTopoShape,(const Standard_CString)filename,aBuilder)) {
PyErr_SetString(PartExceptionOCCError,"Reading BREP failed");
return NULL;
}
} PY_CATCH;
Py_Return;
}
PyObject *TopoShapePyOld::exportBREP(PyObject *args)
{
char* filename;
if (!PyArg_ParseTuple(args, "s", &filename ))
return NULL;
PY_TRY {
// read brep file
if (!BRepTools::Write(_cTopoShape,(const Standard_CString)filename)) {
PyErr_SetString(PartExceptionOCCError,"Writing BREP failed");
return NULL;
}
} PY_CATCH;
Py_Return;
}
PyObject *TopoShapePyOld::exportSTL(PyObject *args)
{
char* filename;
if (!PyArg_ParseTuple(args, "s", &filename ))
return NULL;
PY_TRY {
// write STL file
StlAPI_Writer writer;
writer.Write( _cTopoShape, (const Standard_CString)filename );
} PY_CATCH;
Py_Return;
}
#endif

View File

@@ -1,104 +0,0 @@
/***************************************************************************
* Copyright (c) 2002 Jürgen Riegel <juergen.riegel@web.de> *
* *
* This file is part of the FreeCAD CAx development system. *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Library General Public License (LGPL) *
* as published by the Free Software Foundation; either version 2 of *
* the License, or (at your option) any later version. *
* for detail see the LICENCE text file. *
* *
* FreeCAD is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with FreeCAD; if not, write to the Free Software *
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
* USA *
* *
***************************************************************************/
#ifndef __TOPOLOGY_H__
#define __TOPOLOGY_H__
#if 0
// Std. configurations
#include <Base/PyObjectBase.h>
#include <TopoDS_Shape.hxx>
namespace Part
{
/** The TopoDSShape wrapper class
* This class wraps the functionality of the Topology package. It wraps not
* strictly after the OCC rules. It also includes a lot of algorithms from other
* packages like BRepTools and BRepBuilder. Also iterators and so on.
*/
class AppPartExport TopoShapePyOld :public Base::PyObjectBase
{
/** always start with Py_Header */
Py_Header;
protected:
/// Destruction
~TopoShapePyOld();
public:
/// Constructor
TopoShapePyOld(PyTypeObject *T = &Type);
TopoShapePyOld(const TopoDS_Shape &cShape, PyTypeObject *T = &TopoShapePyOld::Type);
/// for Construction in python
static PyObject *PyMake(PyTypeObject*, PyObject*, PyObject*);
static int PyInit(PyObject*, PyObject*, PyObject*);
//---------------------------------------------------------------------
// exported functions goes here +++++++++++++++++++++++++++++++++++++++
//---------------------------------------------------------------------
/// Gets the OCC Label
TopoDS_Shape getTopoShape(void){return _cTopoShape;}
//---------------------------------------------------------------------
// python exports goes here +++++++++++++++++++++++++++++++++++++++++++
//---------------------------------------------------------------------
virtual PyObject *_repr(void); // the representation
PyObject *_getattr(const char *attr); // __getattr__ function
// getter setter
int _setattr(const char *attr, PyObject *value); // __setattr__ function
// methods
PYFUNCDEF_D (TopoShapePyOld,hasChild);
PYFUNCDEF_D (TopoShapePyOld,isNull);
PYFUNCDEF_D (TopoShapePyOld,isValid);
PYFUNCDEF_D (TopoShapePyOld,analyze);
PYFUNCDEF_D (TopoShapePyOld,importIGES);
PYFUNCDEF_D (TopoShapePyOld,exportIGES);
PYFUNCDEF_D (TopoShapePyOld,importSTEP);
PYFUNCDEF_D (TopoShapePyOld,exportSTEP);
PYFUNCDEF_D (TopoShapePyOld,importBREP);
PYFUNCDEF_D (TopoShapePyOld,exportBREP);
PYFUNCDEF_D (TopoShapePyOld,exportSTL);
TopoDS_Shape &getShape(void){return _cTopoShape;}
protected:
/// The OCC Label
TopoDS_Shape _cTopoShape;
};
} //namespace App
#endif
#endif // __TOPOLOGY_H__

View File

@@ -1689,11 +1689,9 @@ void CmdPartOffset::activated(int iMsg)
doCommand(Doc,"App.ActiveDocument.%s.Source = App.ActiveDocument.%s" ,offset.c_str(), shape->getNameInDocument());
doCommand(Doc,"App.ActiveDocument.%s.Value = 1.0",offset.c_str());
updateActive();
//if (isActiveObjectValid())
// doCommand(Gui,"Gui.ActiveDocument.hide(\"%s\")",shape->getNameInDocument());
doCommand(Gui,"Gui.ActiveDocument.setEdit('%s')",offset.c_str());
//commitCommand();
adjustCameraPosition();
copyVisual(offset.c_str(), "ShapeColor", shape->getNameInDocument());
@@ -1703,15 +1701,9 @@ void CmdPartOffset::activated(int iMsg)
bool CmdPartOffset::isActive()
{
{
bool hasShapes = PartGui::hasShapesInSelection();
std::vector<App::DocumentObject*> docobjs = Gui::Selection().getObjectsOfType(App::DocumentObject::getClassTypeId());
return (hasShapes && !Gui::Control().activeDialog() && docobjs.size() == 1);
}
// Base::Type partid = Base::Type::fromName("Part::Feature");
// bool objectsSelected = Gui::Selection().countObjectsOfType(partid,0,3) == 1;
// return (objectsSelected && !Gui::Control().activeDialog());
bool hasShapes = PartGui::hasShapesInSelection();
std::vector<App::DocumentObject*> docobjs = Gui::Selection().getObjectsOfType(App::DocumentObject::getClassTypeId());
return (hasShapes && !Gui::Control().activeDialog() && docobjs.size() == 1);
}
@@ -1755,11 +1747,7 @@ void CmdPartOffset2D::activated(int iMsg)
doCommand(Doc,"App.ActiveDocument.%s.Source = App.ActiveDocument.%s" ,offset.c_str(), shape->getNameInDocument());
doCommand(Doc,"App.ActiveDocument.%s.Value = 1.0",offset.c_str());
updateActive();
//if (isActiveObjectValid())
// doCommand(Gui,"Gui.ActiveDocument.hide(\"%s\")",shape->getNameInDocument());
doCommand(Gui,"Gui.ActiveDocument.setEdit('%s')",offset.c_str());
//commitCommand();
adjustCameraPosition();
copyVisual(offset.c_str(), "ShapeColor", shape->getNameInDocument());
@@ -1944,8 +1932,6 @@ void CmdPartThickness::activated(int iMsg)
obj->getDocument()->getName(), obj->getNameInDocument());
}
doCommand(Gui,"Gui.ActiveDocument.setEdit('%s')",thick.c_str());
//commitCommand();
adjustCameraPosition();
copyVisual(thick.c_str(), "ShapeColor", obj->getNameInDocument());
@@ -1981,68 +1967,6 @@ CmdShapeInfo::CmdShapeInfo()
void CmdShapeInfo::activated(int iMsg)
{
Q_UNUSED(iMsg);
#if 0
static const char * const part_pipette[]={
"32 32 17 1",
"# c #000000",
"j c #080808",
"b c #101010",
"f c #1c1c1c",
"g c #4c4c4c",
"c c #777777",
"a c #848484",
"i c #9c9c9c",
"l c #b9b9b9",
"e c #cacaca",
"n c #d6d6d6",
"k c #dedede",
"d c #e7e7e7",
"m c #efefef",
"h c #f7f7f7",
"w c #ffffff",
". c None",
"................................",
".....................#####......",
"...................#######......",
"...................#########....",
"..................##########....",
"..................##########....",
"..................##########....",
".................###########....",
"...............#############....",
".............###############....",
".............#############......",
".............#############......",
"...............ab######.........",
"..............cdef#####.........",
".............ghdacf####.........",
"............#ehiacj####.........",
"............awiaaf####..........",
"...........iheacf##.............",
"..........#kdaag##..............",
".........gedaacb#...............",
".........lwiac##................",
".......#amlaaf##................",
".......cheaag#..................",
"......#ndaag##..................",
".....#imaacb#...................",
".....iwlacf#....................",
"....#nlaag##....................",
"....feaagj#.....................",
"....caag##......................",
"....ffbj##......................",
"................................",
"................................"};
Gui::Document* doc = Gui::Application::Instance->activeDocument();
Gui::View3DInventor* view = static_cast<Gui::View3DInventor*>(doc->getActiveView());
#endif
//if (view) {
// Gui::View3DInventorViewer* viewer = view->getViewer();
// viewer->setEditing(true);
// viewer->getWidget()->setCursor(QCursor(QPixmap(part_pipette),4,29));
// viewer->addEventCallback(SoMouseButtonEvent::getClassTypeId(), PartGui::ViewProviderPart::shapeInfoCallback);
// }
}
bool CmdShapeInfo::isActive()
@@ -2144,8 +2068,6 @@ void CmdPartRuledSurface::activated(int iMsg)
}
}
if (!ok) {
QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Wrong selection"),
QObject::tr("You have to select either two edges or two wires."));
@@ -2543,9 +2465,6 @@ CmdPartSectionCut::CmdPartSectionCut()
Gui::Action* CmdPartSectionCut::createAction()
{
Gui::Action* pcAction = Gui::Command::createAction();
#if 0
pcAction->setCheckable(true);
#endif
return pcAction;
}
@@ -2587,8 +2506,6 @@ void CreatePartCommands()
rcCmdMgr.addCommand(new CmdPartCompCompoundTools());
rcCmdMgr.addCommand(new CmdPartCompound());
rcCmdMgr.addCommand(new CmdPartSection());
//rcCmdMgr.addCommand(new CmdPartBox2());
//rcCmdMgr.addCommand(new CmdPartBox3());
rcCmdMgr.addCommand(new CmdPartPrimitives());
rcCmdMgr.addCommand(new CmdPartImport());

View File

@@ -140,7 +140,6 @@ public:
const cc_glglue * glue = cc_glglue_instance((int) context);
PFNGLDELETEBUFFERSARBPROC glDeleteBuffersARB = (PFNGLDELETEBUFFERSARBPROC)cc_glglue_getprocaddress(glue, "glDeleteBuffersARB");
#endif
//cc_glglue_glDeleteBuffers(glue, buffer.size(), buffer.data());
auto &buffer = it->second;
glDeleteBuffersARB(2, buffer.myvbo);
self->vbomap.erase(it);
@@ -436,12 +435,8 @@ void SoBrepFaceSet::GLRender(SoGLRenderAction *action)
if(normalCacheUsed)
this->readUnlockNormalCache();
}
// Workaround for #0000433
//#if !defined(FC_OS_WIN32)
renderHighlight(action,ctx);
renderSelection(action,ctx);
//#endif
}
//****************************************************************************
@@ -458,13 +453,8 @@ void SoBrepFaceSet::renderSimpleArray()
glEnableClientState(GL_NORMAL_ARRAY);
glEnableClientState(GL_VERTEX_ARRAY);
#if 0
glInterleavedArrays(GL_N3F_V3F, 0, vertex_array.data());
glDrawElements(GL_TRIANGLES, cnt, GL_UNSIGNED_INT, index_array.data());
#else
glInterleavedArrays(GL_N3F_V3F, 0, &(vertex_array[0]));
glDrawElements(GL_TRIANGLES, cnt, GL_UNSIGNED_INT, &(index_array[0]));
#endif
glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_NORMAL_ARRAY);
@@ -485,13 +475,8 @@ void SoBrepFaceSet::renderColoredArray(SoMaterialBundle *const materials)
glEnableClientState(GL_NORMAL_ARRAY);
glEnableClientState(GL_VERTEX_ARRAY);
#if 0
glInterleavedArrays(GL_N3F_V3F, 0, vertex_array.data());
const int32_t* ptr = index_array.data();
#else
glInterleavedArrays(GL_N3F_V3F, 0, &(vertex_array[0]));
const int32_t* ptr = &(index_array[0]);
#endif
for (int part_id = 0; part_id < num_parts; part_id++) {
int tris = partIndex[part_id];
@@ -651,20 +636,10 @@ void SoBrepFaceSet::GLRender(SoGLRenderAction *action)
if (hasVBO) {
// get the VBO status of the viewer
Gui::SoGLVBOActivatedElement::get(state, hasVBO);
//
//if (SoGLVBOElement::shouldCreateVBO(state, numindices)) {
// this->startVertexArray(action, coords, normals, false, false);
//}
}
renderShape(action, hasVBO, static_cast<const SoGLCoordinateElement*>(coords), cindices, numindices,
pindices, numparts, normals, nindices, &mb, mindices, &tb, tindices, nbind, mbind, doTextures?1:0);
// if (!hasVBO) {
// // Disable caching for this node
// SoGLCacheContextElement::shouldAutoCache(state, SoGLCacheContextElement::DONT_AUTO_CACHE);
// }else
// SoGLCacheContextElement::setAutoCacheBits(state, SoGLCacheContextElement::DO_AUTO_CACHE);
if (normalCacheUsed)
this->readUnlockNormalCache();
}
@@ -971,10 +946,6 @@ void SoBrepFaceSet::getBoundingBox(SoGetBoundingBoxAction * action) {
void SoBrepFaceSet::generatePrimitives(SoAction * action)
{
//TODO
#if 0
inherited::generatePrimitives(action);
#else
//This is highly experimental!!!
if (this->coordIndex.getNum() < 3)
@@ -1203,7 +1174,6 @@ void SoBrepFaceSet::generatePrimitives(SoAction * action)
if (this->vertexProperty.getValue()) {
state->pop();
}
#endif
}
#undef DO_VERTEX
@@ -1386,7 +1356,6 @@ void SoBrepFaceSet::renderSelection(SoGLRenderAction *action, SelContextPtr ctx,
}
if (push) {
state->pop();
// SoCacheElement::invalidate(state);
}
if (normalCacheUsed)

View File

@@ -35,7 +35,6 @@
class SoGLCoordinateElement;
class SoTextureCoordinateBundle;
// #define RENDER_GLARRAYS
namespace PartGui {

View File

@@ -185,32 +185,13 @@ public:
Base::Vector3d pt2d;
pt2d = proj(Base::Vector3d(p.X(), p.Y(), p.Z()));
if (polygon.Contains(Base::Vector2d(pt2d.x, pt2d.y))) {
#if 0
// TODO
if (isVisibleFace(k - 1, SbVec2f(pt2d.x, pt2d.y), viewer))
#endif
{
std::stringstream str;
str << "Face" << k;
Gui::Selection().addSelection(appdoc->getName(), obj->getNameInDocument(), str.str().c_str());
break;
}
std::stringstream str;
str << "Face" << k;
Gui::Selection().addSelection(appdoc->getName(), obj->getNameInDocument(), str.str().c_str());
break;
}
xp_vertex.Next();
}
//GProp_GProps props;
//BRepGProp::SurfaceProperties(face, props);
//gp_Pnt c = props.CentreOfMass();
//Base::Vector3d pt2d;
//pt2d = proj(Base::Vector3d(c.X(), c.Y(), c.Z()));
//if (polygon.Contains(Base::Vector2d(pt2d.x, pt2d.y))) {
// if (isVisibleFace(k-1, SbVec2f(pt2d.x, pt2d.y), viewer)) {
// std::stringstream str;
// str << "Face" << k;
// Gui::Selection().addSelection(appdoc->getName(), obj->getNameInDocument(), str.str().c_str());
// }
//}
}
}
catch (...) {

View File

@@ -92,9 +92,6 @@ ViewProvider2DObjectGrid::~ViewProvider2DObjectGrid()
SoSeparator* ViewProvider2DObjectGrid::createGrid()
{
//double dx = 10 * GridSize.getValue(); // carpet size
//double dy = 10 * GridSize.getValue();
// float Size = (MaxX-MinX > MaxY-MinY) ? MaxX-MinX : MaxY-MinY;
float Step = GridSize.getValue(); //pow(10,floor(log10(Size/5.0)));
float MiX, MaX, MiY, MaY;
if (TightGrid.getValue()) {
@@ -133,35 +130,6 @@ SoSeparator* ViewProvider2DObjectGrid::createGrid()
SoBaseColor *mycolor;
SoVertexProperty *vts;
// carpet
/* mycolor = new SoBaseColor;
mycolor->rgb.setValue(0.2f, 0.7f, 0.7f);
parent->addChild(mycolor);
vts = new SoVertexProperty;
vts->vertex.set1Value(0, -0.5*dx, -1.5*dy, 0.5*zGrid);
vts->vertex.set1Value(1, -0.5*dx, -1.5*dy, -0.5*zGrid);
vts->vertex.set1Value(2, 0.5*dx, -1.5*dy, 0.5*zGrid);
vts->vertex.set1Value(3, 0.5*dx, -1.5*dy, -0.5*zGrid);
SoQuadMesh *carpet = new SoQuadMesh;
carpet->verticesPerColumn = 2;
carpet->verticesPerRow = 2;
carpet->vertexProperty = vts;
parent->addChild(carpet);*/
// It seems that SoDepthBuffer will mess up with other object's
// pre-selection highlight. No idea why the setting can leak out of a
// separator.
//
// What's the purpose of using SoDepthBuffer here anyway? If the intention
// is to render grid always on top, shouldn't it be better to use
// SoAnnotation?
#if 0
SoDepthBuffer *depth = new SoDepthBuffer;
depth->function = SoDepthBuffer::ALWAYS;
parent->addChild(depth);
#endif
// gridlines
mycolor = new SoBaseColor;

View File

@@ -787,13 +787,6 @@ void ViewProviderPartExt::setHighlightedPoints(const std::vector<App::Color>& co
getObject()->touch(true);
int size = static_cast<int>(colors.size());
if (size > 1) {
#if 0
int numPoints = coords->point.getNum() - nodeset->startIndex.getValue();
if (numPoints != size) {
SoDebugError::postWarning("ViewProviderPartExt::setHighlightedPoints",
"The number of points (%d) doesn't match with the number of colors (%d).", numPoints, size);
}
#endif
pcPointBind->value = SoMaterialBinding::PER_VERTEX;
pcPointMaterial->diffuseColor.setNum(size);
SbColor* ca = pcPointMaterial->diffuseColor.startEditing();