set referenceaxis properly and fix getaxis
This commit is contained in:
@@ -912,7 +912,15 @@ void ProfileBased::getAxis(const App::DocumentObject *pcReferenceAxis, const std
|
||||
if (pcReferenceAxis == NULL)
|
||||
return;
|
||||
|
||||
Part::Part2DObject* sketch = getVerifiedSketch();
|
||||
App::DocumentObject* profile = Profile.getValue();
|
||||
Part::Part2DObject* sketch;
|
||||
if (profile->getTypeId().isDerivedFrom(Part::Part2DObject::getClassTypeId())) {
|
||||
sketch = getVerifiedSketch();
|
||||
}
|
||||
else if (profile->getTypeId().isDerivedFrom(Part::Feature::getClassTypeId())) {
|
||||
sketch = static_cast<Part::Part2DObject*>(getVerifiedObject());
|
||||
}
|
||||
|
||||
Base::Placement SketchPlm = sketch->Placement.getValue();
|
||||
Base::Vector3d SketchPos = SketchPlm.getPosition();
|
||||
Base::Rotation SketchOrientation = SketchPlm.getRotation();
|
||||
@@ -943,7 +951,8 @@ void ProfileBased::getAxis(const App::DocumentObject *pcReferenceAxis, const std
|
||||
return;
|
||||
}
|
||||
|
||||
if (pcReferenceAxis == sketch){
|
||||
if (pcReferenceAxis == profile) {
|
||||
//Part::Part2DObject* sketch = getVerifiedSketch();
|
||||
bool hasValidAxis=false;
|
||||
Base::Axis axis;
|
||||
if (subReferenceAxis[0] == "V_Axis") {
|
||||
|
||||
@@ -739,12 +739,7 @@ void prepareProfileBased(Gui::Command* cmd, const std::string& which,
|
||||
};
|
||||
|
||||
//if a profile is selected we can make our life easy and fast
|
||||
std::vector<Gui::SelectionObject> selection;
|
||||
std::string cmdName = cmd->getName();
|
||||
if (cmdName == "PartDesign_Revolution" || cmdName == "PartDesign_Groove")
|
||||
selection = cmd->getSelection().getSelectionEx(0, Part::Part2DObject::getClassTypeId());
|
||||
else
|
||||
selection = cmd->getSelection().getSelectionEx();
|
||||
std::vector<Gui::SelectionObject> selection = cmd->getSelection().getSelectionEx();
|
||||
if (!selection.empty() && selection.front().hasSubNames()) {
|
||||
base_worker(selection.front().getObject(), selection.front().getSubNames().front());
|
||||
return;
|
||||
@@ -1004,12 +999,19 @@ void CmdPartDesignRevolution::activated(int iMsg)
|
||||
return;
|
||||
|
||||
Gui::Command* cmd = this;
|
||||
auto worker = [this, cmd](Part::Feature* sketch, std::string FeatName) {
|
||||
auto worker = [this, cmd, pcActiveBody](Part::Feature* sketch, std::string FeatName) {
|
||||
|
||||
if (FeatName.empty()) return;
|
||||
|
||||
Gui::Command::doCommand(Doc,"App.activeDocument().%s.ReferenceAxis = (App.activeDocument().%s,['V_Axis'])",
|
||||
FeatName.c_str(), sketch->getNameInDocument());
|
||||
if (sketch->isDerivedFrom(Part::Part2DObject::getClassTypeId())) {
|
||||
Gui::Command::doCommand(Doc, "App.activeDocument().%s.ReferenceAxis = (App.activeDocument().%s,['V_Axis'])",
|
||||
FeatName.c_str(), sketch->getNameInDocument());
|
||||
}
|
||||
else {
|
||||
Gui::Command::doCommand(Doc, "App.activeDocument().%s.ReferenceAxis = (App.activeDocument().%s,[\"\"])",
|
||||
FeatName.c_str(), pcActiveBody->getOrigin()->getY()->getNameInDocument());
|
||||
}
|
||||
|
||||
Gui::Command::doCommand(Doc,"App.activeDocument().%s.Angle = 360.0",FeatName.c_str());
|
||||
PartDesign::Revolution* pcRevolution = static_cast<PartDesign::Revolution*>(cmd->getDocument()->getObject(FeatName.c_str()));
|
||||
if (pcRevolution && pcRevolution->suggestReversed())
|
||||
|
||||
Reference in New Issue
Block a user