fixes #0001333: Extruding a shape 'MyShape' should call solid 'Extruded from MyShape'
This commit is contained in:
parent
18c62a52af
commit
e5965a4596
|
@ -153,12 +153,25 @@ void DlgExtrusion::apply()
|
|||
}
|
||||
activeDoc->openTransaction("Extrude");
|
||||
|
||||
QString shape, type, name;
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
|
||||
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/Part");
|
||||
bool addBaseName = hGrp->GetBool("AddBaseObjectName", false);
|
||||
|
||||
QString shape, type, name, label;
|
||||
QList<QTreeWidgetItem *> items = ui->treeWidget->selectedItems();
|
||||
for (QList<QTreeWidgetItem *>::iterator it = items.begin(); it != items.end(); ++it) {
|
||||
shape = (*it)->data(0, Qt::UserRole).toString();
|
||||
type = QString::fromAscii("Part::Extrusion");
|
||||
name = QString::fromAscii(activeDoc->getUniqueObjectName("Extrude").c_str());
|
||||
if (addBaseName) {
|
||||
QString baseName = QString::fromLatin1("Extrude_%1").arg(shape);
|
||||
label = QString::fromLatin1("%1_Extrude").arg((*it)->text(0));
|
||||
name = QString::fromAscii(activeDoc->getUniqueObjectName((const char*)baseName.toLatin1()).c_str());
|
||||
}
|
||||
else {
|
||||
name = QString::fromAscii(activeDoc->getUniqueObjectName("Extrude").c_str());
|
||||
label = name;
|
||||
}
|
||||
|
||||
double len = ui->dirLen->value();
|
||||
double dirX = ui->dirX->value();
|
||||
double dirY = ui->dirY->value();
|
||||
|
@ -197,14 +210,16 @@ void DlgExtrusion::apply()
|
|||
"FreeCAD.getDocument(\"%1\").%3.Dir = (%5,%6,%7)\n"
|
||||
"FreeCAD.getDocument(\"%1\").%3.Solid = (%8)\n"
|
||||
"FreeCAD.getDocument(\"%1\").%3.TaperAngle = (%9)\n"
|
||||
"FreeCADGui.getDocument(\"%1\").%4.Visibility = False\n")
|
||||
"FreeCADGui.getDocument(\"%1\").%4.Visibility = False\n"
|
||||
"FreeCAD.getDocument(\"%1\").%3.Label = '%10'\n")
|
||||
.arg(QString::fromAscii(this->document.c_str()))
|
||||
.arg(type).arg(name).arg(shape)
|
||||
.arg(dirX*len)
|
||||
.arg(dirY*len)
|
||||
.arg(dirZ*len)
|
||||
.arg(makeSolid ? QLatin1String("True") : QLatin1String("False"))
|
||||
.arg(angle);
|
||||
.arg(angle)
|
||||
.arg(label);
|
||||
Gui::Application::Instance->runPythonCode((const char*)code.toAscii());
|
||||
QByteArray to = name.toAscii();
|
||||
QByteArray from = shape.toAscii();
|
||||
|
|
|
@ -72,6 +72,7 @@ void DlgSettingsGeneral::saveSettings()
|
|||
ui->checkBooleanCheck->onSave();
|
||||
ui->checkBooleanRefine->onSave();
|
||||
ui->checkSketchBaseRefine->onSave();
|
||||
ui->checkObjectNaming->onSave();
|
||||
}
|
||||
|
||||
void DlgSettingsGeneral::loadSettings()
|
||||
|
@ -83,6 +84,7 @@ void DlgSettingsGeneral::loadSettings()
|
|||
ui->checkBooleanCheck->onRestore();
|
||||
ui->checkBooleanRefine->onRestore();
|
||||
ui->checkSketchBaseRefine->onRestore();
|
||||
ui->checkObjectNaming->onRestore();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
<property name="windowTitle">
|
||||
<string>General</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="0" column="0">
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
|
@ -117,6 +117,28 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QGroupBox" name="groupBox_3">
|
||||
<property name="title">
|
||||
<string>Object naming</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
<widget class="Gui::PrefCheckBox" name="checkObjectNaming">
|
||||
<property name="text">
|
||||
<string>Add name of base object</string>
|
||||
</property>
|
||||
<property name="prefEntry" stdset="0">
|
||||
<cstring>AddBaseObjectName</cstring>
|
||||
</property>
|
||||
<property name="prefPath" stdset="0">
|
||||
<cstring>Mod/Part</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<spacer>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
|
|
Loading…
Reference in New Issue
Block a user