if (!data()->isValid())
return;
AttributeRefListPtr aList = reflist(FEATURES_ID());
- // if the object is last, remove it from the list (needed to skip empty transaction on edit of sketch feature)
- if (aList->object(aList->size(true) - 1, true) == theFeature) {
- aList->remove(theFeature);
- } else {
- // to keep the persistent sub-elements indexing, do not remove elements from list,
- // but substitute by nulls
- aList->substitute(theFeature, ObjectPtr());
- }
+ aList->remove(theFeature);
}
int ExchangePlugin_ImportFeature::numberOfSubs(bool forTree) const
{
- return data()->reflist(FEATURES_ID())->size(false);
+ return data()->reflist(FEATURES_ID())->size(true);
}
std::shared_ptr<ModelAPI_Feature> ExchangePlugin_ImportFeature::subFeature(
file = anImportFeature.string(aFieldName)
assert file, "{0}: Can not receive string field {1}".format(theType, aFieldName)
file.setValue(theFile)
- anImportFeature.execute()
aSession.finishOperation()
# Check results
aSession.startOperation("Import XAO")
anImportFeature = aPart.addFeature("Import")
anImportFeature.string("file_path").setValue("Data/test.xao")
- anImportFeature.execute()
aSession.finishOperation()
# Check results
#=========================================================================
# Create a shape imported from XAO
#=========================================================================
-# testImportXAO()
+ testImportXAO()
#=========================================================================
# End of test
#=========================================================================
isPostponedMain = aCurrentOwner.get() && aCompos->isSub(aCurrentOwner);
}
- #ifdef DEB_UPDATE
- std::cout<<"Update args "<<theFeature->name()<<std::endl;
- #endif
+#ifdef DEB_UPDATE
+ std::cout<<"Update args "<<theFeature->name()<<std::endl;
+#endif
+ // TestImport.py : after arguments are updated, theFeature may be removed
+ if (!theFeature->data()->isValid())
+ return false;
// Update selection and parameters attributes first, before sub-features analysis (sketch plane).
updateArguments(theFeature);