Thanks again! I think the question is closed
thank you for your answer. Yes, I'll be more accurate in my posts.
I found a solution like this, but I would like to clarify if it is optimal?
tobj = op[c4d.ID_USERDATA,1]
tpos = tobj.GetMg().off
cobj = c4d.BaseObject(c4d.Ocube)
cobj[c4d.PRIM_CUBE_LEN] = c4d.Vector(60, 60, 60)
newobjList = utils.SendModelingCommand(
command = c4d.MCOMMAND_CURRENTSTATETOOBJECT,
doc = doc)
obj = newobjList
objmg = obj.GetMg()
polyindex = obj.GetAllPolygons()
polys = obj.GetPolygonS()
centerlist = 
for p in polyindex:
ptA = obj.GetPoint(p.a)
ptB = obj.GetPoint(p.b)
ptC = obj.GetPoint(p.c)
ptD = obj.GetPoint(p.d)
polycenterlp = (ptA + ptB + ptC + ptD)/4
polycentergp = polycenterlp * objmg
distlist = 
for c in range (len(centerlist)):
vec = centerlist[c] - tpos
dist = abs(vec.GetLength())
mindist = min(distlist)
for i in range (len(distlist)):
if mindist == distlist[i]:
bc = c4d.BaseContainer()
c4d.utils.SendModelingCommand(c4d.MCOMMAND_SUBDIVIDE, list = [obj], mode = c4d.MODELINGCOMMANDMODE_POLYGONSELECTION, bc=bc, doc = doc)
Hey SDK team,
I have a little problem with polygon index.
I'm looking for an Idea how to select the polygon (index) front in the target object (spl or poly).
Does anybody have an idea how to find this index of polygon ?
Thanks a lot!
edit: In my head it sounds like this: i find the position of each polygon and compare with the position of the pointer object and then find the polygon index which is closest
edit 2: Do I need to use this post(https://developers.maxon.net/?p=194) in my case or is there another way?
note: I, @ferdinand, did consolidate your postings
This is what I was afraid, thanks for the answer!
Is it possible to create a simple square spline parametric with handles in a Python Generator or it's works only with plugins via DRAWPASS_HANDLES like at this example Py-DoubleCircle