Actually above solution is not working in Revit 2021.
Please refer above solution .But above solution is not working as version is 2021.Is there any solution?