Merge branch 'master' into path_simulator

This commit is contained in:
Oleg Belov
2022-01-08 10:58:30 +03:00
committed by GitHub
12 changed files with 77 additions and 122 deletions

View File

@@ -4,88 +4,66 @@ aline
alle
alledges
alocation
als
ang
anid
anormal
apoints
appy
ba
beginn
behaviour
bloaded
bottome
byteorder
calculater
cancelled
cancelling
cas
cascade
centimetre
childrens
childs
colour
colours
commen
connexion
currenty
dof
curvelinear
doubleclick
dum
eiter
elemente
ende
feld
extaction
finde
findf
findn
fle
fo
freez
froms
hist
iff
indicies
initialisation
initialise
initialised
initialises
initialisiert
inout
ist
kilometre
lod
mantatory
mata
methode
metres
millimetre
modell
nd
noe
nin
normale
normaly
nto
numer
oder
ontop
orgin
orginx
orginy
ot
pard
parm
parms
pres
programm
que
propt
rady
recurrance
rougly
seperator
seh
serie
sinc
som
strack
substraction
sur
te
thist
thru
tread
uint
unter
ue
uptodate
usind
vas
vertexes
wallthickness
whitespaces
zuser

View File

@@ -27,5 +27,5 @@ jobs:
with:
check_filenames: true
ignore_words_file: .github/codespellignore
skip: ./.git,*.po,*.ts,./ChangeLog.txt,./src/3rdParty,./src/Mod/Assembly/App/opendcm,./src/CXX,./src/zipios++,./src/Base/swig*,./src/Mod/Robot/App/kdl_cp,./src/Mod/Import/App/SCL,./src/WindowsInstaller,./src/Doc/FreeCAD.uml,./build/
skip: ./.git,*.po,*.ts,*,svg,./ChangeLog.txt,./src/3rdParty,./src/Mod/Assembly/App/opendcm,./src/CXX,./src/zipios++,./src/Base/swig*,./src/Mod/Robot/App/kdl_cp,./src/Mod/Import/App/SCL,./src/WindowsInstaller,./src/Doc/FreeCAD.uml,./build/
path: ${{ steps.changed-files.outputs.all_changed_files }}

View File

@@ -43,7 +43,7 @@ import FreeCAD as App
import draftutils.utils as utils
from draftutils.messages import _msg, _wrn, _err
from draftutils.translate import _tr, translate
from draftutils.translate import translate
if App.GuiUp:
import FreeCADGui as Gui
@@ -78,7 +78,7 @@ def get_3d_view():
if v:
return v[0]
_wrn(_tr("No graphical interface"))
_wrn(translate("draft", "No graphical interface"))
return None
@@ -155,7 +155,7 @@ def autogroup(obj):
return
matrix = parent.getSubObject(sub, retType=4)
if matrix.hasScale() == 1:
err = translate("Draft",
err = translate("draft",
"Unable to insert new object into "
"a scaled part")
App.Console.PrintMessage(err)
@@ -264,7 +264,7 @@ def dim_symbol(symbol=None, invert=False):
elif symbol == 4:
return dim_dash((-1.5, -1.5, 0), (1.5, 1.5, 0))
else:
_wrn(_tr("Symbol not implemented. Use a default symbol."))
_wrn(translate("draft", "Symbol not implemented. Using a default symbol."))
return coin.SoSphere()
@@ -330,7 +330,7 @@ def remove_hidden(objectslist):
if obj.ViewObject:
if not obj.ViewObject.isVisible():
newlist.remove(obj)
_msg(_tr("Visibility off; removed from list: ") + obj.Label)
_msg(translate("draft", "Visibility off; removed from list: ") + obj.Label)
return newlist
@@ -600,13 +600,13 @@ def load_texture(filename, size=None, gui=App.GuiUp):
p = QtGui.QImage(filename)
if p.isNull():
_wrn("load_texture: " + _tr("image is Null"))
_wrn("load_texture: " + translate("draft", "image is Null"))
if not os.path.exists(filename):
raise FileNotFoundError(-1,
_tr("filename does not exist "
"on the system or "
"on the resource file"),
translate("draft", "filename does not exist "
"on the system or "
"in the resource file"),
filename)
# This is buggy so it was de-activated.
@@ -665,7 +665,7 @@ def load_texture(filename, size=None, gui=App.GuiUp):
return None
except Exception as exc:
_wrn(str(exc))
_wrn("load_texture: " + _tr("unable to load texture"))
_wrn("load_texture: " + translate("draft", "unable to load texture"))
return None
else:
return img
@@ -717,7 +717,7 @@ def get_bbox(obj, debug=False):
found, doc = utils.find_doc(App.activeDocument())
if not found:
_err(_tr("No active document. Aborting."))
_err(translate("draft", "No active document. Aborting."))
return None
if isinstance(obj, str):
@@ -726,7 +726,7 @@ def get_bbox(obj, debug=False):
found, obj = utils.find_object(obj, doc)
if not found:
_msg("obj: {}".format(obj_str))
_err(_tr("Wrong input: object not in document."))
_err(translate("draft", "Wrong input: object not in document."))
return None
if debug:
@@ -735,7 +735,7 @@ def get_bbox(obj, debug=False):
if (not hasattr(obj, "ViewObject")
or not obj.ViewObject
or not hasattr(obj.ViewObject, "RootNode")):
_err(_tr("Does not have 'ViewObject.RootNode'."))
_err(translate("draft", "Does not have 'ViewObject.RootNode'."))
# For Draft Dimensions
# node = obj.ViewObject.Proxy.node

View File

@@ -41,7 +41,7 @@ import PySide.QtCore as QtCore
import FreeCAD as App
from draftutils.messages import _msg, _wrn, _err, _log
from draftutils.translate import _tr
from draftutils.translate import translate
# TODO: move the functions that require the graphical interface
# This module should not import any graphical commands; those should be
@@ -647,20 +647,20 @@ def print_shape(shape):
shape : Part::TopoShape
Any topological shape in an object, usually obtained from `obj.Shape`.
"""
_msg(_tr("Solids:") + " {}".format(len(shape.Solids)))
_msg(_tr("Faces:") + " {}".format(len(shape.Faces)))
_msg(_tr("Wires:") + " {}".format(len(shape.Wires)))
_msg(_tr("Edges:") + " {}".format(len(shape.Edges)))
_msg(_tr("Vertices:") + " {}".format(len(shape.Vertexes)))
_msg(translate("draft", "Solids:") + " {}".format(len(shape.Solids)))
_msg(translate("draft", "Faces:") + " {}".format(len(shape.Faces)))
_msg(translate("draft", "Wires:") + " {}".format(len(shape.Wires)))
_msg(translate("draft", "Edges:") + " {}".format(len(shape.Edges)))
_msg(translate("draft", "Vertices:") + " {}".format(len(shape.Vertexes)))
if shape.Faces:
for f in range(len(shape.Faces)):
_msg(_tr("Face") + " {}:".format(f))
_msg(translate("draft", "Face") + " {}:".format(f))
for v in shape.Faces[f].Vertexes:
_msg(" {}".format(v.Point))
elif shape.Wires:
for w in range(len(shape.Wires)):
_msg(_tr("Wire") + " {}:".format(w))
_msg(translate("draft", "Wire") + " {}:".format(w))
for v in shape.Wires[w].Vertexes:
_msg(" {}".format(v.Point))
else:
@@ -692,11 +692,11 @@ def compare_objects(obj1, obj2):
if obj1.TypeId != obj2.TypeId:
_msg("'{0}' ({1}), '{2}' ({3}): ".format(obj1.Name, obj1.TypeId,
obj2.Name, obj2.TypeId)
+ _tr("different types") + " (TypeId)")
+ translate("draft", "different types") + " (TypeId)")
elif getType(obj1) != getType(obj2):
_msg("'{0}' ({1}), '{2}' ({3}): ".format(obj1.Name, get_type(obj1),
obj2.Name, get_type(obj2))
+ _tr("different types") + " (Proxy.Type)")
+ translate("draft", "different types") + " (Proxy.Type)")
else:
for p in obj1.PropertiesList:
if p in obj2.PropertiesList:
@@ -704,15 +704,15 @@ def compare_objects(obj1, obj2):
pass
elif p == "Placement":
delta = obj1.Placement.Base.sub(obj2.Placement.Base)
text = _tr("Objects have different placements. "
"Distance between the two base points: ")
text = translate("draft", "Objects have different placements. "
"Distance between the two base points: ")
_msg(text + str(delta.Length))
else:
if getattr(obj1, p) != getattr(obj2, p):
_msg("'{}' ".format(p) + _tr("has a different value"))
_msg("'{}' ".format(p) + translate("draft", "has a different value"))
else:
_msg("{} ".format(p)
+ _tr("doesn't exist in one of the objects"))
+ translate("draft", "doesn't exist in one of the objects"))
compareObjects = compare_objects
@@ -824,13 +824,13 @@ def filter_objects_for_modifiers(objects, isCopied=False):
if parent.isDerivedFrom("Part::Feature"):
parents.append(parent.Name)
if len(parents) > 1:
warningMessage = _tr("%s shares a base with %d other objects. Please check if you want to modify this.") % (obj.Name,len(parents) - 1)
warningMessage = translate("draft", "%s shares a base with %d other objects. Please check if you want to modify this.") % (obj.Name,len(parents) - 1)
App.Console.PrintError(warningMessage)
if App.GuiUp:
Gui.getMainWindow().showMessage(warningMessage, 0)
filteredObjects.append(obj.Base)
elif hasattr(obj,"Placement") and obj.getEditorMode("Placement") == ["ReadOnly"] and not isCopied:
App.Console.PrintError(_tr("%s cannot be modified because its placement is readonly.") % obj.Name)
App.Console.PrintError(translate("draft", "%s cannot be modified because its placement is readonly.") % obj.Name)
continue
else:
filteredObjects.append(obj)
@@ -974,7 +974,7 @@ def find_doc(doc=None):
doc = App.getDocument(doc)
except NameError:
_msg("document: {}".format(doc))
_err(_tr("Wrong input: unknown document."))
_err(translate("draft", "Wrong input: unknown document."))
return not FOUND, None
return FOUND, doc
@@ -1011,7 +1011,7 @@ def find_object(obj, doc=None):
found, doc = find_doc(doc)
if not found:
_err(_tr("No active document. Aborting."))
_err(translate("draft", "No active document. Aborting."))
return not FOUND, None
if isinstance(obj, str):
@@ -1050,15 +1050,12 @@ def use_instead(function, version=""):
If we don't know when this command will be deprecated
then we should not give a version.
"""
text = "This function will be deprecated in "
text2 = "This function will be deprecated. "
text3 = "Please use "
if version:
_wrn(_tr(text) + "{}. ".format(version)
+ _tr(text3) + "'{}'.".format(function))
_wrn(translate("draft", "This function will be deprecated in ")
+ "{}. ".format(version)
+ translate("draft", "Please use ") + "'{}'.".format(function))
else:
_wrn(_tr(text2)
+ _tr(text3) + "'{}'.".format(function))
_wrn(translate("draft", "This function will be deprecated. ")
+ translate("draft", "Please use ") + "'{}'.".format(function))
## @}

View File

@@ -61,6 +61,7 @@ PROPERTY_SOURCE(PartDesign::FeatureExtrude, PartDesign::ProfileBased)
FeatureExtrude::FeatureExtrude()
{
signedLengthConstraint = { -DBL_MAX, DBL_MAX, 1.0 };
}
short FeatureExtrude::mustExecute() const

View File

@@ -47,6 +47,8 @@ public:
App::PropertyLength Offset;
App::PropertyLinkSub ReferenceAxis;
App::PropertyQuantityConstraint::Constraints signedLengthConstraint;
/** @name methods override feature */
//@{
short mustExecute() const;

View File

@@ -66,15 +66,14 @@ Pad::Pad()
ADD_PROPERTY_TYPE(Type, (0L), "Pad", App::Prop_None, "Pad type");
Type.setEnums(TypeEnums);
ADD_PROPERTY_TYPE(Length, (100.0), "Pad", App::Prop_None,"Pad length");
ADD_PROPERTY_TYPE(Length2, (100.0), "Pad", App::Prop_None,"Second Pad length");
ADD_PROPERTY_TYPE(Length, (100.0), "Pad", App::Prop_None, "Pad length");
ADD_PROPERTY_TYPE(Length2, (100.0), "Pad", App::Prop_None, "Pad length in 2nd direction");
ADD_PROPERTY_TYPE(UseCustomVector, (false), "Pad", App::Prop_None, "Use custom vector for pad direction");
ADD_PROPERTY_TYPE(Direction, (Base::Vector3d(1.0, 1.0, 1.0)), "Pad", App::Prop_None, "Pad direction vector");
ADD_PROPERTY_TYPE(ReferenceAxis, (0), "Pad", App::Prop_None, "Reference axis of direction");
ADD_PROPERTY_TYPE(AlongSketchNormal, (true), "Pad", App::Prop_None, "Measure pad length along the sketch normal direction");
ADD_PROPERTY_TYPE(UpToFace, (0), "Pad", App::Prop_None, "Face where pad will end");
ADD_PROPERTY_TYPE(Offset, (0.0), "Pad", App::Prop_None, "Offset from face in which pad will end");
static const App::PropertyQuantityConstraint::Constraints signedLengthConstraint = {-DBL_MAX, DBL_MAX, 1.0};
Offset.setConstraints(&signedLengthConstraint);
// Remove the constraints and keep the type to allow to accept negative values

View File

@@ -63,18 +63,17 @@ Pocket::Pocket()
{
addSubType = FeatureAddSub::Subtractive;
ADD_PROPERTY_TYPE(Type,((long)0),"Pocket",App::Prop_None,"Pocket type");
ADD_PROPERTY_TYPE(Type, ((long)0), "Pocket", App::Prop_None, "Pocket type");
Type.setEnums(TypeEnums);
ADD_PROPERTY_TYPE(Length,(100.0),"Pocket",App::Prop_None,"Pocket length");
ADD_PROPERTY_TYPE(Length2,(100.0),"Pocket",App::Prop_None,"P");
ADD_PROPERTY_TYPE(Length, (100.0), "Pocket", App::Prop_None, "Pocket length");
ADD_PROPERTY_TYPE(Length2, (100.0), "Pocket", App::Prop_None, "Pocket length in 2nd direction");
ADD_PROPERTY_TYPE(UseCustomVector, (false), "Pocket", App::Prop_None, "Use custom vector for pocket direction");
ADD_PROPERTY_TYPE(Direction, (Base::Vector3d(1.0, 1.0, 1.0)), "Pocket", App::Prop_None, "Pocket direction vector");
ADD_PROPERTY_TYPE(ReferenceAxis, (0), "Pocket", App::Prop_None, "Reference axis of direction");
ADD_PROPERTY_TYPE(AlongSketchNormal, (true), "Pocket", App::Prop_None, "Measure pocket length along the sketch normal direction");
ADD_PROPERTY_TYPE(UpToFace,(0),"Pocket",App::Prop_None,"Face where pocket will end");
ADD_PROPERTY_TYPE(Offset,(0.0),"Pocket",App::Prop_None,"Offset from face in which pocket will end");
static const App::PropertyQuantityConstraint::Constraints signedLengthConstraint = {-DBL_MAX, DBL_MAX, 1.0};
Offset.setConstraints ( &signedLengthConstraint );
ADD_PROPERTY_TYPE(UpToFace, (0), "Pocket", App::Prop_None, "Face where pocket will end");
ADD_PROPERTY_TYPE(Offset, (0.0), "Pocket", App::Prop_None, "Offset from face in which pocket will end");
Offset.setConstraints(&signedLengthConstraint);
// Remove the constraints and keep the type to allow to accept negative values
// https://forum.freecadweb.org/viewtopic.php?f=3&t=52075&p=448410#p447636

View File

@@ -522,6 +522,7 @@ void TaskExtrudeParameters::onMidplaneChanged(bool on)
{
PartDesign::FeatureExtrude* extrude = static_cast<PartDesign::FeatureExtrude*>(vp->getObject());
extrude->Midplane.setValue(on);
ui->checkBoxReversed->setEnabled(!on);
tryRecomputeFeature();
}
@@ -529,6 +530,7 @@ void TaskExtrudeParameters::onReversedChanged(bool on)
{
PartDesign::FeatureExtrude* extrude = static_cast<PartDesign::FeatureExtrude*>(vp->getObject());
extrude->Reversed.setValue(on);
ui->checkBoxMidplane->setEnabled(!on);
// update the direction
tryRecomputeFeature();
updateDirectionEdits();
@@ -618,16 +620,6 @@ void TaskExtrudeParameters::translateFaceName()
}
}
double TaskExtrudeParameters::getLength(void) const
{
return ui->lengthEdit->value().getValue();
}
double TaskExtrudeParameters::getLength2(void) const
{
return ui->lengthEdit2->value().getValue();
}
double TaskExtrudeParameters::getOffset(void) const
{
return ui->offsetEdit->value().getValue();

View File

@@ -89,8 +89,6 @@ protected:
App::PropertyLinkSub* propReferenceAxis;
void getReferenceAxis(App::DocumentObject*& obj, std::vector<std::string>& sub) const;
double getLength(void) const;
double getLength2(void) const;
bool getAlongSketchNormal(void) const;
bool getCustom(void) const;
std::string getReferenceAxis(void) const;

View File

@@ -89,7 +89,6 @@ void TaskPadParameters::updateUI(int index)
bool isMidplaneEnabled = false;
bool isMidplaneVisible = false;
bool isReversedEnabled = false;
bool isReversedVisible = false;
bool isFaceEditEnabled = false;
Modes mode = static_cast<Modes>(index);
@@ -97,20 +96,15 @@ void TaskPadParameters::updateUI(int index)
if (mode == Modes::Dimension) {
isLengthEditVisible = true;
ui->lengthEdit->selectNumber();
// Make sure that the spin box has the focus to get key events
// Calling setFocus() directly doesn't work because the spin box is not
// yet visible.
QMetaObject::invokeMethod(ui->lengthEdit, "setFocus", Qt::QueuedConnection);
isMidplaneEnabled = !ui->checkBoxReversed->isChecked();
isMidplaneVisible = true;
// Reverse only makes sense if Midplane is not true
isReversedEnabled = !ui->checkBoxMidplane->isChecked();
isReversedVisible = true;
}
else if (mode == Modes::ToLast || mode == Modes::ToFirst) {
isOffsetEditVisible = true;
isReversedEnabled = true;
isReversedVisible = true;
}
else if (mode == Modes::ToFace) {
isOffsetEditVisible = true;
@@ -120,15 +114,11 @@ void TaskPadParameters::updateUI(int index)
if (ui->lineFaceName->property("FeatureName").isNull())
onButtonFace(true);
isReversedEnabled = true;
isReversedVisible = true;
}
else if (mode == Modes::TwoDimensions) {
isLengthEditVisible = true;
isLengthEdit2Visible = true;
isMidplaneEnabled = !ui->checkBoxReversed->isChecked();
isMidplaneVisible = true;
isReversedEnabled = !ui->checkBoxMidplane->isChecked();
isReversedVisible = true;
isReversedEnabled = true;
}
ui->lengthEdit->setVisible( isLengthEditVisible );
@@ -144,7 +134,6 @@ void TaskPadParameters::updateUI(int index)
ui->checkBoxMidplane->setVisible( isMidplaneVisible );
ui->checkBoxReversed->setEnabled( isReversedEnabled );
ui->checkBoxReversed->setVisible( isReversedVisible );
ui->lengthEdit2->setVisible( isLengthEdit2Visible );
ui->lengthEdit2->setEnabled( isLengthEdit2Visible );

View File

@@ -88,7 +88,8 @@ void TaskPocketParameters::updateUI(int index)
bool isLengthEdit2Visible = false;
bool isOffsetEditVisible = false;
bool isOffsetEditEnabled = true;
bool isMidplateEnabled = false;
bool isMidplaneEnabled = false;
bool isMidplaneVisible = false;
bool isReversedEnabled = false;
bool isFaceEditEnabled = false;
@@ -97,18 +98,16 @@ void TaskPocketParameters::updateUI(int index)
if (mode == Modes::Dimension) {
isLengthEditVisible = true;
ui->lengthEdit->selectNumber();
// Make sure that the spin box has the focus to get key events
// Calling setFocus() directly doesn't work because the spin box is not
// yet visible.
QMetaObject::invokeMethod(ui->lengthEdit, "setFocus", Qt::QueuedConnection);
isMidplateEnabled = true;
isMidplaneVisible = true;
isMidplaneEnabled = true;
// Reverse only makes sense if Midplane is not true
isReversedEnabled = !ui->checkBoxMidplane->isChecked();
}
else if (mode == Modes::ThroughAll) {
isOffsetEditVisible = true;
isOffsetEditEnabled = false; // offset may have some meaning for through all but it doesn't work
isMidplateEnabled = true;
isMidplaneEnabled = true;
isReversedEnabled = !ui->checkBoxMidplane->isChecked();
}
else if (mode == Modes::ToFirst) {
@@ -146,7 +145,8 @@ void TaskPocketParameters::updateUI(int index)
ui->offsetEdit->setEnabled( isOffsetEditVisible && isOffsetEditEnabled );
ui->labelOffset->setVisible( isOffsetEditVisible );
ui->checkBoxMidplane->setEnabled( isMidplateEnabled );
ui->checkBoxMidplane->setEnabled( isMidplaneEnabled );
ui->checkBoxMidplane->setVisible(isMidplaneVisible);
ui->checkBoxReversed->setEnabled( isReversedEnabled );