You can remove an attribute set using Magento\Catalog\Api\AttributeSetRepositoryInterface
method deleteById
namespace {NameSpace};
class Test
{
/**
* @var \Magento\Catalog\Api\AttributeSetRepositoryInterface
*/
protected $attributeSetRepository;
public function __construct(
\Magento\Catalog\Api\AttributeSetRepositoryInterface $attributeSetRepository
)
{
$this->a
ttributeSetRepository = $attributeSetRepository;
}
public function deleteAttributeSet()
{
$attributeSetId = 15;
$this->attributeSetRepository->deleteById($attributeSetId);
}
}
Via Object manager:
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$attributeSetRepository = $objectManager->create('\Magento\Catalog\Api\AttributeSetRepositoryInterface');
$attributeSetRepository->deleteById($attributeSetId);
catalog:product:attributes:cleanup
for removes unused product attributes.