Hey @ferdinand
Thanks again! I think the question is closed
Latest posts made by inevestenko
-
RE: PG\ How to find polygon index
-
RE: PG\ How to find polygon index
Hey Ferdinand,
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?
def main(): 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, list= [cobj.GetClone()], mode=c4d.MODELINGCOMMANDMODE_ALL, doc = doc) obj = newobjList[0] 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 centerlist.append(polycentergp) distlist = [] for c in range (len(centerlist)): vec = centerlist[c] - tpos dist = abs(vec.GetLength()) distlist.append(dist) mindist = min(distlist) for i in range (len(distlist)): if mindist == distlist[i]: polys.Select(i) bc = c4d.BaseContainer() bc.SetData(c4d.MDATA_SUBDIVIDE_SUB, 1) c4d.utils.SendModelingCommand(c4d.MCOMMAND_SUBDIVIDE, list = [obj], mode = c4d.MODELINGCOMMANDMODE_POLYGONSELECTION, bc=bc, doc = doc) obj.Message(c4d.MSG_UPDATE) c4d.EventAdd() return obj
-
PG\ How to find polygon index
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([URL-REMOVED] in my case or is there another way?
note: I, @ferdinand, did consolidate your postings
[URL-REMOVED] @maxon: This section contained a non-resolving link which has been removed.
-
RE: Python Generator: Handles
This is what I was afraid, thanks for the answer!
-
Python Generator: Handles
Hi all,
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