Subs utilities converted from sub3dtool C++