Navigation

    • Register
    • Login
    • Search
    1. Home
    2. inevestenko
    I

    inevestenko

    @inevestenko

    0
    Reputation
    5
    Posts
    3
    Profile views
    0
    Followers
    0
    Following
    Joined Last Online

    • Profile
    • More
      • Following
      • Followers
      • Topics
      • Posts
      • Best
      • Groups
    inevestenko Follow

    Best posts made by inevestenko

    This user does not have any upvoted posts yet.

    Latest posts made by inevestenko

    RE: PG\ How to find polygon index

    Hey @ferdinand
    Thanks again! I think the question is closed

    posted in Cinema 4D SDK •
    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?
    photo_2021-05-27_15-20-35.jpg

    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
    
    posted in Cinema 4D SDK •
    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).
    target4subdiv.png
    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

    posted in Cinema 4D SDK •
    RE: Python Generator: Handles

    This is what I was afraid, thanks for the answer!

    posted in Cinema 4D SDK •
    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

    posted in Cinema 4D SDK •