code: def __shpFileLength(self):
          
          # Start with header length
          size = 100
          # Calculate size of all shapes
          for s in self._shapes:
              # Add in record header and shape type fields
              size += 12
              # nParts and nPoints do not apply to all shapes
              #if self.shapeType not in (0,1):
              #       nParts = len(s.parts)
              #       nPoints = len(s.points)
              if hasattr(s,'parts'):
                  nParts = len(s.parts)
              if hasattr(s,'points'):
                  nPoints = len(s.points)
              # All shape types capable of having a bounding box
              if self.shapeType in (3,5,8,13,15,18,23,25,28,31):
                  size += 32
              # Shape types with parts
              if self.shapeType in (3,5,13,15,23,25,31):
                  # Parts count
                  size += 4
                  # Parts index array
                  size += nParts * 4
              # Shape types with points
              if self.shapeType in (3,5,8,13,15,23,25,31):
                  # Points count
                  size += 4
                  # Points array
                  size += 16 * nPoints
              # Calc size of part types for Multipatch (31)
              if self.shapeType == 31:
                  size += nParts * 4
              # Calc z extremes and values
              if self.shapeType in (13,15,18,31):
                  # z extremes
                  size += 16
                  # z array
                  size += 8 * nPoints
              # Calc m extremes and values
              if self.shapeType in (23,25,31):
                  # m extremes
                  size += 16
                  # m array
                  size += 8 * nPoints
              # Calc a single point
              if self.shapeType in (1,11,21):
                  size += 16
              # Calc a single Z value
              if self.shapeType == 11:
                  size += 8
              # Calc a single M value
              if self.shapeType in (11,21):
                  size += 8
          # Calculate size as 16-bit words
          size //= 2
          return size
docs: Calculates the file length of the shp file.