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. Christian 0
    3. Posts
    C
    • Profile
    • Following 0
    • Followers 0
    • Topics 2
    • Posts 3
    • Best 0
    • Controversial 0
    • Groups 0

    Posts made by Christian 0

    • How to get position and rotation in softbody simulation

      Hello,

      I'm currently working on a project in Cinema 4D Python. I'm trying to get the change in position and rotation when I make a softbody simulation. For example, when I try to let a object fall to the ground, I would like to get the new position and rotation at the end of the simulation. I tried the GetMg() function but it always returns the same value. Here is my code:

      import c4d
      
      doc: c4d.documents.BaseDocument
      
      obj = c4d.BaseObject(c4d.Osphere)
      obj[c4d.ID_BASEOBJECT_REL_POSITION] = c4d.Vector(0,100,0)
      softbody_tag = c4d.BaseTag(c4d.Tcloth) 
      c4d.CallButton(softbody_tag, c4d.CLOTH_PBD_STRUT_SOFTBODY_UPDATE_BUTTON)
      obj.InsertTag(softbody_tag)
      doc.InsertObject(obj)
      c4d.EventAdd()
      
      for frame in range(90): 
          doc.SetTime(c4d.BaseTime(frame,doc.GetFps())) 
          doc.ExecutePasses(None, True, True, True, 0)
          c4d.GeSyncMessage(c4d.EVMSG_TIMECHANGED) 
          print(obj.GetMg())
      

      Could someone please guide me on how I can accurately determine the position and rotation changes in this scenario? Any help or suggestions would be greatly appreciated.

      Thank you in advance!

      posted in Cinema 4D SDK 2023 windows python
      C
      Christian 0
    • RE: How can I use Plane Cut in Python

      Thank you very much! Now it is working.

      posted in Cinema 4D SDK
      C
      Christian 0
    • How can I use Plane Cut in Python

      Hi!
      How can I use the Plane Cut Tool with Python in Cinema4D. I tried the following code but it always fails and returns false as a result. Also: is it possible to specify coordinates by using a vertex (e.g. c4d.Vector(0,0,0) to specify the cut location?

      obj = doc.GetActiveObject()
       
      settings = c4d.BaseContainer()  # Settings
      settings[c4d.MDATA_KNIFEPLANE_MODE] = c4d.MDATA_KNIFEPLANE_MODE_REGION_A
      settings[c4d.MDATA_KNIFEPLANE_PLANE_MODE] = c4d.MDATA_KNIFEPLANE_PLANE_MODE_LOCAL
      settings[c4d.MDATA_KNIFEPLANE_PLANE] = c4d.MDATA_KNIFEPLANE_PLANE_XZ
      
      result = c4d.utils.SendModelingCommand(
                  command=c4d.ID_MODELING_KNIFE_PLANE,  # Use the ID of the modeling command for the cut tool
                  list=[obj],
                  mode=c4d.MODELINGCOMMANDMODE_POLYGONSELECTION, 
                  bc=settings, 
                  doc=doc,
              )
      
      
      posted in Cinema 4D SDK python 2023 windows
      C
      Christian 0