-// Copyright (C) 2014-2019 CEA/DEN, EDF R&D
+// Copyright (C) 2014-2023 CEA, EDF
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
#include <AIS_InteractiveObject.hxx>
#include <AIS_Shape.hxx>
+#include <AIS_Trihedron.hxx>
+#include <AIS_ViewCube.hxx>
#include <StdSelect_BRepOwner.hxx>
Standard_Boolean PartSet_GlobalFilter::IsOk(const Handle(SelectMgr_EntityOwner)& theOwner) const
{
bool aValid = true;
+ std::shared_ptr<GeomAPI_AISObject> aAISObj = AISObjectPtr(new GeomAPI_AISObject());
+ Handle(AIS_InteractiveObject) aAisObj;
+ if (theOwner->HasSelectable()) {
+ aAisObj = Handle(AIS_InteractiveObject)::DownCast(theOwner->Selectable());
+ if (!aAisObj.IsNull()) {
+ aAISObj->setImpl(new Handle(AIS_InteractiveObject)(aAisObj));
+ }
+ }
+ ObjectPtr aObj = myWorkshop->findPresentedObject(aAISObj);
ModuleBase_Operation* anOperation = myWorkshop->module()->currentOperation();
+
+#ifdef HAVE_SALOME
+ if (!aObj.get()) {
+ // Workaround to enable View Cube and Trihedron selection
+ if (!aAisObj.IsNull()) {
+ if (aAisObj->IsKind(STANDARD_TYPE(AIS_Trihedron)) ||
+ aAisObj->IsKind(STANDARD_TYPE(AIS_ViewCube))) {
+ return true;
+ }
+ }
+
+ // Issue #3161: Do not use presentations for non-SHAPER objects
+ if (!anOperation)
+ return false;
+ }
+#endif
+
// the shapes from different documents should be provided if there is no started operation
// in order to show/hide results
if (anOperation) {
aValid = false;
if (ModuleBase_ShapeDocumentFilter::IsOk(theOwner)) {
- std::shared_ptr<GeomAPI_AISObject> aAISObj = AISObjectPtr(new GeomAPI_AISObject());
- if (theOwner->HasSelectable()) {
- Handle(AIS_InteractiveObject) aAisObj =
- Handle(AIS_InteractiveObject)::DownCast(theOwner->Selectable());
- if (!aAisObj.IsNull()) {
- aAISObj->setImpl(new Handle(AIS_InteractiveObject)(aAisObj));
- }
- }
- ObjectPtr aObj = myWorkshop->findPresentedObject(aAISObj);
if (aObj) {
ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(aObj);
// result of parts belongs to PartSet document and can be selected only when PartSet
}
FeaturePtr aFeature = aDocument->feature(aResult);
- if(!aFeature.get() || aFeature->getKind() != "SketchCircle") {
+ if(!aFeature.get() ||
+ ((aFeature->getKind() != "SketchCircle") &&
+ (aFeature->getKind() != "SketchBSplinePeriodic"))) {
return Standard_True;
}