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
    • Recent
    • Tags
    • Users
    • Register
    • Login

    Using the Bridge Tool

    Scheduled Pinned Locked Moved Cinema 4D SDK
    python
    4 Posts 2 Posters 25 Views 1 Watching
    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.
    • D Offline
      Dimitris_Derm.
      last edited by

      Hello, I'm trying to use the Bridge Tool with the SendModelingCommand but I'm having trouble as there are attributes I don't know how to use. Could someone explain to me what these are for ?

      MDATA_BRIDGE_ELEMENT1 = 1100, //LONG
      MDATA_BRIDGE_ELEMENT2 = 1101, //LONG
      MDATA_BRIDGE_ELEMENT3 = 1102, //LONG
      MDATA_BRIDGE_ELEMENT4 = 1103, //LONG
      MDATA_BRIDGE_OBJINDEX1 = 1104, //LINK
      MDATA_BRIDGE_OBJINDEX2 = 1105, //LINK
      MDATA_BRIDGE_OBJINDEX3 = 1106, //LINK
      MDATA_BRIDGE_OBJINDEX4 = 1107, //LINK
      MDATA_BRIDGE_DELETE = 1108, //BOOL
      MDATA_BRIDGE_ISO = 1109, //BOOL

      Also, given the type of elements I'm bridging and subsequently the modeling mode in which I will be using the Tool should I look out for specific things like the sequence of edges or points between the two parts to be connected ? Should I be treating Edge Selections like a sequence of point IDs or can I use them with their own IDs ?

      Thank you for your time.

      ferdinandF 1 Reply Last reply Reply Quote 0
      • ferdinandF Offline
        ferdinand @Dimitris_Derm.
        last edited by ferdinand

        Hey @Dimitris_Derm. ,

        Thank you for reaching out to us. The bridge tool in Cinema supports (in point mode) up to four objects as inputs. MDATA_BRIDGE_OBJINDEX1 to MDATA_BRIDGE_OBJINDEX4 are BaseLink parameters where you must link the PolygonObject instances you want to bridge. When you want the common case of bridging within one object, you set the same object for all four slots.

        MDATA_BRIDGE_ELEMENT1 to MDATA_BRIDGE_ELEMENT4 are then the element (e.g. point) indices to bridge (which can be scattered over multiple objects). They will be evaluated in relation to what you have set for the object indices.

        MDATA_BRIDGE_DELETE is "Delete Original Polygons" when you are bridging polygons in polygon mode. MDATA_BRIDGE_ISO seems to be related to SDS isoparms in the viewport, you can probably ignore it.

        // Only use case of MDATA_BRIDGE_ISO in our code base, very likely a dormant parameter.
        Bool BridgeTool::MouseInput(...)
        {
          // ...
          if (bd->GetEditState()& DISPLAYEDITSTATE::SDS)
            data.SetBool(MDATA_BRIDGE_ISO, true);
          else
            data.SetBool(MDATA_BRIDGE_ISO, false);
          // ...
        

        When bridging in edge mode, you likely will have to operate with half-edge indices, as for example described under GetEdgeS. I would personally either go for point or polygon mode bridging, as edges are a virtual construct which can be a pain in the *** to deal with in code.

        Cheers,
        Ferdinand

        MAXON SDK Specialist
        developers.maxon.net

        1 Reply Last reply Reply Quote 0
        • D Offline
          Dimitris_Derm.
          last edited by

          Oh ! we can bridge independent objects ? That simplifies things as I thought I would have to Connect+Delete first and then bridge...
          Thank you for the explanation of the attribute calls.

          1 Reply Last reply Reply Quote 0
          • D Offline
            Dimitris_Derm.
            last edited by

            I'm still having trouble with this.

            I'm trying to bridge polygon selections on a single merged object, but it keeps returning False.

            My setup:

            • Single polygon object (2 cylinders under a Connect, then Connect+Delete)
            • Two polygon selection tags with different names on the merged object
            • Polygon mode (MODELINGCOMMANDMODE_POLYGONSELECTION)

            All settings:

            python  settings[MDATA_BRIDGE_RESTRICT] = True
            settings[MDATA_BRIDGE_OBJINDEX1] = merged_obj
            settings[MDATA_BRIDGE_OBJINDEX2] = merged_obj
            settings[MDATA_BRIDGE_OBJINDEX3] = merged_obj
            settings[MDATA_BRIDGE_OBJINDEX4] = merged_obj
            settings[MDATA_BRIDGE_ELEMENT1] = 48  # First polygon of source selection
            settings[MDATA_BRIDGE_ELEMENT2] = 56  # Last polygon of source selection
            settings[MDATA_BRIDGE_ELEMENT3] = 19  # First polygon of target selection
            settings[MDATA_BRIDGE_ELEMENT4] = 30  # Last polygon of target selection
            //+ subdivision, tension, mode, etc.
            

            The bridge tool returns False. The selections are verified to exist on the object (9 polygons at indices 48-56, and 12 polygons at indices 19-30).

            Questions:

            • Do all MDATA_BRIDGE_OBJINDEX# need to be filled when bridging in polygon mode ?
            • Do I need to apply the selections to the active BaseSelect, or should they only be in tags?
            • Are there other required parameters for polygon mode ?
            • Does RESTRICT=True have any meaning when using the tool programmatically ?
            • If MDATA_BRIDGE_DELETE is "Keep Original Polygons" when bridging polygons then what is the MDATA_BRIDGE_KEEP_POLYGONS ?

            Thanks!

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