PD: modernize C++11

* use nullptr
This commit is contained in:
wmayer
2022-03-23 19:07:22 +01:00
parent 068c0e5a98
commit 3608ee7f51
89 changed files with 273 additions and 273 deletions

View File

@@ -72,7 +72,7 @@ PyMOD_INIT_FUNC(_PartDesign)
}
catch(const Base::Exception& e) {
PyErr_SetString(PyExc_ImportError, e.what());
PyMOD_Return(0);
PyMOD_Return(nullptr);
}
PyObject* mod = PartDesign::initModule();

View File

@@ -175,7 +175,7 @@ bool Body::isAfterInsertPoint(App::DocumentObject* feature) {
bool Body::isMemberOfMultiTransform(const App::DocumentObject* f)
{
if (f == NULL)
if (f == nullptr)
return false;
// ORIGINAL COMMENT:
@@ -195,7 +195,7 @@ bool Body::isMemberOfMultiTransform(const App::DocumentObject* f)
bool Body::isSolidFeature(const App::DocumentObject* f)
{
if (f == NULL)
if (f == nullptr)
return false;
if (f->getTypeId().isDerivedFrom(PartDesign::Feature::getClassTypeId()) &&
@@ -208,7 +208,7 @@ bool Body::isSolidFeature(const App::DocumentObject* f)
bool Body::isAllowed(const App::DocumentObject* f)
{
if (f == NULL)
if (f == nullptr)
return false;
// TODO: Should we introduce a PartDesign::FeaturePython class? This should then also return true for isSolidFeature()

View File

@@ -126,13 +126,13 @@ public:
* Return the solid feature before the given feature, or before the Tip feature
* That is, sketches and datum features are skipped
*/
App::DocumentObject *getPrevSolidFeature(App::DocumentObject *start = NULL);
App::DocumentObject *getPrevSolidFeature(App::DocumentObject *start = nullptr);
/**
* Return the next solid feature after the given feature, or after the Tip feature
* That is, sketches and datum features are skipped
*/
App::DocumentObject *getNextSolidFeature(App::DocumentObject* start = NULL);
App::DocumentObject *getNextSolidFeature(App::DocumentObject* start = nullptr);
// a body is solid if it has features that are solid according to member isSolidFeature.
bool isSolid(void);

View File

@@ -42,7 +42,7 @@ std::string BodyPy::representation(void) const
PyObject *BodyPy::getCustomAttributes(const char* /*attr*/) const
{
return 0;
return nullptr;
}
int BodyPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/)
@@ -57,7 +57,7 @@ PyObject* BodyPy::insertObject(PyObject *args)
PyObject* afterPy = Py_False;
if (!PyArg_ParseTuple(args, "O!O|O!", &(App::DocumentObjectPy::Type), &featurePy,
&targetPy, &PyBool_Type, &afterPy)) {
return 0;
return nullptr;
}
App::DocumentObject* feature = static_cast<App::DocumentObjectPy*>(featurePy)->getDocumentObjectPtr();
@@ -68,7 +68,7 @@ PyObject* BodyPy::insertObject(PyObject *args)
if (!Body::isAllowed(feature)) {
PyErr_SetString(PyExc_SystemError, "Only PartDesign features, datum features and sketches can be inserted into a Body");
return 0;
return nullptr;
}
bool after = PyObject_IsTrue(afterPy) ? true : false;
@@ -79,7 +79,7 @@ PyObject* BodyPy::insertObject(PyObject *args)
}
catch (Base::Exception& e) {
PyErr_SetString(PyExc_SystemError, e.what());
return 0;
return nullptr;
}
Py_Return;

View File

@@ -37,7 +37,7 @@ using namespace Attacher;
// ============================================================================
const char* Line::ResizeModeEnums[]= {"Automatic","Manual",NULL};
const char* Line::ResizeModeEnums[]= {"Automatic","Manual",nullptr};
PROPERTY_SOURCE(PartDesign::Line, Part::Datum)

View File

@@ -37,7 +37,7 @@ using namespace Attacher;
// ============================================================================
const char* Plane::ResizeModeEnums[]= {"Automatic","Manual",NULL};
const char* Plane::ResizeModeEnums[]= {"Automatic","Manual",nullptr};
PROPERTY_SOURCE(PartDesign::Plane, Part::Datum)

View File

@@ -52,8 +52,8 @@ PROPERTY_SOURCE(PartDesign::Feature,Part::Feature)
Feature::Feature()
{
ADD_PROPERTY(BaseFeature,(0));
ADD_PROPERTY_TYPE(_Body,(0),"Base",(App::PropertyType)(
ADD_PROPERTY(BaseFeature,(nullptr));
ADD_PROPERTY_TYPE(_Body,(nullptr),"Base",(App::PropertyType)(
App::Prop_ReadOnly|App::Prop_Hidden|App::Prop_Output|App::Prop_Transient),0);
Placement.setStatus(App::Property::Hidden, true);
BaseFeature.setStatus(App::Property::Hidden, true);
@@ -197,7 +197,7 @@ bool Feature::isDatum(const App::DocumentObject* feature)
gp_Pln Feature::makePlnFromPlane(const App::DocumentObject* obj)
{
const App::GeoFeature* plane = static_cast<const App::GeoFeature*>(obj);
if (plane == NULL)
if (plane == nullptr)
throw Base::ValueError("Feature: Null object");
Base::Vector3d pos = plane->Placement.getValue().getPosition();

View File

@@ -44,7 +44,7 @@ namespace PartDesign {
PROPERTY_SOURCE_WITH_EXTENSIONS(PartDesign::Boolean, PartDesign::Feature)
const char* Boolean::TypeEnums[]= {"Fuse","Cut","Common",NULL};
const char* Boolean::TypeEnums[]= {"Fuse","Cut","Common",nullptr};
Boolean::Boolean()
{

View File

@@ -48,7 +48,7 @@ using namespace PartDesign;
PROPERTY_SOURCE(PartDesign::Chamfer, PartDesign::DressUp)
const char* ChamferTypeEnums[] = {"Equal distance", "Two distances", "Distance and Angle", NULL};
const char* ChamferTypeEnums[] = {"Equal distance", "Two distances", "Distance and Angle", nullptr};
const App::PropertyQuantityConstraint::Constraints Chamfer::floatSize = {0.0, FLT_MAX, 0.1};
const App::PropertyAngle::Constraints Chamfer::floatAngle = {0.0, 180.0, 1.0};

View File

@@ -64,8 +64,8 @@ Draft::Draft()
{
ADD_PROPERTY(Angle,(1.5));
Angle.setConstraints(&floatAngle);
ADD_PROPERTY_TYPE(NeutralPlane,(0),"Draft",(App::PropertyType)(App::Prop_None),"NeutralPlane");
ADD_PROPERTY_TYPE(PullDirection,(0),"Draft",(App::PropertyType)(App::Prop_None),"PullDirection");
ADD_PROPERTY_TYPE(NeutralPlane,(nullptr),"Draft",(App::PropertyType)(App::Prop_None),"NeutralPlane");
ADD_PROPERTY_TYPE(PullDirection,(nullptr),"Draft",(App::PropertyType)(App::Prop_None),"PullDirection");
ADD_PROPERTY(Reversed,(0));
}
@@ -118,7 +118,7 @@ App::DocumentObjectExecReturn *Draft::execute(void)
// Pull direction
gp_Dir pullDirection;
App::DocumentObject* refDirection = PullDirection.getValue();
if (refDirection != NULL) {
if (refDirection != nullptr) {
if (refDirection->getTypeId().isDerivedFrom(PartDesign::Line::getClassTypeId())) {
PartDesign::Line* line = static_cast<PartDesign::Line*>(refDirection);
Base::Vector3d d = line->getDirection();
@@ -155,7 +155,7 @@ App::DocumentObjectExecReturn *Draft::execute(void)
// Neutral plane
gp_Pln neutralPlane;
App::DocumentObject* refPlane = NeutralPlane.getValue();
if (refPlane == NULL) {
if (refPlane == nullptr) {
// Try to guess a neutral plane from the first selected face
// Get edges of first selected face
TopoDS_Shape face = TopShape.getSubShape(SubVals[0].c_str());
@@ -229,7 +229,7 @@ App::DocumentObjectExecReturn *Draft::execute(void)
neutralPlane = adapt.Plane();
} else if (ref.ShapeType() == TopAbs_EDGE) {
if (refDirection != NULL) {
if (refDirection != nullptr) {
// Create neutral plane through edge normal to pull direction
TopoDS_Edge refEdge = TopoDS::Edge(ref);
if (refEdge.IsNull())
@@ -255,7 +255,7 @@ App::DocumentObjectExecReturn *Draft::execute(void)
neutralPlane.Transform(invObjLoc.Transformation());
}
if (refDirection == NULL) {
if (refDirection == nullptr) {
// Choose pull direction normal to neutral plane
pullDirection = neutralPlane.Axis().Direction();
}

View File

@@ -44,7 +44,7 @@ PROPERTY_SOURCE(PartDesign::DressUp, PartDesign::FeatureAddSub)
DressUp::DressUp()
{
ADD_PROPERTY(Base,(0));
ADD_PROPERTY(Base,(nullptr));
Placement.setStatus(App::Property::ReadOnly, true);
ADD_PROPERTY_TYPE(SupportTransform,(false),"Base", App::Prop_None,

View File

@@ -56,7 +56,7 @@ Groove::Groove()
ADD_PROPERTY_TYPE(Axis,(Base::Vector3d(0.0f,1.0f,0.0f)),"Groove", App::Prop_ReadOnly, "Axis");
ADD_PROPERTY_TYPE(Angle,(360.0),"Groove", App::Prop_None, "Angle");
Angle.setConstraints(&floatAngle);
ADD_PROPERTY_TYPE(ReferenceAxis,(0),"Groove",(App::PropertyType)(App::Prop_None),"Reference axis of Groove");
ADD_PROPERTY_TYPE(ReferenceAxis,(nullptr),"Groove",(App::PropertyType)(App::Prop_None),"Reference axis of Groove");
}
short Groove::mustExecute() const

View File

@@ -54,7 +54,7 @@
using namespace PartDesign;
const char* Helix::ModeEnums[] = { "pitch-height-angle", "pitch-turns-angle", "height-turns-angle", "height-turns-growth", NULL };
const char* Helix::ModeEnums[] = { "pitch-height-angle", "pitch-turns-angle", "height-turns-angle", "height-turns-growth", nullptr };
PROPERTY_SOURCE(PartDesign::Helix, PartDesign::ProfileBased)
@@ -72,7 +72,7 @@ Helix::Helix()
QT_TRANSLATE_NOOP("App::Property", "The center point of the helix' start; derived from the reference axis."));
ADD_PROPERTY_TYPE(Axis, (Base::Vector3d(0.0, 1.0, 0.0)), group, App::Prop_ReadOnly,
QT_TRANSLATE_NOOP("App::Property", "The helix' direction; derived from the reference axis."));
ADD_PROPERTY_TYPE(ReferenceAxis, (0), group, App::Prop_None,
ADD_PROPERTY_TYPE(ReferenceAxis, (nullptr), group, App::Prop_None,
QT_TRANSLATE_NOOP("App::Property", "The reference axis of the helix."));
ADD_PROPERTY_TYPE(Mode, (long(initialMode)), group, App::Prop_None,
QT_TRANSLATE_NOOP("App::Property", "The helix input mode specifies which properties are set by the user.\n"

View File

@@ -58,18 +58,18 @@ namespace PartDesign {
/* TRANSLATOR PartDesign::Hole */
const char* Hole::DepthTypeEnums[] = { "Dimension", "ThroughAll", /*, "UpToFirst", */ NULL };
const char* Hole::ThreadDepthTypeEnums[] = { "Hole Depth", "Dimension", "Tapped (DIN76)", NULL };
const char* Hole::ThreadTypeEnums[] = { "None", "ISOMetricProfile", "ISOMetricFineProfile", "UNC", "UNF", "UNEF", NULL};
const char* Hole::ClearanceMetricEnums[] = { "Standard", "Close", "Wide", NULL};
const char* Hole::ClearanceUTSEnums[] = { "Normal", "Close", "Loose", NULL };
const char* Hole::DrillPointEnums[] = { "Flat", "Angled", NULL};
const char* Hole::DepthTypeEnums[] = { "Dimension", "ThroughAll", /*, "UpToFirst", */ nullptr };
const char* Hole::ThreadDepthTypeEnums[] = { "Hole Depth", "Dimension", "Tapped (DIN76)", nullptr };
const char* Hole::ThreadTypeEnums[] = { "None", "ISOMetricProfile", "ISOMetricFineProfile", "UNC", "UNF", "UNEF", nullptr};
const char* Hole::ClearanceMetricEnums[] = { "Standard", "Close", "Wide", nullptr};
const char* Hole::ClearanceUTSEnums[] = { "Normal", "Close", "Loose", nullptr };
const char* Hole::DrillPointEnums[] = { "Flat", "Angled", nullptr};
/* "None" profile */
const char* Hole::HoleCutType_None_Enums[] = { "None", "Counterbore", "Countersink", NULL };
const char* Hole::ThreadSize_None_Enums[] = { "None", NULL };
const char* Hole::ThreadClass_None_Enums[] = { "None", NULL };
const char* Hole::HoleCutType_None_Enums[] = { "None", "Counterbore", "Countersink", nullptr };
const char* Hole::ThreadSize_None_Enums[] = { "None", nullptr };
const char* Hole::ThreadClass_None_Enums[] = { "None", nullptr };
/* Sources:
http://www.engineeringtoolbox.com/metric-threads-d_777.html
@@ -482,8 +482,8 @@ const char* Hole::ThreadSize_ISOmetric_Enums[] = { "M1", "M1.1", "M1.2", "M1
"M12", "M14", "M16", "M18", "M20",
"M22", "M24", "M27", "M30", "M33",
"M36", "M39", "M42", "M45", "M48",
"M52", "M56", "M60", "M64", "M68", NULL };
const char* Hole::ThreadClass_ISOmetric_Enums[] = { "4G", "4H", "5G", "5H", "6G", "6H", "7G", "7H","8G", "8H", NULL };
"M52", "M56", "M60", "M64", "M68", nullptr };
const char* Hole::ThreadClass_ISOmetric_Enums[] = { "4G", "4H", "5G", "5H", "6G", "6H", "7G", "7H","8G", "8H", nullptr };
std::vector<std::string> Hole::HoleCutType_ISOmetricfine_Enums = { "None", "Counterbore", "Countersink", "Cheesehead (deprecated)", "Countersink socket screw (deprecated)", "Cap screw (deprecated)" };
const char* Hole::ThreadSize_ISOmetricfine_Enums[] = {
@@ -529,8 +529,8 @@ const char* Hole::ThreadSize_ISOmetricfine_Enums[] = {
"M85x2.0", "M85x3.0", "M85x4.0", "M85x6.0",
"M90x2.0", "M90x3.0", "M90x4.0", "M90x6.0",
"M95x2.0", "M95x3.0", "M95x4.0", "M95x6.0",
"M100x2.0", "M100x3.0", "M100x4.0", "M100x6.0", NULL };
const char* Hole::ThreadClass_ISOmetricfine_Enums[] = { "4G", "4H", "5G", "5H", "6G", "6H", "7G", "7H","8G", "8H", NULL };
"M100x2.0", "M100x3.0", "M100x4.0", "M100x6.0", nullptr };
const char* Hole::ThreadClass_ISOmetricfine_Enums[] = { "4G", "4H", "5G", "5H", "6G", "6H", "7G", "7H","8G", "8H", nullptr };
// ISO 965-1:2013 ISO general purpose metric screw threads - Tolerances - Part 1
// Table 1 - Fundamentral deviations for internal threads ...
@@ -596,35 +596,35 @@ const double Hole::ThreadRunout[ThreadRunout_size][2] = {
/* Details from https://en.wikipedia.org/wiki/Unified_Thread_Standard */
/* UTS coarse */
const char* Hole::HoleCutType_UNC_Enums[] = { "None", "Counterbore", "Countersink", NULL};
const char* Hole::HoleCutType_UNC_Enums[] = { "None", "Counterbore", "Countersink", nullptr};
const char* Hole::ThreadSize_UNC_Enums[] = { "#1", "#2", "#3", "#4", "#5", "#6",
"#8", "#10", "#12",
"1/4", "5/16", "3/8", "7/16", "1/2", "9/16",
"5/8", "3/4", "7/8", "1", "1 1/8", "1 1/4",
"1 3/8", "1 1/2", "1 3/4", "2", "2 1/4",
"2 1/2", "2 3/4", "3", "3 1/4", "3 1/2",
"3 3/4", "4", NULL };
const char* Hole::ThreadClass_UNC_Enums[] = { "1B", "2B", "3B", NULL };
"3 3/4", "4", nullptr };
const char* Hole::ThreadClass_UNC_Enums[] = { "1B", "2B", "3B", nullptr };
/* UTS fine */
const char* Hole::HoleCutType_UNF_Enums[] = { "None", "Counterbore", "Countersink", NULL};
const char* Hole::HoleCutType_UNF_Enums[] = { "None", "Counterbore", "Countersink", nullptr};
const char* Hole::ThreadSize_UNF_Enums[] = { "#0", "#1", "#2", "#3", "#4", "#5", "#6",
"#8", "#10", "#12",
"1/4", "5/16", "3/8", "7/16", "1/2", "9/16",
"5/8", "3/4", "7/8", "1", "1 1/8", "1 1/4",
"1 3/8", "1 1/2", NULL };
const char* Hole::ThreadClass_UNF_Enums[] = { "1B", "2B", "3B", NULL };
"1 3/8", "1 1/2", nullptr };
const char* Hole::ThreadClass_UNF_Enums[] = { "1B", "2B", "3B", nullptr };
/* UTS extrafine */
const char* Hole::HoleCutType_UNEF_Enums[] = { "None", "Counterbore", "Countersink", NULL};
const char* Hole::HoleCutType_UNEF_Enums[] = { "None", "Counterbore", "Countersink", nullptr};
const char* Hole::ThreadSize_UNEF_Enums[] = { "#12", "1/4", "5/16", "3/8", "7/16", "1/2",
"9/16", "5/8", "11/16", "3/4", "13/16", "7/8",
"15/16", "1", "1 1/16", "1 1/8", "1 1/4",
"1 5/16", "1 3/8", "1 7/16", "1 1/2", "1 9/16",
"1 5/8", "1 11/16", NULL };
const char* Hole::ThreadClass_UNEF_Enums[] = { "1B", "2B", "3B", NULL };
"1 5/8", "1 11/16", nullptr };
const char* Hole::ThreadClass_UNEF_Enums[] = { "1B", "2B", "3B", nullptr };
const char* Hole::ThreadDirectionEnums[] = { "Right", "Left", NULL};
const char* Hole::ThreadDirectionEnums[] = { "Right", "Left", nullptr};
PROPERTY_SOURCE(PartDesign::Hole, PartDesign::ProfileBased)

View File

@@ -53,7 +53,7 @@ const App::PropertyIntegerConstraint::Constraints LinearPattern::intOccurrences
LinearPattern::LinearPattern()
{
ADD_PROPERTY_TYPE(Direction,(0),"LinearPattern",(App::PropertyType)(App::Prop_None),"Direction");
ADD_PROPERTY_TYPE(Direction,(nullptr),"LinearPattern",(App::PropertyType)(App::Prop_None),"Direction");
ADD_PROPERTY(Reversed,(0));
ADD_PROPERTY(Length,(100.0));
ADD_PROPERTY(Occurrences,(3));
@@ -81,7 +81,7 @@ const std::list<gp_Trsf> LinearPattern::getTransformations(const std::vector<App
bool reversed = Reversed.getValue();
App::DocumentObject* refObject = Direction.getValue();
if (refObject == NULL)
if (refObject == nullptr)
throw Base::ValueError("No direction reference specified");
std::vector<std::string> subStrings = Direction.getSubValues();

View File

@@ -50,8 +50,8 @@ PROPERTY_SOURCE(PartDesign::Loft, PartDesign::ProfileBased)
Loft::Loft()
{
ADD_PROPERTY_TYPE(Sections,(0),"Loft",App::Prop_None,"List of sections");
Sections.setValue(0);
ADD_PROPERTY_TYPE(Sections,(nullptr),"Loft",App::Prop_None,"List of sections");
Sections.setValue(nullptr);
ADD_PROPERTY_TYPE(Ruled,(false),"Loft",App::Prop_None,"Create ruled surface");
ADD_PROPERTY_TYPE(Closed,(false),"Loft",App::Prop_None,"Close Last to First Profile");
}

View File

@@ -47,7 +47,7 @@ PROPERTY_SOURCE(PartDesign::Mirrored, PartDesign::Transformed)
Mirrored::Mirrored()
{
ADD_PROPERTY_TYPE(MirrorPlane,(0),"Mirrored",(App::PropertyType)(App::Prop_None),"Mirror plane");
ADD_PROPERTY_TYPE(MirrorPlane,(nullptr),"Mirrored",(App::PropertyType)(App::Prop_None),"Mirror plane");
}
short Mirrored::mustExecute() const
@@ -60,7 +60,7 @@ short Mirrored::mustExecute() const
const std::list<gp_Trsf> Mirrored::getTransformations(const std::vector<App::DocumentObject*>)
{
App::DocumentObject* refObject = MirrorPlane.getValue();
if (refObject == NULL)
if (refObject == nullptr)
throw Base::ValueError("No mirror plane reference specified");
std::vector<std::string> subStrings = MirrorPlane.getSubValues();
if (subStrings.empty())

View File

@@ -42,7 +42,7 @@ PROPERTY_SOURCE(PartDesign::MultiTransform, PartDesign::Transformed)
MultiTransform::MultiTransform()
{
ADD_PROPERTY(Transformations,(0));
ADD_PROPERTY(Transformations,(nullptr));
Transformations.setSize(0);
}

View File

@@ -38,7 +38,7 @@
using namespace PartDesign;
const char* Pad::TypeEnums[]= {"Length", "UpToLast", "UpToFirst", "UpToFace", "TwoLengths", NULL};
const char* Pad::TypeEnums[]= {"Length", "UpToLast", "UpToFirst", "UpToFace", "TwoLengths", nullptr};
PROPERTY_SOURCE(PartDesign::Pad, PartDesign::FeatureExtrude)
@@ -52,9 +52,9 @@ Pad::Pad()
ADD_PROPERTY_TYPE(Length2, (10.0), "Pad", App::Prop_None, "Pad length in 2nd direction");
ADD_PROPERTY_TYPE(UseCustomVector, (false), "Pad", App::Prop_None, "Use custom vector for pad direction");
ADD_PROPERTY_TYPE(Direction, (Base::Vector3d(1.0, 1.0, 1.0)), "Pad", App::Prop_None, "Pad direction vector");
ADD_PROPERTY_TYPE(ReferenceAxis, (0), "Pad", App::Prop_None, "Reference axis of direction");
ADD_PROPERTY_TYPE(ReferenceAxis, (nullptr), "Pad", App::Prop_None, "Reference axis of direction");
ADD_PROPERTY_TYPE(AlongSketchNormal, (true), "Pad", App::Prop_None, "Measure pad length along the sketch normal direction");
ADD_PROPERTY_TYPE(UpToFace, (0), "Pad", App::Prop_None, "Face where pad will end");
ADD_PROPERTY_TYPE(UpToFace, (nullptr), "Pad", App::Prop_None, "Face where pad will end");
ADD_PROPERTY_TYPE(Offset, (0.0), "Pad", App::Prop_None, "Offset from face in which pad will end");
Offset.setConstraints(&signedLengthConstraint);
ADD_PROPERTY_TYPE(TaperAngle, (0.0), "Pad", App::Prop_None, "Taper angle");

View File

@@ -57,21 +57,21 @@
using namespace PartDesign;
const char* Pipe::TypeEnums[] = {"FullPath", "UpToFace", NULL};
const char* Pipe::TransitionEnums[] = {"Transformed", "Right corner", "Round corner", NULL};
const char* Pipe::ModeEnums[] = {"Standard", "Fixed", "Frenet", "Auxiliary", "Binormal", NULL};
const char* Pipe::TransformEnums[] = {"Constant", "Multisection", "Linear", "S-shape", "Interpolation", NULL};
const char* Pipe::TypeEnums[] = {"FullPath", "UpToFace", nullptr};
const char* Pipe::TransitionEnums[] = {"Transformed", "Right corner", "Round corner", nullptr};
const char* Pipe::ModeEnums[] = {"Standard", "Fixed", "Frenet", "Auxiliary", "Binormal", nullptr};
const char* Pipe::TransformEnums[] = {"Constant", "Multisection", "Linear", "S-shape", "Interpolation", nullptr};
PROPERTY_SOURCE(PartDesign::Pipe, PartDesign::ProfileBased)
Pipe::Pipe()
{
ADD_PROPERTY_TYPE(Sections,(0),"Sweep",App::Prop_None,"List of sections");
Sections.setValue(0);
ADD_PROPERTY_TYPE(Spine,(0),"Sweep",App::Prop_None,"Path to sweep along");
ADD_PROPERTY_TYPE(Sections,(nullptr),"Sweep",App::Prop_None,"List of sections");
Sections.setValue(nullptr);
ADD_PROPERTY_TYPE(Spine,(nullptr),"Sweep",App::Prop_None,"Path to sweep along");
ADD_PROPERTY_TYPE(SpineTangent,(false),"Sweep",App::Prop_None,"Include tangent edges into path");
ADD_PROPERTY_TYPE(AuxillerySpine,(0),"Sweep",App::Prop_None,"Secondary path to orient sweep");
ADD_PROPERTY_TYPE(AuxillerySpine,(nullptr),"Sweep",App::Prop_None,"Secondary path to orient sweep");
ADD_PROPERTY_TYPE(AuxillerySpineTangent,(false),"Sweep",App::Prop_None,"Include tangent edges into secondary path");
ADD_PROPERTY_TYPE(AuxilleryCurvelinear, (true), "Sweep", App::Prop_None,"Calculate normal between equidistant points on both spines");
ADD_PROPERTY_TYPE(Mode,(long(0)),"Sweep",App::Prop_None,"Profile mode");

View File

@@ -39,7 +39,7 @@ using namespace PartDesign;
/* TRANSLATOR PartDesign::Pocket */
const char* Pocket::TypeEnums[]= {"Length","ThroughAll","UpToFirst","UpToFace","TwoLengths",NULL};
const char* Pocket::TypeEnums[]= {"Length","ThroughAll","UpToFirst","UpToFace","TwoLengths",nullptr};
PROPERTY_SOURCE(PartDesign::Pocket, PartDesign::FeatureExtrude)
@@ -53,9 +53,9 @@ Pocket::Pocket()
ADD_PROPERTY_TYPE(Length2, (5.0), "Pocket", App::Prop_None, "Pocket length in 2nd direction");
ADD_PROPERTY_TYPE(UseCustomVector, (false), "Pocket", App::Prop_None, "Use custom vector for pocket direction");
ADD_PROPERTY_TYPE(Direction, (Base::Vector3d(1.0, 1.0, 1.0)), "Pocket", App::Prop_None, "Pocket direction vector");
ADD_PROPERTY_TYPE(ReferenceAxis, (0), "Pocket", App::Prop_None, "Reference axis of direction");
ADD_PROPERTY_TYPE(ReferenceAxis, (nullptr), "Pocket", App::Prop_None, "Reference axis of direction");
ADD_PROPERTY_TYPE(AlongSketchNormal, (true), "Pocket", App::Prop_None, "Measure pocket length along the sketch normal direction");
ADD_PROPERTY_TYPE(UpToFace, (0), "Pocket", App::Prop_None, "Face where pocket will end");
ADD_PROPERTY_TYPE(UpToFace, (nullptr), "Pocket", App::Prop_None, "Face where pocket will end");
ADD_PROPERTY_TYPE(Offset, (0.0), "Pocket", App::Prop_None, "Offset from face in which pocket will end");
Offset.setConstraints(&signedLengthConstraint);
ADD_PROPERTY_TYPE(TaperAngle, (0.0), "Pocket", App::Prop_None, "Taper angle");
@@ -73,7 +73,7 @@ App::DocumentObjectExecReturn *Pocket::execute()
// Handle legacy features, these typically have Type set to 3 (previously NULL, now UpToFace),
// empty FaceName (because it didn't exist) and a value for Length
if (std::string(Type.getValueAsString()) == "UpToFace" &&
(UpToFace.getValue() == NULL && Length.getValue() > Precision::Confusion()))
(UpToFace.getValue() == nullptr && Length.getValue() > Precision::Confusion()))
Type.setValue("Length");
// Validate parameters

View File

@@ -53,7 +53,7 @@ const App::PropertyAngle::Constraints PolarPattern::floatAngle = { Base::toDegre
PolarPattern::PolarPattern()
{
ADD_PROPERTY_TYPE(Axis, (0), "PolarPattern", (App::PropertyType)(App::Prop_None), "Direction");
ADD_PROPERTY_TYPE(Axis, (nullptr), "PolarPattern", (App::PropertyType)(App::Prop_None), "Direction");
ADD_PROPERTY(Reversed, (0));
ADD_PROPERTY(Angle, (360.0));
Angle.setConstraints(&floatAngle);
@@ -98,7 +98,7 @@ const std::list<gp_Trsf> PolarPattern::getTransformations(const std::vector<App:
offset = radians / (occurrences - 1);
App::DocumentObject* refObject = Axis.getValue();
if (refObject == NULL)
if (refObject == nullptr)
throw Base::ValueError("No axis reference specified");
std::vector<std::string> subStrings = Axis.getSubValues();
if (subStrings.empty())

View File

@@ -40,7 +40,7 @@ std::string FeaturePy::representation(void) const
PyObject *FeaturePy::getCustomAttributes(const char* ) const
{
return 0;
return nullptr;
}
int FeaturePy::setCustomAttributes(const char* , PyObject *)

View File

@@ -55,7 +55,7 @@ Revolution::Revolution()
ADD_PROPERTY_TYPE(Axis,(Base::Vector3d(0.0,1.0,0.0)),"Revolution", App::Prop_ReadOnly, "Axis");
ADD_PROPERTY_TYPE(Angle,(360.0),"Revolution", App::Prop_None, "Angle");
Angle.setConstraints(&floatAngle);
ADD_PROPERTY_TYPE(ReferenceAxis,(0),"Revolution",(App::Prop_None),"Reference axis of revolution");
ADD_PROPERTY_TYPE(ReferenceAxis,(nullptr),"Revolution",(App::Prop_None),"Reference axis of revolution");
}
short Revolution::mustExecute() const

View File

@@ -69,10 +69,10 @@ PROPERTY_SOURCE(PartDesign::ProfileBased, PartDesign::FeatureAddSub)
ProfileBased::ProfileBased()
{
ADD_PROPERTY_TYPE(Profile, (0), "SketchBased", App::Prop_None, "Reference to sketch");
ADD_PROPERTY_TYPE(Profile, (nullptr), "SketchBased", App::Prop_None, "Reference to sketch");
ADD_PROPERTY_TYPE(Midplane, (0), "SketchBased", App::Prop_None, "Extrude symmetric to sketch face");
ADD_PROPERTY_TYPE(Reversed, (0), "SketchBased", App::Prop_None, "Reverse extrusion direction");
ADD_PROPERTY_TYPE(UpToFace, (0), "SketchBased", (App::PropertyType)(App::Prop_None), "Face where feature will end");
ADD_PROPERTY_TYPE(UpToFace, (nullptr), "SketchBased", (App::PropertyType)(App::Prop_None), "Face where feature will end");
ADD_PROPERTY_TYPE(AllowMultiFace, (false), "SketchBased", App::Prop_None, "Allow multiple faces in profile");
}
@@ -196,7 +196,7 @@ TopoDS_Shape ProfileBased::getVerifiedFace(bool silent) const {
if (!shape.hasSubShape(TopAbs_WIRE))
shape = shape.makeWires();
if (shape.hasSubShape(TopAbs_WIRE))
shape = shape.makeFace(0, "Part::FaceMakerBullseye");
shape = shape.makeFace(nullptr, "Part::FaceMakerBullseye");
else
err = "Cannot make face from profile";
}
@@ -389,7 +389,7 @@ void ProfileBased::onChanged(const App::Property* prop)
{
if (prop == &Profile) {
// if attached to a sketch then mark it as read-only
this->Placement.setStatus(App::Property::ReadOnly, Profile.getValue() != 0);
this->Placement.setStatus(App::Property::ReadOnly, Profile.getValue() != nullptr);
}
FeatureAddSub::onChanged(prop);
@@ -402,7 +402,7 @@ void ProfileBased::getUpToFaceFromLinkSub(TopoDS_Face& upToFace,
App::DocumentObject* ref = refFace.getValue();
std::vector<std::string> subStrings = refFace.getSubValues();
if (ref == NULL)
if (ref == nullptr)
throw Base::ValueError("SketchBased: Up to face: No face selected");
if (ref->getTypeId().isDerivedFrom(App::Plane::getClassTypeId())) {
@@ -1141,11 +1141,11 @@ void ProfileBased::handleChangedPropertyName(Base::XMLReader & reader, const cha
if (name != "") {
App::Document* document = getDocument();
DocumentObject* object = document ? document->getObject(name.c_str()) : 0;
DocumentObject* object = document ? document->getObject(name.c_str()) : nullptr;
Profile.setValue(object, vec);
}
else {
Profile.setValue(0, vec);
Profile.setValue(nullptr, vec);
}
}
else {

View File

@@ -33,8 +33,8 @@
using namespace PartDesign;
const char* PartDesign::Thickness::ModeEnums[] = {"Skin","Pipe", "RectoVerso",NULL};
const char* PartDesign::Thickness::JoinEnums[] = {"Arc", "Intersection",NULL};
const char* PartDesign::Thickness::ModeEnums[] = {"Skin","Pipe", "RectoVerso",nullptr};
const char* PartDesign::Thickness::JoinEnums[] = {"Arc", "Intersection",nullptr};
PROPERTY_SOURCE(PartDesign::Thickness, PartDesign::DressUp)

View File

@@ -53,13 +53,13 @@ using namespace PartDesign;
namespace PartDesign {
const char* Transformed::OverlapEnums[] = { "Detect", "Overlap mode", "Non-overlap mode", NULL};
const char* Transformed::OverlapEnums[] = { "Detect", "Overlap mode", "Non-overlap mode", nullptr};
PROPERTY_SOURCE(PartDesign::Transformed, PartDesign::Feature)
Transformed::Transformed()
{
ADD_PROPERTY(Originals,(0));
ADD_PROPERTY(Originals,(nullptr));
Originals.setSize(0);
Placement.setStatus(App::Property::ReadOnly, true);
@@ -90,7 +90,7 @@ Part::Feature* Transformed::getBaseObject(bool silent) const {
const char* err = nullptr;
const std::vector<App::DocumentObject*> & originals = Originals.getValues();
// NOTE: may be here supposed to be last origin but in order to keep the old behaviour keep here first
App::DocumentObject* firstOriginal = originals.empty() ? NULL : originals.front();
App::DocumentObject* firstOriginal = originals.empty() ? nullptr : originals.front();
if (firstOriginal) {
if(firstOriginal->isDerivedFrom(Part::Feature::getClassTypeId())) {
rv = static_cast<Part::Feature*>(firstOriginal);
@@ -115,7 +115,7 @@ App::DocumentObject* Transformed::getSketchObject() const
return (static_cast<PartDesign::ProfileBased*>(originals.front()))->getVerifiedSketch(true);
}
else if (!originals.empty() && originals.front()->getTypeId().isDerivedFrom(PartDesign::FeatureAddSub::getClassTypeId())) {
return NULL;
return nullptr;
}
else if (this->getTypeId().isDerivedFrom(LinearPattern::getClassTypeId())) {
// if Originals is empty then try the linear pattern's Direction property
@@ -133,7 +133,7 @@ App::DocumentObject* Transformed::getSketchObject() const
return pattern->MirrorPlane.getValue();
}
else {
return 0;
return nullptr;
}
}

View File

@@ -58,7 +58,7 @@ PROPERTY_SOURCE(PartDesign::ShapeBinder, Part::Feature)
ShapeBinder::ShapeBinder()
{
ADD_PROPERTY_TYPE(Support, (0,0), "",(App::PropertyType)(App::Prop_None),"Support of the geometry");
ADD_PROPERTY_TYPE(Support, (nullptr,nullptr), "",(App::PropertyType)(App::Prop_None),"Support of the geometry");
Placement.setStatus(App::Property::Hidden, true);
ADD_PROPERTY_TYPE(TraceSupport, (false), "", App::Prop_None, "Trace support shape");
}
@@ -303,13 +303,13 @@ PROPERTY_SOURCE(PartDesign::SubShapeBinder, Part::Feature)
SubShapeBinder::SubShapeBinder()
{
ADD_PROPERTY_TYPE(Support, (0), "",(App::PropertyType)(App::Prop_None), "Support of the geometry");
ADD_PROPERTY_TYPE(Support, (nullptr), "",(App::PropertyType)(App::Prop_None), "Support of the geometry");
Support.setStatus(App::Property::ReadOnly, true);
ADD_PROPERTY_TYPE(Fuse, (false), "Base",App::Prop_None,"Fuse solids from bound shapes");
ADD_PROPERTY_TYPE(MakeFace, (true), "Base",App::Prop_None,"Create face using wires from bound shapes");
ADD_PROPERTY_TYPE(Offset, (0.0), "Offsetting", App::Prop_None, "2D offset face or wires, 0.0 = no offset");
ADD_PROPERTY_TYPE(OffsetJoinType, ((long)0), "Offsetting", App::Prop_None, "Arcs, Tangent, Intersection");
static const char*JoinTypeEnum[] = {"Arcs", "Tangent", "Intersection", 0};
static const char*JoinTypeEnum[] = {"Arcs", "Tangent", "Intersection", nullptr};
OffsetJoinType.setEnums(JoinTypeEnum);
ADD_PROPERTY_TYPE(OffsetFill, (false),"Offsetting", App::Prop_None, "True = make face between original wire and offset.");
ADD_PROPERTY_TYPE(OffsetOpenResult, (false), "Offsetting", App::Prop_None, "False = make closed offset from open wire.");
@@ -324,14 +324,14 @@ SubShapeBinder::SubShapeBinder()
"Enable partial loading, which disables auto loading of external document for"
"external bound object.");
PartialLoad.setStatus(App::Property::PartialTrigger,true);
static const char *BindModeEnum[] = {"Synchronized", "Frozen", "Detached", 0};
static const char *BindModeEnum[] = {"Synchronized", "Frozen", "Detached", nullptr};
BindMode.setEnums(BindModeEnum);
ADD_PROPERTY_TYPE(Context, (0), "Base", App::Prop_Hidden,
ADD_PROPERTY_TYPE(Context, (nullptr), "Base", App::Prop_Hidden,
"Stores the context of this binder. It is used for monitoring and auto updating\n"
"the relative placement of the bound shape");
static const char *BindCopyOnChangeEnum[] = {"Disabled", "Enabled", "Mutated", 0};
static const char *BindCopyOnChangeEnum[] = {"Disabled", "Enabled", "Mutated", nullptr};
BindCopyOnChange.setEnums(BindCopyOnChangeEnum);
ADD_PROPERTY_TYPE(BindCopyOnChange, ((long)0), "Base", App::Prop_None,
"Disabled: disable copy on change.\n"
@@ -351,7 +351,7 @@ SubShapeBinder::SubShapeBinder()
App::Prop_Hidden|App::Prop_ReadOnly), "");
_CopiedLink.setScope(App::LinkScope::Hidden);
ADD_PROPERTY_TYPE(_CopiedLink,(0),"Base",(App::PropertyType)(
ADD_PROPERTY_TYPE(_CopiedLink,(nullptr),"Base",(App::PropertyType)(
App::Prop_Hidden|App::Prop_ReadOnly|App::Prop_NoPersist), "");
}
@@ -462,7 +462,7 @@ void SubShapeBinder::clearCopiedObjects() {
if(obj)
obj->getDocument()->removeObject(obj->getNameInDocument());
}
_CopiedLink.setValue(0);
_CopiedLink.setValue(nullptr);
}
void SubShapeBinder::update(SubShapeBinder::UpdateOption options) {
@@ -477,7 +477,7 @@ void SubShapeBinder::update(SubShapeBinder::UpdateOption options) {
auto parent = Context.getValue();
std::string parentSub = Context.getSubName(false);
if(!Relative.getValue())
parent = 0;
parent = nullptr;
else {
if(parent && parent->getSubObject(parentSub.c_str())==this) {
auto parents = parent->getParents();
@@ -486,7 +486,7 @@ void SubShapeBinder::update(SubShapeBinder::UpdateOption options) {
parentSub = parents.begin()->second + parentSub;
}
} else
parent = 0;
parent = nullptr;
if(!parent && parentSub.empty()) {
auto parents = getParents();
if(parents.size()) {
@@ -518,7 +518,7 @@ void SubShapeBinder::update(SubShapeBinder::UpdateOption options) {
}
}else{
Base::Matrix4D mat;
auto sobj = resolved->getSubObject(resolvedSub.c_str(),0,&mat);
auto sobj = resolved->getSubObject(resolvedSub.c_str(),nullptr,&mat);
if(sobj!=this) {
FC_LOG(getFullName() << " skip invalid parent " << resolved->getFullName()
<< '.' << resolvedSub);
@@ -546,7 +546,7 @@ void SubShapeBinder::update(SubShapeBinder::UpdateOption options) {
if(init)
continue;
App::DocumentObject *copied = 0;
App::DocumentObject *copied = nullptr;
if(BindCopyOnChange.getValue() == 2 && Support.getSubListValues().size()==1) {
if(_CopiedObjs.size())
@@ -559,7 +559,7 @@ void SubShapeBinder::update(SubShapeBinder::UpdateOption options) {
clearCopiedObjects();
auto tmpDoc = App::GetApplication().newDocument(
"_tmp_binder", 0, false, true);
"_tmp_binder", nullptr, false, true);
auto objs = tmpDoc->copyObject({obj},true,true);
if(objs.size()) {
for(auto it=objs.rbegin(); it!=objs.rend(); ++it)
@@ -737,7 +737,7 @@ void SubShapeBinder::update(SubShapeBinder::UpdateOption options) {
{
result = result.makeWires();
try {
result = result.makeFace(0);
result = result.makeFace(nullptr);
}catch(...){}
}
@@ -762,7 +762,7 @@ void SubShapeBinder::update(SubShapeBinder::UpdateOption options) {
if(!prop || !prop->isDerivedFrom(App::PropertyMatrix::getClassTypeId())) {
if(prop)
removeDynamicProperty(name);
prop = addDynamicProperty("App::PropertyMatrix",name,"Cache",0,0,false,true);
prop = addDynamicProperty("App::PropertyMatrix",name,"Cache",nullptr,0,false,true);
}
caches.erase(name);
static_cast<App::PropertyMatrix*>(prop)->setValue(v.second);
@@ -822,13 +822,13 @@ void SubShapeBinder::onChanged(const App::Property *prop) {
if(Support.getSubListValues().size()) {
update();
if(BindMode.getValue() == 2)
Support.setValue(0);
Support.setValue(nullptr);
}
}else if(prop == &BindCopyOnChange) {
setupCopyOnChange();
}else if(prop == &BindMode) {
if(BindMode.getValue() == 2)
Support.setValue(0);
Support.setValue(nullptr);
else if(BindMode.getValue() == 0)
update();
checkPropertyStatus();
@@ -869,7 +869,7 @@ void SubShapeBinder::setLinks(std::map<App::DocumentObject *, std::vector<std::s
{
if(values.empty()) {
if(reset) {
Support.setValue(0);
Support.setValue(nullptr);
Shape.setValue(Part::TopoShape());
}
return;

View File

@@ -118,8 +118,8 @@ public:
virtual bool canLinkProperties() const override {return false;}
virtual App::DocumentObject *getSubObject(const char *subname, PyObject **pyObj=0,
Base::Matrix4D *mat=0, bool transform=true, int depth=0) const override;
virtual App::DocumentObject *getSubObject(const char *subname, PyObject **pyObj=nullptr,
Base::Matrix4D *mat=nullptr, bool transform=true, int depth=0) const override;
protected:
virtual App::DocumentObjectExecReturn* execute(void) override;
@@ -141,7 +141,7 @@ protected:
typedef boost::signals2::scoped_connection Connection;
Connection connRecomputedObj;
App::Document *contextDoc = 0;
App::Document *contextDoc = nullptr;
std::vector<Connection> copyOnChangeConns;
bool hasCopyOnChange = true;