PD: remove trailing whitespace
This commit is contained in:
@@ -71,7 +71,7 @@ Base::Vector3d CoordinateSystem::getYAxis()
|
||||
rot.multVec(Base::Vector3d(0,1,0), normal);
|
||||
return normal;
|
||||
}
|
||||
|
||||
|
||||
Base::Vector3d CoordinateSystem::getZAxis()
|
||||
{
|
||||
Base::Rotation rot = Placement.getValue().getRotation();
|
||||
@@ -80,7 +80,7 @@ Base::Vector3d CoordinateSystem::getZAxis()
|
||||
return normal;
|
||||
}
|
||||
|
||||
App::DocumentObject *CoordinateSystem::getSubObject(const char *subname,
|
||||
App::DocumentObject *CoordinateSystem::getSubObject(const char *subname,
|
||||
PyObject **pyObj, Base::Matrix4D *pmat, bool transform, int) const
|
||||
{
|
||||
if(pmat && transform)
|
||||
|
||||
@@ -43,13 +43,13 @@ public:
|
||||
App::PropertyEnumeration ResizeMode;
|
||||
App::PropertyLength Length;
|
||||
void onChanged(const App::Property *prop) override;
|
||||
|
||||
|
||||
const char* getViewProviderName() const override {
|
||||
return "PartDesignGui::ViewProviderDatumLine";
|
||||
}
|
||||
|
||||
Base::Vector3d getDirection() const;
|
||||
|
||||
|
||||
private:
|
||||
static const char* ResizeModeEnums[];
|
||||
};
|
||||
|
||||
@@ -226,11 +226,11 @@ Body* Feature::getFeatureBody() const {
|
||||
for (auto in : list) {
|
||||
if(in->isDerivedFrom(Body::getClassTypeId()) && //is Body?
|
||||
static_cast<Body*>(in)->hasObject(this)) { //is part of this Body?
|
||||
|
||||
|
||||
return static_cast<Body*>(in);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ public:
|
||||
|
||||
/// Returns the body the feature is in, or none
|
||||
Body* getFeatureBody() const;
|
||||
|
||||
|
||||
/**
|
||||
* Returns the BaseFeature property's object (if any)
|
||||
* @param silent if couldn't determine the base feature and silent == true,
|
||||
@@ -86,11 +86,11 @@ protected:
|
||||
/**
|
||||
* Get a solid of the given shape. If no solid is found an exception is raised.
|
||||
*/
|
||||
static TopoDS_Shape getSolid(const TopoDS_Shape&);
|
||||
static int countSolids(const TopoDS_Shape&, TopAbs_ShapeEnum type = TopAbs_SOLID );
|
||||
static TopoDS_Shape getSolid(const TopoDS_Shape&);
|
||||
static int countSolids(const TopoDS_Shape&, TopAbs_ShapeEnum type = TopAbs_SOLID );
|
||||
|
||||
/// Grab any point from the given face
|
||||
static const gp_Pnt getPointFromFace(const TopoDS_Face& f);
|
||||
static const gp_Pnt getPointFromFace(const TopoDS_Face& f);
|
||||
/// Make a shape from a base plane (convenience method)
|
||||
static gp_Pln makePlnFromPlane(const App::DocumentObject* obj);
|
||||
static TopoDS_Shape makeShapeFromPlane(const App::DocumentObject* obj);
|
||||
|
||||
@@ -37,9 +37,9 @@ class PartDesignExport FeatureAddSub : public PartDesign::Feature
|
||||
public:
|
||||
enum Type {
|
||||
Additive = 0,
|
||||
Subtractive
|
||||
Subtractive
|
||||
};
|
||||
|
||||
|
||||
FeatureAddSub();
|
||||
|
||||
Type getAddSubType();
|
||||
|
||||
@@ -43,50 +43,50 @@ FeatureBase::FeatureBase()
|
||||
}
|
||||
|
||||
Part::Feature* FeatureBase::getBaseObject(bool) const {
|
||||
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
short int FeatureBase::mustExecute() const {
|
||||
|
||||
|
||||
if(BaseFeature.isTouched())
|
||||
return 1;
|
||||
|
||||
|
||||
return Part::Feature::mustExecute();
|
||||
}
|
||||
|
||||
|
||||
App::DocumentObjectExecReturn* FeatureBase::execute() {
|
||||
|
||||
|
||||
if(!BaseFeature.getValue())
|
||||
return new App::DocumentObjectExecReturn("BaseFeature link is not set");
|
||||
|
||||
|
||||
if(!BaseFeature.getValue()->isDerivedFrom(Part::Feature::getClassTypeId()))
|
||||
return new App::DocumentObjectExecReturn("BaseFeature must be a Part::Feature");
|
||||
|
||||
|
||||
auto shape = static_cast<Part::Feature*>(BaseFeature.getValue())->Shape.getValue();
|
||||
if (shape.IsNull())
|
||||
return new App::DocumentObjectExecReturn("BaseFeature has an empty shape");
|
||||
|
||||
|
||||
Shape.setValue(shape);
|
||||
|
||||
|
||||
return StdReturn;
|
||||
}
|
||||
|
||||
void FeatureBase::onChanged(const App::Property* prop) {
|
||||
|
||||
|
||||
// the BaseFeature property should track the Body BaseFeature and vice-versa
|
||||
if (prop == &BaseFeature) {
|
||||
|
||||
|
||||
auto body = getFeatureBody();
|
||||
if(!body)
|
||||
return;
|
||||
|
||||
|
||||
if (BaseFeature.getValue() && body->BaseFeature.getValue() != BaseFeature.getValue()) {
|
||||
body->BaseFeature.setValue(BaseFeature.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Part::Feature::onChanged(prop);
|
||||
}
|
||||
|
||||
|
||||
@@ -36,15 +36,15 @@ class PartDesignExport FeatureBase : public PartDesign::Feature
|
||||
|
||||
public:
|
||||
FeatureBase();
|
||||
|
||||
|
||||
short int mustExecute() const override;
|
||||
|
||||
|
||||
Part::Feature* getBaseObject(bool silent=false) const override;
|
||||
|
||||
|
||||
const char* getViewProviderName() const override {
|
||||
return "PartDesignGui::ViewProviderBase";
|
||||
}
|
||||
|
||||
|
||||
void onChanged(const App::Property* prop) override;
|
||||
App::DocumentObjectExecReturn* execute() override;
|
||||
void onDocumentRestored() override;
|
||||
|
||||
@@ -70,7 +70,7 @@ App::DocumentObjectExecReturn *Boolean::execute()
|
||||
{
|
||||
// Get the operation type
|
||||
std::string type = Type.getValueAsString();
|
||||
|
||||
|
||||
// Check the parameters
|
||||
const Part::Feature* baseFeature = this->getBaseObject(/* silent = */ true);
|
||||
|
||||
@@ -90,11 +90,11 @@ App::DocumentObjectExecReturn *Boolean::execute()
|
||||
auto feature = tools.back();
|
||||
if(!feature->isDerivedFrom(Part::Feature::getClassTypeId()))
|
||||
return new App::DocumentObjectExecReturn("Cannot do boolean with anything but Part::Feature and its derivatives");
|
||||
|
||||
|
||||
baseTopShape = static_cast<Part::Feature*>(feature)->Shape.getShape();
|
||||
tools.pop_back();
|
||||
}
|
||||
|
||||
|
||||
if (baseTopShape.getShape().IsNull())
|
||||
return new App::DocumentObjectExecReturn("Cannot do boolean operation with invalid base shape");
|
||||
|
||||
@@ -157,7 +157,7 @@ App::DocumentObjectExecReturn *Boolean::execute()
|
||||
}
|
||||
|
||||
void Boolean::onChanged(const App::Property* prop) {
|
||||
|
||||
|
||||
if(strcmp(prop->getName(), "Group") == 0)
|
||||
touch();
|
||||
|
||||
|
||||
@@ -162,7 +162,7 @@ App::DocumentObjectExecReturn *Chamfer::execute()
|
||||
|
||||
// Set the face based on flipDirection for all edges by default. Note for chamferType==0 it does not matter which face is used.
|
||||
TopoDS_Face face = TopoDS::Face( flipDirection ? faceLast : faceFirst );
|
||||
|
||||
|
||||
// for chamfer types otherthan Equal (type = 0) check if one of the faces associated with the edge
|
||||
// is one of the originally selected faces. If so use the other face by default or the selected face if "flipDirection" is set
|
||||
if (chamferType != 0) {
|
||||
@@ -171,14 +171,14 @@ App::DocumentObjectExecReturn *Chamfer::execute()
|
||||
for (const auto &itFN : FaceNames) {
|
||||
const TopoDS_Shape selFace = baseShape.getSubShape(itFN.c_str());
|
||||
|
||||
if ( faceLast.IsEqual(selFace) )
|
||||
if ( faceLast.IsEqual(selFace) )
|
||||
face = TopoDS::Face( flipDirection ? faceFirst : faceLast );
|
||||
|
||||
else if ( faceFirst.IsEqual(selFace) )
|
||||
|
||||
else if ( faceFirst.IsEqual(selFace) )
|
||||
face = TopoDS::Face( flipDirection ? faceLast : faceFirst );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
switch (chamferType) {
|
||||
case 0: // Equal distance
|
||||
|
||||
@@ -117,7 +117,7 @@ App::DocumentObjectExecReturn *Draft::execute()
|
||||
|
||||
// Pull direction
|
||||
gp_Dir pullDirection;
|
||||
App::DocumentObject* refDirection = PullDirection.getValue();
|
||||
App::DocumentObject* refDirection = PullDirection.getValue();
|
||||
if (refDirection) {
|
||||
if (refDirection->getTypeId().isDerivedFrom(PartDesign::Line::getClassTypeId())) {
|
||||
PartDesign::Line* line = static_cast<PartDesign::Line*>(refDirection);
|
||||
|
||||
@@ -218,7 +218,7 @@ void DressUp::getAddSubShape(Part::TopoShape &addShape, Part::TopoShape &subShap
|
||||
for(Feature *current=this; ;current=static_cast<DressUp*>(base)) {
|
||||
base = Base::freecad_dynamic_cast<FeatureAddSub>(current->getBaseObject(true));
|
||||
if(!base)
|
||||
FC_THROWM(Base::CADKernelError,
|
||||
FC_THROWM(Base::CADKernelError,
|
||||
"Cannot find additive or subtractive support for " << getFullName());
|
||||
if(!base->isDerivedFrom(DressUp::getClassTypeId()))
|
||||
break;
|
||||
|
||||
@@ -111,7 +111,7 @@ protected:
|
||||
const double angle,
|
||||
const double angle2,
|
||||
const bool midplane);
|
||||
|
||||
|
||||
/**
|
||||
* Disables settings that are not valid for the current method
|
||||
*/
|
||||
|
||||
@@ -71,7 +71,7 @@ App::DocumentObjectExecReturn *Fillet::execute()
|
||||
} catch (Base::Exception& e) {
|
||||
return new App::DocumentObjectExecReturn(e.what());
|
||||
}
|
||||
std::vector<std::string> SubNames = std::vector<std::string>(Base.getSubValues());
|
||||
std::vector<std::string> SubNames = std::vector<std::string>(Base.getSubValues());
|
||||
|
||||
if (UseAllEdges.getValue()){
|
||||
SubNames.clear();
|
||||
@@ -88,9 +88,9 @@ App::DocumentObjectExecReturn *Fillet::execute()
|
||||
|
||||
if (SubNames.empty())
|
||||
return new App::DocumentObjectExecReturn("Fillet not possible on selected shapes");
|
||||
|
||||
|
||||
double radius = Radius.getValue();
|
||||
|
||||
|
||||
if(radius <= 0)
|
||||
return new App::DocumentObjectExecReturn("Fillet radius must be greater than zero");
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ const App::PropertyAngle::Constraints Groove::floatAngle = { Base::toDegrees<dou
|
||||
Groove::Groove()
|
||||
{
|
||||
addSubType = FeatureAddSub::Subtractive;
|
||||
|
||||
|
||||
ADD_PROPERTY_TYPE(Base,(Base::Vector3d(0.0f,0.0f,0.0f)),"Groove", App::Prop_ReadOnly, "Base");
|
||||
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");
|
||||
@@ -139,7 +139,7 @@ App::DocumentObjectExecReturn *Groove::execute()
|
||||
if (checkLineCrossesFace(gp_Lin(pnt, dir), TopoDS::Face(xp.Current())))
|
||||
return new App::DocumentObjectExecReturn("Revolve axis intersects the sketch");
|
||||
}
|
||||
|
||||
|
||||
// revolve the face to a solid
|
||||
BRepPrimAPI_MakeRevol RevolMaker(sketchshape, gp_Ax1(pnt, dir), angle);
|
||||
|
||||
@@ -167,7 +167,7 @@ App::DocumentObjectExecReturn *Groove::execute()
|
||||
if (solidCount > 1) {
|
||||
return new App::DocumentObjectExecReturn("Groove: Result has multiple solids. This is not supported at this time.");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
return new App::DocumentObjectExecReturn("Could not revolve the sketch!");
|
||||
|
||||
@@ -905,7 +905,7 @@ void Hole::updateHoleCutParams()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else { // we have an UTS profile or none
|
||||
|
||||
|
||||
@@ -253,5 +253,5 @@ App::DocumentObjectExecReturn *Pad::execute()
|
||||
catch (Base::Exception& e) {
|
||||
return new App::DocumentObjectExecReturn(e.what());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -46,16 +46,16 @@ public:
|
||||
Prism,
|
||||
Wedge
|
||||
};
|
||||
|
||||
|
||||
FeaturePrimitive();
|
||||
|
||||
|
||||
const char* getViewProviderName() const override {
|
||||
return "PartDesignGui::ViewProviderPrimitive";
|
||||
}
|
||||
Type getPrimitiveType() {return primitiveType;}
|
||||
void onChanged(const App::Property* prop) override;
|
||||
PyObject* getPyObject() override;
|
||||
|
||||
|
||||
/// Do nothing, just to suppress warning, must be redefined in derived classes
|
||||
App::DocumentObjectExecReturn* execute() override {
|
||||
return PartDesign::FeatureAddSub::execute();
|
||||
@@ -64,7 +64,7 @@ protected:
|
||||
void handleChangedPropertyName(Base::XMLReader &reader, const char* TypeName, const char* PropName) override;
|
||||
//make the boolean ops with the primitives provided by the derived features
|
||||
App::DocumentObjectExecReturn* execute(const TopoDS_Shape& primitiveShape);
|
||||
Type primitiveType = Box;
|
||||
Type primitiveType = Box;
|
||||
};
|
||||
|
||||
class PartDesignExport Box : public PartDesign::FeaturePrimitive {
|
||||
@@ -72,24 +72,24 @@ class PartDesignExport Box : public PartDesign::FeaturePrimitive {
|
||||
PROPERTY_HEADER_WITH_OVERRIDE(PartDesign::Box);
|
||||
|
||||
public:
|
||||
|
||||
|
||||
Box();
|
||||
|
||||
|
||||
App::PropertyLength Length,Height,Width;
|
||||
|
||||
|
||||
/** @name methods override feature */
|
||||
//@{
|
||||
/// recalculate the Feature
|
||||
App::DocumentObjectExecReturn *execute() override;
|
||||
short mustExecute() const override;
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
};
|
||||
|
||||
class PartDesignExport AdditiveBox : public Box {
|
||||
PROPERTY_HEADER_WITH_OVERRIDE(PartDesign::AdditiveBox);
|
||||
|
||||
|
||||
AdditiveBox() {
|
||||
addSubType = FeatureAddSub::Additive;
|
||||
}
|
||||
@@ -97,7 +97,7 @@ class PartDesignExport AdditiveBox : public Box {
|
||||
|
||||
class PartDesignExport SubtractiveBox : public Box {
|
||||
PROPERTY_HEADER_WITH_OVERRIDE(PartDesign::SubtractiveBox);
|
||||
|
||||
|
||||
SubtractiveBox() {
|
||||
addSubType = FeatureAddSub::Subtractive;
|
||||
}
|
||||
@@ -109,13 +109,13 @@ class PartDesignExport Cylinder : public PartDesign::FeaturePrimitive, public Pa
|
||||
PROPERTY_HEADER_WITH_OVERRIDE(PartDesign::Cylinder);
|
||||
|
||||
public:
|
||||
|
||||
|
||||
Cylinder();
|
||||
|
||||
|
||||
App::PropertyLength Radius;
|
||||
App::PropertyLength Height;
|
||||
App::PropertyAngle Angle;
|
||||
|
||||
|
||||
/** @name methods override feature */
|
||||
//@{
|
||||
/// recalculate the Feature
|
||||
@@ -125,7 +125,7 @@ public:
|
||||
|
||||
class PartDesignExport AdditiveCylinder : public Cylinder {
|
||||
PROPERTY_HEADER_WITH_OVERRIDE(PartDesign::AdditiveCylinder);
|
||||
|
||||
|
||||
AdditiveCylinder() {
|
||||
addSubType = FeatureAddSub::Additive;
|
||||
}
|
||||
@@ -133,7 +133,7 @@ class PartDesignExport AdditiveCylinder : public Cylinder {
|
||||
|
||||
class PartDesignExport SubtractiveCylinder : public Cylinder {
|
||||
PROPERTY_HEADER_WITH_OVERRIDE(PartDesign::SubtractiveCylinder);
|
||||
|
||||
|
||||
SubtractiveCylinder() {
|
||||
addSubType = FeatureAddSub::Subtractive;
|
||||
}
|
||||
@@ -145,27 +145,27 @@ class PartDesignExport Sphere : public PartDesign::FeaturePrimitive {
|
||||
PROPERTY_HEADER_WITH_OVERRIDE(PartDesign::Sphere);
|
||||
|
||||
public:
|
||||
|
||||
|
||||
Sphere();
|
||||
|
||||
|
||||
App::PropertyLength Radius;
|
||||
App::PropertyAngle Angle1;
|
||||
App::PropertyAngle Angle2;
|
||||
App::PropertyAngle Angle3;
|
||||
|
||||
|
||||
/** @name methods override feature */
|
||||
//@{
|
||||
/// recalculate the Feature
|
||||
App::DocumentObjectExecReturn *execute() override;
|
||||
short mustExecute() const override;
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
};
|
||||
|
||||
class PartDesignExport AdditiveSphere : public Sphere {
|
||||
PROPERTY_HEADER_WITH_OVERRIDE(PartDesign::AdditiveSphere);
|
||||
|
||||
|
||||
AdditiveSphere() {
|
||||
addSubType = FeatureAddSub::Additive;
|
||||
}
|
||||
@@ -173,7 +173,7 @@ class PartDesignExport AdditiveSphere : public Sphere {
|
||||
|
||||
class PartDesignExport SubtractiveSphere : public Sphere {
|
||||
PROPERTY_HEADER_WITH_OVERRIDE(PartDesign::SubtractiveSphere);
|
||||
|
||||
|
||||
SubtractiveSphere() {
|
||||
addSubType = FeatureAddSub::Subtractive;
|
||||
}
|
||||
@@ -184,27 +184,27 @@ class PartDesignExport Cone : public PartDesign::FeaturePrimitive {
|
||||
PROPERTY_HEADER_WITH_OVERRIDE(PartDesign::Cone);
|
||||
|
||||
public:
|
||||
|
||||
|
||||
Cone();
|
||||
|
||||
|
||||
App::PropertyLength Radius1;
|
||||
App::PropertyLength Radius2;
|
||||
App::PropertyLength Height;
|
||||
App::PropertyAngle Angle;
|
||||
|
||||
|
||||
/** @name methods override feature */
|
||||
//@{
|
||||
/// recalculate the Feature
|
||||
App::DocumentObjectExecReturn *execute() override;
|
||||
short mustExecute() const override;
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
};
|
||||
|
||||
class PartDesignExport AdditiveCone : public Cone {
|
||||
PROPERTY_HEADER_WITH_OVERRIDE(PartDesign::AdditiveCone);
|
||||
|
||||
|
||||
AdditiveCone() {
|
||||
addSubType = FeatureAddSub::Additive;
|
||||
}
|
||||
@@ -212,7 +212,7 @@ class PartDesignExport AdditiveCone : public Cone {
|
||||
|
||||
class PartDesignExport SubtractiveCone : public Cone {
|
||||
PROPERTY_HEADER_WITH_OVERRIDE(PartDesign::SubtractiveCone);
|
||||
|
||||
|
||||
SubtractiveCone() {
|
||||
addSubType = FeatureAddSub::Subtractive;
|
||||
}
|
||||
@@ -224,29 +224,29 @@ class PartDesignExport Ellipsoid : public PartDesign::FeaturePrimitive {
|
||||
PROPERTY_HEADER_WITH_OVERRIDE(PartDesign::Ellipsoid);
|
||||
|
||||
public:
|
||||
|
||||
|
||||
Ellipsoid();
|
||||
|
||||
|
||||
App::PropertyLength Radius1;
|
||||
App::PropertyLength Radius2;
|
||||
App::PropertyLength Radius3;
|
||||
App::PropertyAngle Angle1;
|
||||
App::PropertyAngle Angle2;
|
||||
App::PropertyAngle Angle3;
|
||||
|
||||
|
||||
/** @name methods override feature */
|
||||
//@{
|
||||
/// recalculate the Feature
|
||||
App::DocumentObjectExecReturn *execute() override;
|
||||
short mustExecute() const override;
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
};
|
||||
|
||||
class PartDesignExport AdditiveEllipsoid : public Ellipsoid {
|
||||
PROPERTY_HEADER_WITH_OVERRIDE(PartDesign::AdditiveEllipsoid);
|
||||
|
||||
|
||||
AdditiveEllipsoid() {
|
||||
addSubType = FeatureAddSub::Additive;
|
||||
}
|
||||
@@ -254,7 +254,7 @@ class PartDesignExport AdditiveEllipsoid : public Ellipsoid {
|
||||
|
||||
class PartDesignExport SubtractiveEllipsoid : public Ellipsoid {
|
||||
PROPERTY_HEADER_WITH_OVERRIDE(PartDesign::SubtractiveEllipsoid);
|
||||
|
||||
|
||||
SubtractiveEllipsoid() {
|
||||
addSubType = FeatureAddSub::Subtractive;
|
||||
}
|
||||
@@ -266,28 +266,28 @@ class PartDesignExport Torus : public PartDesign::FeaturePrimitive {
|
||||
PROPERTY_HEADER_WITH_OVERRIDE(PartDesign::Torus);
|
||||
|
||||
public:
|
||||
|
||||
|
||||
Torus();
|
||||
|
||||
|
||||
App::PropertyLength Radius1;
|
||||
App::PropertyLength Radius2;
|
||||
App::PropertyAngle Angle1;
|
||||
App::PropertyAngle Angle2;
|
||||
App::PropertyAngle Angle3;
|
||||
|
||||
|
||||
/** @name methods override feature */
|
||||
//@{
|
||||
/// recalculate the Feature
|
||||
App::DocumentObjectExecReturn *execute() override;
|
||||
short mustExecute() const override;
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
};
|
||||
|
||||
class PartDesignExport AdditiveTorus : public Torus {
|
||||
PROPERTY_HEADER_WITH_OVERRIDE(PartDesign::AdditiveTorus);
|
||||
|
||||
|
||||
AdditiveTorus() {
|
||||
addSubType = FeatureAddSub::Additive;
|
||||
}
|
||||
@@ -295,7 +295,7 @@ class PartDesignExport AdditiveTorus : public Torus {
|
||||
|
||||
class PartDesignExport SubtractiveTorus : public Torus {
|
||||
PROPERTY_HEADER_WITH_OVERRIDE(PartDesign::SubtractiveTorus);
|
||||
|
||||
|
||||
SubtractiveTorus() {
|
||||
addSubType = FeatureAddSub::Subtractive;
|
||||
}
|
||||
@@ -312,7 +312,7 @@ public:
|
||||
App::PropertyIntegerConstraint Polygon;
|
||||
App::PropertyLength Circumradius;
|
||||
App::PropertyLength Height;
|
||||
|
||||
|
||||
/** @name methods override feature */
|
||||
//@{
|
||||
/// recalculate the Feature
|
||||
@@ -322,7 +322,7 @@ public:
|
||||
|
||||
class PartDesignExport AdditivePrism : public Prism {
|
||||
PROPERTY_HEADER_WITH_OVERRIDE(PartDesign::AdditivePrism);
|
||||
|
||||
|
||||
AdditivePrism() {
|
||||
addSubType = FeatureAddSub::Additive;
|
||||
}
|
||||
@@ -330,7 +330,7 @@ class PartDesignExport AdditivePrism : public Prism {
|
||||
|
||||
class PartDesignExport SubtractivePrism : public Prism {
|
||||
PROPERTY_HEADER_WITH_OVERRIDE(PartDesign::SubtractivePrism);
|
||||
|
||||
|
||||
SubtractivePrism() {
|
||||
addSubType = FeatureAddSub::Subtractive;
|
||||
}
|
||||
@@ -342,9 +342,9 @@ class PartDesignExport Wedge : public PartDesign::FeaturePrimitive {
|
||||
PROPERTY_HEADER_WITH_OVERRIDE(PartDesign::Wedge);
|
||||
|
||||
public:
|
||||
|
||||
|
||||
Wedge();
|
||||
|
||||
|
||||
App::PropertyDistance Xmin;
|
||||
App::PropertyDistance Ymin;
|
||||
App::PropertyDistance Zmin;
|
||||
@@ -355,20 +355,20 @@ public:
|
||||
App::PropertyDistance Zmax;
|
||||
App::PropertyDistance Z2max;
|
||||
App::PropertyDistance X2max;
|
||||
|
||||
|
||||
/** @name methods override feature */
|
||||
//@{
|
||||
/// recalculate the Feature
|
||||
App::DocumentObjectExecReturn *execute() override;
|
||||
short mustExecute() const override;
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
};
|
||||
|
||||
class PartDesignExport AdditiveWedge : public Wedge {
|
||||
PROPERTY_HEADER_WITH_OVERRIDE(PartDesign::AdditiveWedge);
|
||||
|
||||
|
||||
AdditiveWedge() {
|
||||
addSubType = FeatureAddSub::Additive;
|
||||
}
|
||||
@@ -376,7 +376,7 @@ class PartDesignExport AdditiveWedge : public Wedge {
|
||||
|
||||
class PartDesignExport SubtractiveWedge : public Wedge {
|
||||
PROPERTY_HEADER_WITH_OVERRIDE(PartDesign::SubtractiveWedge);
|
||||
|
||||
|
||||
SubtractiveWedge() {
|
||||
addSubType = FeatureAddSub::Subtractive;
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<GenerateModel xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="generateMetaModel_Module.xsd">
|
||||
<PythonExport
|
||||
<PythonExport
|
||||
Father="PartFeaturePy"
|
||||
Name="FeaturePy"
|
||||
Twin="Feature"
|
||||
TwinPointer="Feature"
|
||||
Twin="Feature"
|
||||
TwinPointer="Feature"
|
||||
Include="Mod/PartDesign/App/Feature.h"
|
||||
Namespace="PartDesign"
|
||||
FatherInclude="Mod/Part/App/PartFeaturePy.h"
|
||||
|
||||
@@ -45,7 +45,7 @@ PyObject *FeaturePy::getCustomAttributes(const char* ) const
|
||||
|
||||
int FeaturePy::setCustomAttributes(const char* , PyObject *)
|
||||
{
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
PyObject* FeaturePy::getBaseObject(PyObject * /*args*/)
|
||||
|
||||
@@ -50,7 +50,7 @@ const App::PropertyAngle::Constraints Revolution::floatAngle = { Base::toDegrees
|
||||
Revolution::Revolution()
|
||||
{
|
||||
addSubType = FeatureAddSub::Additive;
|
||||
|
||||
|
||||
ADD_PROPERTY_TYPE(Base,(Base::Vector3d(0.0,0.0,0.0)),"Revolution", App::Prop_ReadOnly, "Base");
|
||||
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");
|
||||
@@ -138,7 +138,7 @@ App::DocumentObjectExecReturn *Revolution::execute()
|
||||
for (;xp.More(); xp.Next()) {
|
||||
if (checkLineCrossesFace(gp_Lin(pnt, dir), TopoDS::Face(xp.Current())))
|
||||
return new App::DocumentObjectExecReturn("Revolve axis intersects the sketch");
|
||||
}
|
||||
}
|
||||
|
||||
// revolve the face to a solid
|
||||
BRepPrimAPI_MakeRevol RevolMaker(sketchshape, gp_Ax1(pnt, dir), angle);
|
||||
@@ -147,7 +147,7 @@ App::DocumentObjectExecReturn *Revolution::execute()
|
||||
TopoDS_Shape result = RevolMaker.Shape();
|
||||
result = refineShapeIfActive(result);
|
||||
// set the additive shape property for later usage in e.g. pattern
|
||||
this->AddSubShape.setValue(result);
|
||||
this->AddSubShape.setValue(result);
|
||||
|
||||
if (!base.IsNull()) {
|
||||
// Let's call algorithm computing a fuse operation:
|
||||
|
||||
@@ -43,7 +43,7 @@ public:
|
||||
Solid();
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
};
|
||||
|
||||
} //namespace PartDesign
|
||||
|
||||
@@ -42,7 +42,7 @@ public:
|
||||
App::PropertyBool Reversed;
|
||||
App::PropertyBool Intersection;
|
||||
App::PropertyEnumeration Mode;
|
||||
App::PropertyEnumeration Join;
|
||||
App::PropertyEnumeration Join;
|
||||
|
||||
/** @name methods override feature */
|
||||
//@{
|
||||
|
||||
@@ -21,4 +21,4 @@
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#include "PreCompiled.h"
|
||||
#include "PreCompiled.h"
|
||||
|
||||
@@ -66,11 +66,11 @@ class HoleGui:
|
||||
if body is None:
|
||||
QtGui.QMessageBox.critical(mw, "No active body", "Please create a body or make a body active")
|
||||
return
|
||||
|
||||
|
||||
feature = doc.addObject("Part::FeaturePython","Hole")
|
||||
hole = Hole(feature)
|
||||
body.addFeature(feature)
|
||||
|
||||
|
||||
vp = ViewProviderHole(feature.ViewObject)
|
||||
feature.touch()
|
||||
FreeCAD.ActiveDocument.recompute()
|
||||
|
||||
@@ -26,7 +26,7 @@ import FreeCAD
|
||||
"Standards for bore hole feature"
|
||||
sources = {
|
||||
"inet_arcor" : "http://home.arcor.de/maschinenelemente2-din/DIN%20EN%2020273_Durchgangsl%F6cher%20fuer%20Schrauben.PDF",
|
||||
"inet_duckma" : "http://www.duckma.de/mb14/SiteDocs/DIN%20Grundlagen%20Maschinenbau.pdf",
|
||||
"inet_duckma" : "http://www.duckma.de/mb14/SiteDocs/DIN%20Grundlagen%20Maschinenbau.pdf",
|
||||
"klein_14" : "Klein: Einführung in die DIN-Normen, 14. Auflage. Stuttgart, Teubner 2008"
|
||||
}
|
||||
|
||||
@@ -37,19 +37,19 @@ StandardType = 3
|
||||
|
||||
standards = {
|
||||
# "Standard name" : ("Year", "Title", "Source", "Type")
|
||||
"DIN 13-1" : ("1999", "Metrisches ISO-Gewinde allgemeiner Anwendung (Auszug); Nennmaße für Regelgewinde", "klein_14", "thread"),
|
||||
"DIN 74-A" : ("2003", "Senkungen fur Senkschrauben, ausgenommen Senkschrauben mit Kopfen nach DIN EN 27721; Form A", "klein_14", "countersink"),
|
||||
"DIN 74-E" : ("2003", "Senkungen fur Senkschrauben, ausgenommen Senkschrauben mit Kopfen nach DIN EN 27721; Form E", "klein_14", "countersink"),
|
||||
"DIN 74-F" : ("2003", "Senkungen fur Senkschrauben, ausgenommen Senkschrauben mit Kopfen nach DIN EN 27721; Form F", "klein_14", "countersink"),
|
||||
"DIN 76-2" : ("1984", "Gewindeausläufe und Gewindefreistiche (Auszug); für Metrisches ISO-Gewinde nach DIN 13; Innengewinde (Gewindegrundlöcher)", "klein_14", "threaded"),
|
||||
"DIN 974-1" : ("1991", "Senkdurchmesser für Schrauben mit Zylinderkopf; Konstruktionsmaße (Auszug)", "klein_14", "counterbore"),
|
||||
"DIN 974-2" : ("1991", "Senkdurchmesser fur Sechskantschrauben und Sechskantmuttern; Konstruktionsmaße(Auszug)", "klein_14", "counterbore"),
|
||||
"ISO 273" : ("1979", "Fasteners; Clearance holes for bolts and screws", "inet_arcor", "through"),
|
||||
"DIN 13-1" : ("1999", "Metrisches ISO-Gewinde allgemeiner Anwendung (Auszug); Nennmaße für Regelgewinde", "klein_14", "thread"),
|
||||
"DIN 74-A" : ("2003", "Senkungen fur Senkschrauben, ausgenommen Senkschrauben mit Kopfen nach DIN EN 27721; Form A", "klein_14", "countersink"),
|
||||
"DIN 74-E" : ("2003", "Senkungen fur Senkschrauben, ausgenommen Senkschrauben mit Kopfen nach DIN EN 27721; Form E", "klein_14", "countersink"),
|
||||
"DIN 74-F" : ("2003", "Senkungen fur Senkschrauben, ausgenommen Senkschrauben mit Kopfen nach DIN EN 27721; Form F", "klein_14", "countersink"),
|
||||
"DIN 76-2" : ("1984", "Gewindeausläufe und Gewindefreistiche (Auszug); für Metrisches ISO-Gewinde nach DIN 13; Innengewinde (Gewindegrundlöcher)", "klein_14", "threaded"),
|
||||
"DIN 974-1" : ("1991", "Senkdurchmesser für Schrauben mit Zylinderkopf; Konstruktionsmaße (Auszug)", "klein_14", "counterbore"),
|
||||
"DIN 974-2" : ("1991", "Senkdurchmesser fur Sechskantschrauben und Sechskantmuttern; Konstruktionsmaße(Auszug)", "klein_14", "counterbore"),
|
||||
"ISO 273" : ("1979", "Fasteners; Clearance holes for bolts and screws", "inet_arcor", "through"),
|
||||
"ISO 15065" : ("2005", "Senkungen fur Senkschrauben mit Kopfform nach ISO 7721", "klein_14", "countersink")
|
||||
}
|
||||
|
||||
aliases = {
|
||||
"ISO 273" : ("ISO 273:1979", "EN 20273:1991", "DIN EN 20273:1992", "DIN ISO 273", "DIN ISO 273/09.79"),
|
||||
"ISO 273" : ("ISO 273:1979", "EN 20273:1991", "DIN EN 20273:1992", "DIN ISO 273", "DIN ISO 273/09.79"),
|
||||
"ISO 15065" : ("ISO 15065:2005", "EN ISO 15065", "EN ISO 15065:2005", "DIN EN ISO 15065")
|
||||
}
|
||||
|
||||
@@ -115,71 +115,71 @@ standards_through = {
|
||||
standards_counterbore = {
|
||||
# "Standard name" : {Thread_dia : counterboredia(row1, row2, row3, row4, row5, row6)}
|
||||
"DIN 974-1" : {
|
||||
1.0 : (2.2, None, None, None, None, None),
|
||||
1.2 : (2.5, None, None, None, None, None),
|
||||
1.4 : (3.0, None, None, None, None, None),
|
||||
1.6 : (3.5, 3.5, None, None, None, None),
|
||||
1.8 : (3.8, None, None, None, None, None),
|
||||
2.0 : (4.4, 5.0, None, 5.5, 6, 6),
|
||||
2.5 : (5.5, 6, None, 6, 7, 7),
|
||||
3.0 : (6.5, 7, 6.5, 7, 9, 8),
|
||||
3.5 : (6.5, 8, 6.5, 8, 9, 9),
|
||||
4.0 : (8, 9, 8, 9, 10, 10),
|
||||
5.0 : (10, 11, 10, 11, 13, 13),
|
||||
6.0 : (11, 13, 11, 13, 15, 15),
|
||||
8.0 : (15, 18, 15, 16, 18, 20),
|
||||
10.0 : (18, 24, 18, 20, 24, 24),
|
||||
12.0 : (20, None, 20, 24, 26, 33),
|
||||
14.0 : (24, None, 24, 26, 30, 40),
|
||||
16.0 : (26, None, 26, 30, 33, 43),
|
||||
18.0 : (30, None, 30, 33, 36, 46),
|
||||
20.0 : (33, None, 33, 36, 40, 48),
|
||||
22.0 : (36, None, 36, 40, 43, 54),
|
||||
24.0 : (40, None, 40, 43, 48, 58),
|
||||
27.0 : (46, None, 46, 46, 54, 63),
|
||||
30.0 : (50, None, 50, 54, 61, 73),
|
||||
33.0 : (54, None, 54, None, 63, None),
|
||||
36.0 : (58, None, 58, 63, 69, None),
|
||||
42.0 : (69, None, 69, 73, 82, None),
|
||||
48.0 : (78, None, 78, 82, 98, None),
|
||||
56.0 : (93, None, 93, 93, 112, None),
|
||||
64.0 : (107, None, 107, 107, 125, None),
|
||||
72.0 : (118, None, 118, 118, 132, None),
|
||||
80.0 : (132, None, 132, 132, 150, None),
|
||||
90.0 : (145, None, 145, 145, 170, None),
|
||||
1.0 : (2.2, None, None, None, None, None),
|
||||
1.2 : (2.5, None, None, None, None, None),
|
||||
1.4 : (3.0, None, None, None, None, None),
|
||||
1.6 : (3.5, 3.5, None, None, None, None),
|
||||
1.8 : (3.8, None, None, None, None, None),
|
||||
2.0 : (4.4, 5.0, None, 5.5, 6, 6),
|
||||
2.5 : (5.5, 6, None, 6, 7, 7),
|
||||
3.0 : (6.5, 7, 6.5, 7, 9, 8),
|
||||
3.5 : (6.5, 8, 6.5, 8, 9, 9),
|
||||
4.0 : (8, 9, 8, 9, 10, 10),
|
||||
5.0 : (10, 11, 10, 11, 13, 13),
|
||||
6.0 : (11, 13, 11, 13, 15, 15),
|
||||
8.0 : (15, 18, 15, 16, 18, 20),
|
||||
10.0 : (18, 24, 18, 20, 24, 24),
|
||||
12.0 : (20, None, 20, 24, 26, 33),
|
||||
14.0 : (24, None, 24, 26, 30, 40),
|
||||
16.0 : (26, None, 26, 30, 33, 43),
|
||||
18.0 : (30, None, 30, 33, 36, 46),
|
||||
20.0 : (33, None, 33, 36, 40, 48),
|
||||
22.0 : (36, None, 36, 40, 43, 54),
|
||||
24.0 : (40, None, 40, 43, 48, 58),
|
||||
27.0 : (46, None, 46, 46, 54, 63),
|
||||
30.0 : (50, None, 50, 54, 61, 73),
|
||||
33.0 : (54, None, 54, None, 63, None),
|
||||
36.0 : (58, None, 58, 63, 69, None),
|
||||
42.0 : (69, None, 69, 73, 82, None),
|
||||
48.0 : (78, None, 78, 82, 98, None),
|
||||
56.0 : (93, None, 93, 93, 112, None),
|
||||
64.0 : (107, None, 107, 107, 125, None),
|
||||
72.0 : (118, None, 118, 118, 132, None),
|
||||
80.0 : (132, None, 132, 132, 150, None),
|
||||
90.0 : (145, None, 145, 145, 170, None),
|
||||
100.0:(160, None, 160, 160, 182, None)
|
||||
},
|
||||
},
|
||||
"DIN 974-2" : {
|
||||
3.0 : (11, 11, 9),
|
||||
4.0 : (13, 15, 10),
|
||||
5.0 : (15, 18, 11),
|
||||
6.0 : (18, 20, 13),
|
||||
8.0 : (24, 26, 18),
|
||||
10.0:(28, 33, 22),
|
||||
12.0:(33, 36, 26),
|
||||
14.0:(36, 43, 30),
|
||||
16.0:(40, 46, 33),
|
||||
18.0:(43, 50, 36),
|
||||
20.0:(46, 54, 40),
|
||||
22.0:(54, 61, 46),
|
||||
24.0:(58, 73, 48),
|
||||
27.0:(61, 76, 54),
|
||||
30.0:(73, 82, 61),
|
||||
33.0:(76, 89, 69),
|
||||
36.0:(82, 93, 73),
|
||||
39.0:(89, 98, 76),
|
||||
42.0:(98, 107, 82),
|
||||
3.0 : (11, 11, 9),
|
||||
4.0 : (13, 15, 10),
|
||||
5.0 : (15, 18, 11),
|
||||
6.0 : (18, 20, 13),
|
||||
8.0 : (24, 26, 18),
|
||||
10.0:(28, 33, 22),
|
||||
12.0:(33, 36, 26),
|
||||
14.0:(36, 43, 30),
|
||||
16.0:(40, 46, 33),
|
||||
18.0:(43, 50, 36),
|
||||
20.0:(46, 54, 40),
|
||||
22.0:(54, 61, 46),
|
||||
24.0:(58, 73, 48),
|
||||
27.0:(61, 76, 54),
|
||||
30.0:(73, 82, 61),
|
||||
33.0:(76, 89, 69),
|
||||
36.0:(82, 93, 73),
|
||||
39.0:(89, 98, 76),
|
||||
42.0:(98, 107, 82),
|
||||
45.0:(107, 112, 89)
|
||||
}
|
||||
}
|
||||
|
||||
standards_counterbore_through = {
|
||||
# Standard name : Through hole standard name
|
||||
"DIN 74-A" : "ISO 273",
|
||||
"DIN 74-A" : "ISO 273",
|
||||
"DIN 74-E" : "ISO 273", # Note that the standards seems to allow tolerance class "fine" only
|
||||
"DIN 74-F" : "ISO 273",
|
||||
"DIN 974-1" : "ISO 273",
|
||||
"DIN 974-2" : "ISO 273",
|
||||
"DIN 974-1" : "ISO 273",
|
||||
"DIN 974-2" : "ISO 273",
|
||||
"ISO 15065" : "ISO 273"
|
||||
}
|
||||
|
||||
@@ -187,26 +187,26 @@ standards_counterbore_rows = {
|
||||
# Row index : ( extra standards e.g. bolt used or washer used )
|
||||
# Note that DIN 7980 has been cancelled, therefore row three should not be used any more
|
||||
"DIN 974-1" : {
|
||||
1 : ("ISO 1207", "ISO 4762", "DIN 6912", "DIN 7984"),
|
||||
1 : ("ISO 1207", "ISO 4762", "DIN 6912", "DIN 7984"),
|
||||
2 : ("ISO 1580", "ISO 7045"),
|
||||
3 : ("DIN 7980", ""), # single value gives wrong iteration when collecting the standards
|
||||
4 : ("ISO 10673 type C", "DIN 6798", "DIN 6907"),
|
||||
5 : ("ISO 7089", "ISO 7090", "ISO 10673 type A"),
|
||||
4 : ("ISO 10673 type C", "DIN 6798", "DIN 6907"),
|
||||
5 : ("ISO 7089", "ISO 7090", "ISO 10673 type A"),
|
||||
6 : ("DIN 6796", "DIN 6908")
|
||||
},
|
||||
},
|
||||
"DIN 974-2" : {
|
||||
1 : ("DIN 659", "DIN 896", "DIN 3112", "DIN 3124"),
|
||||
2 : ("DIN 838", "DIN 897", "DIN 3129"),
|
||||
1 : ("DIN 659", "DIN 896", "DIN 3112", "DIN 3124"),
|
||||
2 : ("DIN 838", "DIN 897", "DIN 3129"),
|
||||
3 : ("tight", "")
|
||||
}
|
||||
}
|
||||
|
||||
standards_counterbore_extradepth = {
|
||||
# max Thread diameter : extra depth
|
||||
1.4 : 0.2,
|
||||
6.0 : 0.4,
|
||||
20.0 : 0.6,
|
||||
27.0 : 0.8,
|
||||
1.4 : 0.2,
|
||||
6.0 : 0.4,
|
||||
20.0 : 0.6,
|
||||
27.0 : 0.8,
|
||||
100.0 : 1.0
|
||||
}
|
||||
|
||||
@@ -216,46 +216,46 @@ standards_countersink_angle = 1
|
||||
standards_countersink = {
|
||||
# "Standard name" : {Thread_dia : (countersinkdia, head angle)}
|
||||
"DIN 74-A" : {
|
||||
1.6 : (3.7, 90.0),
|
||||
1.6 : (3.7, 90.0),
|
||||
2.0 : (4.6, 90.0),
|
||||
2.5 : (5.7, 90.0),
|
||||
3.0 : (6.5, 90.0),
|
||||
3.5 : (7.6, 90.0),
|
||||
4.0 : (8.6, 90.0),
|
||||
4.5 : (9.5, 90.0),
|
||||
5.0 : (10.4, 90.0),
|
||||
5.5 : (11.4, 90.0),
|
||||
6.0 : (12.4, 90.0),
|
||||
7.0 : (14.4, 90.0),
|
||||
2.5 : (5.7, 90.0),
|
||||
3.0 : (6.5, 90.0),
|
||||
3.5 : (7.6, 90.0),
|
||||
4.0 : (8.6, 90.0),
|
||||
4.5 : (9.5, 90.0),
|
||||
5.0 : (10.4, 90.0),
|
||||
5.5 : (11.4, 90.0),
|
||||
6.0 : (12.4, 90.0),
|
||||
7.0 : (14.4, 90.0),
|
||||
8.0 : (16.4, 90.0)
|
||||
},
|
||||
},
|
||||
"DIN 74-E" : {
|
||||
10.0 : (19.0, 75.0),
|
||||
12.0 : (24.0, 75.0),
|
||||
16.0 : (31.0, 75.0),
|
||||
20.0 : (34.0, 60.0),
|
||||
22.0 : (37.0, 60.0),
|
||||
10.0 : (19.0, 75.0),
|
||||
12.0 : (24.0, 75.0),
|
||||
16.0 : (31.0, 75.0),
|
||||
20.0 : (34.0, 60.0),
|
||||
22.0 : (37.0, 60.0),
|
||||
24.0 : (40.0, 60.0)
|
||||
},
|
||||
},
|
||||
"DIN 74-F" : {
|
||||
3.0 : (6.94, 90.0),
|
||||
4.0 : (9.18, 90.0),
|
||||
5.0 : (11.47, 90.0),
|
||||
6.0 : (13.71, 90.0),
|
||||
8.0 : (18.25, 90.0),
|
||||
10.0 : (22.73, 90.0),
|
||||
12.0 : (27.21, 90.0),
|
||||
14.0 : (31.19, 90.0),
|
||||
3.0 : (6.94, 90.0),
|
||||
4.0 : (9.18, 90.0),
|
||||
5.0 : (11.47, 90.0),
|
||||
6.0 : (13.71, 90.0),
|
||||
8.0 : (18.25, 90.0),
|
||||
10.0 : (22.73, 90.0),
|
||||
12.0 : (27.21, 90.0),
|
||||
14.0 : (31.19, 90.0),
|
||||
16.0 : (33.39, 90.0),
|
||||
20.0 : (40.71, 90.0)
|
||||
},
|
||||
"ISO 15065" : {
|
||||
2.0 : (4.4, 90.0),
|
||||
3.0 : (6.3, 90.0),
|
||||
4.0 : (9.4, 90.0),
|
||||
5.0 : (0.4, 90.0),
|
||||
6.0 : (12.6, 90.0),
|
||||
8.0 : (17.3, 90.0),
|
||||
2.0 : (4.4, 90.0),
|
||||
3.0 : (6.3, 90.0),
|
||||
4.0 : (9.4, 90.0),
|
||||
5.0 : (0.4, 90.0),
|
||||
6.0 : (12.6, 90.0),
|
||||
8.0 : (17.3, 90.0),
|
||||
10.0 : (20.0, 90.0)
|
||||
}
|
||||
}
|
||||
@@ -265,29 +265,29 @@ standards_threaded_types = ("normal", "short", "long")
|
||||
standards_threaded = {
|
||||
# Standard name : { Tread pitch : threadFinish(normal, short, long) }
|
||||
"DIN 76-2" : {
|
||||
0.20 : (1.3, 0.8, 2.0),
|
||||
0.25 : (1.5, 1.0, 2.4),
|
||||
0.30 : (1.8, 1.2, 2.9),
|
||||
0.35 : (2.1, 1.3, 3.3),
|
||||
0.40 : (2.3, 1.5, 3.7),
|
||||
0.45 : (2.6, 1.6, 4.1),
|
||||
0.50 : (2.8, 1.8, 4.5),
|
||||
0.60 : (3.4, 2.1, 5.4),
|
||||
0.70 : (3.8, 2.4, 6.1),
|
||||
0.75 : (4.0 , 2.5, 6.4),
|
||||
0.80 : (4.2, 2.7, 6.8),
|
||||
1.00 : (5.1, 3.2, 8.2),
|
||||
1.25 : (6.2, 3.9, 10),
|
||||
1.5 : (7.3, 4.6, 11.6),
|
||||
1.75 : (8.3, 5.2, 13.3),
|
||||
2.0 : (9.3, 5.8, 14.8),
|
||||
2.5 : (11.2, 7.0, 17.9),
|
||||
3.0 : (13.1, 8.2, 21.0),
|
||||
3.5 : (15.2, 9.5, 24.3),
|
||||
4.0 : (16.8, 10.5, 26.9),
|
||||
4.5 : (18.4, 11.5, 29.4),
|
||||
5.0 : (20.8, 13.0, 33.3),
|
||||
5.5 : (22.4, 14.0, 35.8),
|
||||
0.20 : (1.3, 0.8, 2.0),
|
||||
0.25 : (1.5, 1.0, 2.4),
|
||||
0.30 : (1.8, 1.2, 2.9),
|
||||
0.35 : (2.1, 1.3, 3.3),
|
||||
0.40 : (2.3, 1.5, 3.7),
|
||||
0.45 : (2.6, 1.6, 4.1),
|
||||
0.50 : (2.8, 1.8, 4.5),
|
||||
0.60 : (3.4, 2.1, 5.4),
|
||||
0.70 : (3.8, 2.4, 6.1),
|
||||
0.75 : (4.0 , 2.5, 6.4),
|
||||
0.80 : (4.2, 2.7, 6.8),
|
||||
1.00 : (5.1, 3.2, 8.2),
|
||||
1.25 : (6.2, 3.9, 10),
|
||||
1.5 : (7.3, 4.6, 11.6),
|
||||
1.75 : (8.3, 5.2, 13.3),
|
||||
2.0 : (9.3, 5.8, 14.8),
|
||||
2.5 : (11.2, 7.0, 17.9),
|
||||
3.0 : (13.1, 8.2, 21.0),
|
||||
3.5 : (15.2, 9.5, 24.3),
|
||||
4.0 : (16.8, 10.5, 26.9),
|
||||
4.5 : (18.4, 11.5, 29.4),
|
||||
5.0 : (20.8, 13.0, 33.3),
|
||||
5.5 : (22.4, 14.0, 35.8),
|
||||
6.0 : (24.0, 15, 38.4)
|
||||
}
|
||||
}
|
||||
@@ -309,30 +309,30 @@ standards_thread = {
|
||||
# Standard name : { Thread diameter : (pitch, flank diameter, core diameter, thread depth outer, thread depth inner, round) }
|
||||
# Note: This table only has the most common thread diameters
|
||||
"DIN 13-1" : {
|
||||
1.0 : (0.25, 0.838, 0.693, 0.729, 0.153, 0.135, 0.036),
|
||||
1.1 : (0.25, 0.938, 0.793, 0.829, 0.153, 0.135, 0.036),
|
||||
1.2 : (0.25, 1.038, 0.893, 0.929, 0.153, 0.135, 0.036),
|
||||
1.0 : (0.25, 0.838, 0.693, 0.729, 0.153, 0.135, 0.036),
|
||||
1.1 : (0.25, 0.938, 0.793, 0.829, 0.153, 0.135, 0.036),
|
||||
1.2 : (0.25, 1.038, 0.893, 0.929, 0.153, 0.135, 0.036),
|
||||
2.0 : (0.4, 1.740, 1.509, 1.567, 0.245, 0.217, 0.058),
|
||||
3.0 : (0.5, 2.675, 2.387, 2.459, 0.307, 0.271, 0.072),
|
||||
4.0 : (0.7, 3.545, 3.141, 3.242, 0.429, 0.379, 0.101 ),
|
||||
5.0 : (0.8, 4.480, 4.019, 4.134, 0.491, 0.433, 0.115),
|
||||
6.0 : (1.0, 5.350, 4.773, 4.917, 0.613, 0.541, 0.144),
|
||||
7.0 : (1.0, 6.350, 5.773, 5.917, 0.613, 0.541, 0.144),
|
||||
8.0 : (1.25, 7.188, 6.466, 6.647, 0.767, 0.677, 0.180),
|
||||
10.0 : (1.5, 9.026, 8.160, 8.376, 0.920, 0.812, 0.217),
|
||||
12.0 : (1.75, 10.863, 9.853, 10.106, 1.074, 0.947, 0.253),
|
||||
14.0 : (2.0, 12.701, 11.546, 11.835, 1.227, 1.083, 0.289),
|
||||
16.0 : (2.0, 14.701, 13.546, 13.835, 1.227, 1.083, 0.289),
|
||||
18.0 : (2.5, 16.376, 14.933, 15.294, 1.534, 1.353, 0.361),
|
||||
20.0 : (2.5, 18.376, 16.933, 17.294, 1.534, 1.353, 0.361),
|
||||
3.0 : (0.5, 2.675, 2.387, 2.459, 0.307, 0.271, 0.072),
|
||||
4.0 : (0.7, 3.545, 3.141, 3.242, 0.429, 0.379, 0.101 ),
|
||||
5.0 : (0.8, 4.480, 4.019, 4.134, 0.491, 0.433, 0.115),
|
||||
6.0 : (1.0, 5.350, 4.773, 4.917, 0.613, 0.541, 0.144),
|
||||
7.0 : (1.0, 6.350, 5.773, 5.917, 0.613, 0.541, 0.144),
|
||||
8.0 : (1.25, 7.188, 6.466, 6.647, 0.767, 0.677, 0.180),
|
||||
10.0 : (1.5, 9.026, 8.160, 8.376, 0.920, 0.812, 0.217),
|
||||
12.0 : (1.75, 10.863, 9.853, 10.106, 1.074, 0.947, 0.253),
|
||||
14.0 : (2.0, 12.701, 11.546, 11.835, 1.227, 1.083, 0.289),
|
||||
16.0 : (2.0, 14.701, 13.546, 13.835, 1.227, 1.083, 0.289),
|
||||
18.0 : (2.5, 16.376, 14.933, 15.294, 1.534, 1.353, 0.361),
|
||||
20.0 : (2.5, 18.376, 16.933, 17.294, 1.534, 1.353, 0.361),
|
||||
22.0 : (2.5, 20.376, 18.933, 19.294, 1.534, 1.353, 0.361),
|
||||
24.0 : (3.0, 22.051, 20.319, 20.752, 1.840, 1.624, 0.433),
|
||||
27.0 : (3.0, 25.051, 23.319, 23.752, 1.840, 1.624, 0.433),
|
||||
30.0 : (3.5, 27.727, 25.706, 26.211, 2.147, 1.894, 0.505),
|
||||
33.0 : (3.5, 30.727, 28.706, 29.211, 2.147, 1.894, 0.505),
|
||||
36.0 : (4.0, 33.402, 31.093, 31.670, 2.454, 2.165, 0.577),
|
||||
39.0 : (4.0, 36.402, 34.093, 34.670, 2.454, 2.165, 0.577),
|
||||
42.0 : (4.5 , 39.077, 36.479, 37.129, 2.760, 2.436, 0.650),
|
||||
24.0 : (3.0, 22.051, 20.319, 20.752, 1.840, 1.624, 0.433),
|
||||
27.0 : (3.0, 25.051, 23.319, 23.752, 1.840, 1.624, 0.433),
|
||||
30.0 : (3.5, 27.727, 25.706, 26.211, 2.147, 1.894, 0.505),
|
||||
33.0 : (3.5, 30.727, 28.706, 29.211, 2.147, 1.894, 0.505),
|
||||
36.0 : (4.0, 33.402, 31.093, 31.670, 2.454, 2.165, 0.577),
|
||||
39.0 : (4.0, 36.402, 34.093, 34.670, 2.454, 2.165, 0.577),
|
||||
42.0 : (4.5 , 39.077, 36.479, 37.129, 2.760, 2.436, 0.650),
|
||||
45.0 : (4.5, 42.077, 39.479, 40.129, 2.760, 2.436, 0.650)
|
||||
}
|
||||
}
|
||||
@@ -370,12 +370,12 @@ def getThroughHoleDia(standard, threadDia, tolerance = "medium"):
|
||||
FreeCAD.Console.PrintMessage("Warning: Diameter %f is not in %s" % (threadDia, standard))
|
||||
return values[values.keys()[0]][standards_tolerance.index(tolerance)]
|
||||
return values[threadDia][standards_tolerance.index(tolerance)]
|
||||
|
||||
|
||||
def getThroughHoleStandard(standard):
|
||||
if not standard in standards_counterbore_through.keys():
|
||||
raise Exception("No such standard exists")
|
||||
return standards_counterbore_through[standard]
|
||||
|
||||
|
||||
def getCounterboreDia(standard, threadDia, extraStandard = ""):
|
||||
if not standard in standards_counterbore.keys():
|
||||
raise Exception("No such standard exists")
|
||||
@@ -389,7 +389,7 @@ def getCounterboreDia(standard, threadDia, extraStandard = ""):
|
||||
row = r
|
||||
break
|
||||
return values[threadDia][row-1]
|
||||
|
||||
|
||||
def calcCounterboreDepth(standard, threadDia, standardBolt, standardsWashers = []):
|
||||
headHeight = getBoltHead(standardBolt)
|
||||
washerHeight = 0.0
|
||||
@@ -399,7 +399,7 @@ def calcCounterboreDepth(standard, threadDia, standardBolt, standardsWashers
|
||||
if threadDia <= maxThread:
|
||||
extraDepth = standards_counterbore_extradepth[maxThread]
|
||||
return headHeight + washerHeight + extraDepth
|
||||
|
||||
|
||||
def getRowStandards(standard):
|
||||
if not standard in standards_counterbore_rows.keys():
|
||||
raise Exception("No such standard exists")
|
||||
@@ -428,7 +428,7 @@ def getCountersinkAngle(standard, threadDia):
|
||||
FreeCAD.Console.PrintMessage("Warning: Diameter %f is not in %s" % (threadDia, standard))
|
||||
return values[values.keys()[0]][standards_countersink_angle]
|
||||
return values[threadDia][standards_countersink_angle]
|
||||
|
||||
|
||||
def getThreadCoreDiameter(standard, threadDia):
|
||||
if not standard in standards_thread.keys():
|
||||
raise Exception("No such standard exists")
|
||||
|
||||
@@ -924,8 +924,8 @@ void CmdPartDesignMoveFeatureInTree::activated(int iMsg)
|
||||
for(auto dep : App::Document::getDependencyList({obj})) {
|
||||
auto it = orders.find(dep);
|
||||
if(it != orders.end() && it->second > i) {
|
||||
ss << feat->Label.getValue() << ", " <<
|
||||
obj->Label.getValue() << " -> " <<
|
||||
ss << feat->Label.getValue() << ", " <<
|
||||
obj->Label.getValue() << " -> " <<
|
||||
it->first->Label.getValue();
|
||||
if(!failed)
|
||||
failed = true;
|
||||
@@ -937,7 +937,7 @@ void CmdPartDesignMoveFeatureInTree::activated(int iMsg)
|
||||
}
|
||||
if(failed) {
|
||||
QMessageBox::critical (nullptr, QObject::tr( "Dependency violation" ),
|
||||
QObject::tr( "Early feature must not depend on later feature.\n\n")
|
||||
QObject::tr( "Early feature must not depend on later feature.\n\n")
|
||||
+ QString::fromUtf8(ss.str().c_str()));
|
||||
abortCommand();
|
||||
return;
|
||||
|
||||
@@ -133,7 +133,7 @@ void CmdPrimtiveCompAdditive::activated(int iMsg)
|
||||
copyVisual(prm, "PointColor", base);
|
||||
copyVisual(prm, "Transparency", base);
|
||||
copyVisual(prm, "DisplayMode", base);
|
||||
|
||||
|
||||
PartDesignGui::setEdit(prm,pcActiveBody);
|
||||
}
|
||||
|
||||
|
||||
@@ -21,4 +21,4 @@
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#include "PreCompiled.h"
|
||||
#include "PreCompiled.h"
|
||||
|
||||
@@ -86,7 +86,7 @@ TaskDlgDatumParameters::~TaskDlgDatumParameters()
|
||||
}
|
||||
|
||||
bool TaskDlgDatumParameters::reject() {
|
||||
|
||||
|
||||
return PartGui::TaskDlgAttacher::reject();
|
||||
}
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace Gui {
|
||||
class ViewProvider;
|
||||
}
|
||||
|
||||
namespace PartDesignGui {
|
||||
namespace PartDesignGui {
|
||||
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ class TaskDlgDatumParameters : public PartGui::TaskDlgAttacher
|
||||
public:
|
||||
explicit TaskDlgDatumParameters(ViewProviderDatum *DatumView);
|
||||
~TaskDlgDatumParameters() override;
|
||||
|
||||
|
||||
bool accept() override;
|
||||
bool reject() override;
|
||||
};
|
||||
|
||||
@@ -107,7 +107,7 @@ bool TaskDressUpParameters::referenceSelected(const Gui::SelectionChanges& msg)
|
||||
App::DocumentObject* base = this->getBase();
|
||||
|
||||
// TODO: Must we make a copy here instead of assigning to const char* ?
|
||||
const char* fname = base->getNameInDocument();
|
||||
const char* fname = base->getNameInDocument();
|
||||
if (strcmp(msg.pObjectName, fname) != 0)
|
||||
return false;
|
||||
|
||||
@@ -128,7 +128,7 @@ bool TaskDressUpParameters::referenceSelected(const Gui::SelectionChanges& msg)
|
||||
}
|
||||
DressUpView->highlightReferences(false);
|
||||
setupTransaction();
|
||||
pcDressUp->Base.setValue(base, refs);
|
||||
pcDressUp->Base.setValue(base, refs);
|
||||
pcDressUp->getDocument()->recomputeFeature(pcDressUp);
|
||||
|
||||
return true;
|
||||
@@ -427,7 +427,7 @@ bool TaskDlgDressUpParameters::accept()
|
||||
getDressUpView()->highlightReferences(false);
|
||||
std::vector<std::string> refs = parameter->getReferences();
|
||||
std::stringstream str;
|
||||
str << Gui::Command::getObjectCmd(vp->getObject()) << ".Base = ("
|
||||
str << Gui::Command::getObjectCmd(vp->getObject()) << ".Base = ("
|
||||
<< Gui::Command::getObjectCmd(parameter->getBase()) << ",[";
|
||||
for (std::vector<std::string>::const_iterator it = refs.begin(); it != refs.end(); ++it)
|
||||
str << "\"" << *it << "\",";
|
||||
|
||||
@@ -97,7 +97,7 @@ bool TaskDlgFeatureParameters::accept() {
|
||||
TaskFeatureParameters *param = qobject_cast<TaskFeatureParameters *> (wgt);
|
||||
if(!param)
|
||||
continue;
|
||||
|
||||
|
||||
param->saveHistory ();
|
||||
param->apply ();
|
||||
}
|
||||
|
||||
@@ -228,7 +228,7 @@ void TaskFilletParameters::onLengthChanged(double len)
|
||||
pcFillet->Radius.setValue(len);
|
||||
pcFillet->getDocument()->recomputeFeature(pcFillet);
|
||||
// hide the fillet if there was a computation error
|
||||
hideOnError();
|
||||
hideOnError();
|
||||
}
|
||||
|
||||
double TaskFilletParameters::getLength() const
|
||||
|
||||
@@ -162,7 +162,7 @@ void TaskLinearPatternParameters::setupUI()
|
||||
ui->spinLength->setUnit(Base::Unit::Length);
|
||||
ui->spinLength->blockSignals(false);
|
||||
ui->spinOccurrences->setEnabled(true);
|
||||
|
||||
|
||||
dirLinks.setCombo(*(ui->comboDirection));
|
||||
App::DocumentObject* sketch = getSketchObject();
|
||||
if (sketch && sketch->isDerivedFrom(Part::Part2DObject::getClassTypeId())) {
|
||||
|
||||
@@ -205,7 +205,7 @@ void TaskMirroredParameters::onSelectionChanged(const Gui::SelectionChanges& msg
|
||||
getReferencedSelection(pcMirrored, msg, selObj, mirrorPlanes);
|
||||
if (!selObj)
|
||||
return;
|
||||
|
||||
|
||||
if ( selectionMode == reference || selObj->isDerivedFrom ( App::Plane::getClassTypeId () ) ) {
|
||||
setupTransaction();
|
||||
pcMirrored->MirrorPlane.setValue(selObj, mirrorPlanes);
|
||||
|
||||
@@ -515,7 +515,7 @@ void TaskBoxPrimitives::onEllipsoidRadius3Changed(double v) {
|
||||
|
||||
void TaskBoxPrimitives::onTorusAngle1Changed(double v) {
|
||||
PartDesign::Torus* sph = static_cast<PartDesign::Torus*>(vp->getObject());
|
||||
ui->torusAngle2->setMinimum(v); // Angle1 must geometrically be <= than Angle2
|
||||
ui->torusAngle2->setMinimum(v); // Angle1 must geometrically be <= than Angle2
|
||||
sph->Angle1.setValue(v);
|
||||
vp->getObject()->getDocument()->recomputeFeature(vp->getObject());
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace Gui {
|
||||
class ViewProvider;
|
||||
}
|
||||
|
||||
namespace PartDesignGui {
|
||||
namespace PartDesignGui {
|
||||
class Ui_DlgPrimitives;
|
||||
class TaskBoxPrimitives : public Gui::TaskView::TaskBox,
|
||||
public Gui::DocumentObserver
|
||||
|
||||
@@ -289,7 +289,7 @@ bool TaskShapeBinder::referenceSelected(const SelectionChanges& msg) const
|
||||
if (strcmp(msg.pObjectName, fname) == 0)
|
||||
return false;
|
||||
|
||||
//change the references
|
||||
//change the references
|
||||
std::string subName(msg.pSubName);
|
||||
|
||||
Part::Feature* selectedObj = nullptr;
|
||||
|
||||
@@ -42,7 +42,7 @@ class ButtonGroup;
|
||||
class ViewProvider;
|
||||
}
|
||||
|
||||
namespace PartDesignGui {
|
||||
namespace PartDesignGui {
|
||||
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ protected:
|
||||
enum selectionModes { none, refAdd, refRemove, refObjAdd };
|
||||
void changeEvent(QEvent *e) override;
|
||||
selectionModes selectionMode = none;
|
||||
|
||||
|
||||
void removeFromListWidget(QListWidget *w, QString name);
|
||||
bool referenceSelected(const Gui::SelectionChanges& msg) const;
|
||||
|
||||
|
||||
@@ -153,7 +153,7 @@ void TaskThicknessParameters::onSelectionChanged(const Gui::SelectionChanges& ms
|
||||
}
|
||||
// highlight existing references for possible further selections
|
||||
DressUpView->highlightReferences(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -284,7 +284,7 @@ bool TaskThicknessParameters::getIntersection(void) const
|
||||
}
|
||||
|
||||
int TaskThicknessParameters::getJoinType(void) const {
|
||||
|
||||
|
||||
return ui->joinComboBox->currentIndex();
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace App {
|
||||
class Property;
|
||||
}
|
||||
|
||||
namespace PartDesignGui {
|
||||
namespace PartDesignGui {
|
||||
|
||||
class ViewProviderTransformed;
|
||||
|
||||
@@ -48,7 +48,7 @@ public:
|
||||
void slotDiagnosis(QString msg);
|
||||
|
||||
private Q_SLOTS:
|
||||
|
||||
|
||||
protected:
|
||||
ViewProviderTransformed *transformedView;
|
||||
Connection connectionDiagnosis;
|
||||
|
||||
@@ -95,7 +95,7 @@ bool setEdit(App::DocumentObject *obj, PartDesign::Body *body) {
|
||||
* \param autoActivate
|
||||
* \return Body
|
||||
*/
|
||||
PartDesign::Body *getBody(bool messageIfNot, bool autoActivate, bool assertModern,
|
||||
PartDesign::Body *getBody(bool messageIfNot, bool autoActivate, bool assertModern,
|
||||
App::DocumentObject **topParent, std::string *subname)
|
||||
{
|
||||
PartDesign::Body * activeBody = nullptr;
|
||||
|
||||
@@ -240,7 +240,7 @@ void ViewProviderAddSub::setPreviewDisplayMode(bool onoff) {
|
||||
// not sufficient to only revert the mask mode. Also the child
|
||||
// number of the switch node must be reverted.
|
||||
if (onoff) {
|
||||
if(pcModeSwitch->getChild(getDefaultMode()) == previewShape)
|
||||
if(pcModeSwitch->getChild(getDefaultMode()) == previewShape)
|
||||
return;
|
||||
displayMode = getActiveDisplayMode();
|
||||
whichChild = pcModeSwitch->whichChild.getValue();
|
||||
@@ -248,7 +248,7 @@ void ViewProviderAddSub::setPreviewDisplayMode(bool onoff) {
|
||||
}
|
||||
|
||||
if (!onoff) {
|
||||
if(pcModeSwitch->getChild(getDefaultMode()) != previewShape)
|
||||
if(pcModeSwitch->getChild(getDefaultMode()) != previewShape)
|
||||
return;
|
||||
setDisplayMaskMode(displayMode.c_str());
|
||||
pcModeSwitch->whichChild.setValue(whichChild);
|
||||
|
||||
@@ -38,14 +38,14 @@ public:
|
||||
ViewProviderAddSub();
|
||||
/// destructor
|
||||
~ViewProviderAddSub() override;
|
||||
|
||||
|
||||
void attach(App::DocumentObject*) override;
|
||||
void updateData(const App::Property*) override;
|
||||
|
||||
protected:
|
||||
|
||||
protected:
|
||||
void updateAddSubShapeIndicator();
|
||||
void setPreviewDisplayMode(bool);
|
||||
|
||||
|
||||
SoSeparator* previewShape;
|
||||
PartGui::SoBrepFaceSet* previewFaceSet;
|
||||
SoCoordinate3* previewCoords;
|
||||
|
||||
@@ -143,7 +143,7 @@ bool ViewProviderBody::doubleClicked()
|
||||
if(!activeDoc)
|
||||
activeDoc = getDocument();
|
||||
auto activeView = activeDoc->setActiveView(this);
|
||||
if(!activeView)
|
||||
if(!activeView)
|
||||
return false;
|
||||
|
||||
if (activeView->isActiveObject(getObject(),PDBODYKEY)) {
|
||||
@@ -248,7 +248,7 @@ void ViewProviderBody::slotChangedObjectApp ( const App::DocumentObject& obj, co
|
||||
|
||||
if(App::GetApplication().isRestoring())
|
||||
return;
|
||||
|
||||
|
||||
if (!obj.isDerivedFrom ( Part::Feature::getClassTypeId () ) ||
|
||||
obj.isDerivedFrom ( Part::BodyBase::getClassTypeId () ) ) { // we are interested only in Part::Features, not in bodies
|
||||
return;
|
||||
@@ -364,7 +364,7 @@ void ViewProviderBody::onChanged(const App::Property* prop) {
|
||||
|
||||
if(prop == &DisplayModeBody) {
|
||||
auto body = dynamic_cast<PartDesign::Body*>(getObject());
|
||||
|
||||
|
||||
if ( DisplayModeBody.getValue() == 0 ) {
|
||||
//if we are in an override mode we need to make sure to come out, because
|
||||
//otherwise the maskmode is blocked and won't go into "through"
|
||||
|
||||
@@ -53,7 +53,7 @@ public:
|
||||
~ViewProviderBody() override;
|
||||
|
||||
App::PropertyEnumeration DisplayModeBody;
|
||||
|
||||
|
||||
void attach(App::DocumentObject *) override;
|
||||
|
||||
bool doubleClicked(void) override;
|
||||
@@ -72,7 +72,7 @@ public:
|
||||
|
||||
/// Update the sizes of origin and datums
|
||||
void updateOriginDatumSize ();
|
||||
|
||||
|
||||
/**
|
||||
* Return the bounding box of visible features
|
||||
* @note datums are counted as their base point only
|
||||
|
||||
@@ -43,7 +43,7 @@ public:
|
||||
~ViewProviderBoolean() override;
|
||||
|
||||
App::PropertyEnumeration Display;
|
||||
|
||||
|
||||
/// grouping handling
|
||||
void setupContextMenu(QMenu*, QObject*, const char*) override;
|
||||
|
||||
@@ -53,7 +53,7 @@ public:
|
||||
|
||||
protected:
|
||||
bool setEdit(int ModNum) override;
|
||||
|
||||
|
||||
static const char* DisplayEnum[];
|
||||
|
||||
};
|
||||
|
||||
@@ -190,7 +190,7 @@ void ViewProviderDatumCoordinateSystem::setupLabels() {
|
||||
|
||||
void ViewProviderDatumCoordinateSystem::updateData(const App::Property* prop)
|
||||
{
|
||||
if (strcmp(prop->getName(),"Placement") == 0)
|
||||
if (strcmp(prop->getName(),"Placement") == 0)
|
||||
updateExtents ();
|
||||
|
||||
ViewProviderDatum::updateData(prop);
|
||||
@@ -203,7 +203,7 @@ void ViewProviderDatumCoordinateSystem::onChanged(const App::Property *prop) {
|
||||
else if(prop == &Zoom) {
|
||||
autoZoom->scaleFactor.setValue(Zoom.getValue());
|
||||
updateExtents ();
|
||||
} else if(prop == &FontSize)
|
||||
} else if(prop == &FontSize)
|
||||
font->size = FontSize.getValue();
|
||||
}
|
||||
ViewProviderDatum::onChanged(prop);
|
||||
@@ -212,7 +212,7 @@ void ViewProviderDatumCoordinateSystem::onChanged(const App::Property *prop) {
|
||||
void ViewProviderDatumCoordinateSystem::setExtents (Base::BoundBox3d bbox) {
|
||||
// Axis length of the CS is 1/3 of maximum bbox dimension, any smarter sizing will make it only worse
|
||||
double axisLength;
|
||||
|
||||
|
||||
if(Zoom.getValue()) {
|
||||
axisLength = 6 * Zoom.getValue();
|
||||
}else{
|
||||
|
||||
@@ -49,8 +49,8 @@ public:
|
||||
|
||||
/// Highlight the references that have been selected
|
||||
void highlightReferences(const bool on);
|
||||
|
||||
/**
|
||||
|
||||
/**
|
||||
* Returns the feature Name associated with the view provider.
|
||||
* Should be reimplemented in the successor.
|
||||
*/
|
||||
|
||||
@@ -39,7 +39,7 @@ public:
|
||||
/// destructor
|
||||
~ViewProviderHole() override;
|
||||
|
||||
/// grouping handling
|
||||
/// grouping handling
|
||||
std::vector<App::DocumentObject*> claimChildren()const override;
|
||||
void setupContextMenu(QMenu *menu, QObject *receiver, const char *member) override;
|
||||
bool onDelete(const std::vector<std::string> &s) override;
|
||||
|
||||
@@ -44,7 +44,7 @@ public:
|
||||
/// destructor
|
||||
~ViewProviderLoft() override;
|
||||
|
||||
/// grouping handling
|
||||
/// grouping handling
|
||||
std::vector<App::DocumentObject*> claimChildren(void)const override;
|
||||
void setupContextMenu(QMenu*, QObject*, const char*) override;
|
||||
|
||||
@@ -52,7 +52,7 @@ public:
|
||||
void highlightProfile(bool on);
|
||||
void highlightSection(bool on);
|
||||
void highlightReferences(Reference mode, bool on);
|
||||
|
||||
|
||||
protected:
|
||||
QIcon getIcon(void) const override;
|
||||
bool setEdit(int ModNum) override;
|
||||
|
||||
@@ -39,7 +39,7 @@ public:
|
||||
/// destructor
|
||||
virtual ~ViewProviderMainPart();
|
||||
|
||||
/// grouping handling
|
||||
/// grouping handling
|
||||
std::vector<App::DocumentObject*> claimChildren(void)const;
|
||||
};
|
||||
|
||||
|
||||
@@ -45,18 +45,18 @@ public:
|
||||
/// destructor
|
||||
~ViewProviderPipe() override;
|
||||
|
||||
/// grouping handling
|
||||
/// grouping handling
|
||||
std::vector<App::DocumentObject*> claimChildren()const override;
|
||||
void setupContextMenu(QMenu*, QObject*, const char*) override;
|
||||
|
||||
bool onDelete(const std::vector<std::string> &) override;
|
||||
void highlightReferences(Reference mode, bool on);
|
||||
|
||||
|
||||
protected:
|
||||
QIcon getIcon() const override;
|
||||
bool setEdit(int ModNum) override;
|
||||
void unsetEdit(int ModNum) override;
|
||||
|
||||
|
||||
/// Returns a newly created TaskDlgPipeParameters
|
||||
TaskDlgFeatureParameters *getEditDialog() override;
|
||||
|
||||
|
||||
@@ -37,18 +37,18 @@ public:
|
||||
ViewProviderPrimitive();
|
||||
/// destructor
|
||||
~ViewProviderPrimitive() override;
|
||||
|
||||
|
||||
void attach(App::DocumentObject*) override;
|
||||
void updateData(const App::Property*) override;
|
||||
|
||||
|
||||
protected:
|
||||
QIcon getIcon(void) const override;
|
||||
void setupContextMenu(QMenu* menu, QObject* receiver, const char* member) override;
|
||||
bool setEdit(int ModNum) override;
|
||||
void unsetEdit(int ModNum) override;
|
||||
|
||||
|
||||
void updateAddSubShapeIndicator();
|
||||
|
||||
|
||||
std::string displayMode;
|
||||
};
|
||||
|
||||
|
||||
@@ -40,11 +40,11 @@ public:
|
||||
|
||||
void setupContextMenu(QMenu*, QObject*, const char*) override;
|
||||
void highlightReferences(bool on);
|
||||
|
||||
|
||||
protected:
|
||||
bool setEdit(int ModNum) override;
|
||||
void unsetEdit(int ModNum) override;
|
||||
|
||||
|
||||
private:
|
||||
std::vector<App::Color> originalLineColors;
|
||||
std::vector<App::Color> originalFaceColors;
|
||||
@@ -63,9 +63,9 @@ public:
|
||||
|
||||
bool canDropObjects() const override {return true;}
|
||||
bool canDragAndDropObject(App::DocumentObject*) const override {return false;}
|
||||
bool canDropObjectEx(App::DocumentObject *obj, App::DocumentObject *owner,
|
||||
bool canDropObjectEx(App::DocumentObject *obj, App::DocumentObject *owner,
|
||||
const char *subname, const std::vector<std::string> &elements) const override;
|
||||
std::string dropObjectEx(App::DocumentObject*, App::DocumentObject*, const char *,
|
||||
std::string dropObjectEx(App::DocumentObject*, App::DocumentObject*, const char *,
|
||||
const std::vector<std::string> &) override;
|
||||
std::vector<App::DocumentObject*> claimChildren() const override;
|
||||
|
||||
|
||||
@@ -13,12 +13,12 @@
|
||||
#* for detail see the LICENCE text file. *
|
||||
#* *
|
||||
#* FreeCAD is distributed in the hope that it will be useful, *
|
||||
#* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
#* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
#* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
#* GNU Lesser General Public License for more details. *
|
||||
#* *
|
||||
#* You should have received a copy of the GNU Library General Public *
|
||||
#* License along with FreeCAD; if not, write to the Free Software *
|
||||
#* License along with FreeCAD; if not, write to the Free Software *
|
||||
#* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
|
||||
#* USA *
|
||||
#* *
|
||||
|
||||
@@ -32,7 +32,7 @@ __title__="PartDesign InvoluteGearObject management"
|
||||
__author__ = "Juergen Riegel"
|
||||
__url__ = "http://www.freecadweb.org"
|
||||
|
||||
|
||||
|
||||
|
||||
def makeInvoluteGear(name):
|
||||
'''makeInvoluteGear(name): makes an InvoluteGear'''
|
||||
@@ -57,21 +57,21 @@ class _CommandInvoluteGear:
|
||||
'MenuText': QtCore.QT_TRANSLATE_NOOP("PartDesign_InvoluteGear","Involute gear..."),
|
||||
'Accel': "",
|
||||
'ToolTip': QtCore.QT_TRANSLATE_NOOP("PartDesign_InvoluteGear","Creates or edit the involute gear definition.")}
|
||||
|
||||
|
||||
def Activated(self):
|
||||
|
||||
FreeCAD.ActiveDocument.openTransaction("Create involute gear")
|
||||
FreeCADGui.addModule("InvoluteGearFeature")
|
||||
FreeCADGui.doCommand("InvoluteGearFeature.makeInvoluteGear('InvoluteGear')")
|
||||
FreeCADGui.doCommand("Gui.activeDocument().setEdit(App.ActiveDocument.ActiveObject.Name,0)")
|
||||
|
||||
|
||||
def IsActive(self):
|
||||
if FreeCAD.ActiveDocument:
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
|
||||
|
||||
class _InvoluteGear:
|
||||
"The InvoluteGear object"
|
||||
def __init__(self,obj):
|
||||
@@ -81,16 +81,16 @@ class _InvoluteGear:
|
||||
obj.addProperty("App::PropertyAngle","PressureAngle","Gear","Pressure angle of gear teeth")
|
||||
obj.addProperty("App::PropertyBool","HighPrecision","Gear","True=2 curves with each 3 control points False=1 curve with 4 control points ")
|
||||
obj.addProperty("App::PropertyBool","ExternalGear","Gear","True=external Gear False=internal Gear ")
|
||||
|
||||
|
||||
obj.NumberOfTeeth = 26
|
||||
obj.Modules = "2.5 mm"
|
||||
obj.PressureAngle = "20 deg"
|
||||
obj.HighPrecision = True
|
||||
obj.ExternalGear = True
|
||||
|
||||
obj.Modules = "2.5 mm"
|
||||
obj.PressureAngle = "20 deg"
|
||||
obj.HighPrecision = True
|
||||
obj.ExternalGear = True
|
||||
|
||||
obj.Proxy = self
|
||||
|
||||
|
||||
|
||||
|
||||
def execute(self,obj):
|
||||
#print "_InvoluteGear.execute()"
|
||||
w = fcgear.FCWireBuilder()
|
||||
@@ -102,14 +102,14 @@ class _InvoluteGear:
|
||||
obj.Shape = gearw
|
||||
obj.positionBySupport();
|
||||
return
|
||||
|
||||
|
||||
|
||||
|
||||
class _ViewProviderInvoluteGear:
|
||||
"A View Provider for the InvoluteGear object"
|
||||
|
||||
def __init__(self,vobj):
|
||||
vobj.Proxy = self
|
||||
|
||||
|
||||
def getIcon(self):
|
||||
return ":/icons/PartDesign_InternalExternalGear.svg"
|
||||
|
||||
@@ -117,14 +117,14 @@ class _ViewProviderInvoluteGear:
|
||||
self.ViewObject = vobj
|
||||
self.Object = vobj.Object
|
||||
|
||||
|
||||
|
||||
def setEdit(self,vobj,mode):
|
||||
taskd = _InvoluteGearTaskPanel(self.Object,mode)
|
||||
taskd.obj = vobj.Object
|
||||
taskd.update()
|
||||
FreeCADGui.Control.showDialog(taskd)
|
||||
return True
|
||||
|
||||
|
||||
def unsetEdit(self,vobj,mode):
|
||||
FreeCADGui.Control.closeDialog()
|
||||
return
|
||||
@@ -140,10 +140,10 @@ class _InvoluteGearTaskPanel:
|
||||
'''The editmode TaskPanel for InvoluteGear objects'''
|
||||
def __init__(self,obj,mode):
|
||||
self.obj = obj
|
||||
|
||||
|
||||
self.form=FreeCADGui.PySideUic.loadUi(FreeCAD.getHomePath() + "Mod/PartDesign/InvoluteGearFeature.ui")
|
||||
self.form.setWindowIcon(QtGui.QIcon(":/icons/PartDesign_InternalExternalGear.svg"))
|
||||
|
||||
|
||||
QtCore.QObject.connect(self.form.Quantity_Modules, QtCore.SIGNAL("valueChanged(double)"), self.modulesChanged)
|
||||
QtCore.QObject.connect(self.form.Quantity_PressureAngle, QtCore.SIGNAL("valueChanged(double)"), self.angleChanged)
|
||||
QtCore.QObject.connect(self.form.spinBox_NumberOfTeeth, QtCore.SIGNAL("valueChanged(int)"), self.numTeethChanged)
|
||||
@@ -151,15 +151,15 @@ class _InvoluteGearTaskPanel:
|
||||
#QtCore.QObject.connect(self.form.comboBox_ExternalGear, QtCore.SIGNAL("activated(QString)"), self.externalGearChanged)
|
||||
#QtCore.QObject.connect(self.form.comboBox_ExternalGear, QtCore.SIGNAL("currentIndexChanged(int)"), self.externalGearChanged)
|
||||
QtCore.QObject.connect(self.form.comboBox_ExternalGear, QtCore.SIGNAL("currentIndexChanged(int)"), self.externalGearChanged)
|
||||
|
||||
|
||||
self.update()
|
||||
|
||||
|
||||
if mode == 0: # fresh created
|
||||
self.obj.Proxy.execute(self.obj) # calculate once
|
||||
self.obj.Proxy.execute(self.obj) # calculate once
|
||||
FreeCAD.Gui.SendMsgToActiveView("ViewFit")
|
||||
|
||||
|
||||
def transferTo(self):
|
||||
"Transfer from the dialog to the object"
|
||||
"Transfer from the dialog to the object"
|
||||
self.obj.NumberOfTeeth = self.form.spinBox_NumberOfTeeth.value()
|
||||
self.obj.Modules = self.form.Quantity_Modules.text()
|
||||
self.obj.PressureAngle = self.form.Quantity_PressureAngle.text()
|
||||
@@ -173,8 +173,8 @@ class _InvoluteGearTaskPanel:
|
||||
else:
|
||||
self.obj.ExternalGear = False
|
||||
#self.obj.ExternalGear = self.form.comboBox_ExternalGear.currentIndex()
|
||||
|
||||
|
||||
|
||||
|
||||
def transferFrom(self):
|
||||
"Transfer from the object to the dialog"
|
||||
self.form.spinBox_NumberOfTeeth.setValue(self.obj.NumberOfTeeth)
|
||||
@@ -190,13 +190,13 @@ class _InvoluteGearTaskPanel:
|
||||
else:
|
||||
self.form.comboBox_ExternalGear.setCurrentIndex(1)
|
||||
#self.form.comboBox_ExternalGear.setCurrentIndex(self.obj.ExternalGear)
|
||||
|
||||
|
||||
def modulesChanged(self, value):
|
||||
#print value
|
||||
self.obj.Modules = value
|
||||
self.obj.Proxy.execute(self.obj)
|
||||
FreeCAD.Gui.SendMsgToActiveView("ViewFit")
|
||||
|
||||
|
||||
def angleChanged(self, value):
|
||||
#print value
|
||||
self.obj.PressureAngle = value
|
||||
@@ -207,7 +207,7 @@ class _InvoluteGearTaskPanel:
|
||||
self.obj.NumberOfTeeth = value
|
||||
self.obj.Proxy.execute(self.obj)
|
||||
FreeCAD.Gui.SendMsgToActiveView("ViewFit")
|
||||
|
||||
|
||||
def numCurvesChanged(self, value):
|
||||
#print value
|
||||
if value == 0:
|
||||
@@ -216,7 +216,7 @@ class _InvoluteGearTaskPanel:
|
||||
v=False
|
||||
self.obj.HighPrecision = v
|
||||
self.obj.Proxy.execute(self.obj)
|
||||
|
||||
|
||||
def externalGearChanged(self, value):
|
||||
#print value
|
||||
if value == 0:
|
||||
@@ -225,27 +225,27 @@ class _InvoluteGearTaskPanel:
|
||||
v=False
|
||||
self.obj.ExternalGear = v
|
||||
self.obj.Proxy.execute(self.obj)
|
||||
|
||||
|
||||
def getStandardButtons(self):
|
||||
return int(QtGui.QDialogButtonBox.Ok) | int(QtGui.QDialogButtonBox.Cancel)| int(QtGui.QDialogButtonBox.Apply)
|
||||
|
||||
|
||||
def clicked(self,button):
|
||||
if button == QtGui.QDialogButtonBox.Apply:
|
||||
#print "Apply"
|
||||
self.transferTo()
|
||||
self.obj.Proxy.execute(self.obj)
|
||||
|
||||
self.obj.Proxy.execute(self.obj)
|
||||
|
||||
def update(self):
|
||||
'fills the widgets'
|
||||
self.transferFrom()
|
||||
|
||||
|
||||
def accept(self):
|
||||
#print 'accept(self)'
|
||||
self.transferTo()
|
||||
FreeCAD.ActiveDocument.recompute()
|
||||
FreeCADGui.ActiveDocument.resetEdit()
|
||||
|
||||
|
||||
|
||||
|
||||
def reject(self):
|
||||
#print 'reject(self)'
|
||||
FreeCADGui.ActiveDocument.resetEdit()
|
||||
|
||||
@@ -52,7 +52,7 @@ class TestBoolean(unittest.TestCase):
|
||||
self.BooleanFuse.Type = 0
|
||||
self.Doc.recompute()
|
||||
self.assertAlmostEqual(self.BooleanFuse.Shape.Volume, 1500)
|
||||
|
||||
|
||||
def testBooleanCutCase(self):
|
||||
self.Body = self.Doc.addObject('PartDesign::Body','Body')
|
||||
self.Box = self.Doc.addObject('PartDesign::AdditiveBox','Box')
|
||||
|
||||
@@ -36,7 +36,7 @@ class TestPad(unittest.TestCase):
|
||||
self.Pad.Profile = self.PadSketch
|
||||
self.Doc.recompute()
|
||||
self.assertEqual(len(self.Pad.Shape.Faces), 6)
|
||||
|
||||
|
||||
def testSketchOnPlane(self):
|
||||
self.Body = self.Doc.addObject('PartDesign::Body','Body')
|
||||
self.PadSketch = self.Doc.addObject('Sketcher::SketchObject','SketchPad')
|
||||
|
||||
@@ -44,9 +44,9 @@ class TestPipe(unittest.TestCase):
|
||||
self.SpineSketch.Support = (self.Doc.XZ_Plane, [''])
|
||||
self.Doc.recompute()
|
||||
self.SpineSketch.addGeometry(Part.LineSegment(App.Vector(0.0,0.0,0),App.Vector(0,1,0)),False)
|
||||
self.SpineSketch.addConstraint(Sketcher.Constraint('Coincident',0,1,-1,1))
|
||||
self.SpineSketch.addConstraint(Sketcher.Constraint('PointOnObject',0,2,-2))
|
||||
self.SpineSketch.addConstraint(Sketcher.Constraint('DistanceY',0,1,0,2,1))
|
||||
self.SpineSketch.addConstraint(Sketcher.Constraint('Coincident',0,1,-1,1))
|
||||
self.SpineSketch.addConstraint(Sketcher.Constraint('PointOnObject',0,2,-2))
|
||||
self.SpineSketch.addConstraint(Sketcher.Constraint('DistanceY',0,1,0,2,1))
|
||||
self.Doc.recompute()
|
||||
self.AdditivePipe = self.Doc.addObject("PartDesign::AdditivePipe","AdditivePipe")
|
||||
self.Body.addObject(self.AdditivePipe)
|
||||
@@ -67,9 +67,9 @@ class TestPipe(unittest.TestCase):
|
||||
self.SpineSketch.Support = (self.Doc.XZ_Plane, [''])
|
||||
self.Doc.recompute()
|
||||
self.SpineSketch.addGeometry(Part.LineSegment(App.Vector(0.0,0.0,0),App.Vector(0,1,0)),False)
|
||||
self.SpineSketch.addConstraint(Sketcher.Constraint('Coincident',0,1,-1,1))
|
||||
self.SpineSketch.addConstraint(Sketcher.Constraint('PointOnObject',0,2,-2))
|
||||
self.SpineSketch.addConstraint(Sketcher.Constraint('DistanceY',0,1,0,2,1))
|
||||
self.SpineSketch.addConstraint(Sketcher.Constraint('Coincident',0,1,-1,1))
|
||||
self.SpineSketch.addConstraint(Sketcher.Constraint('PointOnObject',0,2,-2))
|
||||
self.SpineSketch.addConstraint(Sketcher.Constraint('DistanceY',0,1,0,2,1))
|
||||
self.Doc.recompute()
|
||||
self.PadSketch = self.Doc.addObject('Sketcher::SketchObject', 'PadSketch')
|
||||
self.Body.addObject(self.PadSketch)
|
||||
|
||||
@@ -30,7 +30,7 @@ class Epitrochoid:
|
||||
d=fp.Distance
|
||||
ang=0
|
||||
z=0
|
||||
|
||||
|
||||
if r2 == 0:
|
||||
raise ValueError("Exterior radius must not be zero")
|
||||
|
||||
|
||||
@@ -62,21 +62,21 @@ class CommandSprocket:
|
||||
'MenuText': QtCore.QT_TRANSLATE_NOOP("PartDesign_Sprocket","Sprocket..."),
|
||||
'Accel': "",
|
||||
'ToolTip': QtCore.QT_TRANSLATE_NOOP("PartDesign_Sprocket","Creates or edit the sprocket definition.")}
|
||||
|
||||
|
||||
def Activated(self):
|
||||
|
||||
FreeCAD.ActiveDocument.openTransaction("Create Sprocket")
|
||||
FreeCADGui.addModule("SprocketFeature")
|
||||
FreeCADGui.doCommand("SprocketFeature.makeSprocket('Sprocket')")
|
||||
FreeCADGui.doCommand("Gui.activeDocument().setEdit(App.ActiveDocument.ActiveObject.Name,0)")
|
||||
|
||||
|
||||
def IsActive(self):
|
||||
if FreeCAD.ActiveDocument:
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
|
||||
|
||||
class Sprocket:
|
||||
"""
|
||||
The Sprocket object
|
||||
@@ -126,16 +126,16 @@ class Sprocket:
|
||||
obj.addProperty("App::PropertyLength","Thickness","Sprocket","Thickness as stated in the reference specification")
|
||||
|
||||
obj.SprocketReference = list(self.SprocketReferenceRollerTable.keys())
|
||||
|
||||
|
||||
obj.NumberOfTeeth = 50
|
||||
obj.Pitch = "0.375 in"
|
||||
obj.Pitch = "0.375 in"
|
||||
obj.RollerDiameter = "0.20 in"
|
||||
obj.SprocketReference = "ANSI 35"
|
||||
obj.Thickness = "0.11 in"
|
||||
|
||||
obj.Proxy = self
|
||||
|
||||
|
||||
|
||||
|
||||
def execute(self,obj):
|
||||
w = fcsprocket.FCWireBuilder()
|
||||
sprocket.CreateSprocket(w, obj.Pitch.Value, obj.NumberOfTeeth, obj.RollerDiameter.Value)
|
||||
@@ -144,8 +144,8 @@ class Sprocket:
|
||||
obj.Shape = sprocketw
|
||||
obj.positionBySupport();
|
||||
return
|
||||
|
||||
|
||||
|
||||
|
||||
class ViewProviderSprocket:
|
||||
"""
|
||||
A View Provider for the Sprocket object
|
||||
@@ -153,7 +153,7 @@ class ViewProviderSprocket:
|
||||
|
||||
def __init__(self,vobj):
|
||||
vobj.Proxy = self
|
||||
|
||||
|
||||
def getIcon(self):
|
||||
return ":/icons/PartDesign_Sprocket.svg"
|
||||
|
||||
@@ -167,7 +167,7 @@ class ViewProviderSprocket:
|
||||
taskd.update()
|
||||
FreeCADGui.Control.showDialog(taskd)
|
||||
return True
|
||||
|
||||
|
||||
def unsetEdit(self,vobj,mode):
|
||||
FreeCADGui.Control.closeDialog()
|
||||
return
|
||||
@@ -186,32 +186,32 @@ class SprocketTaskPanel:
|
||||
|
||||
def __init__(self,obj,mode):
|
||||
self.obj = obj
|
||||
|
||||
|
||||
self.form=FreeCADGui.PySideUic.loadUi(FreeCAD.getHomePath() + "Mod/PartDesign/SprocketFeature.ui")
|
||||
self.form.setWindowIcon(QtGui.QIcon(":/icons/PartDesign_Sprocket.svg"))
|
||||
|
||||
|
||||
QtCore.QObject.connect(self.form.Quantity_Pitch, QtCore.SIGNAL("valueChanged(double)"), self.pitchChanged)
|
||||
QtCore.QObject.connect(self.form.Quantity_RollerDiameter, QtCore.SIGNAL("valueChanged(double)"), self.rollerDiameterChanged)
|
||||
QtCore.QObject.connect(self.form.spinBox_NumberOfTeeth, QtCore.SIGNAL("valueChanged(int)"), self.numTeethChanged)
|
||||
QtCore.QObject.connect(self.form.comboBox_SprocketReference, QtCore.SIGNAL("currentTextChanged(const QString)"), self.sprocketReferenceChanged)
|
||||
QtCore.QObject.connect(self.form.Quantity_Thickness, QtCore.SIGNAL("valueChanged(double)"), self.thicknessChanged)
|
||||
|
||||
|
||||
self.update()
|
||||
|
||||
|
||||
if mode == 0: # fresh created
|
||||
self.obj.Proxy.execute(self.obj) # calculate once
|
||||
self.obj.Proxy.execute(self.obj) # calculate once
|
||||
FreeCAD.Gui.SendMsgToActiveView("ViewFit")
|
||||
|
||||
|
||||
def transferTo(self):
|
||||
"""
|
||||
Transfer from the dialog to the object
|
||||
"""
|
||||
"""
|
||||
self.obj.NumberOfTeeth = self.form.spinBox_NumberOfTeeth.value()
|
||||
self.obj.Pitch = self.form.Quantity_Pitch.text()
|
||||
self.obj.RollerDiameter = self.form.Quantity_RollerDiameter.text()
|
||||
self.obj.SprocketReference = self.form.comboBox_SprocketReference.currentText()
|
||||
self.obj.Thickness = self.form.Quantity_Thickness.text()
|
||||
|
||||
|
||||
def transferFrom(self):
|
||||
"""
|
||||
Transfer from the object to the dialog
|
||||
@@ -221,7 +221,7 @@ class SprocketTaskPanel:
|
||||
self.form.Quantity_RollerDiameter.setText(self.obj.RollerDiameter.UserString)
|
||||
self.form.comboBox_SprocketReference.setCurrentText(self.obj.SprocketReference)
|
||||
self.form.Quantity_Thickness.setText(self.obj.Thickness.UserString)
|
||||
|
||||
|
||||
def pitchChanged(self, value):
|
||||
self.obj.Pitch = value
|
||||
self.obj.Proxy.execute(self.obj)
|
||||
@@ -235,10 +235,10 @@ class SprocketTaskPanel:
|
||||
self.form.Quantity_Pitch.setText(self.obj.Pitch.UserString)
|
||||
self.form.Quantity_RollerDiameter.setText(self.obj.RollerDiameter.UserString)
|
||||
self.form.Quantity_Thickness.setText(self.obj.Thickness.UserString)
|
||||
|
||||
|
||||
self.obj.Proxy.execute(self.obj)
|
||||
FreeCAD.Gui.SendMsgToActiveView("ViewFit")
|
||||
|
||||
|
||||
def rollerDiameterChanged(self, value):
|
||||
self.obj.RollerDiameter = value
|
||||
self.obj.Proxy.execute(self.obj)
|
||||
@@ -251,23 +251,23 @@ class SprocketTaskPanel:
|
||||
def thicknessChanged(self, value):
|
||||
self.obj.Thickness = str(value)
|
||||
self.obj.Proxy.execute(self.obj)
|
||||
|
||||
|
||||
def getStandardButtons(self):
|
||||
return int(QtGui.QDialogButtonBox.Ok) | int(QtGui.QDialogButtonBox.Cancel)| int(QtGui.QDialogButtonBox.Apply)
|
||||
|
||||
|
||||
def clicked(self,button):
|
||||
if button == QtGui.QDialogButtonBox.Apply:
|
||||
self.transferTo()
|
||||
self.obj.Proxy.execute(self.obj)
|
||||
|
||||
self.obj.Proxy.execute(self.obj)
|
||||
|
||||
def update(self):
|
||||
self.transferFrom()
|
||||
|
||||
|
||||
def accept(self):
|
||||
self.transferTo()
|
||||
FreeCAD.ActiveDocument.recompute()
|
||||
FreeCADGui.ActiveDocument.resetEdit()
|
||||
|
||||
|
||||
def reject(self):
|
||||
FreeCADGui.ActiveDocument.resetEdit()
|
||||
FreeCAD.ActiveDocument.abortTransaction()
|
||||
|
||||
@@ -26,7 +26,7 @@ import numpy as np
|
||||
|
||||
class SegmentFunctionSegment:
|
||||
"One segment of a segment function"
|
||||
|
||||
|
||||
def __init__(self, st, var, coeff, exp):
|
||||
self.start = st
|
||||
self.variable = var
|
||||
@@ -37,7 +37,7 @@ class SegmentFunctionSegment:
|
||||
"Return true if the start of this segment is xval"
|
||||
#FIXME: 1E-9 is arbitrary here. But since units are in meters, 1E-9 is a nanometer...
|
||||
return abs(self.start - xval) < 1E-9
|
||||
|
||||
|
||||
def isZero(self):
|
||||
#FIXME: 1E-9 is arbitrary here. But since units are in meters, 1E-9 is a nanometer...
|
||||
return abs(self.coefficient) < 1E-5
|
||||
@@ -50,14 +50,14 @@ class SegmentFunctionSegment:
|
||||
|
||||
def clone(self):
|
||||
return SegmentFunctionSegment(self.start, self.variable, self.coefficient, self.exponent)
|
||||
|
||||
|
||||
def negate(self):
|
||||
self.coefficient *= -1
|
||||
return self
|
||||
|
||||
|
||||
def negated(self):
|
||||
return SegmentFunctionSegment(self.start, self.variable, self.coefficient * -1.0, self.exponent)
|
||||
|
||||
|
||||
def __mul__(self, value):
|
||||
return SegmentFunctionSegment(self.start, self.variable, self.coefficient * value, self.exponent)
|
||||
|
||||
@@ -76,7 +76,7 @@ class SegmentFunction:
|
||||
self.variable = "x"
|
||||
self.segments = []
|
||||
self.name = name
|
||||
|
||||
|
||||
def findSegment(self, xval):
|
||||
"Find segment valid for the given xval"
|
||||
for s in self.segments:
|
||||
@@ -94,14 +94,14 @@ class SegmentFunction:
|
||||
for s in self.segments:
|
||||
s.negate()
|
||||
return self
|
||||
|
||||
|
||||
def negated(self):
|
||||
result = SegmentFunction()
|
||||
result.variable = self.variable
|
||||
for s in self.segments:
|
||||
result.segments.append(s.negated())
|
||||
return result
|
||||
|
||||
|
||||
def __mul__(self, value):
|
||||
result = SegmentFunction()
|
||||
result.variable = self.variable
|
||||
@@ -124,7 +124,7 @@ class SegmentFunction:
|
||||
for key in sorted(dict.keys()):
|
||||
#if abs(dict[key]) > 1E-9:
|
||||
self.segments.append(SegmentFunctionSegment(key, var, dict[key], 0))
|
||||
|
||||
|
||||
def addSegment(self, st, coeff, exp = 0.0):
|
||||
if abs(coeff) > 1E-9:
|
||||
self.segments.insert(self.index(st), SegmentFunctionSegment(st, self.variable, coeff, exp))
|
||||
@@ -196,24 +196,24 @@ class SegmentFunction:
|
||||
|
||||
class IntervalFunction:
|
||||
"Function defined in intervals"
|
||||
|
||||
|
||||
def __init__(self):
|
||||
self.intervals = []
|
||||
self.values = []
|
||||
|
||||
|
||||
def addInterval(self, begin, length, value):
|
||||
self.intervals.append((begin, length))
|
||||
self.values.append(value)
|
||||
|
||||
def value(self, xval):
|
||||
|
||||
def value(self, xval):
|
||||
for i in range(len(self.intervals)):
|
||||
if xval >= self.intervals[i][0] and xval < self.intervals[i][0] + self.intervals[i][1]:
|
||||
return self.values[i]
|
||||
return self.values[len(self.values)-1]
|
||||
|
||||
|
||||
def lowervalue(self, xval):
|
||||
return self.value(xval - 1E-8)
|
||||
|
||||
|
||||
def index(self, xval):
|
||||
lastStart = 0.0
|
||||
for i in range(len(self.intervals)):
|
||||
@@ -226,25 +226,25 @@ class IntervalFunction:
|
||||
def interval(self, xval):
|
||||
"Return interval (begin, length) for this xval"
|
||||
return self.intervals[self.index(xval)]
|
||||
|
||||
|
||||
def begin(self, xval):
|
||||
return self.intervals[self.index(xval)][0]
|
||||
|
||||
|
||||
def length(self, xval):
|
||||
return self.intervals[self.index(xval)][1]
|
||||
|
||||
class StressFunction:
|
||||
"Specialization for segment-wise display of stresses"
|
||||
# The hairy thing about this is that the segments of the segfunc usually do not correspond with the intervals of the intfunc!
|
||||
|
||||
|
||||
def __init__(self, f, i):
|
||||
self.segfunc = f # The segment function for the force/moment
|
||||
self.intfunc = i # The divisors, an interval function giving a specific value for each interval
|
||||
name = "sigma"
|
||||
|
||||
|
||||
def isZero(self):
|
||||
return self.segfunc.isZero()
|
||||
|
||||
|
||||
def evaluate(self, maxX, pointsX):
|
||||
# Note: This usually creates a few more points than specified in pointsX
|
||||
offset = (maxX - self.segfunc.segments[0].start) / (pointsX - 1)
|
||||
@@ -253,10 +253,10 @@ class StressFunction:
|
||||
xvals = xvals.union(starts) # Make sure we have a point on each segment start
|
||||
divs = set([self.intfunc.intervals[i][0] for i in range(len(self.intfunc.intervals))])
|
||||
xvals = xvals.union(divs)
|
||||
|
||||
|
||||
xresult = []
|
||||
yresult = []
|
||||
for xval in sorted(xvals):
|
||||
for xval in sorted(xvals):
|
||||
if xval in starts:
|
||||
# create double point at segment border
|
||||
xresult.append(xval)
|
||||
@@ -268,10 +268,10 @@ class StressFunction:
|
||||
xresult.append(xval)
|
||||
yresult.append(self.segfunc.value(xval) / self.intfunc.value(xval))
|
||||
return (xresult, yresult)
|
||||
|
||||
|
||||
class TranslationFunction:
|
||||
"Specialization for segment-wise display of translations"
|
||||
|
||||
|
||||
def __init__(self, f, E, d, tangents, translations):
|
||||
if f.isZero():
|
||||
self.transfunc = None
|
||||
@@ -289,7 +289,7 @@ class TranslationFunction:
|
||||
self.module = E
|
||||
self.intfunc = d
|
||||
self.name = "w"
|
||||
|
||||
|
||||
# Solve boundary conditions. There are two types:
|
||||
# External boundary conditions, e.g. a given tangent direction or translation value at a given x-value
|
||||
# Internal boundary conditions, i.e. at the segment borders the tangent direction and translation of the lines must be equal
|
||||
@@ -301,20 +301,20 @@ class TranslationFunction:
|
||||
b = np.zeros(shape = 2 * len(self.intfunc.intervals))
|
||||
# Current row where coefficients of next equation will be added
|
||||
row = 0
|
||||
|
||||
|
||||
# First look at external boundary conditions
|
||||
for bound in tangents:
|
||||
xval = bound[0]
|
||||
tang = bound[1]
|
||||
tang = bound[1]
|
||||
i = self.intfunc.index(xval) # index of this segment
|
||||
I_i = self.intfunc.value(xval) # Area moment of this segment
|
||||
I_i = self.intfunc.value(xval) # Area moment of this segment
|
||||
# w_i'(xval) = tang => (tangfunc(xval) + C_i0) / (E * I_i) = tang => C_i0 = tang * (E * I_i) - tangfunc(xval)
|
||||
A[row][2 * i] = 1.0
|
||||
b[row] = tang * E * I_i - self.tangfunc.value(xval)
|
||||
row += 1
|
||||
for bound in translations:
|
||||
xval = bound[0]
|
||||
trans = bound[1]
|
||||
trans = bound[1]
|
||||
i = self.intfunc.index(xval) # index of this segment
|
||||
I_i = self.intfunc.value(xval) # Area moment of this segment
|
||||
# w_i(xval) = trans => (transfunc(xval) + C_i0 * xval + C_i1) / (E * I_i) = trans => xval / (E * I_i) * C_i0 + 1 / (E * I_i) * C_i1 = trans - transfunc(xval) / (E * I_i)
|
||||
@@ -322,7 +322,7 @@ class TranslationFunction:
|
||||
A[row][2 * i + 1] = 1 / (E * I_i)
|
||||
b[row] = trans - self.transfunc.value(xval) / (E * I_i)
|
||||
row += 1
|
||||
|
||||
|
||||
# Now look at internal boundary conditions (n intervals have n-1 common segment boundaries)
|
||||
for i in range(len(self.intfunc.intervals) - 1):
|
||||
x_start = self.intfunc.intervals[i][0]
|
||||
@@ -343,24 +343,24 @@ class TranslationFunction:
|
||||
A[row][2 * (i+1) + 1] = -1 / (E * I_ip1)
|
||||
b[row] = self.transfunc.value(x_end) / (E * I_ip1) - self.transfunc.value(x_end) / (E * I_i)
|
||||
row += 1
|
||||
|
||||
|
||||
#FreeCAD.Console.PrintMessage(A)
|
||||
#FreeCAD.Console.PrintMessage(" * x = ")
|
||||
#FreeCAD.Console.PrintMessage(b)
|
||||
#FreeCAD.Console.PrintMessage("\n")
|
||||
|
||||
|
||||
try:
|
||||
self.boundaries = np.linalg.solve(A, b) # A * self.boundaries = b
|
||||
except np.linalg.linalg.LinAlgError as e:
|
||||
FreeCAD.Console.PrintMessage(e.message)
|
||||
FreeCAD.Console.PrintMessage(". No solution possible.\n")
|
||||
return
|
||||
|
||||
|
||||
def isZero(self):
|
||||
if self.transfunc is None:
|
||||
return True
|
||||
return self.transfunc.isZero()
|
||||
|
||||
|
||||
def evaluate(self, maxX, pointsX):
|
||||
# Note: This usually creates a few more points than specified in pointsX
|
||||
offset = (maxX - self.transfunc.segments[0].start) / (pointsX - 1)
|
||||
@@ -370,7 +370,7 @@ class TranslationFunction:
|
||||
divs = set([self.intfunc.intervals[i][0] for i in range(len(self.intfunc.intervals))])
|
||||
xvals = xvals.union(divs)
|
||||
E = self.module
|
||||
|
||||
|
||||
xresult = []
|
||||
yresult = []
|
||||
# Coverity has reported a problem that I_i, C_i0 or C_i1:
|
||||
@@ -383,11 +383,11 @@ class TranslationFunction:
|
||||
C_i0 = self.boundaries[2 * i]
|
||||
C_i1 = self.boundaries[2 * i + 1]
|
||||
FreeCAD.Console.PrintMessage("Interval %u: %f to %f, I_i: %f, C_i0: %f, C_i1: %f\n" % (i, begin, length, I_i, C_i0, C_i1))
|
||||
|
||||
|
||||
xresult.append(xval)
|
||||
# w(xval) = (transfunc(xval) + C_i0 * xval + C_i1) / (E * I_i)
|
||||
value = (self.transfunc.value(xval) + C_i0 * xval + C_i1) / (E * I_i)
|
||||
yresult.append(value)
|
||||
|
||||
|
||||
return (xresult, yresult)
|
||||
|
||||
|
||||
@@ -44,14 +44,14 @@ class Shaft:
|
||||
sigmaNstr = ["sigmax","sigmay","sigmaz"] # Normal/shear stresses
|
||||
sigmaBstr = ["taut","sigmabz", "sigmaby"] # Torsion/bending stresses
|
||||
# For diagram labeling
|
||||
Qstrings = (("Normal force [x]", "x", "mm", "N_x", "N"),
|
||||
("Shear force [y]", "x", "mm", "Q_y", "N"),
|
||||
Qstrings = (("Normal force [x]", "x", "mm", "N_x", "N"),
|
||||
("Shear force [y]", "x", "mm", "Q_y", "N"),
|
||||
("Shear force [z]", "x", "mm", "Q_z", "N"))
|
||||
Mstrings = (("Torque [x]", "x", "mm", "M_t", "Nm"),
|
||||
("Bending moment [z]", "x", "mm", "M_{b,z}", "Nm"),
|
||||
Mstrings = (("Torque [x]", "x", "mm", "M_t", "Nm"),
|
||||
("Bending moment [z]", "x", "mm", "M_{b,z}", "Nm"),
|
||||
("Bending moment [y]", "x", "mm", "M_{b,y}", "Nm"))
|
||||
wstrings = (("", "", "", "", ""),
|
||||
("Translation [y]", "x", "mm", "w_y", "mm"),
|
||||
wstrings = (("", "", "", "", ""),
|
||||
("Translation [y]", "x", "mm", "w_y", "mm"),
|
||||
("Translation [z]", "x", "mm", "w_z", "mm"))
|
||||
sigmaNstrings = (("Normal stress [x]", "x", "mm", "\\sigma_x", u"N/mm²"),
|
||||
("Shear stress [y]", "x", "mm", "\\sigma_y", u"N/mm²"),
|
||||
@@ -94,18 +94,18 @@ class Shaft:
|
||||
self.segments[index].constraint.References = [( self.feature.feature, "Face%u" % (2 * (index+1) + 1) )]
|
||||
else:
|
||||
# Remove reference since it is now in the middle of the shaft (which is not allowed)
|
||||
self.segments[index].constraint.References = [(None, "")]
|
||||
self.segments[index].constraint.References = [(None, "")]
|
||||
|
||||
def updateSegment(self, index, length = None, diameter = None, innerdiameter = None):
|
||||
oldLength = self.segments[index].length
|
||||
|
||||
|
||||
if length is not None:
|
||||
self.segments[index].length = length
|
||||
if diameter is not None:
|
||||
self.segments[index].diameter = diameter
|
||||
if innerdiameter is not None:
|
||||
self.segments[index].innerdiameter = innerdiameter
|
||||
|
||||
|
||||
self.feature.updateSegment(index, oldLength, self.segments[index].length, self.segments[index].diameter, self.segments[index].innerdiameter)
|
||||
self.equilibrium()
|
||||
self.updateDiagrams()
|
||||
@@ -116,14 +116,14 @@ class Shaft:
|
||||
if (self.segments[index].constraintType != "None") and (self.segments[index].constraintType != constraintType):
|
||||
self.doc.removeObject(self.segments[index].constraint.Name)
|
||||
self.segments[index].constraint = None
|
||||
|
||||
self.segments[index].constraintType = constraintType
|
||||
|
||||
|
||||
self.segments[index].constraintType = constraintType
|
||||
|
||||
# Create constraint if it does not exist yet or has changed
|
||||
if self.segments[index].constraint is None:
|
||||
if (constraintType == "Force"):
|
||||
# TODO: Create a reference point and put the force onto it
|
||||
constraint = self.doc.addObject("Fem::ConstraintForce","ShaftConstraintForce")
|
||||
constraint = self.doc.addObject("Fem::ConstraintForce","ShaftConstraintForce")
|
||||
constraint.Force = 1000.0
|
||||
self.segments[index].constraint = constraint
|
||||
elif (constraintType == "Fixed"):
|
||||
@@ -136,26 +136,26 @@ class Shaft:
|
||||
self.segments[index].constraint = constraint
|
||||
elif (constraintType == "Bearing"):
|
||||
# TODO: Use robust reference as soon as it is available for the cylindrical face reference
|
||||
constraint = self.doc.addObject("Fem::ConstraintBearing","ShaftConstraintBearing")
|
||||
constraint.References = [( self.feature.feature, "Face%u" % (2 * (index+1)) )]
|
||||
constraint = self.doc.addObject("Fem::ConstraintBearing","ShaftConstraintBearing")
|
||||
constraint.References = [( self.feature.feature, "Face%u" % (2 * (index+1)) )]
|
||||
constraint.AxialFree = True
|
||||
self.segments[index].constraint = constraint
|
||||
self.segments[index].constraint = constraint
|
||||
elif (constraintType == "Pulley"):
|
||||
constraint= self.doc.addObject("Fem::ConstraintPulley","ShaftConstraintPulley")
|
||||
constraint.References = [( self.feature.feature, "Face%u" % (2 * (index+1)) )]
|
||||
self.segments[index].constraint = constraint
|
||||
constraint.References = [( self.feature.feature, "Face%u" % (2 * (index+1)) )]
|
||||
self.segments[index].constraint = constraint
|
||||
elif (constraintType == "Gear"):
|
||||
constraint = self.doc.addObject("Fem::ConstraintGear","ShaftConstraintGear")
|
||||
constraint.References = [( self.feature.feature, "Face%u" % (2 * (index+1)) )]
|
||||
self.segments[index].constraint = constraint
|
||||
|
||||
constraint = self.doc.addObject("Fem::ConstraintGear","ShaftConstraintGear")
|
||||
constraint.References = [( self.feature.feature, "Face%u" % (2 * (index+1)) )]
|
||||
self.segments[index].constraint = constraint
|
||||
|
||||
self.equilibrium()
|
||||
self.updateDiagrams()
|
||||
|
||||
|
||||
def editConstraint(self, index):
|
||||
if (self.segments[index].constraint is not None):
|
||||
FreeCADGui.activeDocument().setEdit(self.segments[index].constraint.Name)
|
||||
|
||||
|
||||
def getConstraint(self, index):
|
||||
return self.segments[index].constraint
|
||||
|
||||
@@ -193,7 +193,7 @@ class Shaft:
|
||||
# FIXME: This is impossible without robust references anchored in the sketch!!!
|
||||
return
|
||||
|
||||
def updateDiagrams(self):
|
||||
def updateDiagrams(self):
|
||||
for ax in range(3):
|
||||
if self.F[ax] is not None:
|
||||
if self.F[ax].name in self.diagrams:
|
||||
@@ -211,7 +211,7 @@ class Shaft:
|
||||
if self.sigmaB[ax].name in self.diagrams:
|
||||
self.diagrams[self.sigmaB[ax].name].update(self.sigmaB[ax], self.getLengthTo(len(self.segments)) / 1000.0)
|
||||
|
||||
def showDiagram(self, which):
|
||||
def showDiagram(self, which):
|
||||
if which in self.Fstr:
|
||||
ax = self.Fstr.index(which)
|
||||
text = self.Qstrings[ax]
|
||||
@@ -277,13 +277,13 @@ class Shaft:
|
||||
return
|
||||
self.diagrams[self.sigmaB[ax].name] = Diagram()
|
||||
self.diagrams[self.sigmaB[ax].name].create(text[0], self.sigmaB[ax], self.getLengthTo(len(self.segments)) / 1000.0, text[1], text[2], 1000.0, text[3], text[4], 1.0E-6, 20)
|
||||
|
||||
|
||||
def addTo(self, dict, location, value):
|
||||
if location not in dict:
|
||||
dict[location] = value
|
||||
else:
|
||||
dict[location] += value
|
||||
|
||||
|
||||
def equilibrium(self):
|
||||
# Build equilibrium equations
|
||||
try:
|
||||
@@ -291,20 +291,20 @@ class Shaft:
|
||||
except ImportError:
|
||||
FreeCAD.Console.PrintMessage("numpy is not installed on your system\n")
|
||||
raise ImportError("numpy not installed")
|
||||
|
||||
|
||||
# Initialization of structures. All three axes are handled separately so everything is 3-fold
|
||||
# dictionaries of (location : outer force/moment) with reverse sign, which means that the segment functions for the section force and section moment
|
||||
# created from them will have signs as by the convention in
|
||||
# created from them will have signs as by the convention in
|
||||
# http://www.umwelt-campus.de/ucb/fileadmin/users/90_t.preussler/dokumente/Skripte/TEMECH/TMI/Ebene_Balkenstatik.pdf (page 10)
|
||||
# (see also example on page 19)
|
||||
forces = [{0.0:0.0}, {0.0:0.0}, {0.0:0.0}]
|
||||
forces = [{0.0:0.0}, {0.0:0.0}, {0.0:0.0}]
|
||||
moments = [{0.0:0.0}, {0.0:0.0}, {0.0:0.0}]
|
||||
# Boundary conditions for shaft bending line
|
||||
tangents = [[], [], []] # Tangents to shaft bending line
|
||||
translations = [[], [], []] # Shaft displacement
|
||||
# Variable names, e.g. Fx, Mz. Because the system must be exactly determined, not more than two independent variables for each
|
||||
# Variable names, e.g. Fx, Mz. Because the system must be exactly determined, not more than two independent variables for each
|
||||
# force/moment per axis are possible (if there are more no solution is calculated)
|
||||
variableNames = [[""], [""], [""]]
|
||||
variableNames = [[""], [""], [""]]
|
||||
# # dictionary of (variableName : location) giving the x-coordinate at which the force/moment represented by the variable acts on the shaft
|
||||
locations = {}
|
||||
# Coefficients of the equilibrium equations in the form a = b * F1 + c * F2 and d = e * M1 + f * M2
|
||||
@@ -315,58 +315,58 @@ class Shaft:
|
||||
for i in range(len(self.segments)):
|
||||
cType = self.segments[i].constraintType
|
||||
constraint = self.segments[i].constraint
|
||||
|
||||
|
||||
if cType == "Fixed":
|
||||
# Fixed segment
|
||||
if i == 0:
|
||||
# At beginning of shaft
|
||||
location = 0
|
||||
location = 0
|
||||
elif i == len(self.segments) - 1:
|
||||
# At end of shaft
|
||||
location = self.getLengthTo(len(self.segments)) / 1000.0 # convert to meters
|
||||
location = self.getLengthTo(len(self.segments)) / 1000.0 # convert to meters
|
||||
else:
|
||||
# TODO: Better error message
|
||||
FreeCAD.Console.PrintMessage("Fixed constraint must be at beginning or end of shaft\n")
|
||||
return
|
||||
|
||||
for ax in range(3):
|
||||
|
||||
for ax in range(3):
|
||||
# Create a new reaction force
|
||||
variableNames[ax].append("%s%u" % (self.Fstr[ax], i))
|
||||
coefficientsF[ax].append(1)
|
||||
# Register location of reaction force
|
||||
# Register location of reaction force
|
||||
locations["%s%u" % (self.Fstr[ax], i)] = location
|
||||
# Boundary conditions for the translations
|
||||
tangents[ax].append((location, 0.0))
|
||||
translations[ax].append((location, 0.0))
|
||||
coefficientsM[0].append(0) # Reaction force contributes no moment around x axis
|
||||
coefficientsM[1].append(location) # Reaction force contributes a positive moment around z axis
|
||||
coefficientsM[2].append(-location) # Reaction force contributes a negative moment around y axis
|
||||
|
||||
coefficientsM[2].append(-location) # Reaction force contributes a negative moment around y axis
|
||||
|
||||
for ax in range(3):
|
||||
# Create a new reaction moment
|
||||
variableNames[ax].append("%s%u" % (self.Mstr[ax], i))
|
||||
coefficientsF[ax].append(0)
|
||||
coefficientsM[ax].append(1)
|
||||
coefficientsM[ax].append(1)
|
||||
locations["%s%u" % (self.Mstr[ax], i)] = location
|
||||
|
||||
|
||||
elif cType == "Force":
|
||||
# Static force (currently force on midpoint of segment only)
|
||||
force = constraint.DirectionVector.multiply(constraint.Force)
|
||||
force = constraint.DirectionVector.multiply(constraint.Force)
|
||||
# TODO: Extract value of the location from geometry
|
||||
location = (self.getLengthTo(i) + self.segments[i].length/2.0) / 1000.0
|
||||
# The force itself
|
||||
for ax in range(3):
|
||||
for ax in range(3):
|
||||
if abs(force[ax]) > 0.0:
|
||||
coefficientsF[ax][0] = coefficientsF[ax][0] - force[ax] # neg. because this coefficient is on the LHS of the equilibrium equation
|
||||
self.addTo(forces[ax], location, -force[ax]) # neg. to fulfill the convention mentioned above
|
||||
# Moments created by the force (by definition no moment is created by the force in x-direction)
|
||||
# Moments created by the force (by definition no moment is created by the force in x-direction)
|
||||
if abs(force[1]) > 0.0:
|
||||
coefficientsM[1][0] = coefficientsM[1][0] - force[1] * location # moment around z-axis
|
||||
self.addTo(moments[1], location, 0)
|
||||
if abs(force[2]) > 0.0:
|
||||
coefficientsM[2][0] = coefficientsM[2][0] + force[2] * location # moment around y-axis
|
||||
self.addTo(moments[2], location, 0) # No outer moment acts here!
|
||||
|
||||
|
||||
elif cType == "Bearing":
|
||||
location = constraint.BasePoint.x / 1000.0 # TODO: This assumes that the shaft feature starts with the first segment at (0,0,0) and its axis corresponds to the x-axis
|
||||
# Bearing reaction forces. TODO: the bearing is assumed to not induce any reaction moments
|
||||
@@ -380,28 +380,28 @@ class Shaft:
|
||||
if constraint.AxialFree == False:
|
||||
coefficientsM[0].append(0) # Reaction force contributes no moment around x axis
|
||||
coefficientsM[1].append(location) # Reaction force contributes a positive moment around z axis
|
||||
coefficientsM[2].append(-location) # Reaction force contributes a negative moment around y axis
|
||||
|
||||
coefficientsM[2].append(-location) # Reaction force contributes a negative moment around y axis
|
||||
|
||||
elif cType == "Gear":
|
||||
force = constraint.DirectionVector.multiply(constraint.Force)
|
||||
force = constraint.DirectionVector.multiply(constraint.Force)
|
||||
location = constraint.BasePoint.x / 1000.0
|
||||
lever = [0, constraint.Diameter/2.0/1000.0 * math.sin(constraint.ForceAngle / 180.0 * math.pi),
|
||||
lever = [0, constraint.Diameter/2.0/1000.0 * math.sin(constraint.ForceAngle / 180.0 * math.pi),
|
||||
constraint.Diameter/2.0 /1000.0* math.cos(constraint.ForceAngle / 180.0 * math.pi)]
|
||||
|
||||
|
||||
# Effect of the gear force
|
||||
for ax in range(3):
|
||||
if abs(force[ax]) > 0.0:
|
||||
# Effect of the force
|
||||
coefficientsF[ax][0] = coefficientsF[ax][0] - force[ax]
|
||||
self.addTo(forces[ax], location, -force[ax])
|
||||
# Moments created by the force (by definition no moment is created by the force in x-direction)
|
||||
# Moments created by the force (by definition no moment is created by the force in x-direction)
|
||||
if abs(force[1]) > 0.0:
|
||||
coefficientsM[1][0] = coefficientsM[1][0] - force[1] * location # moment around z-axis
|
||||
self.addTo(moments[1], location, 0)
|
||||
if abs(force[2]) > 0.0:
|
||||
coefficientsM[2][0] = coefficientsM[2][0] + force[2] * location # moment around y-axis
|
||||
self.addTo(moments[2], location, 0) # No outer moment acts here!
|
||||
|
||||
|
||||
# Moments created by the force and lever
|
||||
if abs(force[0]) > 0.0:
|
||||
momenty = force[0] * lever[2]
|
||||
@@ -409,7 +409,7 @@ class Shaft:
|
||||
coefficientsM[1][0] = coefficientsM[1][0] + momentz # moment around z-axis
|
||||
self.addTo(moments[1], location, momentz)
|
||||
coefficientsM[2][0] = coefficientsM[2][0] - momenty # moment around y-axis
|
||||
self.addTo(moments[2], location, -momenty)
|
||||
self.addTo(moments[2], location, -momenty)
|
||||
if abs(force[1]) > 0.0:
|
||||
moment = force[1] * lever[2]
|
||||
coefficientsM[0][0] = coefficientsM[0][0] + moment
|
||||
@@ -423,26 +423,26 @@ class Shaft:
|
||||
forceAngle2 = (constraint.ForceAngle - constraint.BeltAngle + 90.0) / 180.0 * math.pi
|
||||
#FreeCAD.Console.PrintMessage("BeltForce1: %f, BeltForce2: %f\n" % (constraint.BeltForce1, constraint.BeltForce2))
|
||||
#FreeCAD.Console.PrintMessage("Angle1: %f, Angle2: %f\n" % (forceAngle1, forceAngle2))
|
||||
force = [0, -constraint.BeltForce1 * math.sin(forceAngle1) - constraint.BeltForce2 * math.sin(forceAngle2),
|
||||
force = [0, -constraint.BeltForce1 * math.sin(forceAngle1) - constraint.BeltForce2 * math.sin(forceAngle2),
|
||||
constraint.BeltForce1 * math.cos(forceAngle1) + constraint.BeltForce2 * math.cos(forceAngle2)]
|
||||
location = constraint.BasePoint.x / 1000.0
|
||||
|
||||
location = constraint.BasePoint.x / 1000.0
|
||||
|
||||
# Effect of the pulley forces
|
||||
for ax in range(3):
|
||||
if abs(force[ax]) > 0.0:
|
||||
# Effect of the force
|
||||
coefficientsF[ax][0] = coefficientsF[ax][0] - force[ax]
|
||||
self.addTo(forces[ax], location, -force[ax])
|
||||
# Moments created by the force (by definition no moment is created by the force in x-direction)
|
||||
# Moments created by the force (by definition no moment is created by the force in x-direction)
|
||||
if abs(force[1] ) > 0.0:
|
||||
coefficientsM[1][0] = coefficientsM[1][0] - force[1] * location # moment around z-axis
|
||||
self.addTo(moments[1], location, 0)
|
||||
if abs(force[2]) > 0.0:
|
||||
coefficientsM[2][0] = coefficientsM[2][0] + force[2] * location # moment around y-axis
|
||||
self.addTo(moments[2], location, 0) # No outer moment acts here!
|
||||
|
||||
|
||||
# Torque
|
||||
moment = constraint.Force * (1 if constraint.IsDriven is True else -1)
|
||||
moment = constraint.Force * (1 if constraint.IsDriven is True else -1)
|
||||
coefficientsM[0][0] = coefficientsM[0][0] + moment
|
||||
self.addTo(moments[0], location, moment)
|
||||
|
||||
@@ -450,9 +450,9 @@ class Shaft:
|
||||
areamoments = [None, None, None]
|
||||
bendingmoments = [None, None, None]
|
||||
torquemoments = [None, None, None]
|
||||
|
||||
|
||||
for ax in range(3):
|
||||
FreeCAD.Console.PrintMessage("Axis: %u\n" % ax)
|
||||
FreeCAD.Console.PrintMessage("Axis: %u\n" % ax)
|
||||
self.printEquilibrium(variableNames[ax], coefficientsF[ax])
|
||||
self.printEquilibrium(variableNames[ax], coefficientsM[ax])
|
||||
|
||||
@@ -461,7 +461,7 @@ class Shaft:
|
||||
FreeCAD.Console.PrintMessage("Matrix is singular, no solution possible\n")
|
||||
self.parent.updateButtons(ax, False)
|
||||
continue
|
||||
|
||||
|
||||
# Handle special cases. Note that the code above should ensure that coefficientsF and coefficientsM always have same length
|
||||
solution = [None, None]
|
||||
if len(coefficientsF[ax]) == 2:
|
||||
@@ -473,10 +473,10 @@ class Shaft:
|
||||
FreeCAD.Console.PrintMessage("System is statically undetermined. No solution possible.\n")
|
||||
self.parent.updateButtons(ax, False)
|
||||
continue
|
||||
else:
|
||||
# Build matrix and vector for linear algebra solving algorithm
|
||||
else:
|
||||
# Build matrix and vector for linear algebra solving algorithm
|
||||
# TODO: This could easily be done manually... there are only 2 variables and 6 coefficients
|
||||
A = np.array([coefficientsF[ax][1:], coefficientsM[ax][1:]])
|
||||
A = np.array([coefficientsF[ax][1:], coefficientsM[ax][1:]])
|
||||
b = np.array([coefficientsF[ax][0], coefficientsM[ax][0]])
|
||||
try:
|
||||
solution = np.linalg.solve(A, b) # A * solution = b
|
||||
@@ -500,12 +500,12 @@ class Shaft:
|
||||
FreeCAD.Console.PrintMessage("\n")
|
||||
FreeCAD.Console.PrintMessage(moments[ax])
|
||||
FreeCAD.Console.PrintMessage("\n")
|
||||
|
||||
|
||||
# Forces
|
||||
self.F[ax] = SegmentFunction(self.Fstr[ax])
|
||||
self.F[ax].buildFromDict("x", forces[ax])
|
||||
self.parent.updateButton(1, ax, not self.F[ax].isZero())
|
||||
self.F[ax].output()
|
||||
self.F[ax].output()
|
||||
# Moments
|
||||
if ax == 0:
|
||||
self.M[0] = SegmentFunction(self.Mstr[0])
|
||||
@@ -513,21 +513,21 @@ class Shaft:
|
||||
elif ax == 1:
|
||||
self.M[1] = self.F[1].integrated().negate()
|
||||
self.M[1].name = self.Mstr[1]
|
||||
self.M[1].addSegments(moments[1]) # takes care of boundary conditions
|
||||
self.M[1].addSegments(moments[1]) # takes care of boundary conditions
|
||||
elif ax == 2:
|
||||
self.M[2] = self.F[2].integrated()
|
||||
self.M[2] = self.F[2].integrated()
|
||||
self.M[2].name = self.Mstr[2]
|
||||
self.M[2].addSegments(moments[2]) # takes care of boundary conditions
|
||||
self.M[2].addSegments(moments[2]) # takes care of boundary conditions
|
||||
self.parent.updateButton(2, ax, not self.M[ax].isZero())
|
||||
self.M[ax].output()
|
||||
|
||||
# Areas and area moments
|
||||
|
||||
# Areas and area moments
|
||||
location = 0.0
|
||||
areas[ax] = IntervalFunction() # A [m²]
|
||||
areamoments[ax] = IntervalFunction() # I [m⁴]
|
||||
bendingmoments[ax] = IntervalFunction() # W_b [m³]
|
||||
torquemoments[ax] = IntervalFunction() # W_t [m³]
|
||||
|
||||
torquemoments[ax] = IntervalFunction() # W_t [m³]
|
||||
|
||||
for i in range(len(self.segments)):
|
||||
od = self.segments[i].diameter/1000.0
|
||||
id = self.segments[i].innerdiameter/1000.0
|
||||
@@ -538,7 +538,7 @@ class Shaft:
|
||||
bendingmoments[ax].addInterval(location, length, areamoment / (od / 2.0))
|
||||
torquemoments[ax].addInterval(location, length, 2 * (areamoment / (od / 2.0)))
|
||||
location += length
|
||||
|
||||
|
||||
# Bending line
|
||||
if ax > 0:
|
||||
if len(tangents[ax])+ len(translations[ax]) == 2:
|
||||
@@ -547,8 +547,8 @@ class Shaft:
|
||||
self.w[ax].name= self.wstr[ax]
|
||||
self.parent.updateButton(3, ax, not self.w[ax].isZero())
|
||||
else:
|
||||
self.parent.updateButton(3, ax, False)
|
||||
|
||||
self.parent.updateButton(3, ax, False)
|
||||
|
||||
# Normal/shear stresses and torque/bending stresses
|
||||
self.sigmaN[ax] = StressFunction(self.F[ax], areas[ax])
|
||||
self.sigmaN[ax].name = self.sigmaNstr[ax]
|
||||
@@ -561,7 +561,7 @@ class Shaft:
|
||||
self.parent.updateButton(5, ax, not self.sigmaB[ax].isZero())
|
||||
|
||||
def printEquilibrium(self, var, coeff):
|
||||
# Auxiliary method for debugging purposes
|
||||
# Auxiliary method for debugging purposes
|
||||
for i in range(len(var)):
|
||||
if i == 0:
|
||||
FreeCAD.Console.PrintMessage("%f = " % coeff[i])
|
||||
|
||||
@@ -59,7 +59,7 @@ class Diagram:
|
||||
if xlength is not None:
|
||||
self.xlength = xlength
|
||||
# Calculate points
|
||||
(self.xpoints, self.ypoints) = self.function.evaluate(self.xlength, self.numxpoints)
|
||||
(self.xpoints, self.ypoints) = self.function.evaluate(self.xlength, self.numxpoints)
|
||||
# Create plot
|
||||
self.plot()
|
||||
|
||||
@@ -82,7 +82,7 @@ class Diagram:
|
||||
axes.set_xlim(right = max(self.xpoints) * 1.05)
|
||||
axes.set_ylim(min(self.ypoints) * 1.05, max(self.ypoints) * 1.05)
|
||||
self.thePlot.update()
|
||||
|
||||
|
||||
def close(self):
|
||||
# Close the associated mdiSubWindow
|
||||
self.win.parent().close()
|
||||
|
||||
@@ -36,7 +36,7 @@ class ShaftFeature:
|
||||
# TODO: Discover existing sketch and get data from it
|
||||
self.sketch = self.Doc.addObject("Sketcher::SketchObject","SketchShaft")
|
||||
self.sketch.Placement = self.App.Placement(self.App.Vector(0,0,0),self.App.Rotation(0,0,0,1))
|
||||
|
||||
|
||||
self.feature = 0
|
||||
self.segments = 0 # number of segments
|
||||
self.totalLength = 0 # total length of all segments
|
||||
@@ -72,7 +72,7 @@ class ShaftFeature:
|
||||
# First segment of shaft
|
||||
# Create centerline
|
||||
self.sketch.addGeometry(Part.LineSegment(self.App.Vector(0,0,0), self.App.Vector(self.totalLength,0,0)))
|
||||
self.sketch.addConstraint(Sketcher.Constraint('DistanceX',0, self.totalLength)) # Constraint1
|
||||
self.sketch.addConstraint(Sketcher.Constraint('DistanceX',0, self.totalLength)) # Constraint1
|
||||
self.sketch.addConstraint(Sketcher.Constraint('DistanceY', -1,1,0,1,innerradius)) # Constraint2
|
||||
self.sketch.addConstraint(Sketcher.Constraint('PointOnObject',0,1,-2)) # Constraint3
|
||||
self.sketch.addConstraint(Sketcher.Constraint('Horizontal', 0)) # Constraint4
|
||||
|
||||
@@ -149,7 +149,7 @@ def CreateInternalGear(w, m, Z, phi, split=True):
|
||||
Rroot = Rpitch + dedendum # root circle radius
|
||||
fRad = 1.5 * clearance # fillet radius, max 1.5*clearance
|
||||
Rf = Rroot - clearance # radius at top of fillet (end of profile)
|
||||
|
||||
|
||||
# ****** calculate angles (all in radians)
|
||||
pitchAngle = 2 * pi / Z # angle subtended by whole tooth (rads)
|
||||
baseToPitchAngle = genInvolutePolar(Rb, Rpitch)
|
||||
@@ -232,8 +232,8 @@ def CreateInternalGear(w, m, Z, phi, split=True):
|
||||
w.arc(rootNext, Rroot, 0) # root circle arc
|
||||
|
||||
w.arc(filletNext, fRad, 1)
|
||||
|
||||
|
||||
|
||||
|
||||
w.close()
|
||||
return w
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ to ANSI standards from the methods outlined in:
|
||||
handling. Boca Raton: Taylor & Francis, 2006. Print.
|
||||
|
||||
AND
|
||||
|
||||
|
||||
Oberg, Erik, et al. Machinery's handbook : a reference book for the
|
||||
mechanical engineer, designer, manufacturing engineer, draftsman,
|
||||
toolmaker, and machinist. New York: Industrial Press, 2016. Print.
|
||||
|
||||
@@ -30,7 +30,7 @@ class SprocketCreationFrame(qt.QFrame):
|
||||
l.addRow('Number of teeth:', self.N)
|
||||
l.addRow('Chain Pitch (in):', self.P)
|
||||
l.addRow('Roller Diameter (in):', self.Dr)
|
||||
|
||||
|
||||
|
||||
class SprocketDialog(qt.QDialog):
|
||||
def __init__(self, parent=None):
|
||||
|
||||
@@ -90,19 +90,19 @@ def CreateSprocket(w, P, N, Dr):
|
||||
p6 = [-x2,y2]
|
||||
p7 = [-x3,y3]
|
||||
p8 = [-x4,y4]
|
||||
|
||||
|
||||
w.move(p4) # vectors are lists [x,y]
|
||||
w.arc(p3, F, 0)
|
||||
w.line(p2)
|
||||
w.arc(p1, E, 1)
|
||||
w.arc(p0, R, 1)
|
||||
|
||||
|
||||
# ---- Mirror -----
|
||||
w.arc(p5, R, 1)
|
||||
w.arc(p6, E, 1)
|
||||
w.line(p7)
|
||||
w.arc(p8, F, 0)
|
||||
|
||||
|
||||
# ---- Polar Array ----
|
||||
alpha = -radians(360/N)
|
||||
for n in range(1,N):
|
||||
|
||||
Reference in New Issue
Block a user