[Sketcher] Visibility automation : add option to force orthographic view when entering edit mode

This commit is contained in:
0penBrain
2021-05-06 18:32:13 +02:00
committed by wwmayer
parent 30d277b27a
commit bb434d3ff2
4 changed files with 40 additions and 2 deletions

View File

@@ -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(ForceOrtho,(false),"Visibility automation",(App::PropertyType)(App::Prop_None),"If true, camera type will be forced to orthographic view when entering editing mode.");
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.");
@@ -344,6 +345,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->ForceOrtho.setValue(hGrp->GetBool("ForceOrtho", false));
this->SectionView.setValue(hGrp->GetBool("SectionView", false));
// well it is not visibility automation but a good place nevertheless
@@ -6889,6 +6891,8 @@ void ViewProviderSketch::setEditViewer(Gui::View3DInventorViewer* viewer, int Mo
"ActiveSketch = App.getDocument('%1').getObject('%2')\n"
"if ActiveSketch.ViewObject.RestoreCamera:\n"
" ActiveSketch.ViewObject.TempoVis.saveCamera()\n"
" if ActiveSketch.ViewObject.ForceOrtho:\n"
" ActiveSketch.ViewObject.Document.ActiveView.setCameraType('Orthographic')\n"
).arg(QString::fromLatin1(getDocument()->getDocument()->getName())).arg(
QString::fromLatin1(getSketchObject()->getNameInDocument()));
QByteArray cmdstr_bytearray = cmdstr.toLatin1();