-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[TechDraw] Align points to direction by rotation #16342
base: main
Are you sure you want to change the base?
Conversation
FreeCAD/src/Mod/TechDraw/Gui/Command.cpp Lines 889 to 907 in 7ed1e93
@WandererFan Dude, we seriously need to do something about this. It's way too complicated retrieving just the base view from selection. And the code is just copy-pasted everywhere. |
ffa0e22
to
73c11ed
Compare
@WandererFan, ready for review. This should be tested broadly, as there were multiple issues with rotating the incorrect direction and such stuff. Issue was, that |
73c11ed
to
cf79adf
Compare
@benj5378 right now we are struggling to keep up with the 1.0 milestone PRs. Hold tight, we will get back to our normal PR process as soon as we can. |
@benj5378 could you update the PR? |
@benj5378 ping |
waiting for feedback |
bump |
cf79adf
to
c47205b
Compare
@maxwxyz updated |
@davesrocketshop is going to give it a look |
And so is @WandererFan |
|
||
std::vector<QGIVertex*> vertexes = view->getObjects<QGIVertex*>(vertexIndexes); | ||
if(vertexes.size() != 2) { | ||
Base::Console().Error(QObject::tr("You must select 2 vertexes\n").toStdString().c_str()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Error message only in Report view is easy to miss. Need a QMessageBox here.
QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Incorrect selection"),
QObject::tr("Please select 2 vertexes or 1 edge"));
return false;
|
||
std::vector<std::string> vertexNames = getSelection().getSelectionEx()[0].getSubNames(); | ||
std::vector<int> vertexIndexes = DrawUtil::getIndexFromName(vertexNames); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Didn't the feature request ask for alignment by an edge? This only does 2 vertexes. Need something like:
std::string gType = TechDraw::DrawUtil::getGeomTypeFromName(subnames.at(0));
if (gType == "Edge") {.
auto edgeIndex = TechDraw::DrawUtil::getIndexFromName(Name);
TechDraw::BaseGeomPtr geom = dvp->getGeomByIndex(edgeIndex);
if (geom->getGeomType() != TechDraw::GENERIC) {
QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Incorrect Selection"),
QObject::tr("Please select a straight edge"));
return;
}
point0 = geom->getStartPoint();
point1 = geom->getEndPoint();
} else if (gType == "Vertex") {
...
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It indeed did! However, I think that it will give more flexibility with points. There might not be an edge for the desired alignment, but there will always be points for a desired edge.
We can also do, that either two points or one edge are required?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since they asked for an edge, we should give them an edge. Points can be a bonus.
Works well with 2 vertices. |
aligning->setCommand("Aligning"); | ||
*aligning << "TechDraw_AlignVertexesVertically"; | ||
*aligning << "TechDraw_AlignVertexesHorizontally"; | ||
|
||
// main menu |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No button in toolbar? Hard to find the function if it is only in the menu.
|
||
std::vector<std::string> vertexNames = getSelection().getSelectionEx()[0].getSubNames(); | ||
std::vector<int> vertexIndexes = DrawUtil::getIndexFromName(vertexNames); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since they asked for an edge, we should give them an edge. Points can be a bonus.
Fixes #7061