However, I also have question: For the custom vector I used QDoubleSpinBox but one cannot bind expressions to this. I first tried Gui::PrefDoubleSpinBox, but this does not allow expression bindings as well. Then I tried Gui::PrefQuantitySpinBox but since a vector component has no unit, I don't know if I can use it but simply set the unit to an empty string.
What do you recommend me here?
5. I use simply an empty unit
This is one option. An alternative is using Gui::DoubleSpinBox which extends a QDoubleSpinBox with expressions. However, in the designer plugin it was missing. I have added it with
git commit 93bb9646c
Concerning 3. I understand you now. The pad length should also be matched if skewed. However, at a quick look I could not find out how I could assure this.
The geometrical meaning of my suggestion is called a shearing which is an equal-volume transformation. To make this working you must pass a modified value of "L" to generatePrism.
In the current master we compute dir like this:
Code: Select all
gp_Dir dir(SketchVector.x,SketchVector.y,SketchVector.z);
and in your PR it's computed this way:
Code: Select all
gp_Dir dir(paddingDirection.x, paddingDirection.y, paddingDirection.z);
Since the length of a gp_Dir is 1 you can compute the modified L:
Code: Select all
double factor = dir * gp_Dir(SketchVector.x,SketchVector.y,SketchVector.z);
L = L / factor
Theoretically it can happen that
factor becomes 0 but geometrically this means the pad height is 0 and thus must not be allowed (because it's a degenerated volume). So, you should make sure that the z value of the custom direction is != 0 -- this makes the check for the null vector obsolete again.