return ExportFeature.ID()
# This feature is action: has no property pannel and executes immideately
- # def isAction(self):
- # return True
+ def isAction(self):
+ return True
- def isInHistory(self):
- return False
+ # The action is not placed into the histiry anyway
+ #def isInHistory(self):
+ # return False
def initAttributes(self):
- # This feature has no attributes, but should perform some actions on initialization
- aSession = ModelAPI.ModelAPI_Session.get()
- self.Part = aSession.activeDocument()
- self.geomObjects = []
- self.geompy = geomBuilder.New(salome.myStudy)
-
- # Export bodies and groups
- self.exportBodies()
- self.exportGroups()
+ # This feature has no attributes, it is action
+ pass
def exportBodies(self):
# Get all bodies
self.geompy.addToStudyInFather(obj[1], aGroup, theGroupName)
def execute(self):
- # Nothing to execute: all logic would be in the initAttributes
+ aSession = ModelAPI.ModelAPI_Session.get()
+ self.Part = aSession.activeDocument()
+ self.geomObjects = []
+ self.geompy = geomBuilder.New(salome.myStudy)
+
+ # Export bodies and groups
+ self.exportBodies()
+ self.exportGroups()
pass
SessionPtr aMgr = ModelAPI_Session::get();
ModelAPI_ValidatorsFactory* aFactory = aMgr->validators();
- // If the object is not a line then it is accepted
- const ModelAPI_ResultValidator* aLineValidator =
- dynamic_cast<const ModelAPI_ResultValidator*>(aFactory->validator("SketchPlugin_ResultLine"));
- bool aLineValid = aLineValidator->isValid(theObject);
-
const ModelAPI_ResultValidator* anArcValidator =
dynamic_cast<const ModelAPI_ResultValidator*>(aFactory->validator("SketchPlugin_ResultArc"));
bool anArcValid = anArcValidator->isValid(theObject);
+ if (anArcValid)
+ return false;
- if (!aLineValid && !anArcValid)
+
+ // If the object is not a line then it is accepted
+ const ModelAPI_ResultValidator* aLineValidator =
+ dynamic_cast<const ModelAPI_ResultValidator*>(aFactory->validator("SketchPlugin_ResultLine"));
+ bool aLineValid = aLineValidator->isValid(theObject);
+ if (!aLineValid)
return true;
// If it is a line then we have to check that first attribute id not a line