Merge branch 'master' into bug/pathsanity

This commit is contained in:
sliptonic
2020-10-16 13:03:01 -05:00
committed by GitHub
51 changed files with 798 additions and 257 deletions
+5 -1
View File
@@ -133,8 +133,12 @@ PyTypeObject PyObjectBase::Type = {
#if PY_MAJOR_VERSION >= 3
,0 /*tp_finalize */
#endif
#if PY_VERSION_HEX >= 0x03080000
#if PY_VERSION_HEX >= 0x03090000
,0 /*tp_vectorcall */
#elif PY_VERSION_HEX >= 0x03080000
,0 /*tp_vectorcall */
/* bpo-37250: kept for backwards compatibility in CPython 3.8 only */
,0 /*tp_print */
#endif
};
+1 -1
View File
@@ -61,7 +61,7 @@ void Assistant::showDocumentation(const QString &page)
if (!page.isEmpty()) {
QTextStream str(proc);
str << QLatin1String("setSource qthelp://org.freecad.usermanual/doc/")
<< page << QLatin1Char('\n') << endl;
<< page << QLatin1String("\n\n");
}
}
+6 -6
View File
@@ -149,12 +149,12 @@ void AutoSaver::saveDocument(const std::string& name, AutoSaveProperty& saver)
if (file.open(QFile::WriteOnly)) {
QTextStream str(&file);
str.setCodec("UTF-8");
str << "<?xml version='1.0' encoding='utf-8'?>" << endl
<< "<AutoRecovery SchemaVersion=\"1\">" << endl;
str << " <Status>Created</Status>" << endl;
str << " <Label>" << QString::fromUtf8(doc->Label.getValue()) << "</Label>" << endl; // store the document's current label
str << " <FileName>" << QString::fromUtf8(doc->FileName.getValue()) << "</FileName>" << endl; // store the document's current filename
str << "</AutoRecovery>" << endl;
str << "<?xml version='1.0' encoding='utf-8'?>\n"
<< "<AutoRecovery SchemaVersion=\"1\">\n";
str << " <Status>Created</Status>\n";
str << " <Label>" << QString::fromUtf8(doc->Label.getValue()) << "</Label>\n"; // store the document's current label
str << " <FileName>" << QString::fromUtf8(doc->FileName.getValue()) << "</FileName>\n"; // store the document's current filename
str << "</AutoRecovery>\n";
file.close();
}
+6 -6
View File
@@ -337,9 +337,9 @@ void StdCmdFreezeViews::onSaveViews()
QTextStream str(&file);
ActionGroup* pcAction = qobject_cast<ActionGroup*>(_pcAction);
QList<QAction*> acts = pcAction->actions();
str << "<?xml version='1.0' encoding='utf-8'?>" << endl
<< "<FrozenViews SchemaVersion=\"1\">" << endl;
str << " <Views Count=\"" << savedViews <<"\">" << endl;
str << "<?xml version='1.0' encoding='utf-8'?>\n"
<< "<FrozenViews SchemaVersion=\"1\">\n";
str << " <Views Count=\"" << savedViews <<"\">\n";
for (QList<QAction*>::ConstIterator it = acts.begin()+offset; it != acts.end(); ++it) {
if ( !(*it)->isVisible() )
@@ -356,11 +356,11 @@ void StdCmdFreezeViews::onSaveViews()
viewPos = lines.join(QString::fromLatin1(" "));
}
str << " <Camera settings=\"" << viewPos.toLatin1().constData() << "\"/>" << endl;
str << " <Camera settings=\"" << viewPos.toLatin1().constData() << "\"/>\n";
}
str << " </Views>" << endl;
str << "</FrozenViews>" << endl;
str << " </Views>\n";
str << "</FrozenViews>\n";
}
}
+2 -3
View File
@@ -168,9 +168,8 @@ void DlgDisplayPropertiesImp::slotChangedObject(const Gui::ViewProvider& obj,
// We pick out all the properties for which we need to update this dialog.
std::vector<Gui::ViewProvider*> Provider = getSelection();
std::vector<Gui::ViewProvider*>::const_iterator vp = std::find_if
(Provider.begin(), Provider.end(),
std::bind2nd(std::equal_to<Gui::ViewProvider*>(),
const_cast<Gui::ViewProvider*>(&obj)));
(Provider.begin(), Provider.end(), [&obj](Gui::ViewProvider* v) { return v == &obj; });
if (vp != Provider.end()) {
const char* name = obj.getPropertyName(&prop);
// this is not a property of the view provider but of the document object
+10 -10
View File
@@ -362,28 +362,28 @@ void DocumentRecoveryPrivate::writeRecoveryInfo(const DocumentRecoveryPrivate::I
if (file.open(QFile::WriteOnly)) {
QTextStream str(&file);
str.setCodec("UTF-8");
str << "<?xml version='1.0' encoding='utf-8'?>" << endl
<< "<AutoRecovery SchemaVersion=\"1\">" << endl;
str << "<?xml version='1.0' encoding='utf-8'?>\n"
<< "<AutoRecovery SchemaVersion=\"1\">\n";
switch (info.status) {
case Created:
str << " <Status>Created</Status>" << endl;
str << " <Status>Created</Status>\n";
break;
case Overage:
str << " <Status>Deprecated</Status>" << endl;
str << " <Status>Deprecated</Status>\n";
break;
case Success:
str << " <Status>Success</Status>" << endl;
str << " <Status>Success</Status>\n";
break;
case Failure:
str << " <Status>Failure</Status>" << endl;
str << " <Status>Failure</Status>\n";
break;
default:
str << " <Status>Unknown</Status>" << endl;
str << " <Status>Unknown</Status>\n";
break;
}
str << " <Label>" << info.label << "</Label>" << endl;
str << " <FileName>" << info.fileName << "</FileName>" << endl;
str << "</AutoRecovery>" << endl;
str << " <Label>" << info.label << "</Label>\n";
str << " <FileName>" << info.fileName << "</FileName>\n";
str << "</AutoRecovery>\n";
file.close();
}
}
+5
View File
@@ -374,7 +374,12 @@ void NetworkRetriever::wgetFinished(int exitCode, QProcess::ExitStatus status)
bool NetworkRetriever::testWget()
{
QProcess proc;
#if QT_VERSION > 0x050000
proc.setProgram(QString::fromLatin1("wget"));
proc.start();
#else
proc.start(QString::fromLatin1("wget"));
#endif
bool ok = proc.state() == QProcess::Running;
proc.kill();
proc.waitForFinished();
+2 -4
View File
@@ -255,8 +255,7 @@ QByteArray PythonOnlineHelp::fileNotFound() const
QString http(QLatin1String("HTTP/1.1 %1 %2\r\n%3\r\n"));
QString httpResponseHeader = http.arg(404).arg(QLatin1String("File not found")).arg(header);
QByteArray res;
res.append(httpResponseHeader);
QByteArray res = httpResponseHeader.toLatin1();
return res;
}
@@ -285,8 +284,7 @@ QByteArray PythonOnlineHelp::loadFailed(const QString& error) const
QString http(QLatin1String("HTTP/1.1 %1 %2\r\n%3\r\n"));
QString httpResponseHeader = http.arg(404).arg(QLatin1String("File not found")).arg(header);
QByteArray res;
res.append(httpResponseHeader);
QByteArray res = httpResponseHeader.toLatin1();
return res;
}
+2 -3
View File
@@ -36,7 +36,7 @@
# include <QTimer>
#endif
#include <QDirModel>
#include <QFileSystemModel>
#include <Base/Console.h>
#include <App/Document.h>
@@ -56,8 +56,7 @@ using namespace Gui;
ProjectWidget::ProjectWidget(QWidget* parent)
: QTreeView(parent)
{
fileModel = new QDirModel(this);
fileModel->setSorting(QDir::DirsFirst | QDir::Type);
fileModel = new QFileSystemModel(this);
setModel(fileModel);
}
+3 -2
View File
@@ -31,7 +31,8 @@
#include <Gui/DockWindow.h>
#include <Gui/Selection.h>
class QDirModel;
class QFileSystemModel;
namespace Gui {
@@ -48,7 +49,7 @@ public:
~ProjectWidget();
private:
QDirModel *fileModel;
QFileSystemModel *fileModel;
};
+13
View File
@@ -116,6 +116,19 @@ void ActionBox::setIcon(const QPixmap & icon)
iconLabel->setFixedSize(icon.size());
}
QPixmap ActionBox::icon() const
{
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
return iconLabel->pixmap(Qt::ReturnByValue);
#else
QPixmap p;
const QPixmap* ptr = iconLabel->pixmap();
if (ptr)
p = *ptr;
return p;
#endif
}
ActionLabel* ActionBox::createItem(QAction * action, QLayout * l)
{
if (!action)
+1 -1
View File
@@ -182,7 +182,7 @@ public:
void setIcon(const QPixmap & icon);
/** Returns icon of the ActionBox.
*/
inline const QPixmap* icon() const { return iconLabel->pixmap(); }
QPixmap icon() const;// { return iconLabel->pixmap(); }
/** Returns header item of the ActionBox.
*/
+2 -2
View File
@@ -106,7 +106,7 @@ void TaskGroup::keyPressEvent ( QKeyEvent * event )
{
case Qt::Key_Down:
{
QKeyEvent ke(QEvent::KeyPress, Qt::Key_Tab, 0);
QKeyEvent ke(QEvent::KeyPress, Qt::Key_Tab, Qt::NoModifier);
QApplication::sendEvent(this, &ke);
return;
}
@@ -131,7 +131,7 @@ void TaskGroup::keyReleaseEvent ( QKeyEvent * event )
{
case Qt::Key_Down:
{
QKeyEvent ke(QEvent::KeyRelease, Qt::Key_Tab, 0);
QKeyEvent ke(QEvent::KeyRelease, Qt::Key_Tab, Qt::NoModifier);
QApplication::sendEvent(this, &ke);
return;
}
+2 -2
View File
@@ -264,7 +264,7 @@ void TaskHeader::keyPressEvent ( QKeyEvent * event )
{
case Qt::Key_Down:
{
QKeyEvent ke(QEvent::KeyPress, Qt::Key_Tab,0 );
QKeyEvent ke(QEvent::KeyPress, Qt::Key_Tab, Qt::NoModifier);
QApplication::sendEvent(this, &ke);
return;
}
@@ -288,7 +288,7 @@ void TaskHeader::keyReleaseEvent ( QKeyEvent * event )
{
case Qt::Key_Down:
{
QKeyEvent ke(QEvent::KeyRelease, Qt::Key_Tab, 0);
QKeyEvent ke(QEvent::KeyRelease, Qt::Key_Tab, Qt::NoModifier);
QApplication::sendEvent(this, &ke);
return;
}
+15 -15
View File
@@ -770,38 +770,38 @@ void AboutDialog::on_copyButton_clicked()
}
}
str << "OS: " << SystemInfo::getOperatingSystem() << deskInfo << endl;
str << "OS: " << SystemInfo::getOperatingSystem() << deskInfo << '\n';
int wordSize = SystemInfo::getWordSizeOfOS();
if (wordSize > 0) {
str << "Word size of OS: " << wordSize << "-bit" << endl;
str << "Word size of OS: " << wordSize << "-bit\n";
}
str << "Word size of " << exe << ": " << QSysInfo::WordSize << "-bit" << endl;
str << "Word size of " << exe << ": " << QSysInfo::WordSize << "-bit\n";
str << "Version: " << major << "." << minor << "." << build;
char *appimage = getenv("APPIMAGE");
if (appimage)
str << " AppImage";
str << endl;
str << '\n';
#if defined(_DEBUG) || defined(DEBUG)
str << "Build type: Debug" << endl;
str << "Build type: Debug\n";
#elif defined(NDEBUG)
str << "Build type: Release" << endl;
str << "Build type: Release\n";
#elif defined(CMAKE_BUILD_TYPE)
str << "Build type: " << CMAKE_BUILD_TYPE << endl;
str << "Build type: " << CMAKE_BUILD_TYPE << '\n';
#else
str << "Build type: Unknown" << endl;
str << "Build type: Unknown\n";
#endif
it = config.find("BuildRevisionBranch");
if (it != config.end())
str << "Branch: " << QString::fromUtf8(it->second.c_str()) << endl;
str << "Branch: " << QString::fromUtf8(it->second.c_str()) << '\n';
it = config.find("BuildRevisionHash");
if (it != config.end())
str << "Hash: " << it->second.c_str() << endl;
str << "Hash: " << it->second.c_str() << '\n';
// report also the version numbers of the most important libraries in FreeCAD
str << "Python version: " << PY_VERSION << endl;
str << "Qt version: " << QT_VERSION_STR << endl;
str << "Coin version: " << COIN_VERSION << endl;
str << "Python version: " << PY_VERSION << '\n';
str << "Qt version: " << QT_VERSION_STR << '\n';
str << "Coin version: " << COIN_VERSION << '\n';
#if defined(HAVE_OCC_VERSION)
str << "OCC version: "
<< OCC_VERSION_MAJOR << "."
@@ -810,12 +810,12 @@ void AboutDialog::on_copyButton_clicked()
#ifdef OCC_VERSION_DEVELOPMENT
<< "." OCC_VERSION_DEVELOPMENT
#endif
<< endl;
<< '\n';
#endif
QLocale loc;
str << "Locale: " << loc.languageToString(loc.language()) << "/"
<< loc.countryToString(loc.country())
<< " (" << loc.name() << ")" << endl;
<< " (" << loc.name() << ")\n";
QClipboard* cb = QApplication::clipboard();
cb->setText(data);
+1 -1
View File
@@ -263,7 +263,7 @@ public:
boost::starts_with(msg.pSubName,editSub))
{
for(auto item : ui->elementList->findItems(
QString::fromLatin1(msg.pSubName-editSub.size()),0))
QString::fromLatin1(msg.pSubName-editSub.size()), Qt::MatchExactly))
item->setSelected(msg.Type==SelectionChanges::AddSelection);
}
}
+2 -3
View File
@@ -101,9 +101,8 @@ void TaskAppearance::slotChangedObject(const Gui::ViewProvider& obj,
// We pick out all the properties for which we need to update this dialog.
std::vector<Gui::ViewProvider*> Provider = getSelection();
std::vector<Gui::ViewProvider*>::const_iterator vp = std::find_if
(Provider.begin(), Provider.end(),
std::bind2nd(std::equal_to<Gui::ViewProvider*>(),
const_cast<Gui::ViewProvider*>(&obj)));
(Provider.begin(), Provider.end(), [&obj](Gui::ViewProvider* v) { return v == &obj; });
if (vp != Provider.end()) {
std::string prop_name = obj.getPropertyName(&prop);
if (prop.getTypeId().isDerivedFrom(App::PropertyInteger::getClassTypeId())) {
+2 -2
View File
@@ -368,14 +368,14 @@ def getSVG(source,
for o in objs:
if Draft.getType(o) == "Space":
spaces.append(o)
elif Draft.getType(o) in ["AngularDimension","LinearDimension","Annotation","Label","Text", "DraftText"]:
elif Draft.getType(o) in ["Dimension","AngularDimension","LinearDimension","Annotation","Label","Text", "DraftText"]:
if isOriented(o,cutplane):
drafts.append(o)
elif o.isDerivedFrom("Part::Part2DObject"):
drafts.append(o)
elif looksLikeDraft(o):
drafts.append(o)
else:
elif not o.isDerivedFrom("App::DocumentObjectGroup"):
nonspaces.append(o)
if Draft.getType(o) == "Window":
windows.append(o)
+5 -5
View File
@@ -170,7 +170,7 @@ def makeWindowPreset(windowtype,width,height,h1,h2,h3,w1,w2,o1,o2,placement=None
fw = str(w2)
if w2 == w1:
fw = "0.00+V"
wp.extend(["InnerFrame","Frame","Wire2,Wire3",fw,str(o2)+"+V"])
wp.extend(["InnerFrame","Frame","Wire2,Wire3,Edge8,Mode1",fw,str(o2)+"+V"])
wp.extend(["InnerGlass","Glass panel","Wire3",str(w2/gla),str(o2+w2/2)+"+V"])
elif windowtype == "Open 2-pane":
@@ -220,9 +220,9 @@ def makeWindowPreset(windowtype,width,height,h1,h2,h3,w1,w2,o1,o2,placement=None
fw = str(w2)
if w2 == w1:
fw = "0.00+V"
wp.extend(["LeftFrame","Frame","Wire2,Wire3",fw,str(o2)+"+V"])
wp.extend(["LeftFrame","Frame","Wire2,Wire3,Edge8,Mode1",fw,str(o2)+"+V"])
wp.extend(["LeftGlass","Glass panel","Wire3",str(w2/gla),str(o2+w2/2)+"+V"])
wp.extend(["RightFrame","Frame","Wire4,Wire5",fw,str(o2)+"+V"])
wp.extend(["RightFrame","Frame","Wire4,Wire5,Edge6,Mode2",fw,str(o2)+"+V"])
wp.extend(["RightGlass","Glass panel","Wire5",str(w2/gla),str(o2+w2/2)+"+V"])
elif windowtype == "Sash 2-pane":
@@ -433,7 +433,7 @@ def makeWindowPreset(windowtype,width,height,h1,h2,h3,w1,w2,o1,o2,placement=None
elif windowtype == "Simple door":
wp = doorFrame(s,width,height,h1,w1,o1)
wp.extend(["Door","Solid panel","Wire1",str(w2),str(o2)+"+V"])
wp.extend(["Door","Solid panel","Wire1,Edge8,Mode2",str(w2),str(o2)+"+V"])
elif windowtype == "Glass door":
@@ -463,7 +463,7 @@ def makeWindowPreset(windowtype,width,height,h1,h2,h3,w1,w2,o1,o2,placement=None
fw = str(w2)
if w2 == w1:
fw = "0.00+V"
wp.extend(["InnerFrame","Frame","Wire2,Wire3",fw,str(o2)+"+V"])
wp.extend(["InnerFrame","Frame","Wire2,Wire3,Edge8,Mode1",fw,str(o2)+"+V"])
wp.extend(["InnerGlass","Glass panel","Wire3",str(w2/gla),str(o2+w2/2)+"+V"])
return (s,wp)
+24 -4
View File
@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>200</width>
<height>547</height>
<width>210</width>
<height>568</height>
</rect>
</property>
<property name="windowTitle">
@@ -192,7 +192,7 @@ will be moved to the center of the view</string>
</property>
</widget>
</item>
<item row="3" column="1">
<item row="4" column="1">
<widget class="QSpinBox" name="fieldSnapRadius">
<property name="toolTip">
<string>The distance at which a point can be snapped to
@@ -201,7 +201,7 @@ value by using the [ and ] keys while drawing</string>
</property>
</widget>
</item>
<item row="3" column="0">
<item row="4" column="0">
<widget class="QLabel" name="label_6">
<property name="toolTip">
<string>The distance at which a point can be snapped to
@@ -213,6 +213,26 @@ value by using the [ and ] keys while drawing</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_8">
<property name="text">
<string>Grid extension</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QSpinBox" name="fieldGridExtension">
<property name="suffix">
<string> lines</string>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>9999</number>
</property>
</widget>
</item>
</layout>
</item>
<item>
@@ -102,6 +102,7 @@ class Draft_SelectPlane:
q = FreeCAD.Units.Quantity(self.param.GetFloat("gridSpacing", 1.0), FreeCAD.Units.Length)
self.taskd.form.fieldGridSpacing.setText(q.UserString)
self.taskd.form.fieldGridMainLine.setValue(self.param.GetInt("gridEvery", 10))
self.taskd.form.fieldGridExtension.setValue(self.param.GetInt("gridSize", 100))
self.taskd.form.fieldSnapRadius.setValue(self.param.GetInt("snapRange", 8))
# Set icons
@@ -126,6 +127,7 @@ class Draft_SelectPlane:
self.taskd.form.buttonPrevious.clicked.connect(self.onClickPrevious)
self.taskd.form.fieldGridSpacing.textEdited.connect(self.onSetGridSize)
self.taskd.form.fieldGridMainLine.valueChanged.connect(self.onSetMainline)
self.taskd.form.fieldGridExtension.valueChanged.connect(self.onSetExtension)
self.taskd.form.fieldSnapRadius.valueChanged.connect(self.onSetSnapRadius)
# Try to find a WP from the current selection
@@ -475,6 +477,13 @@ class Draft_SelectPlane:
if hasattr(FreeCADGui, "Snapper"):
FreeCADGui.Snapper.setGrid()
def onSetExtension(self, i):
"""Execute when setting grid extension."""
if i > 1:
self.param.SetInt("gridSize", i)
if hasattr(FreeCADGui, "Snapper"):
FreeCADGui.Snapper.setGrid()
def onSetSnapRadius(self, i):
"""Execute when setting the snap radius."""
self.param.SetInt("snapRange", i)
+4 -2
View File
@@ -893,14 +893,16 @@ void MeshAlgorithm::ResetPointFlag (MeshPoint::TFlagType tF) const
unsigned long MeshAlgorithm::CountFacetFlag (MeshFacet::TFlagType tF) const
{
MeshIsFlag<MeshFacet> flag;
return std::count_if(_rclMesh._aclFacetArray.begin(), _rclMesh._aclFacetArray.end(),
std::bind2nd(MeshIsFlag<MeshFacet>(), tF));
[flag, tF](const MeshFacet& f) { return flag(f, tF);});
}
unsigned long MeshAlgorithm::CountPointFlag (MeshPoint::TFlagType tF) const
{
MeshIsFlag<MeshPoint> flag;
return std::count_if(_rclMesh._aclPointArray.begin(), _rclMesh._aclPointArray.end(),
std::bind2nd(MeshIsFlag<MeshPoint>(), tF));
[flag, tF](const MeshPoint& f) { return flag(f, tF);});
}
void MeshAlgorithm::GetFacetsFromToolMesh( const MeshKernel& rToolMesh, const Base::Vector3f& rcDir, std::vector<unsigned long> &raclCutted ) const
+3 -1
View File
@@ -208,7 +208,9 @@ void MeshBuilder::RemoveUnreferencedPoints()
_meshKernel._aclPointArray[it->_aulPoints[i]].ResetInvalid();
}
unsigned long uValidPts = std::count_if(_meshKernel._aclPointArray.begin(), _meshKernel._aclPointArray.end(), std::mem_fun_ref(&MeshPoint::IsValid));
unsigned long uValidPts = std::count_if(_meshKernel._aclPointArray.begin(),
_meshKernel._aclPointArray.end(),
[](const MeshPoint& p) { return p.IsValid(); });
if ( uValidPts < _meshKernel.CountPoints() )
_meshKernel.RemoveInvalids();
}
+2 -2
View File
@@ -1158,7 +1158,7 @@ bool MeshEvalRangePoint::Evaluate()
unsigned long ulCtPoints = _rclMesh.CountPoints();
for (MeshFacetArray::_TConstIterator it = rFaces.begin(); it != rFaces.end(); ++it) {
if (std::find_if(it->_aulPoints, it->_aulPoints + 3, std::bind2nd(std::greater_equal<unsigned long>(), ulCtPoints)) < it->_aulPoints + 3)
if (std::find_if(it->_aulPoints, it->_aulPoints + 3, [ulCtPoints](unsigned long i) { return i >= ulCtPoints; }) < it->_aulPoints + 3)
return false;
}
@@ -1173,7 +1173,7 @@ std::vector<unsigned long> MeshEvalRangePoint::GetIndices() const
unsigned long ind=0;
for (MeshFacetArray::_TConstIterator it = rFaces.begin(); it != rFaces.end(); ++it, ind++) {
if (std::find_if(it->_aulPoints, it->_aulPoints + 3, std::bind2nd(std::greater_equal<unsigned long>(), ulCtPoints)) < it->_aulPoints + 3)
if (std::find_if(it->_aulPoints, it->_aulPoints + 3, [ulCtPoints](unsigned long i) { return i >= ulCtPoints; }) < it->_aulPoints + 3)
aInds.push_back(ind);
}
+4 -1
View File
@@ -226,7 +226,10 @@ std::vector<unsigned long> MeshEvalOrientation::GetIndices() const
// if the mesh consists of several topologic independent components
// We can search from position 'iTri' on because all elements _before_ are already visited
// what we know from the previous iteration.
iTri = std::find_if(iTri, iEnd, std::bind2nd(MeshIsNotFlag<MeshFacet>(), MeshFacet::VISIT));
MeshIsNotFlag<MeshFacet> flag;
iTri = std::find_if(iTri, iEnd, [flag](const MeshFacet& f) {
return flag(f, MeshFacet::VISIT);
});
if (iTri < iEnd)
ulStartFacet = iTri - iBeg;
+12 -10
View File
@@ -967,17 +967,17 @@ bool MeshInput::LoadPLY (std::istream &inp)
// check if valid 3d points
Property property;
std::size_t num_x = std::count_if(vertex_props.begin(), vertex_props.end(),
std::bind2nd(property, "x"));
[&property](const std::pair<std::string, int>& p) { return property(p, "x"); });
if (num_x != 1)
return false;
std::size_t num_y = std::count_if(vertex_props.begin(), vertex_props.end(),
std::bind2nd(property, "y"));
[&property](const std::pair<std::string, int>& p) { return property(p, "y"); });
if (num_y != 1)
return false;
std::size_t num_z = std::count_if(vertex_props.begin(), vertex_props.end(),
std::bind2nd(property, "z"));
[&property](const std::pair<std::string, int>& p) { return property(p, "z"); });
if (num_z != 1)
return false;
@@ -993,11 +993,11 @@ bool MeshInput::LoadPLY (std::istream &inp)
// check if valid colors are set
std::size_t num_r = std::count_if(vertex_props.begin(), vertex_props.end(),
std::bind2nd(property, "red"));
[&property](const std::pair<std::string, int>& p) { return property(p, "red"); });
std::size_t num_g = std::count_if(vertex_props.begin(), vertex_props.end(),
std::bind2nd(property, "green"));
[&property](const std::pair<std::string, int>& p) { return property(p, "green"); });
std::size_t num_b = std::count_if(vertex_props.begin(), vertex_props.end(),
std::bind2nd(property, "blue"));
[&property](const std::pair<std::string, int>& p) { return property(p, "blue"); });
std::size_t rgb_colors = num_r + num_g + num_b;
if (rgb_colors != 0 && rgb_colors != 3)
return false;
@@ -3501,8 +3501,9 @@ void MeshCleanup::RemoveInvalids()
void MeshCleanup::RemoveInvalidFacets()
{
MeshIsFlag<MeshFacet> flag;
std::size_t countInvalidFacets = std::count_if(facetArray.begin(), facetArray.end(),
std::bind2nd(MeshIsFlag<MeshFacet>(), MeshFacet::INVALID));
[flag](const MeshFacet& f) { return flag(f, MeshFacet::INVALID); });
if (countInvalidFacets > 0) {
// adjust the material array if needed
@@ -3522,15 +3523,16 @@ void MeshCleanup::RemoveInvalidFacets()
MeshFacetArray copy_facets(facetArray.size() - countInvalidFacets);
// copy all valid facets to the new array
std::remove_copy_if(facetArray.begin(), facetArray.end(), copy_facets.begin(),
std::bind2nd(MeshIsFlag<MeshFacet>(), MeshFacet::INVALID));
[flag](const MeshFacet& f) { return flag(f, MeshFacet::INVALID); });
facetArray.swap(copy_facets);
}
}
void MeshCleanup::RemoveInvalidPoints()
{
MeshIsFlag<MeshPoint> flag;
std::size_t countInvalidPoints = std::count_if(pointArray.begin(), pointArray.end(),
std::bind2nd(MeshIsFlag<MeshPoint>(), MeshPoint::INVALID));
[flag](const MeshPoint& p) { return flag(p, MeshPoint::INVALID); });
if (countInvalidPoints > 0) {
// generate array of decrements
std::vector<unsigned long> decrements;
@@ -3573,7 +3575,7 @@ void MeshCleanup::RemoveInvalidPoints()
MeshPointArray copy_points(validPoints);
// copy all valid facets to the new array
std::remove_copy_if(pointArray.begin(), pointArray.end(), copy_points.begin(),
std::bind2nd(MeshIsFlag<MeshPoint>(), MeshPoint::INVALID));
[flag](const MeshPoint& p) { return flag(p, MeshPoint::INVALID); });
pointArray.swap(copy_points);
}
}
+9 -6
View File
@@ -259,8 +259,10 @@ unsigned long MeshKernel::AddFacets(const std::vector<MeshFacet> &rclFAry,
// Do not insert directly to the data structure because we should get the correct size of new
// facets, otherwise std::vector reallocates too much memory which can't be freed so easily
unsigned long countValid = std::count_if(rclFAry.begin(), rclFAry.end(),
std::bind2nd(MeshIsNotFlag<MeshFacet>(), MeshFacet::INVALID));
MeshIsNotFlag<MeshFacet> flag;
unsigned long countValid = std::count_if(rclFAry.begin(), rclFAry.end(), [flag](const MeshFacet& f) {
return flag(f, MeshFacet::INVALID);
});
_aclFacetArray.reserve( _aclFacetArray.size() + countValid );
// now start inserting the facets to the data structure and set the correct neighbourhood as well
unsigned long startIndex = CountFacets();
@@ -374,8 +376,9 @@ void MeshKernel::Merge(const MeshPointArray& rPoints, const MeshFacetArray& rFac
this->_aclFacetArray.push_back(face);
}
unsigned long countNewPoints = std::count_if(increments.begin(), increments.end(),
std::bind2nd(std::greater<unsigned long>(), 0));
unsigned long countNewPoints = std::count_if(increments.begin(), increments.end(),[](unsigned long v) {
return v > 0;
});
// Reserve the additional memory to append the new points
unsigned long index = this->_aclPointArray.size();
this->_aclPointArray.reserve(this->_aclPointArray.size() + countNewPoints);
@@ -657,7 +660,7 @@ void MeshKernel::RemoveInvalids ()
// delete point, number of valid points
unsigned long ulNewPts = std::count_if(_aclPointArray.begin(), _aclPointArray.end(),
std::mem_fun_ref(&MeshPoint::IsValid));
[](const MeshPoint& p) { return p.IsValid(); });
// tmp. point array
MeshPointArray aclTempPt(ulNewPts);
MeshPointArray::_TIterator pPTemp = aclTempPt.begin();
@@ -702,7 +705,7 @@ void MeshKernel::RemoveInvalids ()
// delete facets, number of valid facets
unsigned long ulDelFacets = std::count_if(_aclFacetArray.begin(), _aclFacetArray.end(),
std::mem_fun_ref(&MeshFacet::IsValid));
[](const MeshFacet& f) { return f.IsValid(); });
MeshFacetArray aclFArray(ulDelFacets);
MeshFacetArray::_TIterator pFTemp = aclFArray.begin();
pFEnd = _aclFacetArray.end();
+7 -4
View File
@@ -556,8 +556,10 @@ void MeshSegmentAlgorithm::FindSegments(std::vector<MeshSurfaceSegmentPtr>& segm
cAlgo.ResetFacetsFlag(resetVisited, MeshCore::MeshFacet::VISIT);
resetVisited.clear();
iCur = std::find_if(iBeg, iEnd, std::bind2nd(MeshCore::MeshIsNotFlag<MeshCore::MeshFacet>(),
MeshCore::MeshFacet::VISIT));
MeshCore::MeshIsNotFlag<MeshCore::MeshFacet> flag;
iCur = std::find_if(iBeg, iEnd, [flag](const MeshFacet& f) {
return flag(f, MeshFacet::VISIT);
});
if (iCur < iEnd)
startFacet = iCur - iBeg;
else
@@ -580,8 +582,9 @@ void MeshSegmentAlgorithm::FindSegments(std::vector<MeshSurfaceSegmentPtr>& segm
}
// search for the next start facet
iCur = std::find_if(iCur, iEnd, std::bind2nd(MeshCore::MeshIsNotFlag<MeshCore::MeshFacet>(),
MeshCore::MeshFacet::VISIT));
iCur = std::find_if(iCur, iEnd, [flag](const MeshFacet& f) {
return flag(f, MeshFacet::VISIT);
});
if (iCur < iEnd)
startFacet = iCur - iBeg;
else
+7 -2
View File
@@ -1587,7 +1587,10 @@ void MeshComponents::SearchForComponents(TMode tMode, const std::vector<unsigned
// start from the first not visited facet
ulVisited = cAlgo.CountFacetFlag(MeshFacet::VISIT);
iTri = std::find_if(iTri, iEnd, std::bind2nd(MeshIsNotFlag<MeshFacet>(), MeshFacet::VISIT));
MeshIsNotFlag<MeshFacet> flag;
iTri = std::find_if(iTri, iEnd, [flag](const MeshFacet& f) {
return flag(f, MeshFacet::VISIT);
});
ulStartFacet = iTri - iBeg;
// visitor
@@ -1611,7 +1614,9 @@ void MeshComponents::SearchForComponents(TMode tMode, const std::vector<unsigned
// if the mesh consists of several topologic independent components
// We can search from position 'iTri' on because all elements _before_ are already visited
// what we know from the previous iteration.
iTri = std::find_if(iTri, iEnd, std::bind2nd(MeshIsNotFlag<MeshFacet>(), MeshFacet::VISIT));
iTri = std::find_if(iTri, iEnd, [flag](const MeshFacet& f) {
return flag(f, MeshFacet::VISIT);
});
if (iTri < iEnd)
ulStartFacet = iTri - iBeg;
+8 -6
View File
@@ -685,8 +685,9 @@ void MeshObject::deletedFacets(const std::vector<unsigned long>& remFacets)
// remove the invalid indices
std::sort(segm.begin(), segm.end());
std::vector<unsigned long>::iterator ft = std::find_if
(segm.begin(), segm.end(),
std::bind2nd(std::equal_to<unsigned long>(), ULONG_MAX));
(segm.begin(), segm.end(), [](unsigned long v) {
return v == ULONG_MAX;
});
if (ft != segm.end())
segm.erase(ft, segm.end());
it->_indices = segm;
@@ -839,8 +840,9 @@ unsigned long MeshObject::getPointDegree(const std::vector<unsigned long>& indic
pointDeg[face._aulPoints[2]]--;
}
unsigned long countInvalids = std::count_if(pointDeg.begin(), pointDeg.end(),
std::bind2nd(std::equal_to<unsigned long>(), 0));
unsigned long countInvalids = std::count_if(pointDeg.begin(), pointDeg.end(), [](unsigned long v) {
return v == 0;
});
point_degree.swap(pointDeg);
return countInvalids;
@@ -1386,8 +1388,8 @@ void MeshObject::removeSelfIntersections(const std::vector<unsigned long>& indic
// make sure that the number of indices is even and are in range
if (indices.size() % 2 != 0)
return;
if (std::find_if(indices.begin(), indices.end(),
std::bind2nd(std::greater_equal<unsigned long>(), _kernel.CountFacets())) < indices.end())
unsigned long cntfacets = _kernel.CountFacets();
if (std::find_if(indices.begin(), indices.end(), [cntfacets](unsigned long v) { return v >= cntfacets; }) < indices.end())
return;
std::vector<std::pair<unsigned long, unsigned long> > selfIntersections;
std::vector<unsigned long>::const_iterator it;
+4 -3
View File
@@ -2047,9 +2047,10 @@ void ViewProviderMesh::invertSelection()
{
const Mesh::MeshObject& rMesh = static_cast<Mesh::Feature*>(pcObject)->Mesh.getValue();
const MeshCore::MeshFacetArray& faces = rMesh.getKernel().GetFacets();
unsigned long num_notsel = std::count_if(faces.begin(), faces.end(),
std::bind2nd(MeshCore::MeshIsNotFlag<MeshCore::MeshFacet>(),
MeshCore::MeshFacet::SELECTED));
MeshCore::MeshIsNotFlag<MeshCore::MeshFacet> flag;
unsigned long num_notsel = std::count_if(faces.begin(), faces.end(), [flag](const MeshCore::MeshFacet& f) {
return flag(f, MeshCore::MeshFacet::SELECTED);
});
std::vector<unsigned long> notselect;
notselect.reserve(num_notsel);
MeshCore::MeshFacetArray::_TConstIterator beg = faces.begin();
+5
View File
@@ -108,6 +108,7 @@
#include "Mod/Part/App/BRepOffsetAPI_MakeFillingPy.h"
#include "Mod/Part/App/PartFeaturePy.h"
#include "Mod/Part/App/AttachEnginePy.h"
#include <Mod/Part/App/BRepFeat/MakePrismPy.h>
#include <Mod/Part/App/Geom2d/ArcOfCircle2dPy.h>
#include <Mod/Part/App/Geom2d/ArcOfConic2dPy.h>
#include <Mod/Part/App/Geom2d/ArcOfEllipse2dPy.h>
@@ -376,6 +377,10 @@ PyMOD_INIT_FUNC(Part)
Base::Interpreter().addType(&Part::GeometryBoolExtensionPy ::Type,partModule,"GeometryBoolExtension");
Base::Interpreter().addType(&Part::GeometryDoubleExtensionPy ::Type,partModule,"GeometryDoubleExtension");
// BRepFeat package
PyObject* brepfeatModule(module.getAttr("BRepFeat").ptr());
Base::Interpreter().addType(&Part::MakePrismPy::Type,brepfeatModule,"MakePrism");
// BRepOffsetAPI package
PyObject* brepOffsetApiModule(module.getAttr("BRepOffsetAPI").ptr());
Base::Interpreter().addType(&Part::BRepOffsetAPI_MakePipeShellPy::Type,brepOffsetApiModule,"MakePipeShell");
+16 -41
View File
@@ -271,6 +271,17 @@ PartExport std::list<TopoDS_Edge> sort_Edges(double tol3d, std::list<TopoDS_Edge
}
namespace Part {
class BRepFeatModule : public Py::ExtensionModule<BRepFeatModule>
{
public:
BRepFeatModule() : Py::ExtensionModule<BRepFeatModule>("BRepFeat")
{
initialize("This is a module working with the BRepFeat package."); // register with Python
}
virtual ~BRepFeatModule() {}
};
class BRepOffsetAPIModule : public Py::ExtensionModule<BRepOffsetAPIModule>
{
public:
@@ -317,6 +328,7 @@ public:
class Module : public Py::ExtensionModule<Module>
{
BRepFeatModule brepFeat;
BRepOffsetAPIModule brepOffsetApi;
Geom2dModule geom2d;
GeomPlateModule geomPlate;
@@ -537,6 +549,7 @@ public:
);
initialize("This is a module working with shapes."); // register with Python
PyModule_AddObject(m_module, "BRepFeat", brepFeat.module().ptr());
PyModule_AddObject(m_module, "BRepOffsetAPI", brepOffsetApi.module().ptr());
PyModule_AddObject(m_module, "Geom2d", geom2d.module().ptr());
PyModule_AddObject(m_module, "GeomPlate", geomPlate.module().ptr());
@@ -912,17 +925,8 @@ private:
fm->Build();
if(fm->Shape().IsNull())
return Py::asObject(new TopoShapePy(new TopoShape(fm->Shape())));
switch(fm->Shape().ShapeType()){
case TopAbs_FACE:
return Py::asObject(new TopoShapeFacePy(new TopoShape(fm->Shape())));
case TopAbs_COMPOUND:
return Py::asObject(new TopoShapeCompoundPy(new TopoShape(fm->Shape())));
default:
return Py::asObject(new TopoShapePy(new TopoShape(fm->Shape())));
}
TopoShape topo(fm->Shape());
return Py::asObject(topo.getPyObject());
}
throw Py::Exception(Base::BaseExceptionFreeCADError, std::string("Argument type signature not recognized. Should be either (list, string), or (shape, string)"));
@@ -2012,36 +2016,7 @@ private:
PyObject *object;
if (PyArg_ParseTuple(args.ptr(),"O!",&(Part::TopoShapePy::Type), &object)) {
TopoShape* ptr = static_cast<TopoShapePy*>(object)->getTopoShapePtr();
TopoDS_Shape shape = ptr->getShape();
if (!shape.IsNull()) {
TopAbs_ShapeEnum type = shape.ShapeType();
switch (type)
{
case TopAbs_COMPOUND:
return Py::asObject(new TopoShapeCompoundPy(new TopoShape(shape)));
case TopAbs_COMPSOLID:
return Py::asObject(new TopoShapeCompSolidPy(new TopoShape(shape)));
case TopAbs_SOLID:
return Py::asObject(new TopoShapeSolidPy(new TopoShape(shape)));
case TopAbs_SHELL:
return Py::asObject(new TopoShapeShellPy(new TopoShape(shape)));
case TopAbs_FACE:
return Py::asObject(new TopoShapeFacePy(new TopoShape(shape)));
case TopAbs_WIRE:
return Py::asObject(new TopoShapeWirePy(new TopoShape(shape)));
case TopAbs_EDGE:
return Py::asObject(new TopoShapeEdgePy(new TopoShape(shape)));
case TopAbs_VERTEX:
return Py::asObject(new TopoShapeVertexPy(new TopoShape(shape)));
case TopAbs_SHAPE:
return Py::asObject(new TopoShapePy(new TopoShape(shape)));
default:
break;
}
}
else {
throw Py::Exception(PartExceptionOCCError, "empty shape");
}
return Py::asObject(ptr->getPyObject());
}
throw Py::Exception();
+100
View File
@@ -0,0 +1,100 @@
<?xml version="1.0" encoding="utf-8"?>
<GenerateModel xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="generateMetaModel_Module.xsd">
<PythonExport
Father="PyObjectBase"
Name="MakePrismPy"
PythonName="Part.BRepFeat.MakePrism"
Twin="BRepFeat_MakePrism"
TwinPointer="BRepFeat_MakePrism"
Include="BRepFeat_MakePrism.hxx"
Namespace="Part"
FatherInclude="Base/PyObjectBase.h"
FatherNamespace="Base"
Constructor="true"
Delete="true">
<Documentation>
<Author Licence="LGPL" Name="Werner Mayer" EMail="wmayer[at]users.sourceforge.net" />
<UserDocu>Describes functions to build prism features.</UserDocu>
</Documentation>
<Methode Name="init" Keyword="true">
<Documentation>
<UserDocu>
Initializes this algorithm for building prisms along surfaces.
A face Pbase is selected in the shape Sbase
to serve as the basis for the prism. The orientation
of the prism will be defined by the vector Direction.
Fuse offers a choice between:
- removing matter with a Boolean cut using the setting 0
- adding matter with Boolean fusion using the setting 1.
The sketch face Skface serves to determine
the type of operation. If it is inside the basis
shape, a local operation such as glueing can be performed.
</UserDocu>
</Documentation>
</Methode>
<Methode Name="add" Keyword="true">
<Documentation>
<UserDocu>
Indicates that the edge will slide on the face.
Raises ConstructionError if the face does not belong to the
basis shape, or the edge to the prismed shape.
</UserDocu>
</Documentation>
</Methode>
<Methode Name="perform" Keyword="true">
<Documentation>
<UserDocu></UserDocu>
</Documentation>
</Methode>
<Methode Name="performUntilEnd">
<Documentation>
<UserDocu>
Realizes a semi-infinite prism, limited by the
position of the prism base. All other faces extend infinitely.
</UserDocu>
</Documentation>
</Methode>
<Methode Name="performFromEnd">
<Documentation>
<UserDocu>
Realizes a semi-infinite prism, limited by the face Funtil.
</UserDocu>
</Documentation>
</Methode>
<Methode Name="performThruAll">
<Documentation>
<UserDocu>
Builds an infinite prism. The infinite descendants will not be kept in the result.
</UserDocu>
</Documentation>
</Methode>
<Methode Name="performUntilHeight">
<Documentation>
<UserDocu>
Assigns both a limiting shape, Until from TopoDS_Shape
and a height, Length at which to stop generation of the prism feature.
</UserDocu>
</Documentation>
</Methode>
<Methode Name="curves" Const="true">
<Documentation>
<UserDocu>
Returns the list of curves S parallel to the axis of the prism.
</UserDocu>
</Documentation>
</Methode>
<Methode Name="barycCurve" Const="true">
<Documentation>
<UserDocu>
Generates a curve along the center of mass of the primitive.
</UserDocu>
</Documentation>
</Methode>
<Methode Name="shape" Const="true">
<Documentation>
<UserDocu>Returns a shape built by the shape construction algorithm.</UserDocu>
</Documentation>
</Methode>
</PythonExport>
</GenerateModel>
@@ -0,0 +1,339 @@
/***************************************************************************
* Copyright (c) 2020 Werner Mayer <wmayer[at]users.sourceforge.net> *
* *
* This file is part of the FreeCAD CAx development system. *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This library 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 this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA *
* *
***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
# include <TopoDS.hxx>
# include <TopoDS_Edge.hxx>
# include <TopoDS_Face.hxx>
#endif
#include "BRepFeat/MakePrismPy.h"
#include "BRepFeat/MakePrismPy.cpp"
#include "Geometry.h"
#include "TopoShapeEdgePy.h"
#include "TopoShapeFacePy.h"
#include <Base/VectorPy.h>
using namespace Part;
PyObject *MakePrismPy::PyMake(struct _typeobject *, PyObject *, PyObject *) // Python wrapper
{
// create a new instance of MakePrismPy
return new MakePrismPy(nullptr);
}
// constructor method
int MakePrismPy::PyInit(PyObject* args, PyObject* kwds)
{
PyObject* Sbase;
PyObject* Pbase;
PyObject* Skface;
PyObject* Direction;
int Fuse;
PyObject* Modify;
static char* keywords[] = {"Sbase", "Pbase", "Skface", "Direction", "Fuse", "Modifiy", nullptr};
if (PyArg_ParseTupleAndKeywords(args, kwds, "O!O!O!O!iO!", keywords,
&(TopoShapePy::Type), &Sbase,
&(TopoShapePy::Type), &Pbase,
&(TopoShapeFacePy::Type), &Skface,
&(Base::VectorPy::Type), &Direction, &Fuse,
&(PyBool_Type), &Modify)) {
try {
TopoDS_Shape sbase = static_cast<TopoShapePy*>(Sbase)->getTopoShapePtr()->getShape();
TopoDS_Shape pbase = static_cast<TopoShapePy*>(Pbase)->getTopoShapePtr()->getShape();
TopoDS_Face skface = TopoDS::Face(static_cast<TopoShapePy*>(Skface)->getTopoShapePtr()->getShape());
Base::Vector3d dir = static_cast<Base::VectorPy*>(Direction)->value();
std::unique_ptr<BRepFeat_MakePrism> ptr(new BRepFeat_MakePrism(sbase, pbase, skface, gp_Dir(dir.x, dir.y, dir.z), Fuse,
PyObject_IsTrue(Modify) ? Standard_True : Standard_False));
setTwinPointer(ptr.release());
return 0;
}
catch (const Standard_Failure& e) {
PyErr_SetString(PyExc_RuntimeError, e.GetMessageString());
return -1;
}
}
PyErr_Clear();
if (PyArg_ParseTuple(args, "")) {
try {
std::unique_ptr<BRepFeat_MakePrism> ptr(new BRepFeat_MakePrism());
setTwinPointer(ptr.release());
return 0;
}
catch (const Standard_Failure& e) {
PyErr_SetString(PyExc_RuntimeError, e.GetMessageString());
return -1;
}
}
PyErr_SetString(PyExc_TypeError, "supported signatures:\n"
"MakePrism()\n"
"MakePrism(Sbase [shape], Pbase [shape], Skface [face], Direction [Vector], Fuse [int={0, 1}], Modify [bool])\n");
return -1;
}
// returns a string which represents the object e.g. when printed in python
std::string MakePrismPy::representation(void) const
{
return std::string("<BRepFeat_MakePrism object>");
}
PyObject* MakePrismPy::init(PyObject *args, PyObject* kwds)
{
PyObject* Sbase;
PyObject* Pbase;
PyObject* Skface;
PyObject* Direction;
int Fuse;
PyObject* Modify;
static char* keywords[] = {"Sbase", "Pbase", "Skface", "Direction", "Fuse", "Modifiy", nullptr};
if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!O!O!O!iO!", keywords,
&(TopoShapePy::Type), &Sbase,
&(TopoShapePy::Type), &Pbase,
&(TopoShapeFacePy::Type), &Skface,
&(Base::VectorPy::Type), &Direction, &Fuse,
&(PyBool_Type), &Modify))
return nullptr;
try {
TopoDS_Shape sbase = static_cast<TopoShapePy*>(Sbase)->getTopoShapePtr()->getShape();
TopoDS_Shape pbase = static_cast<TopoShapePy*>(Pbase)->getTopoShapePtr()->getShape();
TopoDS_Face skface = TopoDS::Face(static_cast<TopoShapePy*>(Skface)->getTopoShapePtr()->getShape());
Base::Vector3d dir = static_cast<Base::VectorPy*>(Direction)->value();
getBRepFeat_MakePrismPtr()->Init(sbase, pbase, skface, gp_Dir(dir.x, dir.y, dir.z), Fuse,
PyObject_IsTrue(Modify) ? Standard_True : Standard_False);
Py_Return;
}
catch (const Standard_Failure& e) {
PyErr_SetString(PyExc_RuntimeError, e.GetMessageString());
return nullptr;
}
}
PyObject* MakePrismPy::add(PyObject *args, PyObject* kwds)
{
PyObject* Edge;
PyObject* Face;
static char* keywords[] = {"Edge", "Face", nullptr};
if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!O!", keywords,
&(TopoShapeEdgePy::Type), &Edge,
&(TopoShapeFacePy::Type), &Face))
return nullptr;
try {
TopoDS_Edge edge = TopoDS::Edge(static_cast<TopoShapePy*>(Edge)->getTopoShapePtr()->getShape());
TopoDS_Face face = TopoDS::Face(static_cast<TopoShapePy*>(Face)->getTopoShapePtr()->getShape());
getBRepFeat_MakePrismPtr()->Add(edge, face);
Py_Return;
}
catch (const Standard_Failure& e) {
PyErr_SetString(PyExc_RuntimeError, e.GetMessageString());
return nullptr;
}
}
PyObject* MakePrismPy::perform(PyObject *args, PyObject* kwds)
{
PyObject* From;
PyObject* Until;
static char* keywords_fu[] = {"From", "Until", nullptr};
if (PyArg_ParseTupleAndKeywords(args, kwds, "O!O!", keywords_fu,
&(TopoShapePy::Type), &From,
&(TopoShapePy::Type), &Until)) {
try {
TopoDS_Shape from = static_cast<TopoShapePy*>(From)->getTopoShapePtr()->getShape();
TopoDS_Shape until = static_cast<TopoShapePy*>(Until)->getTopoShapePtr()->getShape();
getBRepFeat_MakePrismPtr()->Perform(from, until);
Py_Return;
}
catch (const Standard_Failure& e) {
PyErr_SetString(PyExc_RuntimeError, e.GetMessageString());
return nullptr;
}
}
PyErr_Clear();
static char* keywords_u[] = {"Until", nullptr};
if (PyArg_ParseTupleAndKeywords(args, kwds, "O!", keywords_u,
&(TopoShapePy::Type), &Until)) {
try {
TopoDS_Shape until = static_cast<TopoShapePy*>(Until)->getTopoShapePtr()->getShape();
getBRepFeat_MakePrismPtr()->Perform(until);
Py_Return;
}
catch (const Standard_Failure& e) {
PyErr_SetString(PyExc_RuntimeError, e.GetMessageString());
return nullptr;
}
}
PyErr_Clear();
double length;
static char* keywords_l[] = {"Length", nullptr};
if (PyArg_ParseTupleAndKeywords(args, kwds, "d", keywords_l, &length)) {
try {
getBRepFeat_MakePrismPtr()->Perform(length);
Py_Return;
}
catch (const Standard_Failure& e) {
PyErr_SetString(PyExc_RuntimeError, e.GetMessageString());
return nullptr;
}
}
PyErr_SetString(PyExc_TypeError, "supported signatures:\n"
"perform(From [shape], Until [shape])\n"
"perform(Until [shape])\n"
"perform(Length [float])\n");
return nullptr;
}
PyObject* MakePrismPy::performUntilEnd(PyObject *args)
{
if (!PyArg_ParseTuple(args, ""))
return nullptr;
try {
getBRepFeat_MakePrismPtr()->PerformUntilEnd();
Py_Return;
}
catch (const Standard_Failure& e) {
PyErr_SetString(PyExc_RuntimeError, e.GetMessageString());
return nullptr;
}
}
PyObject* MakePrismPy::performFromEnd(PyObject *args)
{
PyObject* Until;
if (!PyArg_ParseTuple(args, "O!", &(TopoShapePy::Type), &Until))
return nullptr;
try {
TopoDS_Shape until = static_cast<TopoShapePy*>(Until)->getTopoShapePtr()->getShape();
getBRepFeat_MakePrismPtr()->PerformFromEnd(until);
Py_Return;
}
catch (const Standard_Failure& e) {
PyErr_SetString(PyExc_RuntimeError, e.GetMessageString());
return nullptr;
}
}
PyObject* MakePrismPy::performThruAll(PyObject *args)
{
if (!PyArg_ParseTuple(args, ""))
return nullptr;
try {
getBRepFeat_MakePrismPtr()->PerformThruAll();
Py_Return;
}
catch (const Standard_Failure& e) {
PyErr_SetString(PyExc_RuntimeError, e.GetMessageString());
return nullptr;
}
}
PyObject* MakePrismPy::performUntilHeight(PyObject *args)
{
PyObject* Until;
double length;
if (!PyArg_ParseTuple(args, "O!d", &(TopoShapePy::Type), &Until, &length))
return nullptr;
try {
TopoDS_Shape until = static_cast<TopoShapePy*>(Until)->getTopoShapePtr()->getShape();
getBRepFeat_MakePrismPtr()->PerformUntilHeight(until, length);
Py_Return;
}
catch (const Standard_Failure& e) {
PyErr_SetString(PyExc_RuntimeError, e.GetMessageString());
return nullptr;
}
}
PyObject* MakePrismPy::curves(PyObject *args)
{
if (!PyArg_ParseTuple(args, ""))
return nullptr;
TColGeom_SequenceOfCurve S;
getBRepFeat_MakePrismPtr()->Curves(S);
Py::Tuple tuple(S.Length());
for (int i = S.Lower(); i <= S.Upper(); ++i) {
Handle(Geom_Curve) hC = S.Value(i);
if (hC.IsNull())
continue;
std::unique_ptr<GeomCurve> gc(Part::makeFromCurve(hC));
tuple.setItem(i, Py::asObject(gc->getPyObject()));
}
return Py::new_reference_to(tuple);
}
PyObject* MakePrismPy::barycCurve(PyObject *args)
{
if (!PyArg_ParseTuple(args, ""))
return nullptr;
Handle(Geom_Curve) hC = getBRepFeat_MakePrismPtr()->BarycCurve();
if (hC.IsNull())
Py_Return;
std::unique_ptr<GeomCurve> gc(Part::makeFromCurve(hC));
return gc->getPyObject();
}
PyObject* MakePrismPy::shape(PyObject *args)
{
if (!PyArg_ParseTuple(args, ""))
return nullptr;
try {
TopoShape shape(getBRepFeat_MakePrismPtr()->Shape());
return shape.getPyObject();
}
catch (const Standard_Failure& e) {
PyErr_SetString(PyExc_RuntimeError, e.GetMessageString());
return nullptr;
}
}
PyObject *MakePrismPy::getCustomAttributes(const char* /*attr*/) const
{
return 0;
}
int MakePrismPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/)
{
return 0;
}
+12
View File
@@ -94,10 +94,13 @@ generate_from_xml(BRepOffsetAPI_MakePipeShellPy)
generate_from_xml(BRepOffsetAPI_MakeFillingPy)
# make sure to create the directory at configure time
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/BRepFeat)
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/Geom2d)
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/GeomPlate)
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/ShapeUpgrade)
generate_from_xml(BRepFeat/MakePrismPy)
generate_from_xml(Geom2d/ArcOfCircle2dPy)
generate_from_xml(Geom2d/ArcOfConic2dPy)
generate_from_xml(Geom2d/ArcOfEllipse2dPy)
@@ -312,6 +315,14 @@ SET(Python_SRCS
)
SOURCE_GROUP("Python" FILES ${Python_SRCS})
# BRepFeat wrappers
SET(BRepFeatPy_SRCS
BRepFeat/MakePrismPy.xml
BRepFeat/MakePrismPyImp.cpp
)
SOURCE_GROUP("ShapeUpgrade" FILES ${ShapeUpgradePy_SRCS})
# Geom2d wrappers
SET(Geom2dPy_SRCS
Geom2d/ArcOfCircle2dPy.xml
@@ -376,6 +387,7 @@ SET(Part_SRCS
${Features_SRCS}
${Properties_SRCS}
${Python_SRCS}
${BRepFeatPy_SRCS}
${Geom2dPy_SRCS}
${GeomPlatePy_SRCS}
${ShapeUpgradePy_SRCS}
+1 -42
View File
@@ -35,48 +35,7 @@
namespace Part {
PartExport Py::Object shape2pyshape(const TopoShape &shape)
{
PyObject* ret = 0;
if (!shape.isNull()) {
TopAbs_ShapeEnum type = shape.getShape().ShapeType();
switch (type)
{
case TopAbs_COMPOUND:
ret = new TopoShapeCompoundPy(new TopoShape(shape));
break;
case TopAbs_COMPSOLID:
ret = new TopoShapeCompSolidPy(new TopoShape(shape));
break;
case TopAbs_SOLID:
ret = new TopoShapeSolidPy(new TopoShape(shape));
break;
case TopAbs_SHELL:
ret = new TopoShapeShellPy(new TopoShape(shape));
break;
case TopAbs_FACE:
ret = new TopoShapeFacePy(new TopoShape(shape));
break;
case TopAbs_WIRE:
ret = new TopoShapeWirePy(new TopoShape(shape));
break;
case TopAbs_EDGE:
ret = new TopoShapeEdgePy(new TopoShape(shape));
break;
case TopAbs_VERTEX:
ret = new TopoShapeVertexPy(new TopoShape(shape));
break;
case TopAbs_SHAPE:
ret = new TopoShapePy(new TopoShape(shape));
break;
default:
//shouldn't happen
ret = new TopoShapePy(new TopoShape(shape));
break;
}
} else {
ret = new TopoShapePy(new TopoShape(shape));
}
assert(ret);
PyObject* ret = const_cast<TopoShape &>(shape).getPyObject();
return Py::asObject(ret);
}
+3 -41
View File
@@ -146,47 +146,9 @@ void PropertyPartShape::transformGeometry(const Base::Matrix4D &rclTrf)
PyObject *PropertyPartShape::getPyObject(void)
{
Base::PyObjectBase* prop;
const TopoDS_Shape& sh = _Shape.getShape();
if (sh.IsNull()) {
prop = new TopoShapePy(new TopoShape(sh));
}
else {
TopAbs_ShapeEnum type = sh.ShapeType();
switch (type)
{
case TopAbs_COMPOUND:
prop = new TopoShapeCompoundPy(new TopoShape(sh));
break;
case TopAbs_COMPSOLID:
prop = new TopoShapeCompSolidPy(new TopoShape(sh));
break;
case TopAbs_SOLID:
prop = new TopoShapeSolidPy(new TopoShape(sh));
break;
case TopAbs_SHELL:
prop = new TopoShapeShellPy(new TopoShape(sh));
break;
case TopAbs_FACE:
prop = new TopoShapeFacePy(new TopoShape(sh));
break;
case TopAbs_WIRE:
prop = new TopoShapeWirePy(new TopoShape(sh));
break;
case TopAbs_EDGE:
prop = new TopoShapeEdgePy(new TopoShape(sh));
break;
case TopAbs_VERTEX:
prop = new TopoShapeVertexPy(new TopoShape(sh));
break;
case TopAbs_SHAPE:
default:
prop = new TopoShapePy(new TopoShape(sh));
break;
}
}
prop->setConst();
Base::PyObjectBase* prop = static_cast<Base::PyObjectBase*>(_Shape.getPyObject());
if (prop)
prop->setConst();
return prop;
}
+61
View File
@@ -199,6 +199,11 @@
#include "TopoShapeFacePy.h"
#include "TopoShapeEdgePy.h"
#include "TopoShapeVertexPy.h"
#include "TopoShapeWirePy.h"
#include "TopoShapeShellPy.h"
#include "TopoShapeSolidPy.h"
#include "TopoShapeCompoundPy.h"
#include "TopoShapeCompSolidPy.h"
#include "ProgressIndicator.h"
#include "modelRefine.h"
#include "Tools.h"
@@ -542,6 +547,62 @@ PyObject * TopoShape::getPySubShape(const char* Type, bool silent) const
return Py::new_reference_to(shape2pyshape(getSubShape(Type,silent)));
}
PyObject * TopoShape::getPyObject()
{
Base::PyObjectBase* prop = nullptr;
if (_Shape.IsNull()) {
prop = new TopoShapePy(new TopoShape(_Shape));
}
else {
TopAbs_ShapeEnum type = _Shape.ShapeType();
switch (type)
{
case TopAbs_COMPOUND:
prop = new TopoShapeCompoundPy(new TopoShape(_Shape));
break;
case TopAbs_COMPSOLID:
prop = new TopoShapeCompSolidPy(new TopoShape(_Shape));
break;
case TopAbs_SOLID:
prop = new TopoShapeSolidPy(new TopoShape(_Shape));
break;
case TopAbs_SHELL:
prop = new TopoShapeShellPy(new TopoShape(_Shape));
break;
case TopAbs_FACE:
prop = new TopoShapeFacePy(new TopoShape(_Shape));
break;
case TopAbs_WIRE:
prop = new TopoShapeWirePy(new TopoShape(_Shape));
break;
case TopAbs_EDGE:
prop = new TopoShapeEdgePy(new TopoShape(_Shape));
break;
case TopAbs_VERTEX:
prop = new TopoShapeVertexPy(new TopoShape(_Shape));
break;
case TopAbs_SHAPE:
default:
prop = new TopoShapePy(new TopoShape(_Shape));
break;
}
}
return prop;
}
void TopoShape::setPyObject(PyObject* obj)
{
if (PyObject_TypeCheck(obj, &TopoShapePy::Type)) {
this->_Shape = static_cast<TopoShapePy*>(obj)->getTopoShapePtr()->getShape();
}
else {
std::string error = std::string("type must be 'Shape', not ");
error += obj->ob_type->tp_name;
throw Base::TypeError(error);
}
}
void TopoShape::operator = (const TopoShape& sh)
{
if (this != &sh) {
+2
View File
@@ -157,6 +157,8 @@ public:
bool hasSubShape(TopAbs_ShapeEnum type) const;
/// get the Topo"sub"Shape with the given name
PyObject * getPySubShape(const char* Type, bool silent=false) const;
PyObject * getPyObject();
void setPyObject(PyObject*);
/** @name Save/restore */
//@{
@@ -55,6 +55,13 @@ PyObject *TopoShapeCompSolidPy::PyMake(struct _typeobject *, PyObject *, PyObjec
int TopoShapeCompSolidPy::PyInit(PyObject* args, PyObject* /*kwd*/)
{
if (PyArg_ParseTuple(args, "")) {
// Undefined CompSolid
getTopoShapePtr()->setShape(TopoDS_CompSolid());
return 0;
}
PyErr_Clear();
PyObject *pcObj;
if (!PyArg_ParseTuple(args, "O", &pcObj))
return -1;
+7 -1
View File
@@ -59,6 +59,13 @@ PyObject *TopoShapeCompoundPy::PyMake(struct _typeobject *, PyObject *, PyObject
// constructor method
int TopoShapeCompoundPy::PyInit(PyObject* args, PyObject* /*kwd*/)
{
if (PyArg_ParseTuple(args, "")) {
// Undefined Compound
getTopoShapePtr()->setShape(TopoDS_Compound());
return 0;
}
PyErr_Clear();
PyObject *pcObj;
if (!PyArg_ParseTuple(args, "O", &pcObj))
return -1;
@@ -79,7 +86,6 @@ int TopoShapeCompoundPy::PyInit(PyObject* args, PyObject* /*kwd*/)
}
}
catch (Standard_Failure& e) {
PyErr_SetString(PartExceptionOCCError, e.GetMessageString());
return -1;
}
+7
View File
@@ -121,6 +121,13 @@ PyObject *TopoShapeEdgePy::PyMake(struct _typeobject *, PyObject *, PyObject *)
// constructor method
int TopoShapeEdgePy::PyInit(PyObject* args, PyObject* /*kwd*/)
{
if (PyArg_ParseTuple(args, "")) {
// Undefined Edge
getTopoShapePtr()->setShape(TopoDS_Edge());
return 0;
}
PyErr_Clear();
PyObject *pcObj, *pcObj2;
double first=DBL_MAX, last=DBL_MAX;
if (PyArg_ParseTuple(args, "O!|dd", &(Part::GeometryPy::Type), &pcObj, &first, &last)) {
+7
View File
@@ -117,6 +117,13 @@ PyObject *TopoShapeFacePy::PyMake(struct _typeobject *, PyObject *, PyObject *)
// constructor method
int TopoShapeFacePy::PyInit(PyObject* args, PyObject* /*kwd*/)
{
if (PyArg_ParseTuple(args, "")) {
// Undefined Face
getTopoShapePtr()->setShape(TopoDS_Face());
return 0;
}
PyErr_Clear();
PyObject *pW;
if (PyArg_ParseTuple(args, "O!", &(Part::TopoShapePy::Type), &pW)) {
try {
+7
View File
@@ -77,6 +77,13 @@ PyObject *TopoShapeShellPy::PyMake(struct _typeobject *, PyObject *, PyObject *)
// constructor method
int TopoShapeShellPy::PyInit(PyObject* args, PyObject* /*kwd*/)
{
if (PyArg_ParseTuple(args, "")) {
// Undefined Shell
getTopoShapePtr()->setShape(TopoDS_Shell());
return 0;
}
PyErr_Clear();
PyObject *obj;
if (!PyArg_ParseTuple(args, "O", &obj))
return -1;
+7
View File
@@ -79,6 +79,13 @@ PyObject *TopoShapeSolidPy::PyMake(struct _typeobject *, PyObject *, PyObject *)
// constructor method
int TopoShapeSolidPy::PyInit(PyObject* args, PyObject* /*kwd*/)
{
if (PyArg_ParseTuple(args, "")) {
// Undefined Solid
getTopoShapePtr()->setShape(TopoDS_Solid());
return 0;
}
PyErr_Clear();
PyObject *obj;
if (!PyArg_ParseTuple(args, "O!", &(TopoShapePy::Type), &obj))
return -1;
@@ -63,6 +63,13 @@ PyObject *TopoShapeVertexPy::PyMake(struct _typeobject *, PyObject *, PyObject *
// constructor method
int TopoShapeVertexPy::PyInit(PyObject* args, PyObject* /*kwd*/)
{
if (PyArg_ParseTuple(args, "")) {
// Undefined Vertex
getTopoShapePtr()->setShape(TopoDS_Vertex());
return 0;
}
PyErr_Clear();
double x=0.0,y=0.0,z=0.0;
PyObject *object;
bool success = false;
+7
View File
@@ -85,6 +85,13 @@ PyObject *TopoShapeWirePy::PyMake(struct _typeobject *, PyObject *, PyObject *)
// constructor method
int TopoShapeWirePy::PyInit(PyObject* args, PyObject* /*kwd*/)
{
if (PyArg_ParseTuple(args, "")) {
// Undefined Wire
getTopoShapePtr()->setShape(TopoDS_Wire());
return 0;
}
PyErr_Clear();
PyObject *pcObj;
if (PyArg_ParseTuple(args, "O!", &(Part::TopoShapePy::Type), &pcObj)) {
BRepBuilderAPI_MakeWire mkWire;
+7 -22
View File
@@ -3198,8 +3198,7 @@ void ViewProviderSketch::drawConstraintIcons()
void ViewProviderSketch::combineConstraintIcons(IconQueue iconQueue)
{
// getScaleFactor gives us a ratio of pixels per some kind of real units
// (Translation: this number is somewhat made-up.)
float maxDistSquared = pow(0.05 * getScaleFactor(), 2);
float maxDistSquared = pow(getScaleFactor(), 2);
// There's room for optimisation here; we could reuse the combined icons...
edit->combinedConstrBoxes.clear();
@@ -3219,8 +3218,9 @@ void ViewProviderSketch::combineConstraintIcons(IconQueue iconQueue)
bool addedToGroup = false;
for(IconQueue::iterator j = thisGroup.begin();
j != thisGroup.end(); ++j)
if(i->position.equals(j->position, maxDistSquared) && (*i).type != QString::fromLatin1("small/Constraint_Symmetric_sm")) {
j != thisGroup.end(); ++j) {
float distSquared = pow(i->position[0]-j->position[0],2) + pow(i->position[1]-j->position[1],2);
if(distSquared <= maxDistSquared && (*i).type != QString::fromLatin1("small/Constraint_Symmetric_sm")) {
// Found an icon in iconQueue that's close enough to
// a member of thisGroup, so move it into thisGroup
thisGroup.push_back(*i);
@@ -3228,6 +3228,7 @@ void ViewProviderSketch::combineConstraintIcons(IconQueue iconQueue)
addedToGroup = true;
break;
}
}
if(addedToGroup) {
if(i == iconQueue.end())
@@ -3253,17 +3254,13 @@ void ViewProviderSketch::combineConstraintIcons(IconQueue iconQueue)
void ViewProviderSketch::drawMergedConstraintIcons(IconQueue iconQueue)
{
SbVec3f avPos(0, 0, 0);
for(IconQueue::iterator i = iconQueue.begin(); i != iconQueue.end(); ++i) {
clearCoinImage(i->destination);
avPos = avPos + i->position;
}
avPos = avPos/iconQueue.size();
QImage compositeIcon;
float closest = FLT_MAX; // Closest distance between avPos and any icon
SoImage *thisDest = 0;
SoInfo *thisInfo = 0;
SoImage *thisDest = iconQueue[0].destination;
SoInfo *thisInfo = iconQueue[0].infoPtr;
// Tracks all constraint IDs that are combined into this icon
QString idString;
@@ -3299,12 +3296,6 @@ void ViewProviderSketch::drawMergedConstraintIcons(IconQueue iconQueue)
idString.append(QString::fromLatin1(","));
idString.append(QString::number(i->constraintId));
if((avPos - i->position).length() < closest) {
thisDest = i->destination;
thisInfo = i->infoPtr;
closest = (avPos - i->position).length();
}
i = iconQueue.erase(i);
while(i != iconQueue.end()) {
if(i->type != thisType) {
@@ -3312,12 +3303,6 @@ void ViewProviderSketch::drawMergedConstraintIcons(IconQueue iconQueue)
continue;
}
if((avPos - i->position).length() < closest) {
thisDest = i->destination;
thisInfo = i->infoPtr;
closest = (avPos - i->position).length();
}
labels.append(i->label);
ids.push_back(i->constraintId);
labelColors.append(constrColor(i->constraintId));
+4 -1
View File
@@ -717,9 +717,12 @@ QGIFace* QGIViewPart::drawFace(TechDraw::Face* f, int idx)
std::vector<TechDraw::Wire *> fWires = f->wires;
QPainterPath facePath;
for(std::vector<TechDraw::Wire *>::iterator wire = fWires.begin(); wire != fWires.end(); ++wire) {
QPainterPath wirePath;
std::vector<TechDraw::BaseGeom*> geoms = (*wire)->geoms;
if (geoms.empty())
continue;
TechDraw::BaseGeom* firstGeom = geoms.front();
QPainterPath wirePath;
//QPointF startPoint(firstGeom->getStartPoint().x, firstGeom->getStartPoint().y);
//wirePath.moveTo(startPoint);
QPainterPath firstSeg = drawPainterPath(firstGeom);
@@ -279,6 +279,11 @@ public:
#include <Base/Exception.h>
#include <CXX/Objects.hxx>
#if defined(__clang__)
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wdeprecated-declarations"
#endif
using Base::streq;
using namespace @self.export.Namespace@;
@@ -366,8 +371,12 @@ PyTypeObject @self.export.Name@::Type = {
#if PY_MAJOR_VERSION >= 3
,0 /*tp_finalize */
#endif
#if PY_VERSION_HEX >= 0x03080000
#if PY_VERSION_HEX >= 0x03090000
,0 /*tp_vectorcall */
#elif PY_VERSION_HEX >= 0x03080000
,0 /*tp_vectorcall */
/* bpo-37250: kept for backwards compatibility in CPython 3.8 only */
,0 /*tp_print */
#endif
};
@@ -888,6 +897,10 @@ int @self.export.Name@::_setattr(const char *attr, PyObject *value) // __setattr
return static_cast<@self.export.TwinPointer@ *>(_pcTwinPointer);
}
#if defined(__clang__)
# pragma clang diagnostic pop
#endif
#if 0
/* From here on come the methods you have to implement, but NOT in this module. Implement in @self.export.Name@Imp.cpp! This prototypes
* are just for convenience when you add a new method.