remove limit to only allow vertexes of a model
This commit is contained in:
@@ -82,11 +82,7 @@ public:
|
||||
Placement::Placement(QWidget* parent, Qt::WindowFlags fl)
|
||||
: Gui::LocationDialog(parent, fl)
|
||||
{
|
||||
std::vector<Gui::SelectionObject> selection = Gui::Selection().getSelectionEx();
|
||||
if (selection.size()>=1){
|
||||
documentName = selection[0].getDocName(); //save info so we can reselect
|
||||
featureName = selection[0].getFeatName(); //after select points button clicked
|
||||
}
|
||||
selectionObjects = Gui::Selection().getSelectionEx();
|
||||
|
||||
propertyName = "Placement"; // default name
|
||||
ui = new Ui_PlacementComp(this);
|
||||
@@ -310,17 +306,14 @@ void Placement::on_selectedVertex_clicked()
|
||||
bool success=false;
|
||||
std::vector<Gui::SelectionObject> selection = Gui::Selection().getSelectionEx();
|
||||
std::vector<Base::Vector3d> picked;
|
||||
std::vector<Base::string> subnames;
|
||||
//combine all pickedpoints and subnames into single vectors
|
||||
//combine all pickedpoints into single vector
|
||||
//even if points are from separate objects
|
||||
for (std::vector<Gui::SelectionObject>::iterator it=selection.begin(); it!=selection.end(); ++it){
|
||||
std::vector<Base::Vector3d> points = it->getPickedPoints();
|
||||
picked.insert(picked.begin(),points.begin(),points.end());
|
||||
std::vector<std::string> names = it->getSubNames();
|
||||
subnames.insert(subnames.begin(),names.begin(),names.end());
|
||||
}
|
||||
if (picked.size()==1 && (std::string(subnames[0]).substr(0,6)==std::string("Vertex")
|
||||
|| std::string(subnames[0]).substr(0,5)==std::string("Point"))){
|
||||
|
||||
if (picked.size() == 1) {
|
||||
ui->xCnt->setValue(picked[0].x);
|
||||
ui->yCnt->setValue(picked[0].y);
|
||||
ui->zCnt->setValue(picked[0].z);
|
||||
@@ -328,10 +321,8 @@ void Placement::on_selectedVertex_clicked()
|
||||
cntOfMass.y=picked[0].y;
|
||||
cntOfMass.z=picked[0].z;
|
||||
success=true;
|
||||
} else if (picked.size()==2 && (std::string(subnames[0]).substr(0,6)==std::string("Vertex")
|
||||
|| std::string(subnames[0]).substr(0,5)==std::string("Point"))
|
||||
&& (std::string(subnames[1]).substr(0,6)==std::string("Vertex")
|
||||
|| std::string(subnames[1]).substr(0,5)==std::string("Point"))){
|
||||
}
|
||||
else if (picked.size() == 2) {
|
||||
//average the coords to get center of rotation
|
||||
ui->xCnt->setValue((picked[0].x+picked[1].x)/2.0);
|
||||
ui->yCnt->setValue((picked[0].y+picked[1].y)/2.0);
|
||||
@@ -358,7 +349,8 @@ void Placement::on_selectedVertex_clicked()
|
||||
//of the same object the rotation still gets applied twice
|
||||
Gui::Selection().clearSelection();
|
||||
//reselect original object that was selected when placment dlg first opened
|
||||
Gui::Selection().addSelection(documentName.c_str(),featureName.c_str());
|
||||
for (auto it : selectionObjects)
|
||||
Gui::Selection().addSelection(it);
|
||||
ui->rotationInput->setCurrentIndex(0); //use rotation with axis instead of euler
|
||||
ui->stackedWidget->setCurrentIndex(0);
|
||||
success=true;
|
||||
@@ -366,7 +358,6 @@ void Placement::on_selectedVertex_clicked()
|
||||
|
||||
if (!success){
|
||||
Base::Console().Warning("Placement selection error. Select either 1 or 2 points.\n");
|
||||
|
||||
ui->xCnt->setValue(0);
|
||||
ui->yCnt->setValue(0);
|
||||
ui->zCnt->setValue(0);
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#define GUI_PLACEMENT_H
|
||||
|
||||
#include <Gui/InputVector.h>
|
||||
#include <Gui/SelectionObject.h>
|
||||
#include <Gui/TaskView/TaskDialog.h>
|
||||
#include <Gui/TaskView/TaskView.h>
|
||||
#include <Base/Placement.h>
|
||||
@@ -94,8 +95,11 @@ private:
|
||||
Base::Vector3d cntOfMass;
|
||||
std::string propertyName; // the name of the placement property
|
||||
std::set<std::string> documents;
|
||||
std::string documentName; //store these so we can reselect original object
|
||||
std::string featureName; //after user selects points and clicks Selected point(s)
|
||||
/**
|
||||
* store these so we can reselect original object
|
||||
* after user selects points and clicks Selected point(s)
|
||||
*/
|
||||
std::vector<SelectionObject> selectionObjects;
|
||||
|
||||
friend class TaskPlacement;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user