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

    ID_MODELING_WELD_TOO - Doesn't work [SOLVED]

    PYTHON Development
    0
    2
    508
    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.
    • H
      Helper
      last edited by

      On 24/05/2017 at 18:30, xxxxxxxx wrote:

      Hello everybody.

      I've been trying to weld some points, using "ID_MODELING_WELD_TOOL"
      I've tried setting various settings from:

      MDATA_WELD_POINT			    				     = 1100, //VECTOR
      MDATA_WELD_TOPOINT                     = 1101, //BOOL
      MDATA_WELD_POINTINDEX                  = 1102, //LONG
      MDATA_WELD_OBJECTINDEX                 = 1103, //LONG
      MDATA_WELD_VISIBLE			               = 1104, //BOOL
      MDATA_WELD_COLLAPSE                    = 1105, //BOOL
      MDATA_WELD_COLLAPSE_P1                 = 1106, //LONG
      MDATA_WELD_COLLAPSE_P2                 = 1107, //LONG
      MDATA_WELD_COLLAPSE_OBJ1               = 1108, //LINK
      MDATA_WELD_COLLAPSE_OBJ2               = 1109, //LINK
      MDATA_WELDPOINT\_
      

      But with no clear understanding what's what, I just wasted 3 hours on trial and error. Where does one assign the points to weld and what does some of those variables mean?

      Thank you!

      1 Reply Last reply Reply Quote 0
      • H
        Helper
        last edited by

        On 25/05/2017 at 11:41, xxxxxxxx wrote:

        Hi DayDreamer, thanks for writing us and welcome to our community.

        With reference to your question on how to use the ID_MODELING_WELD_TOOL via SendModellingCommand, I first recommend you to give a look at SendModelingCommand() in the Python API in order to understand how to properly format the SendModellingCommand call.

        The Weld command in Cinema is supposed to operate with points or edges or polygons previously selected on an editable mesh to collapse the points inferred by the selected entities on a specific location. So far in order to have the SendModelingCommand delivering the expected action you have at least have an editable mesh with two points selected (or an edge or a polygon).

        That said, let's see how the different (and relevant) options change the final welding behaviour

        • MDATA_WELD_TOPOINT : if set to True the welding operation weld all the selected entities on the point specified in MDATA_WELD_POINT or on the point referred by the MDATA_WELD_POINTINDEX
        • MDATA_WELD_POINT : the position where all the entities will be welded if MDATA_WELD_TOPOINT is True
        • MDATA_WELD_POINTINDEX : the index of the point (in the PolygonObject) where all the selected entities will be welded on if MDATA_WELD_TOPOINT is True

        Suppose you have a simple plane made up of for quads (numbers are representing the points indexes)

        1-----5-----2
        |       |       |
        4-----8-----6
        |       |       |
        0-----7-----3

        To weld points 0 and 7 (they are selected before running the script) on point 4:

        ...
            # Create the BaseContainer to define the tool settings
            settings = c4d.BaseContainer()
            
            # Specify the settings
            settings[c4d.MDATA_WELD_TOPOINT] = True     
            settings[c4d.MDATA_WELD_POINTINDEX] = 4
            settings[c4d.MDATA_WELD_OBJECTINDEX] = op
          
            # Execute the SendModelingCommand
            res = utils.SendModelingCommand(command = c4d.ID_MODELING_WELD_TOOL,
                                            list = [op], 
                                            mode = c4d.MODELINGCOMMANDMODE_POINTSELECTION, 
                                            bc = settings, 
                                            doc = doc)
            # Update the scene
            c4d.EventAdd()
        ...
        

        To weld instead the bottom/right polygon (the polygon is selected before running the script) on point (0,100,-100) :

        ...
            # Create the BaseContainer to define the tool settings
            settings = c4d.BaseContainer()  
            
            # Specify the settings
            settings[c4d.MDATA_WELD_POINT] = c4d.Vector(0,100,-100)
            settings[c4d.MDATA_WELD_TOPOINT] = True
            
            # Execute the SendModelingCommand
            res = utils.SendModelingCommand(command = c4d.ID_MODELING_WELD_TOOL,
                                            list = [op], 
                                            mode = c4d.MODELINGCOMMANDMODE_POLYGONSELECTION, 
                                            bc = settings, 
                                            doc = doc)
            # Update the scene
            c4d.EventAdd()
        ...
        

        Finally to weld the two points connecting the edge formed by point 4 & 8 (the edge is selected before running the script) on their middle point:

        ...    
            # Create the BaseContainer to define the tool settings
            settings = c4d.BaseContainer() #nothing needs to be set since by default middle point is considered
          
            # Execute the SendModelingCommand
            res = utils.SendModelingCommand(command = c4d.ID_MODELING_WELD_TOOL,  
                                            list = [op], 
                                            mode = c4d.MODELINGCOMMANDMODE_EDGESELECTION, 
                                            bc = settings,
                                            doc = doc)
            # Update the scene
            c4d.EventAdd()
        ....
        

        I hope this few notes could help you to understand a bit more on how the welding tool can be used and i leave to you diving deeper mixing options and primitives.

        Best, Riccardo

        1 Reply Last reply Reply Quote 0
        • i_mazlovI i_mazlov referenced this topic on
        • First post
          Last post