Hi iLad, thanks for reaching out us.
With regard to your question, beside sponsoring @mp5gosu's answers, I also recommend to look at:
- Matrix Fundamentals: a few basic information on matrices and geometry are provided
- c4d.Matrix: the section describing the matrix class implementation in Cinema 4D
- c4d.PointObject: the section describing the PointObject implementation (the class responsible for handling the vertex data of a generic object)
Wrapping all the above information together, you might end up with something like:
import c4d
from c4d import gui
#Welcome to the world of Python
def main():
# check about op existance
if op == None:
return
#check about op being derived from a PointObject
if op.IsInstanceOf(c4d.Opoint) == False:
return
# set the offset of the axis
offset = c4d.Vector(100,0,0)
# move object
m = op.GetMg()
m.off = m.off + offset
op.SetMg(m)
# transform points
padr = op.GetAllPoints()
for i, point in enumerate(padr):
point = point - offset
op.SetPoint(i,point)
op.Message(c4d.MSG_UPDATE)
if __name__=='__main__':
main()
c4d.EventAdd()
Note that the above example works properly only if you're supposed to make on offset of the axis and not if you're attempting to change axis orientation: in this latter case you've to compute the inverse transformation matrix and use this to reposition the object in space upon vertexes repositioning.
Best, Riccardo