Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python 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

    How to use RemoveConnections?

    Cinema 4D SDK
    2023 python
    2
    3
    279
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • B
      bentraje
      last edited by

      Hi,

      How do I use the GraphNode.RemoveConnections? It gives me an error of
      TypeError: unable to convert builtins.property to @net.maxon.graph.wires

      Here is the illustration code:

              base_color_port = list(GraphModelHelper.GetDirectSuccessors(texture_node, maxon.NODE_KIND.INPORT, None))[0] # Results the Standard Material Base Color Port
              base_color_port.RemoveConnections(maxon.PORT_DIR.INPUT, maxon.Wires.dependency)
      

      I get that there is some parameters/masking but shouldn't the default be just a vanilla RemoveConnections? Like you have the access to inport or output and just literally remove the existing connections?

      1 Reply Last reply Reply Quote 0
      • ManuelM
        Manuel
        last edited by

        Hi,
        each connection is composed by eight wires. You are juste removing the dependency wire. You must remove all.
        It is rare that you need to only deal with one wire in a connection. One of the cases is when you want to mute or unmute a connection. You need to change the inhibit wire of the connection. Like in this example where we change the value of the wire maxon.Wires.INHIBIT .

        Just use the maxon.WIres.All() so all wires are removed.

                port.RemoveConnections(maxon.PORT_DIR.OUTPUT, maxon.Wires.All())
        

        Note that you also have this helper function GraphModelHelper.RemoveConnection(srcPort, dstPort) where the input connection of the destination port will be removed if the port is connected with the source port.

        Cheers,
        Manuel

        MAXON SDK Specialist

        MAXON Registered Developer

        1 Reply Last reply Reply Quote 1
        • B
          bentraje
          last edited by

          @Manuel

          Gotcha. Thanks for the clarification. Works as expected.

          1 Reply Last reply Reply Quote 0
          • First post
            Last post