[Sketcher] Visibility automation : add ability to open sketch in Section View mode
This commit is contained in:
committed by
abdullahtahiriyo
parent
18e751530a
commit
043dd45da0
@@ -156,6 +156,7 @@ void SketcherSettingsDisplay::saveSettings()
|
||||
ui->checkBoxTVShowLinks->onSave();
|
||||
ui->checkBoxTVShowSupport->onSave();
|
||||
ui->checkBoxTVRestoreCamera->onSave();
|
||||
ui->checkBoxTVSectionView->onSave();
|
||||
|
||||
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Part");
|
||||
QVariant data = ui->comboBox->itemData(ui->comboBox->currentIndex());
|
||||
@@ -177,6 +178,7 @@ void SketcherSettingsDisplay::loadSettings()
|
||||
ui->checkBoxTVShowLinks->onRestore();
|
||||
ui->checkBoxTVShowSupport->onRestore();
|
||||
ui->checkBoxTVRestoreCamera->onRestore();
|
||||
ui->checkBoxTVSectionView->onRestore();
|
||||
|
||||
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Part");
|
||||
int pattern = hGrp->GetInt("GridLinePattern", 0x0f0f);
|
||||
@@ -208,11 +210,13 @@ void SketcherSettingsDisplay::onBtnTVApplyClicked(bool)
|
||||
" sketch.ViewObject.HideDependent = %s\n"
|
||||
" sketch.ViewObject.ShowLinks = %s\n"
|
||||
" sketch.ViewObject.ShowSupport = %s\n"
|
||||
" sketch.ViewObject.RestoreCamera = %s\n",
|
||||
" sketch.ViewObject.RestoreCamera = %s\n"
|
||||
" sketch.ViewObject.SectionView = %s\n",
|
||||
this->ui->checkBoxTVHideDependent->isChecked() ? "True": "False",
|
||||
this->ui->checkBoxTVShowLinks->isChecked() ? "True": "False",
|
||||
this->ui->checkBoxTVShowSupport->isChecked() ? "True": "False",
|
||||
this->ui->checkBoxTVRestoreCamera->isChecked() ? "True": "False");
|
||||
this->ui->checkBoxTVRestoreCamera->isChecked() ? "True": "False",
|
||||
this->ui->checkBoxTVSectionView->isChecked() ? "True": "False");
|
||||
} catch (Base::PyException &e){
|
||||
Base::Console().Error("SketcherSettings::onBtnTVApplyClicked:\n");
|
||||
e.ReportException();
|
||||
|
||||
@@ -230,6 +230,25 @@ Supports all unit systems except 'US customary' and 'Building US/Euro'.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Gui::PrefCheckBox" name="checkBoxTVSectionView">
|
||||
<property name="toolTip">
|
||||
<string>By default, open a sketch in Section View mode -- objects are only visible behind sketch plane</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Open sketch in Section View mode</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="prefEntry" stdset="0">
|
||||
<cstring>SectionView</cstring>
|
||||
</property>
|
||||
<property name="prefPath" stdset="0">
|
||||
<cstring>Mod/Sketcher/General</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_9">
|
||||
<property name="sizePolicy">
|
||||
|
||||
@@ -335,6 +335,7 @@ ViewProviderSketch::ViewProviderSketch()
|
||||
ADD_PROPERTY_TYPE(ShowLinks,(true),"Visibility automation",(App::PropertyType)(App::Prop_None),"If true, all objects used in links to external geometry are shown when opening sketch.");
|
||||
ADD_PROPERTY_TYPE(ShowSupport,(true),"Visibility automation",(App::PropertyType)(App::Prop_None),"If true, all objects this sketch is attached to are shown when opening sketch.");
|
||||
ADD_PROPERTY_TYPE(RestoreCamera,(true),"Visibility automation",(App::PropertyType)(App::Prop_None),"If true, camera position before entering sketch is remembered, and restored after closing it.");
|
||||
ADD_PROPERTY_TYPE(SectionView,(false),"Visibility automation",(App::PropertyType)(App::Prop_None),"If true, only objects (or part of) located behind the sketch plane are visible.");
|
||||
ADD_PROPERTY_TYPE(EditingWorkbench,("SketcherWorkbench"),"Visibility automation",(App::PropertyType)(App::Prop_None),"Name of the workbench to activate when editing this sketch.");
|
||||
|
||||
{//visibility automation: update defaults to follow preferences
|
||||
@@ -343,6 +344,7 @@ ViewProviderSketch::ViewProviderSketch()
|
||||
this->ShowLinks.setValue(hGrp->GetBool("ShowLinks", true));
|
||||
this->ShowSupport.setValue(hGrp->GetBool("ShowSupport", true));
|
||||
this->RestoreCamera.setValue(hGrp->GetBool("RestoreCamera", true));
|
||||
this->SectionView.setValue(hGrp->GetBool("SectionView", false));
|
||||
|
||||
// well it is not visibility automation but a good place nevertheless
|
||||
this->ShowGrid.setValue(hGrp->GetBool("ShowGrid", false));
|
||||
@@ -6326,6 +6328,7 @@ bool ViewProviderSketch::setEdit(int ModNum)
|
||||
" tv.show([ref[0] for ref in ActiveSketch.Support if not ref[0].isDerivedFrom(\"PartDesign::Plane\")])\n"
|
||||
"if ActiveSketch.ViewObject.ShowLinks:\n"
|
||||
" tv.show([ref[0] for ref in ActiveSketch.ExternalGeometry])\n"
|
||||
" tv.sketchClipPlane(ActiveSketch, ActiveSketch.ViewObject.SectionView)\n"
|
||||
"tv.hide(ActiveSketch)\n"
|
||||
"del(tv)\n"
|
||||
).arg(QString::fromLatin1(getDocument()->getDocument()->getName()),
|
||||
|
||||
@@ -114,6 +114,7 @@ public:
|
||||
App::PropertyBool ShowLinks;
|
||||
App::PropertyBool ShowSupport;
|
||||
App::PropertyBool RestoreCamera;
|
||||
App::PropertyBool SectionView;
|
||||
App::PropertyString EditingWorkbench;
|
||||
|
||||
/// Draw all constraint icons
|
||||
|
||||
Reference in New Issue
Block a user