PD: Add translation to error messages
This commit is contained in:
@@ -169,12 +169,12 @@ App::DocumentObjectExecReturn *Pipe::execute()
|
||||
TopoDS_Shape profileShape = getSectionShape(Profile.getValue(),
|
||||
Profile.getSubValues());
|
||||
if (profileShape.IsNull())
|
||||
return new App::DocumentObjectExecReturn("Pipe: Could not obtain profile shape");
|
||||
return new App::DocumentObjectExecReturn(QT_TRANSLATE_NOOP("Exception", "Pipe: Could not obtain profile shape"));
|
||||
|
||||
// build the paths
|
||||
App::DocumentObject* spine = Spine.getValue();
|
||||
if (!(spine && spine->getTypeId().isDerivedFrom(Part::Feature::getClassTypeId())))
|
||||
return new App::DocumentObjectExecReturn("No spine linked");
|
||||
return new App::DocumentObjectExecReturn(QT_TRANSLATE_NOOP("Exception", "No spine linked"));
|
||||
|
||||
std::vector<std::string> subedge = Spine.getSubValues();
|
||||
TopoDS_Shape path;
|
||||
@@ -187,7 +187,7 @@ App::DocumentObjectExecReturn *Pipe::execute()
|
||||
if (Mode.getValue() == 3) {
|
||||
App::DocumentObject* auxspine = AuxillerySpine.getValue();
|
||||
if (!(auxspine && auxspine->getTypeId().isDerivedFrom(Part::Feature::getClassTypeId())))
|
||||
return new App::DocumentObjectExecReturn("No auxiliary spine linked.");
|
||||
return new App::DocumentObjectExecReturn(QT_TRANSLATE_NOOP("Exception", "No auxiliary spine linked."));
|
||||
std::vector<std::string> auxsubedge = AuxillerySpine.getSubValues();
|
||||
|
||||
const Part::TopoShape& auxshape =
|
||||
@@ -208,14 +208,14 @@ App::DocumentObjectExecReturn *Pipe::execute()
|
||||
for (ex.Init(profileShape, TopAbs_VERTEX); ex.More(); ex.Next(), ++i)
|
||||
profilePoint = ex.Current();
|
||||
if (i > 1)
|
||||
return new App::DocumentObjectExecReturn(
|
||||
return new App::DocumentObjectExecReturn(QT_TRANSLATE_NOOP("Exception",
|
||||
"Pipe: Only one isolated point is needed if using a sketch with isolated "
|
||||
"points for section");
|
||||
"points for section"));
|
||||
}
|
||||
|
||||
if (!profilePoint.IsNull() && (Transformation.getValue() != 1 || multisections.empty()))
|
||||
return new App::DocumentObjectExecReturn(
|
||||
"Pipe: At least one section is needed when using a single point for profile");
|
||||
return new App::DocumentObjectExecReturn(QT_TRANSLATE_NOOP("Exception",
|
||||
"Pipe: At least one section is needed when using a single point for profile"));
|
||||
|
||||
// maybe we need a scaling law
|
||||
Handle(Law_Function) scalinglaw;
|
||||
@@ -228,14 +228,14 @@ App::DocumentObjectExecReturn *Pipe::execute()
|
||||
// as makepipeshell connects the sections in the order of adding
|
||||
for (auto& subSet : multisections) {
|
||||
if (!subSet.first->isDerivedFrom(Part::Feature::getClassTypeId()))
|
||||
return new App::DocumentObjectExecReturn(
|
||||
"Pipe: All sections need to be part features");
|
||||
return new App::DocumentObjectExecReturn(QT_TRANSLATE_NOOP("Exception",
|
||||
"Pipe: All sections need to be part features"));
|
||||
|
||||
// if the section is an object's face then take just the face
|
||||
TopoDS_Shape shape = getSectionShape(subSet.first, subSet.second);
|
||||
if (shape.IsNull())
|
||||
return new App::DocumentObjectExecReturn(
|
||||
"Pipe: Could not obtain section shape");
|
||||
return new App::DocumentObjectExecReturn(QT_TRANSLATE_NOOP("Exception",
|
||||
"Pipe: Could not obtain section shape"));
|
||||
|
||||
size_t nWiresAdded = addWiresToWireSections(shape, wiresections);
|
||||
if (nWiresAdded == 0) {
|
||||
@@ -243,8 +243,8 @@ App::DocumentObjectExecReturn *Pipe::execute()
|
||||
size_t i = 0;
|
||||
for (ex.Init(shape, TopAbs_VERTEX); ex.More(); ex.Next(), ++i) {
|
||||
if (isLastSectionVertex)
|
||||
return new App::DocumentObjectExecReturn(
|
||||
"Pipe: Only the profile and last section can be vertices");
|
||||
return new App::DocumentObjectExecReturn(QT_TRANSLATE_NOOP("Exception",
|
||||
"Pipe: Only the profile and last section can be vertices"));
|
||||
isLastSectionVertex = true;
|
||||
for (auto& wires : wiresections)
|
||||
wires.push_back(ex.Current());
|
||||
@@ -252,9 +252,9 @@ App::DocumentObjectExecReturn *Pipe::execute()
|
||||
}
|
||||
|
||||
if (!isLastSectionVertex && nWiresAdded < wiresections.size())
|
||||
return new App::DocumentObjectExecReturn(
|
||||
return new App::DocumentObjectExecReturn(QT_TRANSLATE_NOOP("Exception",
|
||||
"Multisections need to have the same amount of inner wires as the base "
|
||||
"section");
|
||||
"section"));
|
||||
}
|
||||
}
|
||||
/*//build the law functions instead
|
||||
@@ -279,7 +279,8 @@ App::DocumentObjectExecReturn *Pipe::execute()
|
||||
|
||||
// Verify that path is not a null shape
|
||||
if (path.IsNull())
|
||||
return new App::DocumentObjectExecReturn("Path must not be a null shape");
|
||||
return new App::DocumentObjectExecReturn(QT_TRANSLATE_NOOP(
|
||||
"Exception", "Path must not be a null shape"));
|
||||
|
||||
// build all shells
|
||||
std::vector<TopoDS_Shape> shells;
|
||||
@@ -313,7 +314,7 @@ App::DocumentObjectExecReturn *Pipe::execute()
|
||||
}
|
||||
|
||||
if (!mkPS.IsReady())
|
||||
return new App::DocumentObjectExecReturn("Pipe could not be built");
|
||||
return new App::DocumentObjectExecReturn(QT_TRANSLATE_NOOP("Exception", "Pipe could not be built"));
|
||||
|
||||
shells.push_back(mkPS.Shape());
|
||||
|
||||
@@ -359,7 +360,7 @@ App::DocumentObjectExecReturn *Pipe::execute()
|
||||
}
|
||||
|
||||
if (!mkSolid.IsDone())
|
||||
return new App::DocumentObjectExecReturn("Result is not a solid");
|
||||
return new App::DocumentObjectExecReturn(QT_TRANSLATE_NOOP("Exception", "Result is not a solid"));
|
||||
|
||||
TopoDS_Shape result = mkSolid.Shape();
|
||||
BRepClass3d_SolidClassifier SC(result);
|
||||
@@ -374,7 +375,7 @@ App::DocumentObjectExecReturn *Pipe::execute()
|
||||
if (base.IsNull()) {
|
||||
if (getAddSubType() == FeatureAddSub::Subtractive)
|
||||
return new App::DocumentObjectExecReturn(
|
||||
"Pipe: There is nothing to subtract from\n");
|
||||
QT_TRANSLATE_NOOP("Exception", "Pipe: There is nothing to subtract from"));
|
||||
|
||||
result = refineShapeIfActive(result);
|
||||
Shape.setValue(getSolid(result));
|
||||
@@ -385,17 +386,17 @@ App::DocumentObjectExecReturn *Pipe::execute()
|
||||
|
||||
BRepAlgoAPI_Fuse mkFuse(base, result);
|
||||
if (!mkFuse.IsDone())
|
||||
return new App::DocumentObjectExecReturn("Adding the pipe failed");
|
||||
return new App::DocumentObjectExecReturn(QT_TRANSLATE_NOOP("Exception", "Adding the pipe failed"));
|
||||
// we have to get the solids (fuse sometimes creates compounds)
|
||||
TopoDS_Shape boolOp = this->getSolid(mkFuse.Shape());
|
||||
// lets check if the result is a solid
|
||||
if (boolOp.IsNull())
|
||||
return new App::DocumentObjectExecReturn("Resulting shape is not a solid");
|
||||
return new App::DocumentObjectExecReturn(QT_TRANSLATE_NOOP("Exception", "Resulting shape is not a solid"));
|
||||
|
||||
int solidCount = countSolids(boolOp);
|
||||
if (solidCount > 1) {
|
||||
return new App::DocumentObjectExecReturn(
|
||||
"Pipe: Result has multiple solids. This is not supported at this time.");
|
||||
return new App::DocumentObjectExecReturn(QT_TRANSLATE_NOOP("Exception",
|
||||
"Pipe: Result has multiple solids. This is not supported at this time."));
|
||||
}
|
||||
|
||||
boolOp = refineShapeIfActive(boolOp);
|
||||
@@ -405,17 +406,17 @@ App::DocumentObjectExecReturn *Pipe::execute()
|
||||
|
||||
BRepAlgoAPI_Cut mkCut(base, result);
|
||||
if (!mkCut.IsDone())
|
||||
return new App::DocumentObjectExecReturn("Subtracting the pipe failed");
|
||||
return new App::DocumentObjectExecReturn(QT_TRANSLATE_NOOP("Exception", "Subtracting the pipe failed"));
|
||||
// we have to get the solids (fuse sometimes creates compounds)
|
||||
TopoDS_Shape boolOp = this->getSolid(mkCut.Shape());
|
||||
// lets check if the result is a solid
|
||||
if (boolOp.IsNull())
|
||||
return new App::DocumentObjectExecReturn("Resulting shape is not a solid");
|
||||
return new App::DocumentObjectExecReturn(QT_TRANSLATE_NOOP("Exception", "Resulting shape is not a solid"));
|
||||
|
||||
int solidCount = countSolids(boolOp);
|
||||
if (solidCount > 1) {
|
||||
return new App::DocumentObjectExecReturn(
|
||||
"Pipe: Result has multiple solids. This is not supported at this time.");
|
||||
return new App::DocumentObjectExecReturn(QT_TRANSLATE_NOOP("Exception",
|
||||
"Pipe: Result has multiple solids. This is not supported at this time."));
|
||||
}
|
||||
|
||||
boolOp = refineShapeIfActive(boolOp);
|
||||
@@ -429,7 +430,7 @@ App::DocumentObjectExecReturn *Pipe::execute()
|
||||
return new App::DocumentObjectExecReturn(e.GetMessageString());
|
||||
}
|
||||
catch (...) {
|
||||
return new App::DocumentObjectExecReturn("A fatal error occurred when making the pipe");
|
||||
return new App::DocumentObjectExecReturn(QT_TRANSLATE_NOOP("Exception", "A fatal error occurred when making the pipe"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -554,10 +555,10 @@ void Pipe::buildPipePath(const Part::TopoShape& shape, const std::vector<std::st
|
||||
TopoDS_Iterator it(shape.getShape());
|
||||
for (; it.More(); it.Next()) {
|
||||
if (it.Value().IsNull())
|
||||
throw Base::ValueError("In valid element in spine.");
|
||||
throw Base::ValueError(QT_TRANSLATE_NOOP("Exception", "Invalid element in spine."));
|
||||
if ((it.Value().ShapeType() != TopAbs_EDGE) &&
|
||||
(it.Value().ShapeType() != TopAbs_WIRE)) {
|
||||
throw Base::TypeError("Element in spine is neither an edge nor a wire.");
|
||||
throw Base::TypeError(QT_TRANSLATE_NOOP("Exception", "Element in spine is neither an edge nor a wire."));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -570,15 +571,15 @@ void Pipe::buildPipePath(const Part::TopoShape& shape, const std::vector<std::st
|
||||
hEdges, Precision::Confusion(), Standard_True, hWires);
|
||||
int len = hWires->Length();
|
||||
if (len != 1)
|
||||
throw Base::ValueError("Spine is not connected.");
|
||||
throw Base::ValueError(QT_TRANSLATE_NOOP("Exception", "Spine is not connected."));
|
||||
path = hWires->Value(1);
|
||||
}
|
||||
else {
|
||||
throw Base::TypeError("Spine is neither an edge nor a wire.");
|
||||
throw Base::TypeError(QT_TRANSLATE_NOOP("Exception", "Spine is neither an edge nor a wire."));
|
||||
}
|
||||
}
|
||||
catch (Standard_Failure&) {
|
||||
throw Base::CADKernelError("Invalid spine.");
|
||||
throw Base::CADKernelError(QT_TRANSLATE_NOOP("Exception", "Invalid spine."));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user