Several objects and hooks in CINEMA 4D allow Python to access the internal data on low-level. These functions can be used to handle raw data. ByteSeq is similar to the built-in Buffer Object but is optimized to work with CINEMA 4D.

class c4d.storage.ByteSeq


ByteSeq.__init__(buf, len[, readonly=False])

Allocates a byte sequence.

  • buf (PyCObject or None) – PyCObject address or None to allocate a new pool of memory
  • len (int) – The length of the new byte sequence
  • readonly (bool) – Set to True if the byte sequence should be flagged as read-only, otherwise False.
Return type:



The byte sequence object.


Creates a string object from the byte sequence.

Return type: string
Returns: The byte-sequence returned as a string.
Parameters: other (int) – The offset value.
Return type: ByteSeq
Returns: New ByteSeq object.

Compares two byte sequences.

Parameters: other (ByteSeq) – The other byte sequence.
Return type: bool
Returns: True if the byte sequences are equal, otherwise False.

Iterates over the bytes of the object, interpreted as one-element string:

for b in bs:
    print b
Return type: iter for str
Returns: The iterator.

Returns a hash of the byte sequence. The hash value is cached if the object owns the byte sequence and it’s flagged as read-only:

print hash(bs)
Return type: int
Returns: The hash.

Returns the length of the byte sequence.

Return type: int
Returns: The length.
ByteSeq.__setitem__(key, value)

Replaces a byte at position key with the new value:

bs1[5:7] = "ab"
bs2[100] = "a"
bs3[:100] = "0"*100
Raises TypeError:

Raised if byte sequence is flagged as read-only.

  • key (int or slice) – The index
  • value (int) – The new value, must between 0-255.

Gets the bytes at position key:

print bs1[5:7] #output: "ab"
print bs2[100] # output "a"
print bs3[:100] # output "0000..."
Parameters: key (int or slice) – The index
Return type: str
Returns: The bytes at the requested position.

Clones a byte sequence.

Return type: ByteSeq
Returns: The clone.

Returns a buffer object with a relative point.

Parameters: o (int) – The offset length.
Return type:
Returns: The buffer object.

Table Of Contents