Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login
    1. Maxon Developers Forum
    2. inevestenko
    I
    • Profile
    • Following 0
    • Followers 0
    • Topics 2
    • Posts 5
    • Best 0
    • Controversial 0
    • Groups 0

    inevestenko

    @inevestenko

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

    inevestenko Unfollow Follow

    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
      I
      inevestenko
    • 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
      I
      inevestenko
    • 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([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.

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

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

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