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
    • Unread
    • Recent
    • Tags
    • Users
    • Login
    1. Maxon Developers Forum
    2. ROMAN
    • Profile
    • Following 0
    • Followers 0
    • Topics 11
    • Posts 26
    • Best 0
    • Controversial 0
    • Groups 0

    ROMAN

    @ROMAN

    0
    Reputation
    13
    Profile views
    26
    Posts
    0
    Followers
    0
    Following
    Joined Last Online

    ROMAN Unfollow Follow

    Latest posts made by ROMAN

    • RE: Selected object to selected layer

      I want to add selected objects at selected layer

      To my mind it should be in the following way:

      1. select object
      2. press the button of script
      3. select layer from the list of layers

      How to add all layers in custom menu If this variant is right?

      posted in Cinema 4D SDK
      ROMANR
      ROMAN
    • Selected object to selected layer

      Hello for everyone! How to add selected objects at selected layer in layer mager?!!

      image.png

      @ferdinand

      edit: I restored your image, we will answer the posting tomorrow 🙂 [ferdinand]

      posted in Cinema 4D SDK python r25
      ROMANR
      ROMAN
    • RE: Layers checker

      @mogh I didn't know about this function 🤦
      @ferdinand Thank you a lot for your detailed response. I will chek posts which you recommended

      posted in Cinema 4D SDK
      ROMANR
      ROMAN
    • Layers checker

      Hello guys! Is it real to check everything in layer (objects, materials, tags) and delete layer if its empty?

      posted in Cinema 4D SDK python s24 sdk
      ROMANR
      ROMAN
    • RE: How to Center the Axis of Objects

      @ferdinand

      Script add a null in center of world coordinates. I want to change it, i described what i want to do in pictures.

      1.jpg

      I added Mike's code, because i wanted to make 2 options for Step 2:

      • First option — script add axis poins of selected objects in center.
      • Second option — script add axis poins of selected objects in center but in the lowest position in Y coordinate. Mike's script could do this but just for one object. If i select objects more than one i get a message: "AttributeError: 'NoneType' object has no attribute 'GetAllPoints'".

      I'm sorry for my English...

      posted in Cinema 4D SDK
      ROMANR
      ROMAN
    • How to Center the Axis of Objects

      @ferdinand , thank you a lot!
      When i tried to fix my code i used Mike Udin's example, but i couldn't understand why this code didn't work with multiple objects. I've got next message: "AttributeError: 'NoneType' object has no attribute 'GetAllPoints'".

      I supposed my script to set selected objects' axis points in the center for each other. After that the script should create a null between all axis points.

      import c4d
      
      def main():
          
          ps = op.GetAllPoints() #Points in Local coordinates List
          m = op.GetMg() #Object Global Matrix
      
          center = op.GetMp() #Local coordinates center: https://tinyurl.com/wed88cn
          rad = op.GetRad() # Geometry radius: https://tinyurl.com/tb6vn64
          
          center -= c4d.Vector(0,rad.y,0) #Move down axis to lowest point. Comment this line to keep axis in a center 
          
          center *= m #Convert to Global coordinates center
      
          new_m = c4d.Matrix(m) #Copy matrix
          new_m.off = center #Change its center
      
          loc_m = ~new_m * m #Get local matrix
      
          op.SetAllPoints([loc_m.Mul(p) for p in ps])
          op.SetMg(new_m)
          
          op.Message(c4d.MSG_UPDATE)
          c4d.EventAdd()
      
      
      if name == 'main':
          main()
      

      edit: This topic has been forked from How to fix the bug of objects position in script by @ferdinand

      posted in Cinema 4D SDK python r21
      ROMANR
      ROMAN
    • How to fix the bug of objects position in script

      Guys! Please, help. I cannot fix this problem.

      The main idea of ​​this script is:

      1. add selected objects and materials of these objects to the layer
      2. insert all objects under null.
        But position of objects changes. How to fix it?

      : video

      import c4d
      
      def main():
      
          doc.StartUndo()
      
      
          layer = c4d.documents.LayerObject()
          # Set layer name (another option tp set the name)
          # Get the invisible root layer
          layerRoot = doc.GetLayerObjectRoot()
          # Insert the layer under the parent
          layer.InsertUnder(layerRoot)
      
          name = layer.GetName()
          rvalue = c4d.gui.RenameDialog(name) # rename
          print(rvalue)
          layer [c4d.ID_BASELIST_NAME] = rvalue
          #layer.DelBit(c4d.BIT_ACTIVE)
      
          null_obj = c4d.BaseObject(c4d.Onull)
          null_obj [c4d.ID_LAYER_LINK] = layer
          null_obj [c4d.ID_BASELIST_NAME] = rvalue
          doc.InsertObject(null_obj)
      
      
          doc.AddUndo(c4d.UNDOTYPE_NEWOBJ, layer)
          doc.AddUndo(c4d.UNDOTYPE_NEWOBJ, null_obj)
      
          s = doc.GetSelection()
          vp = doc.GetActiveObjects(c4d.GETACTIVEOBJECTFLAGS_NONE)
      
      
          for obj in vp:
      
              print obj
      
              obj [c4d.ID_LAYER_LINK] = layer
              obj.InsertUnder(null_obj)
      
              obj_mat_tags = [t for t in obj.GetTags() if t.IsInstanceOf(c4d.Ttexture)]
      
              for tag in obj_mat_tags:
      
                  mat = tag.GetMaterial()
                  print mat
                  mat [c4d.ID_LAYER_LINK] = layer
      
      
          doc.EndUndo()
          c4d.EventAdd()
      
      if __name__ == '__main__':
          main()
      

      I use r21 version of c4d.

      posted in Cinema 4D SDK python r21
      ROMANR
      ROMAN
    • RE: Get port id of xpresso node

      @ferdinand Thank you a lot for your help! I'm really sorry for organization of my post. Could you point out on my mistakes in tagging?

      posted in Cinema 4D SDK
      ROMANR
      ROMAN
    • Get port id of xpresso node

      Dear community!

      I want to create length port for spline node but I can’t find correct command for it.
      How to get id of port in form like this
      c4d.GV_PORT_OUTPUT, [c4d.ID_BASEOBJECT_REL_POSITION,c4d.VECTOR_X]

      posted in Cinema 4D SDK python s24
      ROMANR
      ROMAN
    • RE: Insert scene under object

      Mike, thank you a lot!

      posted in Cinema 4D SDK
      ROMANR
      ROMAN