Hi,
I am able to get the center pivot of two objects but for some reason, it needs revision for three or more objects.
You can see an illustration of the problem here:
https://www.dropbox.com/s/u76v7zcbv8a38x4/c4d177_center_pivot_three_selected_object.jpg?dl=0
Here is the working code so far:
import c4d
from c4d import gui
# Main function`
def main():
#Assuming there are three objects in the scene
cube01 = doc.SearchObject('cube01')
cube02 = doc.SearchObject('cube02')
cube03 = doc.SearchObject('cube03')
cube01_pos = cube01.GetMg().off
cube02_pos = cube02.GetMg().off
cube03_pos = cube03.GetMg().off
# Getting the pivot of the two objects. Works as expected
cube_dif = cube02_pos - cube01_pos
cube01_02_pos = ((cube_dif/2) + cube01_pos) # Center Pivot
# Getting the pivot of the three objects.
cube_dif03 = cube01_02_pos - cube03_pos
cube01_02_03_pos = ((cube_dif03/2) + cube01_02_pos)
print cube01_02_03_pos #Does not match the pivot on the coordinate manager when all three objects are selected.
# Execute main()
if __name__=='__main__':
main()
Thank you for looking at my problem.