const ModelHighAPI_Double& theY,
const ModelHighAPI_Double& theZ)
{
- // TODO(spo): check that thePart is not empty
std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(ConstructionAPI_Point::ID());
return PointPtr(new ConstructionAPI_Point(aFeature, theX, theY, theZ));
}
const std::list<ModelHighAPI_Selection> & theSelectionList,
const std::string & theFileFormat)
{
- // TODO(spo): check that thePart is not empty
std::shared_ptr<ModelAPI_Feature> aFeature =
thePart->addFeature(ExchangePlugin_ExportFeature::ID());
fillAttribute("Regular", aFeature->string(ExchangePlugin_ExportFeature::EXPORT_TYPE_ID()));
const std::string & theAuthor,
const std::string & theGeometryName)
{
- // TODO(spo): check that thePart is not empty
std::shared_ptr<ModelAPI_Feature> aFeature =
thePart->addFeature(ExchangePlugin_ExportFeature::ID());
fillAttribute("XAO", aFeature->string(ExchangePlugin_ExportFeature::EXPORT_TYPE_ID()));
const std::shared_ptr<ModelAPI_Document> & thePart,
const std::string & theFilePath)
{
- // TODO(spo): check that thePart is not empty
std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(ExchangeAPI_Import::ID());
return ImportPtr(new ExchangeAPI_Import(aFeature, theFilePath));
}
{
TopTools_IndexedDataMapOfShapeListOfShape aMap;
TopExp::MapShapesAndAncestors(aContext, TopAbs_VERTEX, TopAbs_FACE, aMap);
- const TopTools_ListOfShape& aList2 = aMap.FindFromKey(aSubShape);
TopTools_ListOfShape aList;
TopTools_MapOfShape aFMap;
- // fix is below
- TopTools_ListIteratorOfListOfShape itl2(aList2);
- for (int i = 1;itl2.More();itl2.Next(),i++) {
- if(aFMap.Add(itl2.Value()))
- aList.Append(itl2.Value());
- }
+ // simetimes when group is moved in history, naming may be badly updated, so
+ // avoid crash in FindFromKey (issue 1842)
+ if (aMap.Contains(aSubShape)) {
+ const TopTools_ListOfShape& aList2 = aMap.FindFromKey(aSubShape);
+ // fix is below
+ TopTools_ListIteratorOfListOfShape itl2(aList2);
+ for (int i = 1;itl2.More();itl2.Next(),i++) {
+ if(aFMap.Add(itl2.Value()))
+ aList.Append(itl2.Value());
+ }
+ } else
+ break;
int n = aList.Extent();
bool isByFaces = n >= 3;
if(!isByFaces) { // open topology case or Compound case => via edges
std::list<ModelHighAPI_Selection> ModelHighAPI_Interface::result() const
{
- // TODO(spo): should I use more common function for the whole model to prepare results?
const_cast<ModelHighAPI_Interface*>(this)->execute();
std::list<ModelHighAPI_Selection> aSelectionList;
MODELHIGHAPI_EXPORT
void setName(const std::string& theName);
- // TODO(spo): rename to selectAll()
/// Return all objects of the feature
MODELHIGHAPI_EXPORT
virtual std::list<ModelHighAPI_Selection> result() const;
const std::string & theExpression,
const std::string & theComment)
{
- // TODO(spo): check that thePart is not empty
std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(ParametersAPI_Parameter::ID());
return ParameterPtr(new ParametersAPI_Parameter(aFeature, theName, theExpression, theComment));
}
//--------------------------------------------------------------------------------------
PartPtr addPart(const std::shared_ptr<ModelAPI_Document> & thePart)
{
- // TODO(spo): check that thePart is not empty
std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(PartSetAPI_Part::ID());
aFeature->execute();
return PartPtr(new PartSetAPI_Part(aFeature));
PartPtr duplicatePart(const std::shared_ptr<ModelAPI_Document> & thePart)
{
- // TODO(spo): check that thePart is not empty
std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(PartSetPlugin_Duplicate::ID());
aFeature->execute();
return PartPtr(new PartSetAPI_Part(aFeature));
void removePart(const std::shared_ptr<ModelAPI_Document> & thePart)
{
- // TODO(spo): check that thePart is not empty
std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(PartSetPlugin_Remove::ID());
aFeature->execute();
}
const std::shared_ptr<ModelHighAPI_Interface> & theConstraint,
const ModelHighAPI_Double & theValue)
{
- // TODO(spo): check somehow that the feature is a constraint or eliminate
- // crash if the feature have no real attribute VALUE
fillAttribute(theValue, theConstraint->feature()->real(SketchPlugin_Constraint::VALUE()));
// theConstraint->execute();
SketchPtr addSketch(const std::shared_ptr<ModelAPI_Document> & thePart,
const std::shared_ptr<GeomAPI_Ax3> & thePlane)
{
- // TODO(spo): check that thePart is not empty
std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(SketchAPI_Sketch::ID());
return SketchPtr(new SketchAPI_Sketch(aFeature, thePlane));
}
SketchPtr addSketch(const std::shared_ptr<ModelAPI_Document> & thePart,
const ModelHighAPI_Selection & theExternal)
{
- // TODO(spo): check that thePart is not empty
std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(SketchAPI_Sketch::ID());
return SketchPtr(new SketchAPI_Sketch(aFeature, theExternal));
}
SketchPtr addSketch(const std::shared_ptr<ModelAPI_Document> & thePart,
const std::string & theExternalName)
{
- // TODO(spo): check that thePart is not empty
std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(SketchAPI_Sketch::ID());
return SketchPtr(
new SketchAPI_Sketch(aFeature, ModelHighAPI_Selection("FACE", theExternalName)));