how do i calculate 3d sketch lenght

i'm trying to make 2/1 hanging pulley system rope design and made a 3d sketch for this

i want to make a macro to calculate total lenght of the sketch how can i done it

SolidworksApi/macros