Fix mixed line endings
This commit is contained in:
@@ -409,7 +409,7 @@ int *ConsoleSingleton::GetLogLevel(const char *tag, bool create) {
|
||||
if (!tag) tag = "";
|
||||
if (_logLevels.find(tag) != _logLevels.end())
|
||||
return &_logLevels[tag];
|
||||
if (!create)
|
||||
if (!create)
|
||||
return nullptr;
|
||||
int &ret = _logLevels[tag];
|
||||
ret = -1;
|
||||
|
||||
@@ -377,7 +377,7 @@ bool FileInfo::isFile () const
|
||||
// If we can open it must be an existing file, otherwise we assume it
|
||||
// is a directory (which doesn't need to be true for any cases)
|
||||
std::ifstream str(FileName.c_str(), std::ios::in | std::ios::binary);
|
||||
if (!str)
|
||||
if (!str)
|
||||
return false;
|
||||
str.close();
|
||||
return true;
|
||||
@@ -552,7 +552,7 @@ bool FileInfo::createDirectories() const
|
||||
|
||||
bool FileInfo::deleteDirectory() const
|
||||
{
|
||||
if (isDir() == false )
|
||||
if (isDir() == false )
|
||||
return false;
|
||||
#if defined (FC_OS_WIN32)
|
||||
std::wstring wstr = toStdWString();
|
||||
@@ -566,7 +566,7 @@ bool FileInfo::deleteDirectory() const
|
||||
|
||||
bool FileInfo::deleteDirectoryRecursive() const
|
||||
{
|
||||
if (isDir() == false )
|
||||
if (isDir() == false )
|
||||
return false;
|
||||
std::vector<Base::FileInfo> List = getDirectoryContent();
|
||||
|
||||
|
||||
@@ -511,7 +511,7 @@ void InterpreterSingleton::addType(PyTypeObject* Type,PyObject* Module, const ch
|
||||
// NOTE: To finish the initialization of our own type objects we must
|
||||
// call PyType_Ready, otherwise we run into a segmentation fault, later on.
|
||||
// This function is responsible for adding inherited slots from a type's base class.
|
||||
if (PyType_Ready(Type) < 0)
|
||||
if (PyType_Ready(Type) < 0)
|
||||
return;
|
||||
union PyType_Object pyType = {Type};
|
||||
PyModule_AddObject(Module, Name, pyType.o);
|
||||
|
||||
+1
-1
@@ -539,7 +539,7 @@ void Matrix_gauss(Matrix a, Matrix b)
|
||||
}
|
||||
indxr[i] = irow;
|
||||
indxc[i] = icol;
|
||||
if (a[4*icol+icol] == 0.0)
|
||||
if (a[4*icol+icol] == 0.0)
|
||||
return;
|
||||
pivinv = 1.0/a[4*icol+icol];
|
||||
a[4*icol+icol] = 1.0;
|
||||
|
||||
@@ -413,7 +413,7 @@ bool ParameterGrp::GetBool(const char* Name, bool bPreset) const
|
||||
// check if Element in group
|
||||
DOMElement *pcElem = FindElement(_pGroupNode,"FCBool",Name);
|
||||
// if not return preset
|
||||
if (!pcElem)
|
||||
if (!pcElem)
|
||||
return bPreset;
|
||||
// if yes check the value and return
|
||||
if (strcmp(StrX(pcElem->getAttribute(XStr("Value").unicodeForm())).c_str(),"1"))
|
||||
@@ -481,7 +481,7 @@ long ParameterGrp::GetInt(const char* Name, long lPreset) const
|
||||
// check if Element in group
|
||||
DOMElement *pcElem = FindElement(_pGroupNode,"FCInt",Name);
|
||||
// if not return preset
|
||||
if (!pcElem)
|
||||
if (!pcElem)
|
||||
return lPreset;
|
||||
// if yes check the value and return
|
||||
return atol (StrX(pcElem->getAttribute(XStr("Value").unicodeForm())).c_str());
|
||||
@@ -543,7 +543,7 @@ unsigned long ParameterGrp::GetUnsigned(const char* Name, unsigned long lPreset)
|
||||
// check if Element in group
|
||||
DOMElement *pcElem = FindElement(_pGroupNode,"FCUInt",Name);
|
||||
// if not return preset
|
||||
if (!pcElem)
|
||||
if (!pcElem)
|
||||
return lPreset;
|
||||
// if yes check the value and return
|
||||
return strtoul (StrX(pcElem->getAttribute(XStr("Value").unicodeForm())).c_str(),nullptr,10);
|
||||
@@ -605,7 +605,7 @@ double ParameterGrp::GetFloat(const char* Name, double dPreset) const
|
||||
// check if Element in group
|
||||
DOMElement *pcElem = FindElement(_pGroupNode,"FCFloat",Name);
|
||||
// if not return preset
|
||||
if (!pcElem)
|
||||
if (!pcElem)
|
||||
return dPreset;
|
||||
// if yes check the value and return
|
||||
return atof (StrX(pcElem->getAttribute(XStr("Value").unicodeForm())).c_str());
|
||||
|
||||
@@ -145,7 +145,7 @@ bool BoundBox2d::Intersect(const Polygon2d &rclPoly) const
|
||||
return true; /***** RETURN INTERSECTION *********/
|
||||
|
||||
// test intersections of bound-lines
|
||||
if (rclPoly.GetCtVectors() < 3)
|
||||
if (rclPoly.GetCtVectors() < 3)
|
||||
return false;
|
||||
for (i = 0; i < rclPoly.GetCtVectors(); i++)
|
||||
{
|
||||
@@ -289,7 +289,7 @@ static short _CalcTorsion (double *pfLine, double fX, double fY)
|
||||
|
||||
// Abort at line points within a quadrant
|
||||
// Abort at non-intersecting line points
|
||||
if (abs (sQuad[0] - sQuad[1]) <= 1)
|
||||
if (abs (sQuad[0] - sQuad[1]) <= 1)
|
||||
return 0;
|
||||
|
||||
// Both points to the left of ulX
|
||||
@@ -319,7 +319,7 @@ bool Polygon2d::Contains (const Vector2d &rclV) const
|
||||
short sTorsion = 0;
|
||||
|
||||
// Error check
|
||||
if (GetCtVectors() < 3)
|
||||
if (GetCtVectors() < 3)
|
||||
return false;
|
||||
|
||||
// for all polygon lines
|
||||
|
||||
@@ -443,7 +443,7 @@ void CallTipsList::extractTipsFromProperties(Py::Object& obj, QMap<QString, Call
|
||||
App::PropertyContainerPy* cont = (App::PropertyContainerPy*)(obj.ptr());
|
||||
App::PropertyContainer* container = cont->getPropertyContainerPtr();
|
||||
// Make sure that the C++ object is alive
|
||||
if (!container)
|
||||
if (!container)
|
||||
return;
|
||||
std::map<std::string,App::Property*> Map;
|
||||
container->getPropertyMap(Map);
|
||||
@@ -690,7 +690,7 @@ bool CallTipsList::eventFilter(QObject * watched, QEvent * event)
|
||||
void CallTipsList::callTipItemActivated(QListWidgetItem *item)
|
||||
{
|
||||
hide();
|
||||
if (!item->isSelected())
|
||||
if (!item->isSelected())
|
||||
return;
|
||||
|
||||
QString text = item->text();
|
||||
|
||||
+3
-3
@@ -228,10 +228,10 @@ Command::~Command()
|
||||
bool Command::isViewOfType(Base::Type t) const
|
||||
{
|
||||
Gui::Document *d = getGuiApplication()->activeDocument();
|
||||
if (!d)
|
||||
if (!d)
|
||||
return false;
|
||||
Gui::BaseView *v = d->getActiveView();
|
||||
if (!v)
|
||||
if (!v)
|
||||
return false;
|
||||
if (v->getTypeId().isDerivedFrom(t))
|
||||
return true;
|
||||
@@ -940,7 +940,7 @@ void Command::adjustCameraPosition()
|
||||
SoGetBoundingBoxAction action(viewer->getSoRenderManager()->getViewportRegion());
|
||||
action.apply(viewer->getSceneGraph());
|
||||
SbBox3f box = action.getBoundingBox();
|
||||
if (box.isEmpty())
|
||||
if (box.isEmpty())
|
||||
return;
|
||||
|
||||
// get cirumscribing sphere and check if camera is inside
|
||||
|
||||
@@ -185,7 +185,7 @@ void FCCmdTest3::activated(int iMsg)
|
||||
{
|
||||
Q_UNUSED(iMsg);
|
||||
App::Document *pcDoc = getDocument();
|
||||
if (!pcDoc)
|
||||
if (!pcDoc)
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -216,7 +216,7 @@ void FCCmdTest4::activated(int iMsg)
|
||||
{
|
||||
Q_UNUSED(iMsg);
|
||||
App::Document *pcDoc = getDocument();
|
||||
if(!pcDoc)
|
||||
if(!pcDoc)
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -246,7 +246,7 @@ void FCCmdTest5::activated(int iMsg)
|
||||
{
|
||||
Q_UNUSED(iMsg);
|
||||
App::Document *pcDoc = getDocument();
|
||||
if(!pcDoc)
|
||||
if(!pcDoc)
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -276,7 +276,7 @@ void FCCmdTest6::activated(int iMsg)
|
||||
{
|
||||
Q_UNUSED(iMsg);
|
||||
App::Document *pcDoc = getDocument();
|
||||
if(!pcDoc)
|
||||
if(!pcDoc)
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -305,7 +305,7 @@ void CmdTestCmdFuncs::activated(int iMsg)
|
||||
Q_UNUSED(iMsg);
|
||||
App::Document *doc = getDocument();
|
||||
auto obj = doc->addObject("App::Annotation", "obj");
|
||||
if (!obj)
|
||||
if (!obj)
|
||||
return;
|
||||
|
||||
std::string objName = obj->getNameInDocument();
|
||||
|
||||
@@ -399,7 +399,7 @@ void DlgDisplayPropertiesImp::setDisplayModes(const std::vector<Gui::ViewProvide
|
||||
App::Property* prop = (*it)->getPropertyByName("DisplayMode");
|
||||
if (prop && prop->getTypeId() == App::PropertyEnumeration::getClassTypeId()) {
|
||||
App::PropertyEnumeration* display = static_cast<App::PropertyEnumeration*>(prop);
|
||||
if (!display->getEnums())
|
||||
if (!display->getEnums())
|
||||
return;
|
||||
const std::vector<std::string>& value = display->getEnumVector();
|
||||
if (it == views.begin()) {
|
||||
|
||||
@@ -256,7 +256,7 @@ void DockWindowManager::activate(QWidget* widget)
|
||||
par = par->parentWidget();
|
||||
}
|
||||
|
||||
if (!dw)
|
||||
if (!dw)
|
||||
return;
|
||||
|
||||
if (!dw->toggleViewAction()->isChecked()) {
|
||||
|
||||
@@ -623,11 +623,11 @@ bool PythonEditorView::onMsg(const char* pMsg,const char** ppReturn)
|
||||
*/
|
||||
bool PythonEditorView::onHasMsg(const char* pMsg) const
|
||||
{
|
||||
if (strcmp(pMsg,"Run")==0)
|
||||
if (strcmp(pMsg,"Run")==0)
|
||||
return true;
|
||||
if (strcmp(pMsg,"StartDebug")==0)
|
||||
if (strcmp(pMsg,"StartDebug")==0)
|
||||
return true;
|
||||
if (strcmp(pMsg,"ToggleBreakpoint")==0)
|
||||
if (strcmp(pMsg,"ToggleBreakpoint")==0)
|
||||
return true;
|
||||
return EditorView::onHasMsg(pMsg);
|
||||
}
|
||||
|
||||
@@ -236,7 +236,7 @@ PyObject* LinkViewPy::setLink(PyObject *args)
|
||||
|
||||
Py::Object LinkViewPy::getOwner() const {
|
||||
auto owner = getLinkViewPtr()->getOwner();
|
||||
if(!owner)
|
||||
if(!owner)
|
||||
return Py::Object();
|
||||
return Py::Object(owner->getPyObject(),true);
|
||||
}
|
||||
|
||||
@@ -219,7 +219,7 @@ void Placement::revertTransformation()
|
||||
void Placement::applyPlacement(const Base::Placement& p, bool incremental)
|
||||
{
|
||||
Gui::Document* document = Application::Instance->activeDocument();
|
||||
if (!document)
|
||||
if (!document)
|
||||
return;
|
||||
|
||||
std::vector<App::DocumentObject*> sel = Gui::Selection().getObjectsOfType
|
||||
@@ -258,7 +258,7 @@ void Placement::applyPlacement(const Base::Placement& p, bool incremental)
|
||||
void Placement::applyPlacement(const QString& data, bool incremental)
|
||||
{
|
||||
Gui::Document* document = Application::Instance->activeDocument();
|
||||
if (!document)
|
||||
if (!document)
|
||||
return;
|
||||
|
||||
// When directly changing the property we now only have to commit the transaction,
|
||||
|
||||
@@ -430,7 +430,7 @@ void PythonDebugger::runFile(const QString& fn)
|
||||
#else
|
||||
FILE *fp = fopen((const char*)pxFileName,"r");
|
||||
#endif
|
||||
if (!fp)
|
||||
if (!fp)
|
||||
return;
|
||||
|
||||
Base::PyGILStateLocker locker;
|
||||
|
||||
@@ -496,8 +496,8 @@ SoQtOffscreenRenderer::getBackgroundColor(void) const
|
||||
void
|
||||
SoQtOffscreenRenderer::setGLRenderAction(SoGLRenderAction * action)
|
||||
{
|
||||
if (action == PRIVATE(this)->renderaction) {
|
||||
return;
|
||||
if (action == PRIVATE(this)->renderaction) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (PRIVATE(this)->didallocation) { delete PRIVATE(this)->renderaction; }
|
||||
|
||||
@@ -308,13 +308,13 @@ void SoFCSelection::doAction(SoAction *action)
|
||||
int SoFCSelection::getPriority(const SoPickedPoint* p)
|
||||
{
|
||||
const SoDetail* detail = p->getDetail();
|
||||
if(!detail)
|
||||
if(!detail)
|
||||
return 0;
|
||||
if(detail->isOfType(SoFaceDetail::getClassTypeId()))
|
||||
if(detail->isOfType(SoFaceDetail::getClassTypeId()))
|
||||
return 1;
|
||||
if(detail->isOfType(SoLineDetail::getClassTypeId()))
|
||||
if(detail->isOfType(SoLineDetail::getClassTypeId()))
|
||||
return 2;
|
||||
if(detail->isOfType(SoPointDetail::getClassTypeId()))
|
||||
if(detail->isOfType(SoPointDetail::getClassTypeId()))
|
||||
return 3;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@ SoTextLabel::SoTextLabel()
|
||||
*/
|
||||
void SoTextLabel::GLRender(SoGLRenderAction *action)
|
||||
{
|
||||
if (!this->shouldGLRender(action))
|
||||
if (!this->shouldGLRender(action))
|
||||
return;
|
||||
|
||||
// only draw text without background
|
||||
|
||||
@@ -202,7 +202,7 @@ void TaskAppearance::setDisplayModes(const std::vector<Gui::ViewProvider*>& view
|
||||
App::Property* prop = (*it)->getPropertyByName("DisplayMode");
|
||||
if (prop && prop->getTypeId() == App::PropertyEnumeration::getClassTypeId()) {
|
||||
App::PropertyEnumeration* display = static_cast<App::PropertyEnumeration*>(prop);
|
||||
if (!display->getEnums())
|
||||
if (!display->getEnums())
|
||||
return;
|
||||
const std::vector<std::string>& value = display->getEnumVector();
|
||||
if (it == views.begin()) {
|
||||
|
||||
@@ -65,7 +65,7 @@ void TreeView::mouseDoubleClickEvent (QMouseEvent * event)
|
||||
QTreeView::mouseDoubleClickEvent(event);
|
||||
const Gui::Document* doc = static_cast<Gui::Document*>(item);
|
||||
MDIView *view = doc->getActiveView();
|
||||
if (!view)
|
||||
if (!view)
|
||||
return;
|
||||
getMainWindow()->setActiveWindow(view);
|
||||
}
|
||||
|
||||
@@ -408,7 +408,7 @@ QDir QUiLoader::workingDirectory() const
|
||||
PythonWrapper wrap;
|
||||
Py::Object dir((uiloader.callMemberFunction("workingDirectory")));
|
||||
QDir* d = wrap.toQDir(dir.ptr());
|
||||
if (d)
|
||||
if (d)
|
||||
return *d;
|
||||
return QDir::current();
|
||||
}
|
||||
|
||||
@@ -584,7 +584,7 @@ bool View3DInventor::onMsg(const char* pMsg, const char** ppReturn)
|
||||
}
|
||||
else if(strcmp("GetCamera",pMsg) == 0 ) {
|
||||
SoCamera * Cam = _viewer->getSoRenderManager()->getCamera();
|
||||
if (!Cam)
|
||||
if (!Cam)
|
||||
return false;
|
||||
*ppReturn = SoFCDB::writeNodesToString(Cam).c_str();
|
||||
return true;
|
||||
|
||||
@@ -277,7 +277,7 @@ void LightManip(SoSeparator * root)
|
||||
in.setBuffer((void *)scenegraph, std::strlen(scenegraph));
|
||||
SoSeparator * _root = SoDB::readAll( &in );
|
||||
if ( _root == nullptr ) // Shouldn't happen.
|
||||
return;
|
||||
return;
|
||||
root->addChild(_root);
|
||||
root->ref();
|
||||
|
||||
@@ -291,7 +291,7 @@ void LightManip(SoSeparator * root)
|
||||
sa.apply( root );
|
||||
SoPath * path = sa.getPath();
|
||||
if ( path == nullptr) // Shouldn't happen.
|
||||
return;
|
||||
return;
|
||||
|
||||
SoPointLightManip * manip = new SoPointLightManip;
|
||||
manip->replaceNode( path );
|
||||
@@ -397,7 +397,7 @@ void AnimationTexture(SoSeparator * root)
|
||||
{
|
||||
// Scene graph
|
||||
if ( root == nullptr ) // Shouldn't happen.
|
||||
return;
|
||||
return;
|
||||
|
||||
// Generate a julia set to use as a texturemap
|
||||
julia(global_cr, global_ci, 2.5, texturewidth, textureheight, 4, bitmap, 64);
|
||||
|
||||
@@ -943,7 +943,7 @@ Py::Object View3DInventorPy::viewPosition(const Py::Tuple& args)
|
||||
}
|
||||
|
||||
SoCamera* cam = getView3DIventorPtr()->getViewer()->getSoRenderManager()->getCamera();
|
||||
if (!cam)
|
||||
if (!cam)
|
||||
return Py::None();
|
||||
|
||||
SbRotation rot = cam->orientation.getValue();
|
||||
@@ -1785,7 +1785,7 @@ void View3DInventorPy::eventCallback(void * ud, SoEventCallback * n)
|
||||
Py::Dict dict;
|
||||
const SoEvent* e = n->getEvent();
|
||||
if (!e) // invalid event
|
||||
return;
|
||||
return;
|
||||
// Type
|
||||
dict.setItem("Type", Py::String(std::string(e->getTypeId().getName().getString())));
|
||||
// Time
|
||||
|
||||
@@ -904,7 +904,7 @@ std::vector< App::DocumentObject* > ViewProvider::claimChildren3D(void) const
|
||||
return vec;
|
||||
}
|
||||
bool ViewProvider::getElementPicked(const SoPickedPoint *pp, std::string &subname) const {
|
||||
if(!isSelectable())
|
||||
if(!isSelectable())
|
||||
return false;
|
||||
auto vector = getExtensionsDerivedFromType<Gui::ViewProviderExtension>();
|
||||
for(Gui::ViewProviderExtension* ext : vector) {
|
||||
|
||||
@@ -581,7 +581,7 @@ bool ViewProviderDocumentObject::showInTree() const {
|
||||
|
||||
bool ViewProviderDocumentObject::getElementPicked(const SoPickedPoint *pp, std::string &subname) const
|
||||
{
|
||||
if(!isSelectable())
|
||||
if(!isSelectable())
|
||||
return false;
|
||||
auto vector = getExtensionsDerivedFromType<Gui::ViewProviderExtension>();
|
||||
for(Gui::ViewProviderExtension* ext : vector)
|
||||
@@ -602,7 +602,7 @@ bool ViewProviderDocumentObject::getElementPicked(const SoPickedPoint *pp, std::
|
||||
if(idx<0 || idx+1>=path->getLength())
|
||||
return false;
|
||||
auto vp = getDocument()->getViewProvider(path->getNode(idx+1));
|
||||
if(!vp)
|
||||
if(!vp)
|
||||
return false;
|
||||
auto obj = vp->getObject();
|
||||
if(!obj || !obj->getNameInDocument())
|
||||
@@ -631,16 +631,16 @@ bool ViewProviderDocumentObject::getDetailPath(const char *subname, SoFullPath *
|
||||
}
|
||||
|
||||
const char *dot = strchr(subname,'.');
|
||||
if(!dot)
|
||||
if(!dot)
|
||||
return false;
|
||||
auto obj = getObject();
|
||||
if(!obj || !obj->getNameInDocument())
|
||||
if(!obj || !obj->getNameInDocument())
|
||||
return false;
|
||||
auto sobj = obj->getSubObject(std::string(subname,dot-subname+1).c_str());
|
||||
if(!sobj)
|
||||
if(!sobj)
|
||||
return false;
|
||||
auto vp = Application::Instance->getViewProvider(sobj);
|
||||
if(!vp)
|
||||
if(!vp)
|
||||
return false;
|
||||
|
||||
auto childRoot = getChildRoot();
|
||||
|
||||
@@ -94,7 +94,7 @@ void ViewProviderInventorObject::updateData(const App::Property* prop)
|
||||
SoInput in;
|
||||
std::string buffer = ivObj->Buffer.getValue();
|
||||
coinRemoveAllChildren(pcBuffer);
|
||||
if (buffer.empty())
|
||||
if (buffer.empty())
|
||||
return;
|
||||
in.setBuffer((void *)buffer.c_str(), buffer.size());
|
||||
SoSeparator * node = SoDB::readAll(&in);
|
||||
|
||||
@@ -465,7 +465,7 @@ ViewProviderPythonFeatureImp::getElementPicked(const SoPickedPoint *pp, std::str
|
||||
Py::Tuple args(1);
|
||||
args.setItem(0, Py::Object(pivy, true));
|
||||
Py::Object ret(Base::pyCall(py_getElementPicked.ptr(),args.ptr()));
|
||||
if(!ret.isString())
|
||||
if(!ret.isString())
|
||||
return Rejected;
|
||||
subname = ret.as_string();
|
||||
return Accepted;
|
||||
|
||||
@@ -298,7 +298,7 @@ public:
|
||||
private:
|
||||
virtual void applyFaceColors(Part::Feature* part, const std::vector<App::Color>& colors) override {
|
||||
auto vp = dynamic_cast<PartGui::ViewProviderPartExt*>(Gui::Application::Instance->getViewProvider(part));
|
||||
if (!vp)
|
||||
if (!vp)
|
||||
return;
|
||||
if(colors.empty()) {
|
||||
// vp->MapFaceColor.setValue(true);
|
||||
@@ -317,7 +317,7 @@ private:
|
||||
}
|
||||
virtual void applyEdgeColors(Part::Feature* part, const std::vector<App::Color>& colors) override {
|
||||
auto vp = dynamic_cast<PartGui::ViewProviderPartExt*>(Gui::Application::Instance->getViewProvider(part));
|
||||
if (!vp)
|
||||
if (!vp)
|
||||
return;
|
||||
// vp->MapLineColor.setValue(false);
|
||||
if(colors.size() == 1)
|
||||
|
||||
@@ -789,7 +789,7 @@ bool MeshAlgorithm::FillupHole(const std::vector<PointIndex>& boundary,
|
||||
|
||||
void MeshAlgorithm::SetFacetsProperty(const std::vector<FacetIndex> &raulInds, const std::vector<unsigned long> &raulProps) const
|
||||
{
|
||||
if (raulInds.size() != raulProps.size())
|
||||
if (raulInds.size() != raulProps.size())
|
||||
return;
|
||||
|
||||
std::vector<unsigned long>::const_iterator iP = raulProps.begin();
|
||||
|
||||
@@ -275,7 +275,7 @@ struct MeshFastBuilder::Private {
|
||||
}
|
||||
bool operator<(const Vertex& rhs) const
|
||||
{
|
||||
if (x != rhs.x)
|
||||
if (x != rhs.x)
|
||||
return x < rhs.x;
|
||||
else if (y != rhs.y) return y < rhs.y;
|
||||
else if (z != rhs.z) return z < rhs.z;
|
||||
|
||||
@@ -301,7 +301,7 @@ struct MeshFacet_Less
|
||||
if (y1 > y2)
|
||||
{ tmp = y1; y1 = y2; y2 = tmp; }
|
||||
|
||||
if (x0 < y0)
|
||||
if (x0 < y0)
|
||||
return true;
|
||||
else if (x0 > y0) return false;
|
||||
else if (x1 < y1) return true;
|
||||
@@ -1066,8 +1066,8 @@ bool MeshEvalRangePoint::Evaluate()
|
||||
PointIndex ulCtPoints = _rclMesh.CountPoints();
|
||||
|
||||
for (MeshFacetArray::_TConstIterator it = rFaces.begin(); it != rFaces.end(); ++it) {
|
||||
if (std::find_if(it->_aulPoints, it->_aulPoints + 3, [ulCtPoints](PointIndex i) {
|
||||
return i >= ulCtPoints;
|
||||
if (std::find_if(it->_aulPoints, it->_aulPoints + 3, [ulCtPoints](PointIndex i) {
|
||||
return i >= ulCtPoints;
|
||||
}) < it->_aulPoints + 3)
|
||||
return false;
|
||||
}
|
||||
@@ -1083,8 +1083,8 @@ std::vector<PointIndex> MeshEvalRangePoint::GetIndices() const
|
||||
|
||||
PointIndex ind=0;
|
||||
for (MeshFacetArray::_TConstIterator it = rFaces.begin(); it != rFaces.end(); ++it, ind++) {
|
||||
if (std::find_if(it->_aulPoints, it->_aulPoints + 3, [ulCtPoints](PointIndex i) {
|
||||
return i >= ulCtPoints;
|
||||
if (std::find_if(it->_aulPoints, it->_aulPoints + 3, [ulCtPoints](PointIndex i) {
|
||||
return i >= ulCtPoints;
|
||||
}) < it->_aulPoints + 3)
|
||||
aInds.push_back(ind);
|
||||
}
|
||||
|
||||
@@ -250,7 +250,7 @@ bool MeshInput::LoadSTL (std::istream &rstrIn)
|
||||
// the file size has only 134 bytes in this case. On the other hand we must overread the first 80 bytes
|
||||
// because it can happen that the file is binary but contains one of these keywords.
|
||||
std::streambuf* buf = rstrIn.rdbuf();
|
||||
if (!buf)
|
||||
if (!buf)
|
||||
return false;
|
||||
buf->pubseekoff(80, std::ios::beg, std::ios::in);
|
||||
uint32_t ulCt, ulBytes=50;
|
||||
|
||||
@@ -1406,7 +1406,7 @@ void MeshTopoAlgorithm::SplitNeighbourFacet(FacetIndex ulFacetPos, unsigned shor
|
||||
|
||||
bool MeshTopoAlgorithm::RemoveDegeneratedFacet(FacetIndex index)
|
||||
{
|
||||
if (index >= _rclMesh._aclFacetArray.size())
|
||||
if (index >= _rclMesh._aclFacetArray.size())
|
||||
return false;
|
||||
MeshFacet& rFace = _rclMesh._aclFacetArray[index];
|
||||
|
||||
@@ -1476,7 +1476,7 @@ bool MeshTopoAlgorithm::RemoveDegeneratedFacet(FacetIndex index)
|
||||
|
||||
bool MeshTopoAlgorithm::RemoveCorruptedFacet(FacetIndex index)
|
||||
{
|
||||
if (index >= _rclMesh._aclFacetArray.size())
|
||||
if (index >= _rclMesh._aclFacetArray.size())
|
||||
return false;
|
||||
MeshFacet& rFace = _rclMesh._aclFacetArray[index];
|
||||
|
||||
|
||||
@@ -383,14 +383,14 @@ bool EarClippingTriangulator::Triangulate::Snip(const std::vector<Base::Vector3f
|
||||
Cx = contour[V[w]].x;
|
||||
Cy = contour[V[w]].y;
|
||||
|
||||
if (FLOAT_EPS > (((Bx-Ax)*(Cy-Ay)) - ((By-Ay)*(Cx-Ax))))
|
||||
if (FLOAT_EPS > (((Bx-Ax)*(Cy-Ay)) - ((By-Ay)*(Cx-Ax))))
|
||||
return false;
|
||||
|
||||
for (p=0;p<n;p++) {
|
||||
if( (p == u) || (p == v) || (p == w) ) continue;
|
||||
Px = contour[V[p]].x;
|
||||
Py = contour[V[p]].y;
|
||||
if (InsideTriangle(Ax,Ay,Bx,By,Cx,Cy,Px,Py))
|
||||
if (InsideTriangle(Ax,Ay,Bx,By,Cx,Cy,Px,Py))
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -405,7 +405,7 @@ bool EarClippingTriangulator::Triangulate::Process(const std::vector<Base::Vecto
|
||||
/* allocate and initialize list of Vertices in polygon */
|
||||
|
||||
int n = contour.size();
|
||||
if ( n < 3 )
|
||||
if ( n < 3 )
|
||||
return false;
|
||||
|
||||
int *V = new int[n];
|
||||
@@ -607,7 +607,7 @@ struct Vertex2d_Less
|
||||
{
|
||||
if (fabs(p.x - q.x) < MeshDefinitions::_fMinPointDistanceD1) {
|
||||
if (fabs(p.y - q.y) < MeshDefinitions::_fMinPointDistanceD1) {
|
||||
return false;
|
||||
return false;
|
||||
} else return p.y < q.y;
|
||||
} else return p.x < q.x;
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ HarmonizeNormals::~HarmonizeNormals()
|
||||
App::DocumentObjectExecReturn *HarmonizeNormals::execute()
|
||||
{
|
||||
App::DocumentObject* link = Source.getValue();
|
||||
if (!link)
|
||||
if (!link)
|
||||
return new App::DocumentObjectExecReturn("No mesh linked");
|
||||
App::Property* prop = link->getPropertyByName("Mesh");
|
||||
if (prop && prop->getTypeId() == Mesh::PropertyMeshKernel::getClassTypeId()) {
|
||||
@@ -108,7 +108,7 @@ FlipNormals::~FlipNormals()
|
||||
App::DocumentObjectExecReturn *FlipNormals::execute()
|
||||
{
|
||||
App::DocumentObject* link = Source.getValue();
|
||||
if (!link)
|
||||
if (!link)
|
||||
return new App::DocumentObjectExecReturn("No mesh linked");
|
||||
App::Property* prop = link->getPropertyByName("Mesh");
|
||||
if (prop && prop->getTypeId() == Mesh::PropertyMeshKernel::getClassTypeId()) {
|
||||
@@ -137,7 +137,7 @@ FixNonManifolds::~FixNonManifolds()
|
||||
App::DocumentObjectExecReturn *FixNonManifolds::execute()
|
||||
{
|
||||
App::DocumentObject* link = Source.getValue();
|
||||
if (!link)
|
||||
if (!link)
|
||||
return new App::DocumentObjectExecReturn("No mesh linked");
|
||||
App::Property* prop = link->getPropertyByName("Mesh");
|
||||
if (prop && prop->getTypeId() == Mesh::PropertyMeshKernel::getClassTypeId()) {
|
||||
@@ -166,7 +166,7 @@ FixDuplicatedFaces::~FixDuplicatedFaces()
|
||||
App::DocumentObjectExecReturn *FixDuplicatedFaces::execute()
|
||||
{
|
||||
App::DocumentObject* link = Source.getValue();
|
||||
if (!link)
|
||||
if (!link)
|
||||
return new App::DocumentObjectExecReturn("No mesh linked");
|
||||
App::Property* prop = link->getPropertyByName("Mesh");
|
||||
if (prop && prop->getTypeId() == Mesh::PropertyMeshKernel::getClassTypeId()) {
|
||||
@@ -195,7 +195,7 @@ FixDuplicatedPoints::~FixDuplicatedPoints()
|
||||
App::DocumentObjectExecReturn *FixDuplicatedPoints::execute()
|
||||
{
|
||||
App::DocumentObject* link = Source.getValue();
|
||||
if (!link)
|
||||
if (!link)
|
||||
return new App::DocumentObjectExecReturn("No mesh linked");
|
||||
App::Property* prop = link->getPropertyByName("Mesh");
|
||||
if (prop && prop->getTypeId() == Mesh::PropertyMeshKernel::getClassTypeId()) {
|
||||
@@ -224,7 +224,7 @@ FixDegenerations::~FixDegenerations()
|
||||
App::DocumentObjectExecReturn *FixDegenerations::execute()
|
||||
{
|
||||
App::DocumentObject* link = Source.getValue();
|
||||
if (!link)
|
||||
if (!link)
|
||||
return new App::DocumentObjectExecReturn("No mesh linked");
|
||||
App::Property* prop = link->getPropertyByName("Mesh");
|
||||
if (prop && prop->getTypeId() == Mesh::PropertyMeshKernel::getClassTypeId()) {
|
||||
@@ -254,7 +254,7 @@ FixDeformations::~FixDeformations()
|
||||
App::DocumentObjectExecReturn *FixDeformations::execute()
|
||||
{
|
||||
App::DocumentObject* link = Source.getValue();
|
||||
if (!link)
|
||||
if (!link)
|
||||
return new App::DocumentObjectExecReturn("No mesh linked");
|
||||
App::Property* prop = link->getPropertyByName("Mesh");
|
||||
if (prop && prop->getTypeId() == Mesh::PropertyMeshKernel::getClassTypeId()) {
|
||||
@@ -285,7 +285,7 @@ FixIndices::~FixIndices()
|
||||
App::DocumentObjectExecReturn *FixIndices::execute()
|
||||
{
|
||||
App::DocumentObject* link = Source.getValue();
|
||||
if (!link)
|
||||
if (!link)
|
||||
return new App::DocumentObjectExecReturn("No mesh linked");
|
||||
App::Property* prop = link->getPropertyByName("Mesh");
|
||||
if (prop && prop->getTypeId() == Mesh::PropertyMeshKernel::getClassTypeId()) {
|
||||
@@ -316,7 +316,7 @@ FillHoles::~FillHoles()
|
||||
App::DocumentObjectExecReturn *FillHoles::execute()
|
||||
{
|
||||
App::DocumentObject* link = Source.getValue();
|
||||
if (!link)
|
||||
if (!link)
|
||||
return new App::DocumentObjectExecReturn("No mesh linked");
|
||||
App::Property* prop = link->getPropertyByName("Mesh");
|
||||
if (prop && prop->getTypeId() == Mesh::PropertyMeshKernel::getClassTypeId()) {
|
||||
@@ -348,7 +348,7 @@ RemoveComponents::~RemoveComponents()
|
||||
App::DocumentObjectExecReturn *RemoveComponents::execute()
|
||||
{
|
||||
App::DocumentObject* link = Source.getValue();
|
||||
if (!link)
|
||||
if (!link)
|
||||
return new App::DocumentObjectExecReturn("No mesh linked");
|
||||
App::Property* prop = link->getPropertyByName("Mesh");
|
||||
if (prop && prop->getTypeId() == Mesh::PropertyMeshKernel::getClassTypeId()) {
|
||||
|
||||
@@ -1454,8 +1454,8 @@ void MeshObject::removeSelfIntersections(const std::vector<FacetIndex>& indices)
|
||||
if (indices.size() % 2 != 0)
|
||||
return;
|
||||
unsigned long cntfacets = _kernel.CountFacets();
|
||||
if (std::find_if(indices.begin(), indices.end(), [cntfacets](FacetIndex v) {
|
||||
return v >= cntfacets;
|
||||
if (std::find_if(indices.begin(), indices.end(), [cntfacets](FacetIndex v) {
|
||||
return v >= cntfacets;
|
||||
}) < indices.end())
|
||||
return;
|
||||
std::vector<std::pair<FacetIndex, FacetIndex> > selfIntersections;
|
||||
|
||||
@@ -72,7 +72,7 @@ int MeshPy::PyInit(PyObject* args, PyObject*)
|
||||
try {
|
||||
this->parentProperty = nullptr;
|
||||
// if no mesh is given
|
||||
if (!pcObj)
|
||||
if (!pcObj)
|
||||
return 0;
|
||||
if (PyObject_TypeCheck(pcObj, &(MeshPy::Type))) {
|
||||
getMeshObjectPtr()->operator = (*static_cast<MeshPy*>(pcObj)->getMeshObjectPtr());
|
||||
@@ -81,14 +81,14 @@ int MeshPy::PyInit(PyObject* args, PyObject*)
|
||||
PyObject* ret = addFacets(args);
|
||||
bool ok = (ret!=nullptr);
|
||||
Py_XDECREF(ret);
|
||||
if (!ok)
|
||||
if (!ok)
|
||||
return -1;
|
||||
}
|
||||
else if (PyTuple_Check(pcObj)) {
|
||||
PyObject* ret = addFacets(args);
|
||||
bool ok = (ret!=nullptr);
|
||||
Py_XDECREF(ret);
|
||||
if (!ok)
|
||||
if (!ok)
|
||||
return -1;
|
||||
}
|
||||
else if (PyUnicode_Check(pcObj)) {
|
||||
|
||||
@@ -102,7 +102,7 @@ CmdMeshTransform::CmdMeshTransform()
|
||||
void CmdMeshTransform::activated(int)
|
||||
{
|
||||
unsigned int n = getSelection().countObjectsOfType(Mesh::Feature::getClassTypeId());
|
||||
if ( n!=1 )
|
||||
if ( n!=1 )
|
||||
return;
|
||||
|
||||
std::string fName = getUniqueObjectName("Move");
|
||||
@@ -142,7 +142,7 @@ CmdMeshDemolding::CmdMeshDemolding()
|
||||
void CmdMeshDemolding::activated(int)
|
||||
{
|
||||
unsigned int n = getSelection().countObjectsOfType(Mesh::Feature::getClassTypeId());
|
||||
if ( n!=1 )
|
||||
if ( n!=1 )
|
||||
return;
|
||||
|
||||
std::string fName = getUniqueObjectName("Demolding");
|
||||
@@ -610,7 +610,7 @@ void CmdMeshFromGeometry::activated(int)
|
||||
bool CmdMeshFromGeometry::isActive()
|
||||
{
|
||||
App::Document* doc = App::GetApplication().getActiveDocument();
|
||||
if (!doc)
|
||||
if (!doc)
|
||||
return false;
|
||||
return getSelection().countObjectsOfType(App::GeoFeature::getClassTypeId()) >= 1;
|
||||
}
|
||||
@@ -1650,7 +1650,7 @@ void CmdMeshFillupHoles::activated(int)
|
||||
bool ok;
|
||||
int FillupHolesOfLength = QInputDialog::getInt(Gui::getMainWindow(), QObject::tr("Fill holes"),
|
||||
QObject::tr("Fill holes with maximum number of edges:"), 3, 3, 10000, 1, &ok, Qt::MSWindowsFixedSizeDialogHint);
|
||||
if (!ok)
|
||||
if (!ok)
|
||||
return;
|
||||
openCommand(QT_TRANSLATE_NOOP("Command", "Fill up holes"));
|
||||
for (std::vector<App::DocumentObject*>::const_iterator it = meshes.begin(); it != meshes.end(); ++it) {
|
||||
|
||||
@@ -566,7 +566,7 @@ void SoFCMeshNode::computeBBox(SoAction *action, SbBox3f &box, SbVec3f ¢er)
|
||||
*/
|
||||
void SoFCMeshNode::getPrimitiveCount(SoGetPrimitiveCountAction * action)
|
||||
{
|
||||
if (!this->shouldPrimitiveCount(action))
|
||||
if (!this->shouldPrimitiveCount(action))
|
||||
return;
|
||||
action->addNumTriangles(countTriangles());
|
||||
}
|
||||
@@ -592,7 +592,7 @@ void SoFCMeshNode::write( SoWriteAction* action )
|
||||
else if (out->getStage() == SoOutput::WRITE) {
|
||||
const MeshCore::MeshPointArray& rPoints = _mesh->getKernel().GetPoints();
|
||||
const MeshCore::MeshFacetArray& rFacets = _mesh->getKernel().GetFacets();
|
||||
if (this->writeHeader(out, FALSE, FALSE))
|
||||
if (this->writeHeader(out, FALSE, FALSE))
|
||||
return;
|
||||
point.setNum(rPoints.size());
|
||||
unsigned int pos=0;
|
||||
@@ -746,7 +746,7 @@ void SoFCMeshOpenEdge::computeBBox(SoAction *action, SbBox3f &box, SbVec3f ¢
|
||||
*/
|
||||
void SoFCMeshOpenEdge::getPrimitiveCount(SoGetPrimitiveCountAction * action)
|
||||
{
|
||||
if (!this->shouldPrimitiveCount(action))
|
||||
if (!this->shouldPrimitiveCount(action))
|
||||
return;
|
||||
|
||||
// Count number of open edges first
|
||||
|
||||
@@ -1261,9 +1261,9 @@ void ViewProviderMesh::panCamera(SoCamera * cam, float aspectratio, const SbPlan
|
||||
const SbVec2f & currpos, const SbVec2f & prevpos)
|
||||
{
|
||||
if (cam == nullptr) // can happen for empty scenegraph
|
||||
return;
|
||||
return;
|
||||
if (currpos == prevpos) // useless invocation
|
||||
return;
|
||||
return;
|
||||
|
||||
|
||||
// Find projection points for the last and current mouse coordinates.
|
||||
|
||||
@@ -258,7 +258,7 @@ std::vector<std::string> ViewProviderMeshNode::getDisplayModes(void) const
|
||||
|
||||
bool ViewProviderMeshNode::setEdit(int ModNum)
|
||||
{
|
||||
if ( m_bEdit )
|
||||
if ( m_bEdit )
|
||||
return true;
|
||||
m_bEdit = true;
|
||||
return true;
|
||||
|
||||
@@ -287,7 +287,7 @@ static TopoShape _getTopoShape(const App::DocumentObject *obj, const char *subna
|
||||
{
|
||||
TopoShape shape;
|
||||
|
||||
if(!obj)
|
||||
if(!obj)
|
||||
return shape;
|
||||
|
||||
PyObject *pyobj = nullptr;
|
||||
@@ -527,7 +527,7 @@ TopoShape Feature::getTopoShape(const App::DocumentObject *obj, const char *subn
|
||||
|
||||
App::DocumentObject *Feature::getShapeOwner(const App::DocumentObject *obj, const char *subname)
|
||||
{
|
||||
if(!obj)
|
||||
if(!obj)
|
||||
return nullptr;
|
||||
auto owner = obj->getSubObject(subname);
|
||||
if(owner) {
|
||||
|
||||
@@ -243,7 +243,7 @@ static Standard_Boolean BRepTools_Write(const TopoDS_Shape& Sh, const Standard_
|
||||
#else
|
||||
os.open(File, std::ios::out);
|
||||
#endif
|
||||
if (!os.rdbuf()->is_open())
|
||||
if (!os.rdbuf()->is_open())
|
||||
return Standard_False;
|
||||
|
||||
Standard_Boolean isGood = (os.good() && !os.eof());
|
||||
|
||||
+210
-210
@@ -24,7 +24,7 @@
|
||||
#include "PreCompiled.h"
|
||||
#ifndef _PreComp_
|
||||
# include <sstream>
|
||||
# include <boost/regex.hpp>
|
||||
# include <boost/regex.hpp>
|
||||
# include <BRepMesh_IncrementalMesh.hxx>
|
||||
# include <BRepBuilderAPI_Copy.hxx>
|
||||
# include <BRepBuilderAPI_MakeVertex.hxx>
|
||||
@@ -136,7 +136,7 @@ int TopoShapePy::PyInit(PyObject* args, PyObject*)
|
||||
PY_TRY {
|
||||
if(PyObject_TypeCheck(pcObj,&TopoShapePy::Type)) {
|
||||
shape = *static_cast<TopoShapePy*>(pcObj)->getTopoShapePtr();
|
||||
}
|
||||
}
|
||||
else {
|
||||
Py::Sequence list(pcObj);
|
||||
bool first = true;
|
||||
@@ -154,7 +154,7 @@ int TopoShapePy::PyInit(PyObject* args, PyObject*)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
_PY_CATCH_OCC(return(-1))
|
||||
|
||||
getTopoShapePtr()->setShape(shape.getShape());
|
||||
@@ -264,7 +264,7 @@ PyObject* TopoShapePy::removeShape(PyObject *args)
|
||||
std::vector<TopoDS_Shape> shapes;
|
||||
for (Py::Sequence::iterator it = list.begin(); it != list.end(); ++it) {
|
||||
Py::TopoShape sh(*it);
|
||||
shapes.push_back(sh.extensionObject()->getTopoShapePtr()->getShape());
|
||||
shapes.push_back(sh.extensionObject()->getTopoShapePtr()->getShape());
|
||||
}
|
||||
PyTypeObject* type = this->GetType();
|
||||
PyObject* inst = type->tp_new(type, this, nullptr);
|
||||
@@ -283,7 +283,7 @@ PyObject* TopoShapePy::read(PyObject *args)
|
||||
char* Name;
|
||||
if (!PyArg_ParseTuple(args, "et","utf-8",&Name))
|
||||
return nullptr;
|
||||
|
||||
|
||||
std::string EncodedName = std::string(Name);
|
||||
PyMem_Free(Name);
|
||||
|
||||
@@ -311,12 +311,12 @@ PyObject* TopoShapePy::writeInventor(PyObject * args, PyObject * keywds)
|
||||
|
||||
std::stringstream result;
|
||||
BRepMesh_IncrementalMesh(getTopoShapePtr()->getShape(),dev);
|
||||
if (mode == 0) {
|
||||
if (mode == 0) {
|
||||
getTopoShapePtr()->exportFaceSet(dev, angle, faceColors, result);
|
||||
}
|
||||
else if (mode == 1) {
|
||||
}
|
||||
else if (mode == 1) {
|
||||
getTopoShapePtr()->exportLineSet(result);
|
||||
}
|
||||
}
|
||||
else {
|
||||
getTopoShapePtr()->exportFaceSet(dev, angle, faceColors, result);
|
||||
getTopoShapePtr()->exportLineSet(result);
|
||||
@@ -331,7 +331,7 @@ PyObject* TopoShapePy::exportIges(PyObject *args)
|
||||
char* Name;
|
||||
if (!PyArg_ParseTuple(args, "et","utf-8",&Name))
|
||||
return nullptr;
|
||||
|
||||
|
||||
std::string EncodedName = std::string(Name);
|
||||
PyMem_Free(Name);
|
||||
|
||||
@@ -352,7 +352,7 @@ PyObject* TopoShapePy::exportStep(PyObject *args)
|
||||
char* Name;
|
||||
if (!PyArg_ParseTuple(args, "et","utf-8",&Name))
|
||||
return nullptr;
|
||||
|
||||
|
||||
std::string EncodedName = std::string(Name);
|
||||
PyMem_Free(Name);
|
||||
|
||||
@@ -590,7 +590,7 @@ PyObject* TopoShapePy::exportStl(PyObject *args)
|
||||
char* Name;
|
||||
if (!PyArg_ParseTuple(args, "et|d","utf-8",&Name,&deflection))
|
||||
return nullptr;
|
||||
|
||||
|
||||
std::string EncodedName = std::string(Name);
|
||||
PyMem_Free(Name);
|
||||
|
||||
@@ -613,14 +613,14 @@ PyObject* TopoShapePy::exportStl(PyObject *args)
|
||||
PyObject* TopoShapePy::extrude(PyObject *args)
|
||||
{
|
||||
PyObject *pVec;
|
||||
if (!PyArg_ParseTuple(args, "O!", &(Base::VectorPy::Type), &pVec))
|
||||
return nullptr;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "O!", &(Base::VectorPy::Type), &pVec))
|
||||
return nullptr;
|
||||
|
||||
try {
|
||||
Base::Vector3d vec = static_cast<Base::VectorPy*>(pVec)->value();
|
||||
TopoDS_Shape shape = this->getTopoShapePtr()->makePrism(gp_Vec(vec.x,vec.y,vec.z));
|
||||
TopAbs_ShapeEnum type = shape.ShapeType();
|
||||
switch (type) {
|
||||
switch (type) {
|
||||
case TopAbs_COMPOUND:
|
||||
return new TopoShapeCompoundPy(new TopoShape(shape));
|
||||
case TopAbs_COMPSOLID:
|
||||
@@ -642,7 +642,7 @@ PyObject* TopoShapePy::extrude(PyObject *args)
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
PyErr_SetString(PartExceptionOCCError, "extrusion for this shape type not supported");
|
||||
return nullptr;
|
||||
}
|
||||
@@ -656,16 +656,16 @@ PyObject* TopoShapePy::revolve(PyObject *args)
|
||||
{
|
||||
PyObject *pPos,*pDir;
|
||||
double d=360;
|
||||
if (!PyArg_ParseTuple(args, "O!O!|d", &(Base::VectorPy::Type), &pPos, &(Base::VectorPy::Type), &pDir,&d))
|
||||
if (!PyArg_ParseTuple(args, "O!O!|d", &(Base::VectorPy::Type), &pPos, &(Base::VectorPy::Type), &pDir,&d))
|
||||
return nullptr;
|
||||
|
||||
|
||||
try {
|
||||
const TopoDS_Shape& input = this->getTopoShapePtr()->getShape();
|
||||
if (input.IsNull()) {
|
||||
PyErr_SetString(PartExceptionOCCError, "empty shape cannot be revolved");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
TopExp_Explorer xp;
|
||||
xp.Init(input,TopAbs_SOLID);
|
||||
if (xp.More()) {
|
||||
@@ -677,14 +677,14 @@ PyObject* TopoShapePy::revolve(PyObject *args)
|
||||
PyErr_SetString(PartExceptionOCCError, "shape must not contain compound solids");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
Base::Vector3d pos = static_cast<Base::VectorPy*>(pPos)->value();
|
||||
Base::Vector3d dir = static_cast<Base::VectorPy*>(pDir)->value();
|
||||
TopoDS_Shape shape = this->getTopoShapePtr()->revolve(
|
||||
gp_Ax1(gp_Pnt(pos.x,pos.y,pos.z), gp_Dir(dir.x,dir.y,dir.z)),d*(M_PI/180));
|
||||
TopAbs_ShapeEnum type = shape.ShapeType();
|
||||
|
||||
switch (type) {
|
||||
|
||||
switch (type) {
|
||||
case TopAbs_COMPOUND:
|
||||
return new TopoShapeCompoundPy(new TopoShape(shape));
|
||||
case TopAbs_COMPSOLID:
|
||||
@@ -706,7 +706,7 @@ PyObject* TopoShapePy::revolve(PyObject *args)
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
PyErr_SetString(PartExceptionOCCError, "revolution for this shape type not supported");
|
||||
return nullptr;
|
||||
}
|
||||
@@ -721,7 +721,7 @@ PyObject* TopoShapePy::check(PyObject *args)
|
||||
PyObject* runBopCheck = Py_False;
|
||||
if (!PyArg_ParseTuple(args, "|O!", &(PyBool_Type), &runBopCheck))
|
||||
return nullptr;
|
||||
|
||||
|
||||
if (!getTopoShapePtr()->getShape().IsNull()) {
|
||||
std::stringstream str;
|
||||
if (!getTopoShapePtr()->analyze(PyObject_IsTrue(runBopCheck) ? true : false, str)) {
|
||||
@@ -812,7 +812,7 @@ PyObject* TopoShapePy::multiFuse(PyObject *args)
|
||||
PyObject *pcObj;
|
||||
if (!PyArg_ParseTuple(args, "O|d", &pcObj, &tolerance))
|
||||
return nullptr;
|
||||
|
||||
|
||||
std::vector<TopoDS_Shape> shapeVec;
|
||||
Py::Sequence shapeSeq(pcObj);
|
||||
for (Py::Sequence::iterator it = shapeSeq.begin(); it != shapeSeq.end(); ++it) {
|
||||
@@ -1135,7 +1135,7 @@ PyObject* TopoShapePy::generalFuse(PyObject *args)
|
||||
PyObject *pcObj;
|
||||
if (!PyArg_ParseTuple(args, "O|d", &pcObj, &tolerance))
|
||||
return nullptr;
|
||||
|
||||
|
||||
std::vector<TopoDS_Shape> shapeVec;
|
||||
Py::Sequence shapeSeq(pcObj);
|
||||
for (Py::Sequence::iterator it = shapeSeq.begin(); it != shapeSeq.end(); ++it) {
|
||||
@@ -1195,7 +1195,7 @@ PyObject* TopoShapePy::childShapes(PyObject *args)
|
||||
{
|
||||
PyObject* cumOri = Py_True;
|
||||
PyObject* cumLoc = Py_True;
|
||||
if (!PyArg_ParseTuple(args, "|O!O!", &(PyBool_Type), &cumOri, &(PyBool_Type), &cumLoc))
|
||||
if (!PyArg_ParseTuple(args, "|O!O!", &(PyBool_Type), &cumOri, &(PyBool_Type), &cumLoc))
|
||||
return nullptr;
|
||||
|
||||
try {
|
||||
@@ -1213,7 +1213,7 @@ PyObject* TopoShapePy::childShapes(PyObject *args)
|
||||
if (!aChild.IsNull()) {
|
||||
TopAbs_ShapeEnum type = aChild.ShapeType();
|
||||
PyObject* pyChild = nullptr;
|
||||
switch (type) {
|
||||
switch (type) {
|
||||
case TopAbs_COMPOUND:
|
||||
pyChild = new TopoShapeCompoundPy(new TopoShape(aChild));
|
||||
break;
|
||||
@@ -1258,32 +1258,32 @@ PyObject* TopoShapePy::childShapes(PyObject *args)
|
||||
}
|
||||
|
||||
namespace Part {
|
||||
// Containers to associate TopAbs_ShapeEnum values to each TopoShape*Py class
|
||||
const std::vector<std::pair<PyTypeObject*, TopAbs_ShapeEnum>> vecTypeShape = {
|
||||
{&TopoShapeCompoundPy::Type, TopAbs_COMPOUND},
|
||||
{&TopoShapeCompSolidPy::Type, TopAbs_COMPSOLID},
|
||||
{&TopoShapeSolidPy::Type, TopAbs_SOLID},
|
||||
{&TopoShapeShellPy::Type, TopAbs_SHELL},
|
||||
{&TopoShapeFacePy::Type, TopAbs_FACE},
|
||||
{&TopoShapeWirePy::Type, TopAbs_WIRE},
|
||||
{&TopoShapeEdgePy::Type, TopAbs_EDGE},
|
||||
{&TopoShapeVertexPy::Type, TopAbs_VERTEX},
|
||||
{&TopoShapePy::Type, TopAbs_SHAPE}
|
||||
};
|
||||
|
||||
const std::map<PyTypeObject*, TopAbs_ShapeEnum> mapTypeShape(
|
||||
vecTypeShape.begin(), vecTypeShape.end());
|
||||
|
||||
// Returns shape type of a Python type. Similar to TopAbs::ShapeTypeFromString.
|
||||
// Returns TopAbs_SHAPE if pyType is not a subclass of any of the TopoShape*Py.
|
||||
static TopAbs_ShapeEnum ShapeTypeFromPyType(PyTypeObject* pyType)
|
||||
{
|
||||
for (auto it = vecTypeShape.begin(); it != vecTypeShape.end(); ++it) {
|
||||
if (PyType_IsSubtype(pyType, it->first))
|
||||
return it->second;
|
||||
}
|
||||
return TopAbs_SHAPE;
|
||||
};
|
||||
// Containers to associate TopAbs_ShapeEnum values to each TopoShape*Py class
|
||||
const std::vector<std::pair<PyTypeObject*, TopAbs_ShapeEnum>> vecTypeShape = {
|
||||
{&TopoShapeCompoundPy::Type, TopAbs_COMPOUND},
|
||||
{&TopoShapeCompSolidPy::Type, TopAbs_COMPSOLID},
|
||||
{&TopoShapeSolidPy::Type, TopAbs_SOLID},
|
||||
{&TopoShapeShellPy::Type, TopAbs_SHELL},
|
||||
{&TopoShapeFacePy::Type, TopAbs_FACE},
|
||||
{&TopoShapeWirePy::Type, TopAbs_WIRE},
|
||||
{&TopoShapeEdgePy::Type, TopAbs_EDGE},
|
||||
{&TopoShapeVertexPy::Type, TopAbs_VERTEX},
|
||||
{&TopoShapePy::Type, TopAbs_SHAPE}
|
||||
};
|
||||
|
||||
const std::map<PyTypeObject*, TopAbs_ShapeEnum> mapTypeShape(
|
||||
vecTypeShape.begin(), vecTypeShape.end());
|
||||
|
||||
// Returns shape type of a Python type. Similar to TopAbs::ShapeTypeFromString.
|
||||
// Returns TopAbs_SHAPE if pyType is not a subclass of any of the TopoShape*Py.
|
||||
static TopAbs_ShapeEnum ShapeTypeFromPyType(PyTypeObject* pyType)
|
||||
{
|
||||
for (auto it = vecTypeShape.begin(); it != vecTypeShape.end(); ++it) {
|
||||
if (PyType_IsSubtype(pyType, it->first))
|
||||
return it->second;
|
||||
}
|
||||
return TopAbs_SHAPE;
|
||||
};
|
||||
}
|
||||
|
||||
PyObject* TopoShapePy::ancestorsOfType(PyObject *args)
|
||||
@@ -1303,11 +1303,11 @@ PyObject* TopoShapePy::ancestorsOfType(PyObject *args)
|
||||
}
|
||||
|
||||
PyTypeObject* pyType = reinterpret_cast<PyTypeObject*>(type);
|
||||
TopAbs_ShapeEnum shapetype = ShapeTypeFromPyType(pyType);
|
||||
if (!PyType_IsSubtype(pyType, &TopoShapePy::Type)) {
|
||||
PyErr_SetString(PyExc_TypeError, "type must be a Shape subtype");
|
||||
return nullptr;
|
||||
}
|
||||
TopAbs_ShapeEnum shapetype = ShapeTypeFromPyType(pyType);
|
||||
if (!PyType_IsSubtype(pyType, &TopoShapePy::Type)) {
|
||||
PyErr_SetString(PyExc_TypeError, "type must be a Shape subtype");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
TopTools_IndexedDataMapOfShapeListOfShape mapOfShapeShape;
|
||||
TopExp::MapShapesAndAncestors(model, shape.ShapeType(), shapetype, mapOfShapeShape);
|
||||
@@ -1354,7 +1354,7 @@ PyObject* TopoShapePy::removeInternalWires(PyObject *args)
|
||||
PyObject* TopoShapePy::mirror(PyObject *args)
|
||||
{
|
||||
PyObject *v1, *v2;
|
||||
if (!PyArg_ParseTuple(args, "O!O!", &(Base::VectorPy::Type),&v1, &(Base::VectorPy::Type),&v2))
|
||||
if (!PyArg_ParseTuple(args, "O!O!", &(Base::VectorPy::Type),&v1, &(Base::VectorPy::Type),&v2))
|
||||
return nullptr;
|
||||
|
||||
Base::Vector3d base = Py::Vector(v1,false).toVector();
|
||||
@@ -1402,7 +1402,7 @@ PyObject* TopoShapePy::transformShape(PyObject *args)
|
||||
this->getTopoShapePtr()->transformShape(mat, PyObject_IsTrue(copy) ? true : false,
|
||||
PyObject_IsTrue(checkScale));
|
||||
return IncRef();
|
||||
}
|
||||
}
|
||||
PY_CATCH_OCC
|
||||
}
|
||||
|
||||
@@ -1416,14 +1416,14 @@ PyObject* TopoShapePy::transformed(PyObject *args, PyObject *keywds)
|
||||
if (!PyArg_ParseTupleAndKeywords(args, keywds, "O!|OOs", kwlist,
|
||||
&Base::MatrixPy::Type, &pymat,©,&checkScale,&op))
|
||||
return nullptr;
|
||||
|
||||
|
||||
Base::Matrix4D mat = static_cast<Base::MatrixPy*>(pymat)->value();
|
||||
(void)op;
|
||||
PY_TRY {
|
||||
TopoShape s(*getTopoShapePtr());
|
||||
s.transformShape(mat,PyObject_IsTrue(copy),PyObject_IsTrue(checkScale));
|
||||
return Py::new_reference_to(shape2pyshape(s));
|
||||
}
|
||||
}
|
||||
PY_CATCH_OCC
|
||||
}
|
||||
|
||||
@@ -1451,7 +1451,7 @@ PyObject* TopoShapePy::translate(PyObject *args)
|
||||
TopoDS_Shape shape = getTopoShapePtr()->getShape();
|
||||
shape.Move(loc);
|
||||
getTopoShapePtr()->setShape(shape);
|
||||
|
||||
|
||||
return IncRef();
|
||||
}
|
||||
|
||||
@@ -1480,9 +1480,9 @@ PyObject* TopoShapePy::rotate(PyObject *args)
|
||||
TopoDS_Shape shape = getTopoShapePtr()->getShape();
|
||||
shape.Move(loc);
|
||||
getTopoShapePtr()->setShape(shape);
|
||||
|
||||
|
||||
return IncRef();
|
||||
}
|
||||
}
|
||||
PY_CATCH_OCC
|
||||
}
|
||||
|
||||
@@ -1516,23 +1516,23 @@ PyObject* TopoShapePy::scale(PyObject *args)
|
||||
getTopoShapePtr()->setShape(BRepScale.Shape());
|
||||
}
|
||||
return IncRef();
|
||||
}
|
||||
}
|
||||
PY_CATCH_OCC
|
||||
}
|
||||
|
||||
PyObject* TopoShapePy::translated(PyObject *args)
|
||||
PyObject* TopoShapePy::translated(PyObject *args)
|
||||
{
|
||||
Py::Object pyobj(shape2pyshape(*getTopoShapePtr()));
|
||||
return static_cast<TopoShapePy*>(pyobj.ptr())->translate(args);
|
||||
}
|
||||
|
||||
PyObject* TopoShapePy::rotated(PyObject *args)
|
||||
PyObject* TopoShapePy::rotated(PyObject *args)
|
||||
{
|
||||
Py::Object pyobj(shape2pyshape(*getTopoShapePtr()));
|
||||
return static_cast<TopoShapePy*>(pyobj.ptr())->rotate(args);
|
||||
}
|
||||
|
||||
PyObject* TopoShapePy::scaled(PyObject *args)
|
||||
PyObject* TopoShapePy::scaled(PyObject *args)
|
||||
{
|
||||
Py::Object pyobj(shape2pyshape(*getTopoShapePtr()));
|
||||
return static_cast<TopoShapePy*>(pyobj.ptr())->scale(args);
|
||||
@@ -1675,9 +1675,9 @@ PyObject* TopoShapePy::makeThickness(PyObject *args)
|
||||
PyObject* inter = Py_False;
|
||||
PyObject* self_inter = Py_False;
|
||||
short offsetMode = 0, join = 0;
|
||||
if (!PyArg_ParseTuple(args, "Odd|O!O!hh", &obj, &offset, &tolerance,
|
||||
&(PyBool_Type), &inter, &(PyBool_Type), &self_inter, &offsetMode, &join))
|
||||
return nullptr;
|
||||
if (!PyArg_ParseTuple(args, "Odd|O!O!hh", &obj, &offset, &tolerance,
|
||||
&(PyBool_Type), &inter, &(PyBool_Type), &self_inter, &offsetMode, &join))
|
||||
return nullptr;
|
||||
|
||||
try {
|
||||
TopTools_ListOfShape facesToRemove;
|
||||
@@ -1707,7 +1707,7 @@ PyObject* TopoShapePy::makeOffsetShape(PyObject *args, PyObject *keywds)
|
||||
PyObject* self_inter = Py_False;
|
||||
PyObject* fill = Py_False;
|
||||
short offsetMode = 0, join = 0;
|
||||
if (!PyArg_ParseTupleAndKeywords(args, keywds, "dd|O!O!hhO!", kwlist, &offset, &tolerance,
|
||||
if (!PyArg_ParseTupleAndKeywords(args, keywds, "dd|O!O!hhO!", kwlist, &offset, &tolerance,
|
||||
&(PyBool_Type), &inter, &(PyBool_Type), &self_inter, &offsetMode, &join, &(PyBool_Type), &fill))
|
||||
return nullptr;
|
||||
|
||||
@@ -1732,9 +1732,9 @@ PyObject* TopoShapePy::makeOffset2D(PyObject *args, PyObject *keywds)
|
||||
PyObject* openResult = Py_False;
|
||||
PyObject* inter = Py_False;
|
||||
short join = 0;
|
||||
if (!PyArg_ParseTupleAndKeywords(args, keywds, "d|hO!O!O!", kwlist, &offset, &join,
|
||||
&(PyBool_Type), &fill, &(PyBool_Type), &openResult, &(PyBool_Type), &inter))
|
||||
return nullptr;
|
||||
if (!PyArg_ParseTupleAndKeywords(args, keywds, "d|hO!O!O!", kwlist, &offset, &join,
|
||||
&(PyBool_Type), &fill, &(PyBool_Type), &openResult, &(PyBool_Type), &inter))
|
||||
return nullptr;
|
||||
|
||||
try {
|
||||
TopoDS_Shape resultShape = this->getTopoShapePtr()->makeOffset2D(offset, join,
|
||||
@@ -1754,8 +1754,8 @@ PyObject* TopoShapePy::reverse(PyObject *args)
|
||||
TopoDS_Shape shape = getTopoShapePtr()->getShape();
|
||||
shape.Reverse();
|
||||
getTopoShapePtr()->setShape(shape);
|
||||
|
||||
Py_Return;
|
||||
|
||||
Py_Return;
|
||||
}
|
||||
|
||||
PyObject* TopoShapePy::reversed(PyObject *args)
|
||||
@@ -1791,7 +1791,7 @@ PyObject* TopoShapePy::complement(PyObject *args)
|
||||
TopoDS_Shape shape = getTopoShapePtr()->getShape();
|
||||
shape.Complement();
|
||||
getTopoShapePtr()->setShape(shape);
|
||||
|
||||
|
||||
Py_Return;
|
||||
}
|
||||
|
||||
@@ -1803,7 +1803,7 @@ PyObject* TopoShapePy::nullify(PyObject *args)
|
||||
TopoDS_Shape shape = getTopoShapePtr()->getShape();
|
||||
shape.Nullify();
|
||||
getTopoShapePtr()->setShape(shape);
|
||||
|
||||
|
||||
Py_Return;
|
||||
}
|
||||
|
||||
@@ -1811,7 +1811,7 @@ PyObject* TopoShapePy::isNull(PyObject *args)
|
||||
{
|
||||
if (!PyArg_ParseTuple(args, ""))
|
||||
return nullptr;
|
||||
|
||||
|
||||
bool null = getTopoShapePtr()->isNull();
|
||||
return Py_BuildValue("O", (null ? Py_True : Py_False));
|
||||
}
|
||||
@@ -1820,7 +1820,7 @@ PyObject* TopoShapePy::isClosed(PyObject *args)
|
||||
{
|
||||
if (!PyArg_ParseTuple(args, ""))
|
||||
return nullptr;
|
||||
|
||||
|
||||
try {
|
||||
if (getTopoShapePtr()->getShape().IsNull())
|
||||
Standard_Failure::Raise("Cannot determine the 'Closed'' flag of an empty shape");
|
||||
@@ -1840,7 +1840,7 @@ PyObject* TopoShapePy::isEqual(PyObject *args)
|
||||
|
||||
TopoDS_Shape shape = static_cast<TopoShapePy*>(pcObj)->getTopoShapePtr()->getShape();
|
||||
Standard_Boolean test = (getTopoShapePtr()->getShape().IsEqual(shape));
|
||||
|
||||
|
||||
return Py_BuildValue("O", (test ? Py_True : Py_False));
|
||||
}
|
||||
|
||||
@@ -1852,7 +1852,7 @@ PyObject* TopoShapePy::isSame(PyObject *args)
|
||||
|
||||
TopoDS_Shape shape = static_cast<TopoShapePy*>(pcObj)->getTopoShapePtr()->getShape();
|
||||
Standard_Boolean test = getTopoShapePtr()->getShape().IsSame(shape);
|
||||
|
||||
|
||||
return Py_BuildValue("O", (test ? Py_True : Py_False));
|
||||
}
|
||||
|
||||
@@ -1864,7 +1864,7 @@ PyObject* TopoShapePy::isPartner(PyObject *args)
|
||||
|
||||
TopoDS_Shape shape = static_cast<TopoShapePy*>(pcObj)->getTopoShapePtr()->getShape();
|
||||
Standard_Boolean test = getTopoShapePtr()->getShape().IsPartner(shape);
|
||||
|
||||
|
||||
return Py_BuildValue("O", (test ? Py_True : Py_False));
|
||||
}
|
||||
|
||||
@@ -1872,10 +1872,10 @@ PyObject* TopoShapePy::isValid(PyObject *args)
|
||||
{
|
||||
if (!PyArg_ParseTuple(args, ""))
|
||||
return nullptr;
|
||||
|
||||
|
||||
PY_TRY {
|
||||
return Py_BuildValue("O", (getTopoShapePtr()->isValid() ? Py_True : Py_False));
|
||||
}
|
||||
}
|
||||
PY_CATCH_OCC
|
||||
}
|
||||
|
||||
@@ -1885,11 +1885,11 @@ PyObject* TopoShapePy::isCoplanar(PyObject *args)
|
||||
double tol = -1;
|
||||
if (!PyArg_ParseTuple(args, "O!|d", &TopoShapePy::Type, &pyObj, &tol))
|
||||
return nullptr;
|
||||
|
||||
|
||||
PY_TRY {
|
||||
return Py::new_reference_to(Py::Boolean(getTopoShapePtr()->isCoplanar(
|
||||
*static_cast<TopoShapePy*>(pyObj)->getTopoShapePtr(),tol)));
|
||||
}
|
||||
}
|
||||
PY_CATCH_OCC
|
||||
}
|
||||
|
||||
@@ -1909,13 +1909,13 @@ PyObject* TopoShapePy::findPlane(PyObject *args)
|
||||
double tol = -1;
|
||||
if (!PyArg_ParseTuple(args, "|d", &tol))
|
||||
return nullptr;
|
||||
|
||||
|
||||
PY_TRY {
|
||||
gp_Pln pln;
|
||||
if(getTopoShapePtr()->findPlane(pln,tol))
|
||||
return new PlanePy(new GeomPlane(new Geom_Plane(pln)));
|
||||
Py_Return;
|
||||
}
|
||||
}
|
||||
PY_CATCH_OCC
|
||||
}
|
||||
|
||||
@@ -1924,7 +1924,7 @@ PyObject* TopoShapePy::fix(PyObject *args)
|
||||
double prec, mintol, maxtol;
|
||||
if (!PyArg_ParseTuple(args, "ddd", &prec, &mintol, &maxtol))
|
||||
return nullptr;
|
||||
|
||||
|
||||
try {
|
||||
return Py_BuildValue("O", (getTopoShapePtr()->fix(prec, mintol, maxtol) ? Py_True : Py_False));
|
||||
}
|
||||
@@ -1939,7 +1939,7 @@ PyObject* TopoShapePy::hashCode(PyObject *args)
|
||||
int upper = IntegerLast();
|
||||
if (!PyArg_ParseTuple(args, "|i",&upper))
|
||||
return nullptr;
|
||||
|
||||
|
||||
int hc = getTopoShapePtr()->getShape().HashCode(upper);
|
||||
return Py_BuildValue("i", hc);
|
||||
}
|
||||
@@ -1950,7 +1950,7 @@ PyObject* TopoShapePy::tessellate(PyObject *args)
|
||||
PyObject* ok = Py_False;
|
||||
if (!PyArg_ParseTuple(args, "f|O!",&tolerance,&PyBool_Type,&ok))
|
||||
return nullptr;
|
||||
|
||||
|
||||
try {
|
||||
std::vector<Base::Vector3d> Points;
|
||||
std::vector<Data::ComplexGeoData::Facet> Facets;
|
||||
@@ -1987,9 +1987,9 @@ PyObject* TopoShapePy::project(PyObject *args)
|
||||
|
||||
BRepAlgo_NormalProjection algo;
|
||||
algo.Init(this->getTopoShapePtr()->getShape());
|
||||
if (!PyArg_ParseTuple(args, "O", &obj))
|
||||
if (!PyArg_ParseTuple(args, "O", &obj))
|
||||
return nullptr;
|
||||
|
||||
|
||||
try {
|
||||
Py::Sequence list(obj);
|
||||
for (Py::Sequence::iterator it = list.begin(); it != list.end(); ++it) {
|
||||
@@ -1998,7 +1998,7 @@ PyObject* TopoShapePy::project(PyObject *args)
|
||||
algo.Add(shape);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
algo.Compute3d(Standard_True);
|
||||
algo.SetLimit(Standard_True);
|
||||
algo.SetParams(1.e-6, 1.e-6, GeomAbs_C1, 14, 16);
|
||||
@@ -2015,9 +2015,9 @@ PyObject* TopoShapePy::project(PyObject *args)
|
||||
PyObject* TopoShapePy::makeParallelProjection(PyObject *args)
|
||||
{
|
||||
PyObject *pShape, *pDir;
|
||||
if (!PyArg_ParseTuple(args, "O!O!", &(Part::TopoShapePy::Type), &pShape, &Base::VectorPy::Type, &pDir))
|
||||
if (!PyArg_ParseTuple(args, "O!O!", &(Part::TopoShapePy::Type), &pShape, &Base::VectorPy::Type, &pDir))
|
||||
return nullptr;
|
||||
|
||||
|
||||
try {
|
||||
const TopoDS_Shape& shape = this->getTopoShapePtr()->getShape();
|
||||
const TopoDS_Shape& wire = static_cast<TopoShapePy*>(pShape)->getTopoShapePtr()->getShape();
|
||||
@@ -2035,9 +2035,9 @@ PyObject* TopoShapePy::makeParallelProjection(PyObject *args)
|
||||
PyObject* TopoShapePy::makePerspectiveProjection(PyObject *args)
|
||||
{
|
||||
PyObject *pShape, *pDir;
|
||||
if (!PyArg_ParseTuple(args, "O!O!", &(Part::TopoShapePy::Type), &pShape, &Base::VectorPy::Type, &pDir))
|
||||
return nullptr;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "O!O!", &(Part::TopoShapePy::Type), &pShape, &Base::VectorPy::Type, &pDir))
|
||||
return nullptr;
|
||||
|
||||
try {
|
||||
const TopoDS_Shape& shape = this->getTopoShapePtr()->getShape();
|
||||
const TopoDS_Shape& wire = static_cast<TopoShapePy*>(pShape)->getTopoShapePtr()->getShape();
|
||||
@@ -2078,9 +2078,9 @@ PyObject* TopoShapePy::reflectLines(PyObject *args, PyObject *kwds)
|
||||
PyObject* pPos = nullptr;
|
||||
PyObject* pUp = nullptr;
|
||||
PyObject *pView;
|
||||
if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!|O!O!sO!O!", kwlist,
|
||||
&Base::VectorPy::Type, &pView, &Base::VectorPy::Type, &pPos, &Base::VectorPy::Type,
|
||||
&pUp, &type, &PyBool_Type, &vis, &PyBool_Type, &in3d))
|
||||
if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!|O!O!sO!O!", kwlist,
|
||||
&Base::VectorPy::Type, &pView, &Base::VectorPy::Type, &pPos, &Base::VectorPy::Type,
|
||||
&pUp, &type, &PyBool_Type, &vis, &PyBool_Type, &in3d))
|
||||
return nullptr;
|
||||
|
||||
try {
|
||||
@@ -2098,12 +2098,12 @@ PyObject* TopoShapePy::reflectLines(PyObject *args, PyObject *kwds)
|
||||
t = HLRBRep_OutLine;
|
||||
|
||||
Base::Vector3d p(0.0, 0.0, 0.0);
|
||||
if (pPos)
|
||||
if (pPos)
|
||||
p = Py::Vector(pPos,false).toVector();
|
||||
Base::Vector3d u(0.0, 1.0, 0.0);
|
||||
if (pUp)
|
||||
if (pUp)
|
||||
u = Py::Vector(pUp,false).toVector();
|
||||
|
||||
|
||||
Base::Vector3d v = Py::Vector(pView,false).toVector();
|
||||
const TopoDS_Shape& shape = this->getTopoShapePtr()->getShape();
|
||||
HLRAppli_ReflectLines reflect(shape);
|
||||
@@ -2150,9 +2150,9 @@ PyObject* TopoShapePy::makeShapeFromMesh(PyObject *args)
|
||||
getTopoShapePtr()->setFaces(Points, Facets, tolerance);
|
||||
if (PyObject_IsTrue(sewShape))
|
||||
getTopoShapePtr()->sewShape(tolerance);
|
||||
|
||||
|
||||
Py_Return;
|
||||
}
|
||||
}
|
||||
PY_CATCH_OCC
|
||||
}
|
||||
|
||||
@@ -2160,10 +2160,10 @@ PyObject* TopoShapePy::makeWires(PyObject *args) {
|
||||
const char *op = nullptr;
|
||||
if (!PyArg_ParseTuple(args, "s", &op))
|
||||
return nullptr;
|
||||
|
||||
|
||||
PY_TRY {
|
||||
return Py::new_reference_to(shape2pyshape(getTopoShapePtr()->makeWires(op)));
|
||||
}
|
||||
}
|
||||
PY_CATCH_OCC
|
||||
}
|
||||
|
||||
@@ -2257,28 +2257,28 @@ PyObject* TopoShapePy::getElement(PyObject *args)
|
||||
char* input;
|
||||
if (!PyArg_ParseTuple(args, "s", &input))
|
||||
return nullptr;
|
||||
|
||||
boost::regex ex("^(Face|Edge|Vertex)[1-9][0-9]*$");
|
||||
|
||||
|
||||
boost::regex ex("^(Face|Edge|Vertex)[1-9][0-9]*$");
|
||||
|
||||
try {
|
||||
if (boost::regex_match(input, ex)) {
|
||||
std::unique_ptr<Part::ShapeSegment> s(static_cast<Part::ShapeSegment*>
|
||||
(getTopoShapePtr()->getSubElementByName(input)));
|
||||
TopoDS_Shape shape = s->Shape;
|
||||
switch (shape.ShapeType()) {
|
||||
case TopAbs_FACE:
|
||||
return new TopoShapeFacePy(new TopoShape(shape));
|
||||
case TopAbs_EDGE:
|
||||
return new TopoShapeEdgePy(new TopoShape(shape));
|
||||
case TopAbs_VERTEX:
|
||||
return new TopoShapeVertexPy(new TopoShape(shape));
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (boost::regex_match(input, ex)) {
|
||||
std::unique_ptr<Part::ShapeSegment> s(static_cast<Part::ShapeSegment*>
|
||||
(getTopoShapePtr()->getSubElementByName(input)));
|
||||
TopoDS_Shape shape = s->Shape;
|
||||
switch (shape.ShapeType()) {
|
||||
case TopAbs_FACE:
|
||||
return new TopoShapeFacePy(new TopoShape(shape));
|
||||
case TopAbs_EDGE:
|
||||
return new TopoShapeEdgePy(new TopoShape(shape));
|
||||
case TopAbs_VERTEX:
|
||||
return new TopoShapeVertexPy(new TopoShape(shape));
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
PyErr_SetString(PyExc_ValueError, "Invalid subelement name");
|
||||
return nullptr;
|
||||
|
||||
PyErr_SetString(PyExc_ValueError, "Invalid subelement name");
|
||||
return nullptr;
|
||||
}
|
||||
catch (Standard_Failure& e) {
|
||||
PyErr_SetString(PartExceptionOCCError, e.GetMessageString());
|
||||
@@ -2291,30 +2291,30 @@ PyObject* TopoShapePy::countElement(PyObject *args)
|
||||
char* input;
|
||||
if (!PyArg_ParseTuple(args, "s", &input))
|
||||
return nullptr;
|
||||
|
||||
|
||||
PY_TRY {
|
||||
return Py::new_reference_to(Py::Int((long)getTopoShapePtr()->countSubShapes(input)));
|
||||
}
|
||||
}
|
||||
PY_CATCH_OCC
|
||||
}
|
||||
|
||||
PyObject* TopoShapePy::getTolerance(PyObject *args)
|
||||
{
|
||||
int mode;
|
||||
PyObject* type = reinterpret_cast<PyObject*>(&TopoShapePy::Type);
|
||||
PyObject* type = reinterpret_cast<PyObject*>(&TopoShapePy::Type);
|
||||
if (!PyArg_ParseTuple(args, "i|O!", &mode, &PyType_Type, &type))
|
||||
return nullptr;
|
||||
|
||||
try {
|
||||
TopoDS_Shape shape = this->getTopoShapePtr()->getShape();
|
||||
PyTypeObject* pyType = reinterpret_cast<PyTypeObject*>(type);
|
||||
TopAbs_ShapeEnum shapetype = ShapeTypeFromPyType(pyType);
|
||||
if (!PyType_IsSubtype(pyType, &TopoShapePy::Type) ||
|
||||
(shapetype != TopAbs_SHAPE && shapetype != TopAbs_VERTEX &&
|
||||
shapetype != TopAbs_EDGE && shapetype != TopAbs_FACE && shapetype != TopAbs_SHELL)) {
|
||||
PyErr_SetString(PyExc_TypeError, "shape type must be Shape, Vertex, Edge, Face or Shell");
|
||||
return nullptr;
|
||||
}
|
||||
TopAbs_ShapeEnum shapetype = ShapeTypeFromPyType(pyType);
|
||||
if (!PyType_IsSubtype(pyType, &TopoShapePy::Type) ||
|
||||
(shapetype != TopAbs_SHAPE && shapetype != TopAbs_VERTEX &&
|
||||
shapetype != TopAbs_EDGE && shapetype != TopAbs_FACE && shapetype != TopAbs_SHELL)) {
|
||||
PyErr_SetString(PyExc_TypeError, "shape type must be Shape, Vertex, Edge, Face or Shell");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
ShapeAnalysis_ShapeTolerance analysis;
|
||||
double tolerance = analysis.Tolerance(shape, mode, shapetype);
|
||||
@@ -2329,20 +2329,20 @@ PyObject* TopoShapePy::getTolerance(PyObject *args)
|
||||
PyObject* TopoShapePy::overTolerance(PyObject *args)
|
||||
{
|
||||
double value;
|
||||
PyObject* type = reinterpret_cast<PyObject*>(&TopoShapePy::Type);
|
||||
PyObject* type = reinterpret_cast<PyObject*>(&TopoShapePy::Type);
|
||||
if (!PyArg_ParseTuple(args, "d|O!", &value, &PyType_Type, &type))
|
||||
return nullptr;
|
||||
|
||||
try {
|
||||
TopoDS_Shape shape = this->getTopoShapePtr()->getShape();
|
||||
PyTypeObject* pyType = reinterpret_cast<PyTypeObject*>(type);
|
||||
TopAbs_ShapeEnum shapetype = ShapeTypeFromPyType(pyType);
|
||||
if (!PyType_IsSubtype(pyType, &TopoShapePy::Type) ||
|
||||
(shapetype != TopAbs_SHAPE && shapetype != TopAbs_VERTEX &&
|
||||
shapetype != TopAbs_EDGE && shapetype != TopAbs_FACE && shapetype != TopAbs_SHELL)) {
|
||||
PyErr_SetString(PyExc_TypeError, "shape type must be Shape, Vertex, Edge, Face or Shell");
|
||||
return nullptr;
|
||||
}
|
||||
TopAbs_ShapeEnum shapetype = ShapeTypeFromPyType(pyType);
|
||||
if (!PyType_IsSubtype(pyType, &TopoShapePy::Type) ||
|
||||
(shapetype != TopAbs_SHAPE && shapetype != TopAbs_VERTEX &&
|
||||
shapetype != TopAbs_EDGE && shapetype != TopAbs_FACE && shapetype != TopAbs_SHELL)) {
|
||||
PyErr_SetString(PyExc_TypeError, "shape type must be Shape, Vertex, Edge, Face or Shell");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
ShapeAnalysis_ShapeTolerance analysis;
|
||||
Handle(TopTools_HSequenceOfShape) seq = analysis.OverTolerance(shape, value, shapetype);
|
||||
@@ -2364,20 +2364,20 @@ PyObject* TopoShapePy::inTolerance(PyObject *args)
|
||||
{
|
||||
double valmin;
|
||||
double valmax;
|
||||
PyObject* type = reinterpret_cast<PyObject*>(&TopoShapePy::Type);
|
||||
PyObject* type = reinterpret_cast<PyObject*>(&TopoShapePy::Type);
|
||||
if (!PyArg_ParseTuple(args, "dd|O!", &valmin, &valmax, &PyType_Type, &type))
|
||||
return nullptr;
|
||||
|
||||
try {
|
||||
TopoDS_Shape shape = this->getTopoShapePtr()->getShape();
|
||||
PyTypeObject* pyType = reinterpret_cast<PyTypeObject*>(type);
|
||||
TopAbs_ShapeEnum shapetype = ShapeTypeFromPyType(pyType);
|
||||
if (!PyType_IsSubtype(pyType, &TopoShapePy::Type) ||
|
||||
(shapetype != TopAbs_SHAPE && shapetype != TopAbs_VERTEX &&
|
||||
shapetype != TopAbs_EDGE && shapetype != TopAbs_FACE && shapetype != TopAbs_SHELL)) {
|
||||
PyErr_SetString(PyExc_TypeError, "shape type must be Shape, Vertex, Edge, Face or Shell");
|
||||
return nullptr;
|
||||
}
|
||||
TopAbs_ShapeEnum shapetype = ShapeTypeFromPyType(pyType);
|
||||
if (!PyType_IsSubtype(pyType, &TopoShapePy::Type) ||
|
||||
(shapetype != TopAbs_SHAPE && shapetype != TopAbs_VERTEX &&
|
||||
shapetype != TopAbs_EDGE && shapetype != TopAbs_FACE && shapetype != TopAbs_SHELL)) {
|
||||
PyErr_SetString(PyExc_TypeError, "shape type must be Shape, Vertex, Edge, Face or Shell");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
ShapeAnalysis_ShapeTolerance analysis;
|
||||
Handle(TopTools_HSequenceOfShape) seq = analysis.InTolerance(shape, valmin, valmax, shapetype);
|
||||
@@ -2406,7 +2406,7 @@ PyObject* TopoShapePy::globalTolerance(PyObject *args)
|
||||
ShapeAnalysis_ShapeTolerance analysis;
|
||||
analysis.Tolerance(shape, mode);
|
||||
double tolerance = analysis.GlobalTolerance(mode);
|
||||
|
||||
|
||||
return PyFloat_FromDouble(tolerance);
|
||||
}
|
||||
catch (Standard_Failure& e) {
|
||||
@@ -2418,19 +2418,19 @@ PyObject* TopoShapePy::globalTolerance(PyObject *args)
|
||||
PyObject* TopoShapePy::fixTolerance(PyObject *args)
|
||||
{
|
||||
double value;
|
||||
PyObject* type = reinterpret_cast<PyObject*>(&TopoShapePy::Type);
|
||||
PyObject* type = reinterpret_cast<PyObject*>(&TopoShapePy::Type);
|
||||
if (!PyArg_ParseTuple(args, "d|O!", &value, &PyType_Type, &type))
|
||||
return nullptr;
|
||||
|
||||
try {
|
||||
TopoDS_Shape shape = this->getTopoShapePtr()->getShape();
|
||||
PyTypeObject* pyType = reinterpret_cast<PyTypeObject*>(type);
|
||||
TopAbs_ShapeEnum shapetype = ShapeTypeFromPyType(pyType);
|
||||
if (!PyType_IsSubtype(pyType, &TopoShapePy::Type)) {
|
||||
PyErr_SetString(PyExc_TypeError, "type must be a Shape subtype");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
TopAbs_ShapeEnum shapetype = ShapeTypeFromPyType(pyType);
|
||||
if (!PyType_IsSubtype(pyType, &TopoShapePy::Type)) {
|
||||
PyErr_SetString(PyExc_TypeError, "type must be a Shape subtype");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
ShapeFix_ShapeTolerance fix;
|
||||
fix.SetTolerance(shape, value, shapetype);
|
||||
Py_Return;
|
||||
@@ -2445,18 +2445,18 @@ PyObject* TopoShapePy::limitTolerance(PyObject *args)
|
||||
{
|
||||
double tmin;
|
||||
double tmax=0;
|
||||
PyObject* type = reinterpret_cast<PyObject*>(&TopoShapePy::Type);
|
||||
PyObject* type = reinterpret_cast<PyObject*>(&TopoShapePy::Type);
|
||||
if (!PyArg_ParseTuple(args, "d|dO!", &tmin, &tmax, &PyType_Type, &type))
|
||||
return nullptr;
|
||||
|
||||
try {
|
||||
TopoDS_Shape shape = this->getTopoShapePtr()->getShape();
|
||||
PyTypeObject* pyType = reinterpret_cast<PyTypeObject*>(type);
|
||||
TopAbs_ShapeEnum shapetype = ShapeTypeFromPyType(pyType);
|
||||
if (!PyType_IsSubtype(pyType, &TopoShapePy::Type)) {
|
||||
PyErr_SetString(PyExc_TypeError, "type must be a Shape subtype");
|
||||
return nullptr;
|
||||
}
|
||||
TopAbs_ShapeEnum shapetype = ShapeTypeFromPyType(pyType);
|
||||
if (!PyType_IsSubtype(pyType, &TopoShapePy::Type)) {
|
||||
PyErr_SetString(PyExc_TypeError, "type must be a Shape subtype");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
ShapeFix_ShapeTolerance fix;
|
||||
Standard_Boolean ok = fix.LimitTolerance(shape, tmin, tmax, shapetype);
|
||||
@@ -2496,7 +2496,7 @@ PyObject* TopoShapePy::proximity(PyObject *args)
|
||||
Standard_Real tol = Precision::Confusion();
|
||||
if (!PyArg_ParseTuple(args, "O!|d",&(TopoShapePy::Type), &ps2, &tol))
|
||||
return nullptr;
|
||||
|
||||
|
||||
const TopoDS_Shape& s1 = getTopoShapePtr()->getShape();
|
||||
const TopoDS_Shape& s2 = static_cast<Part::TopoShapePy*>(ps2)->getTopoShapePtr()->getShape();
|
||||
if (s1.IsNull()) {
|
||||
@@ -2841,10 +2841,10 @@ Py::String TopoShapePy::getShapeType(void) const
|
||||
TopoDS_Shape sh = getTopoShapePtr()->getShape();
|
||||
if (sh.IsNull())
|
||||
throw Py::Exception(Base::PyExc_FC_GeneralError, "cannot determine type of null shape");
|
||||
|
||||
|
||||
TopAbs_ShapeEnum type = sh.ShapeType();
|
||||
std::string name;
|
||||
switch (type) {
|
||||
switch (type) {
|
||||
case TopAbs_COMPOUND:
|
||||
name = "Compound";
|
||||
break;
|
||||
@@ -2882,10 +2882,10 @@ Py::String TopoShapePy::getOrientation(void) const
|
||||
TopoDS_Shape sh = getTopoShapePtr()->getShape();
|
||||
if (sh.IsNull())
|
||||
throw Py::Exception(Base::PyExc_FC_GeneralError, "cannot determine orientation of null shape");
|
||||
|
||||
|
||||
TopAbs_Orientation type = sh.Orientation();
|
||||
std::string name;
|
||||
switch (type) {
|
||||
switch (type) {
|
||||
case TopAbs_FORWARD:
|
||||
name = "Forward";
|
||||
break;
|
||||
@@ -2908,7 +2908,7 @@ void TopoShapePy::setOrientation(Py::String arg)
|
||||
TopoDS_Shape sh = getTopoShapePtr()->getShape();
|
||||
if (sh.IsNull())
|
||||
throw Py::Exception(Base::PyExc_FC_GeneralError, "cannot determine orientation of null shape");
|
||||
|
||||
|
||||
std::string name = static_cast<std::string>(arg);
|
||||
TopAbs_Orientation type;
|
||||
if (name == "Forward") {
|
||||
@@ -2944,64 +2944,64 @@ Py::List TopoShapePy::getSubShapes(void) const
|
||||
return ret;
|
||||
}
|
||||
|
||||
template<typename T> Py::List getShapes(const TopoShape* shapePtr)
|
||||
{
|
||||
Py::List ret;
|
||||
TopTools_IndexedMapOfShape M;
|
||||
TopExp_Explorer Ex(shapePtr->getShape(), mapTypeShape.at(&T::Type));
|
||||
while (Ex.More()) {
|
||||
M.Add(Ex.Current());
|
||||
Ex.Next();
|
||||
}
|
||||
|
||||
for (Standard_Integer k = 1; k <= M.Extent(); k++) {
|
||||
const TopoDS_Shape& shape = M(k);
|
||||
Base::PyObjectBase* baseObj = new T(new TopoShape(shape));
|
||||
baseObj->setNotTracking();
|
||||
ret.append(Py::asObject(baseObj));
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
template<typename T> Py::List getShapes(const TopoShape* shapePtr)
|
||||
{
|
||||
Py::List ret;
|
||||
TopTools_IndexedMapOfShape M;
|
||||
TopExp_Explorer Ex(shapePtr->getShape(), mapTypeShape.at(&T::Type));
|
||||
while (Ex.More()) {
|
||||
M.Add(Ex.Current());
|
||||
Ex.Next();
|
||||
}
|
||||
|
||||
for (Standard_Integer k = 1; k <= M.Extent(); k++) {
|
||||
const TopoDS_Shape& shape = M(k);
|
||||
Base::PyObjectBase* baseObj = new T(new TopoShape(shape));
|
||||
baseObj->setNotTracking();
|
||||
ret.append(Py::asObject(baseObj));
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
Py::List TopoShapePy::getFaces(void) const
|
||||
{
|
||||
return getShapes<TopoShapeFacePy>(getTopoShapePtr());
|
||||
return getShapes<TopoShapeFacePy>(getTopoShapePtr());
|
||||
}
|
||||
|
||||
Py::List TopoShapePy::getVertexes(void) const
|
||||
{
|
||||
return getShapes<TopoShapeVertexPy>(getTopoShapePtr());
|
||||
return getShapes<TopoShapeVertexPy>(getTopoShapePtr());
|
||||
}
|
||||
|
||||
Py::List TopoShapePy::getShells(void) const
|
||||
{
|
||||
return getShapes<TopoShapeShellPy>(getTopoShapePtr());
|
||||
return getShapes<TopoShapeShellPy>(getTopoShapePtr());
|
||||
}
|
||||
|
||||
Py::List TopoShapePy::getSolids(void) const
|
||||
{
|
||||
return getShapes<TopoShapeSolidPy>(getTopoShapePtr());
|
||||
return getShapes<TopoShapeSolidPy>(getTopoShapePtr());
|
||||
}
|
||||
|
||||
Py::List TopoShapePy::getCompSolids(void) const
|
||||
{
|
||||
return getShapes<TopoShapeCompSolidPy>(getTopoShapePtr());
|
||||
return getShapes<TopoShapeCompSolidPy>(getTopoShapePtr());
|
||||
}
|
||||
|
||||
Py::List TopoShapePy::getEdges(void) const
|
||||
{
|
||||
return getShapes<TopoShapeEdgePy>(getTopoShapePtr());
|
||||
return getShapes<TopoShapeEdgePy>(getTopoShapePtr());
|
||||
}
|
||||
|
||||
Py::List TopoShapePy::getWires(void) const
|
||||
{
|
||||
return getShapes<TopoShapeWirePy>(getTopoShapePtr());
|
||||
return getShapes<TopoShapeWirePy>(getTopoShapePtr());
|
||||
}
|
||||
|
||||
Py::List TopoShapePy::getCompounds(void) const
|
||||
{
|
||||
return getShapes<TopoShapeCompoundPy>(getTopoShapePtr());
|
||||
return getShapes<TopoShapeCompoundPy>(getTopoShapePtr());
|
||||
}
|
||||
|
||||
Py::Float TopoShapePy::getLength(void) const
|
||||
@@ -3036,13 +3036,13 @@ Py::Float TopoShapePy::getVolume(void) const
|
||||
|
||||
PyObject *TopoShapePy::getCustomAttributes(const char* attr) const
|
||||
{
|
||||
if (!attr)
|
||||
if (!attr)
|
||||
return nullptr;
|
||||
PY_TRY {
|
||||
TopoDS_Shape res = getTopoShapePtr()->getSubShape(attr,true);
|
||||
if(!res.IsNull())
|
||||
return Py::new_reference_to(shape2pyshape(res));
|
||||
}
|
||||
}
|
||||
PY_CATCH_OCC
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -99,7 +99,7 @@ void LoftWidget::findShapes()
|
||||
{
|
||||
App::Document* activeDoc = App::GetApplication().getActiveDocument();
|
||||
Gui::Document* activeGui = Gui::Application::Instance->getDocument(activeDoc);
|
||||
if (!activeGui)
|
||||
if (!activeGui)
|
||||
return;
|
||||
d->document = activeDoc->getName();
|
||||
|
||||
|
||||
@@ -246,7 +246,7 @@ void ViewProvider2DObjectGrid::updateData(const App::Property* prop)
|
||||
if (prop->getTypeId() == Part::PropertyPartShape::getClassTypeId()) {
|
||||
if (GridAutoSize.getValue()) {
|
||||
Base::BoundBox3d bbox = static_cast<const Part::PropertyPartShape*>(prop)->getBoundingBox();
|
||||
if (!bbox.IsValid())
|
||||
if (!bbox.IsValid())
|
||||
return;
|
||||
Gui::coinRemoveAllChildren(GridRoot);
|
||||
Base::Placement place = static_cast<const Part::PropertyPartShape*>(prop)->getComplexData()->getPlacement();
|
||||
|
||||
@@ -452,7 +452,7 @@ void TaskMultiTransformParameters::moveTransformFeature(const int increment)
|
||||
PartDesign::MultiTransform* pcMultiTransform = static_cast<PartDesign::MultiTransform*>(TransformedView->getObject());
|
||||
std::vector<App::DocumentObject*> transformFeatures = pcMultiTransform->Transformations.getValues();
|
||||
|
||||
if (transformFeatures.empty())
|
||||
if (transformFeatures.empty())
|
||||
return;
|
||||
|
||||
App::DocumentObject* feature = transformFeatures[row];
|
||||
|
||||
@@ -203,7 +203,7 @@ void TaskTransformedParameters::onButtonAddFeature(bool checked)
|
||||
void TaskTransformedParameters::checkVisibility() {
|
||||
auto feat = getObject();
|
||||
auto body = feat->getFeatureBody();
|
||||
if(!body)
|
||||
if(!body)
|
||||
return;
|
||||
auto inset = feat->getInListEx(true);
|
||||
inset.emplace(feat);
|
||||
|
||||
@@ -274,7 +274,7 @@ bool ViewProviderDatum::doubleClicked(void)
|
||||
if(!activeDoc)
|
||||
activeDoc = getDocument();
|
||||
auto activeView = activeDoc->getActiveView();
|
||||
if(!activeView)
|
||||
if(!activeView)
|
||||
return false;
|
||||
|
||||
std::string Msg("Edit ");
|
||||
|
||||
@@ -86,11 +86,11 @@ void ViewProviderDressUp::highlightReferences(const bool on)
|
||||
{
|
||||
PartDesign::DressUp* pcDressUp = static_cast<PartDesign::DressUp*>(getObject());
|
||||
Part::Feature* base = pcDressUp->getBaseObject (/*silent =*/ true);
|
||||
if (base == nullptr)
|
||||
if (base == nullptr)
|
||||
return;
|
||||
PartGui::ViewProviderPart* vp = dynamic_cast<PartGui::ViewProviderPart*>(
|
||||
Gui::Application::Instance->getViewProvider(base));
|
||||
if (vp == nullptr)
|
||||
if (vp == nullptr)
|
||||
return;
|
||||
|
||||
std::vector<std::string> faces = pcDressUp->Base.getSubValuesStartsWith("Face");
|
||||
|
||||
@@ -55,7 +55,7 @@ int PointsPy::PyInit(PyObject* args, PyObject* /*kwd*/)
|
||||
return -1;
|
||||
|
||||
// if no mesh is given
|
||||
if (!pcObj)
|
||||
if (!pcObj)
|
||||
return 0;
|
||||
if (PyObject_TypeCheck(pcObj, &(PointsPy::Type))) {
|
||||
*getPointKernelPtr() = *(static_cast<PointsPy*>(pcObj)->getPointKernelPtr());
|
||||
|
||||
@@ -196,7 +196,7 @@ void CmdRaytracingWritePart::activated(int)
|
||||
// name of the objects in the pov file
|
||||
std::string Name = "Part";
|
||||
std::vector<App::DocumentObject*> obj = Gui::Selection().getObjectsOfType(Part::Feature::getClassTypeId());
|
||||
if (obj.empty())
|
||||
if (obj.empty())
|
||||
return;
|
||||
|
||||
std::stringstream out;
|
||||
|
||||
@@ -1380,7 +1380,7 @@ void CmdMengerSponge::activated(int)
|
||||
QString::fromLatin1("Menger sponge"),
|
||||
QString::fromLatin1("Recursion depth:"),
|
||||
3, 1, 5, 1, &ok);
|
||||
if (!ok)
|
||||
if (!ok)
|
||||
return;
|
||||
int ret = QMessageBox::question(Gui::getMainWindow(),
|
||||
QString::fromLatin1("Parallel"),
|
||||
|
||||
@@ -169,7 +169,7 @@ void SoWidgetShape::GLRender(SoGLRenderAction * /*action*/)
|
||||
void SoWidgetShape::computeBBox(SoAction *action, SbBox3f &box, SbVec3f ¢er)
|
||||
{
|
||||
// ignore if node is empty
|
||||
if (this->image.isNull())
|
||||
if (this->image.isNull())
|
||||
return;
|
||||
|
||||
SbVec3f v0, v1, v2, v3;
|
||||
@@ -238,7 +238,7 @@ SoWidgetShape::getQuad(SoState * state, SbVec3f & v0, SbVec3f & v1,
|
||||
|
||||
void SoWidgetShape::generatePrimitives(SoAction *action)
|
||||
{
|
||||
if (this->image.isNull())
|
||||
if (this->image.isNull())
|
||||
return;
|
||||
|
||||
SoState *state = action->getState();
|
||||
|
||||
@@ -84,7 +84,7 @@ bool ExternalGeometryExtension::getFlagsFromName(std::string str, ExternalGeomet
|
||||
auto pos = std::find_if( ExternalGeometryExtension::flag2str.begin(),
|
||||
ExternalGeometryExtension::flag2str.end(),
|
||||
[str](const char * val) {
|
||||
return strcmp(val,str.c_str())==0;
|
||||
return strcmp(val,str.c_str())==0;
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
@@ -115,7 +115,7 @@ PyObject* ExternalGeometryFacadePy::setFlag(PyObject *args)
|
||||
auto pos = std::find_if(ExternalGeometryExtension::flag2str.begin(),
|
||||
ExternalGeometryExtension::flag2str.end(),
|
||||
[flag](const char * val) {
|
||||
return strcmp(val,flag)==0;
|
||||
return strcmp(val,flag)==0;
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
@@ -114,7 +114,7 @@ bool SketchGeometryExtension::getInternalTypeFromName(std::string str, InternalT
|
||||
auto pos = std::find_if( SketchGeometryExtension::internaltype2str.begin(),
|
||||
SketchGeometryExtension::internaltype2str.end(),
|
||||
[str](const char * val) {
|
||||
return strcmp(val,str.c_str())==0;
|
||||
return strcmp(val,str.c_str())==0;
|
||||
}
|
||||
);
|
||||
|
||||
@@ -133,7 +133,7 @@ bool SketchGeometryExtension::getGeometryModeFromName(std::string str, GeometryM
|
||||
auto pos = std::find_if( SketchGeometryExtension::geometrymode2str.begin(),
|
||||
SketchGeometryExtension::geometrymode2str.end(),
|
||||
[str](const char * val) {
|
||||
return strcmp(val,str.c_str())==0;
|
||||
return strcmp(val,str.c_str())==0;
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
@@ -1807,7 +1807,7 @@ int SketchObject::fillet(int GeoId1, int GeoId2,
|
||||
int filletId;
|
||||
std::unique_ptr<Part::GeomArcOfCircle> arc(
|
||||
Part::createFilletGeometry(lineSeg1, lineSeg2, filletCenter, radius));
|
||||
if (!arc)
|
||||
if (!arc)
|
||||
return -1;
|
||||
|
||||
// calculate intersection and distances before we invalidate lineSeg1 and lineSeg2
|
||||
|
||||
@@ -181,7 +181,7 @@ void CmdSketcherNewSketch::activated(int iMsg)
|
||||
qApp->translate("Sketcher_NewSketch", "Sketch attachment"),
|
||||
qApp->translate("Sketcher_NewSketch", "Select the method to attach this sketch to selected object"),
|
||||
items, iSugg, false, &ok, Qt::MSWindowsFixedSizeDialogHint);
|
||||
if (!ok)
|
||||
if (!ok)
|
||||
return;
|
||||
int index = items.indexOf(text);
|
||||
if (index == 0){
|
||||
|
||||
@@ -598,7 +598,7 @@ int DrawSketchHandler::seekAutoConstraint(std::vector<AutoConstraint> &suggested
|
||||
suggestedConstraints.push_back(constr);
|
||||
|
||||
// Do not seek for tangent if we are actually building a primitive
|
||||
if (type == AutoConstraint::VERTEX_NO_TANGENCY)
|
||||
if (type == AutoConstraint::VERTEX_NO_TANGENCY)
|
||||
return suggestedConstraints.size();
|
||||
|
||||
// Find if there are tangent constraints (currently arcs and circles)
|
||||
|
||||
@@ -224,7 +224,7 @@ CONTEXT_MEMBER_DEF("Sketcher_SelectVerticalAxis",doSelectVAxis)
|
||||
void ElementView::deleteSelectedItems()
|
||||
{
|
||||
App::Document* doc = App::GetApplication().getActiveDocument();
|
||||
if (!doc)
|
||||
if (!doc)
|
||||
return;
|
||||
|
||||
doc->openTransaction("Delete element");
|
||||
@@ -615,7 +615,7 @@ void TaskSketcherElements::on_listWidgetElements_itemSelectionChanged(void)
|
||||
void TaskSketcherElements::on_listWidgetElements_itemEntered(QListWidgetItem *item)
|
||||
{
|
||||
ElementItem *it = dynamic_cast<ElementItem*>(item);
|
||||
if (!it)
|
||||
if (!it)
|
||||
return;
|
||||
|
||||
Gui::Selection().rmvPreselect();
|
||||
@@ -1164,11 +1164,11 @@ TaskSketcherElements::MultIcon::MultIcon(const char* name)
|
||||
|
||||
QIcon TaskSketcherElements::MultIcon::getIcon(bool construction, bool external) const
|
||||
{
|
||||
if (construction && external)
|
||||
if (construction && external)
|
||||
return QIcon();
|
||||
if (construction)
|
||||
if (construction)
|
||||
return Construction;
|
||||
if (external)
|
||||
if (external)
|
||||
return External;
|
||||
return Normal;
|
||||
}
|
||||
|
||||
@@ -523,7 +523,7 @@ void ViewProviderSketch::getProjectingLine(const SbVec2s& pnt, const Gui::View3D
|
||||
}
|
||||
|
||||
SoCamera* pCam = viewer->getSoRenderManager()->getCamera();
|
||||
if (!pCam)
|
||||
if (!pCam)
|
||||
return;
|
||||
SbViewVolume vol = pCam->getViewVolume();
|
||||
|
||||
|
||||
@@ -220,7 +220,7 @@ short DrawProjGroup::mustExecute() const
|
||||
spacingX.isTouched() ||
|
||||
spacingY.isTouched();
|
||||
}
|
||||
if (result)
|
||||
if (result)
|
||||
return result;
|
||||
return TechDraw::DrawViewCollection::mustExecute();
|
||||
}
|
||||
|
||||
@@ -837,15 +837,15 @@ bool BrowserView::onHasMsg(const char* pMsg) const
|
||||
return view->page()->action(QWebEnginePage::Back)->isEnabled();
|
||||
if (strcmp(pMsg,"Next")==0)
|
||||
return view->page()->action(QWebEnginePage::Forward)->isEnabled();
|
||||
if (strcmp(pMsg,"Refresh")==0)
|
||||
if (strcmp(pMsg,"Refresh")==0)
|
||||
return !isLoading;
|
||||
if (strcmp(pMsg,"Stop")==0)
|
||||
if (strcmp(pMsg,"Stop")==0)
|
||||
return isLoading;
|
||||
if (strcmp(pMsg,"ZoomIn")==0)
|
||||
if (strcmp(pMsg,"ZoomIn")==0)
|
||||
return true;
|
||||
if (strcmp(pMsg,"ZoomOut")==0)
|
||||
if (strcmp(pMsg,"ZoomOut")==0)
|
||||
return true;
|
||||
if (strcmp(pMsg,"SetURL")==0)
|
||||
if (strcmp(pMsg,"SetURL")==0)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
||||
@@ -222,7 +222,7 @@ HRESULT CFCStdExtractor::GetLocation(LPWSTR pszPathBuffer,
|
||||
DWORD *pdwFlags)
|
||||
{
|
||||
m_bmSize = *prgSize;
|
||||
if (*pdwFlags & IEIFLAG_ASYNC)
|
||||
if (*pdwFlags & IEIFLAG_ASYNC)
|
||||
return E_PENDING;
|
||||
return NOERROR;
|
||||
}
|
||||
@@ -298,7 +298,7 @@ HRESULT CFCStdExtractor::GetDateStamp(FILETIME *pDateStamp)
|
||||
// open the file and get last write time
|
||||
HANDLE hFile = CreateFile(m_szFile,GENERIC_READ,FILE_SHARE_READ,NULL,
|
||||
OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
|
||||
if(!hFile)
|
||||
if(!hFile)
|
||||
return E_FAIL;
|
||||
GetFileTime(hFile,&ftCreationTime,&ftLastAccessTime,&ftLastWriteTime);
|
||||
CloseHandle(hFile);
|
||||
|
||||
Reference in New Issue
Block a user