コード例 #1
0
void TaskRevolutionParameters::onUpdateView(bool on)
{
    if (on) {
    PartDesign::Revolution* pcRevolution = static_cast<PartDesign::Revolution*>(RevolutionView->getObject());
        pcRevolution->getDocument()->recomputeFeature(pcRevolution);
    }
}
コード例 #2
0
void TaskRevolutionParameters::onReversed(bool on)
{
    PartDesign::Revolution* pcRevolution = static_cast<PartDesign::Revolution*>(RevolutionView->getObject());
    pcRevolution->Reversed.setValue(on);
    if (updateView())
        pcRevolution->getDocument()->recomputeFeature(pcRevolution);
}
コード例 #3
0
void TaskRevolutionParameters::onAngleChanged(double len)
{
    PartDesign::Revolution* pcRevolution = static_cast<PartDesign::Revolution*>(RevolutionView->getObject());
    pcRevolution->Angle.setValue((float)len);
    if (updateView())
        pcRevolution->getDocument()->recomputeFeature(pcRevolution);
}
コード例 #4
0
void TaskRevolutionParameters::onAxisChanged(int num)
{
    PartDesign::Revolution* pcRevolution = static_cast<PartDesign::Revolution*>(RevolutionView->getObject());
    Sketcher::SketchObject *pcSketch = static_cast<Sketcher::SketchObject*>(pcRevolution->Sketch.getValue());
    if (pcSketch) {
        int maxcount = pcSketch->getAxisCount()+2;
        if (num == 0)
            pcRevolution->ReferenceAxis.setValue(pcSketch, std::vector<std::string>(1,"V_Axis"));
        else if (num == 1)
            pcRevolution->ReferenceAxis.setValue(pcSketch, std::vector<std::string>(1,"H_Axis"));
        else if (num >= 2 && num < maxcount) {
            QString buf = QString::fromUtf8("Axis%1").arg(num-2);
            std::string str = buf.toStdString();
            pcRevolution->ReferenceAxis.setValue(pcSketch, std::vector<std::string>(1,str));
        }
        if (num < maxcount && ui->axis->count() > maxcount)
            ui->axis->setMaxCount(maxcount);
    }
    if (updateView())
        pcRevolution->getDocument()->recomputeFeature(pcRevolution);
}
コード例 #5
0
void TaskRevolutionParameters::onAxisChanged(int num)
{
    PartDesign::Revolution* pcRevolution = static_cast<PartDesign::Revolution*>(RevolutionView->getObject());
    Sketcher::SketchObject *pcSketch = static_cast<Sketcher::SketchObject*>(pcRevolution->Sketch.getValue());
    if (pcSketch) {
        App::DocumentObject *oldRefAxis = pcRevolution->ReferenceAxis.getValue();
        std::vector<std::string> oldSubRefAxis = pcRevolution->ReferenceAxis.getSubValues();

        int maxcount = pcSketch->getAxisCount()+2;
        if (num == 0)
            pcRevolution->ReferenceAxis.setValue(pcSketch, std::vector<std::string>(1,"V_Axis"));
        else if (num == 1)
            pcRevolution->ReferenceAxis.setValue(pcSketch, std::vector<std::string>(1,"H_Axis"));
        else if (num >= 2 && num < maxcount) {
            QString buf = QString::fromUtf8("Axis%1").arg(num-2);
            std::string str = buf.toStdString();
            pcRevolution->ReferenceAxis.setValue(pcSketch, std::vector<std::string>(1,str));
        }
        if (num < maxcount && ui->axis->count() > maxcount)
            ui->axis->setMaxCount(maxcount);

        const std::vector<std::string> &newSubRefAxis = pcRevolution->ReferenceAxis.getSubValues();
        if (oldRefAxis != pcSketch ||
            oldSubRefAxis.size() != newSubRefAxis.size() ||
            oldSubRefAxis[0] != newSubRefAxis[0]) {
            bool reversed = pcRevolution->suggestReversed();
            if (reversed != pcRevolution->Reversed.getValue()) {
                pcRevolution->Reversed.setValue(reversed);
                ui->checkBoxReversed->blockSignals(true);
                ui->checkBoxReversed->setChecked(reversed);
                ui->checkBoxReversed->blockSignals(false);
            }
        }
    }
    if (updateView())
        pcRevolution->getDocument()->recomputeFeature(pcRevolution);
}