Navigation

    • Register
    • Login
    • Search
    1. Home
    2. EugeneNUA
    E

    EugeneNUA

    @EugeneNUA

    0
    Reputation
    2
    Posts
    2
    Profile views
    0
    Followers
    1
    Following
    Joined Last Online

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

    Best posts made by EugeneNUA

    This user does not have any upvoted posts yet.

    Latest posts made by EugeneNUA

    RE: Setting an object to the target section of a Transform Constraint Tag

    Hello! @ferdinand

    Proud to be a part of the community.

    Wow, how close the solution to the problem was, but I couldn't find any mention of it anywhere.

    Thank you so much for the ready-made solution and quick help!

    posted in Cinema 4D SDK •
    Setting an object to the target section of a Transform Constraint Tag

    Hi everyone!

    I'm trying to set up the constraint tag, so this will pick the movement from another object. I need to do it strictly with Transform Constraint Tag.

    I was playing around with code and different parameters, but one is driving me crazy, I just can't figure out how to set an object as a target. Likewise, I used SearchObject, I got GUID nothing is going to help.

    I digged through the forums and found out that the UI ID of the target matters (10001), but I find no samples how to use the ID properly in Python scripts. Appreciate any help!

    I work on Windows 11
    Cinema 4D 2023.2.2

    import c4d
    from c4d import gui
    
    doc = c4d.documents.GetActiveDocument()
    
    target_obj = doc.SearchObject("Test")
    
    
    def addConstraint():
        objects = doc.GetActiveObjects(1)
        print(objects)
        my_obj = doc.SearchObject("Test")
        
        for obj in objects:
            tag = obj.MakeTag(c4d.Tcaconstraint)
            print(f"Your tag: {tag}")
            my_obj = doc.SearchObject("Test")
            tag()[c4d.ID_CA_CONSTRAINT_TAG_PSR] = True
            tag()[c4d.ID_CA_CONSTRAINT_TAG_PSR_LINK] = my_obj
            tag()[c4d.ID_CA_CONSTRAINT_TAG_PSR_P_OFFSET] = c4d.Vector(5,0,0)
            tag()[c4d.ID_CA_CONSTRAINT_TAG_PSR_MAINTAIN] = True
            tag.SetName("Boo")
            c4d.EventAdd()
    addConstraint()
    
    posted in Cinema 4D SDK •