@Xiaofei_Ying I have tried your script and it worked just fine,Not sure why your Having this issue.Though one of the issues in using Direct shapes is that you wont be able to change its material property in Revit.I would suggest using Spring.FamilyInstance.ByGeometry for a change.
Check this post.