Plugin Cafe Homepage
Forum Home Forum Home > Plugin Cafe > PYTHON Development
  New Posts New Posts
  FAQ FAQ  Forum Search

ID_MODELING_WELD_TOO - Doesn't work [SOLVED]

Author
Message
  Topic Search Topic Search
DayDreamer View Drop Down
Member
Member


Joined: 2017 May 24
Online Status: Offline
Posts: 1
Direct Link To This Post Topic: ID_MODELING_WELD_TOO - Doesn't work [SOLVED]
    Posted: 2017 May 24 at 6:30pm
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!
Back to Top
knickknack View Drop Down
Forum Moderator
Forum Moderator


Joined: 2016 Jul 01
Location: Italy
Online Status: Offline
Posts: 268
Direct Link To This Post Posted: 2017 May 25 at 11:41am
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


Edited by knickknack - 2017 May 25 at 11:42am
MAXON Computer GmbH
SDK Support Team
Back to Top

Forum Jump Forum Permissions View Drop Down

Bulletin Board Software by Web Wiz Forums® version 9.61 [Free Express Edition]
Copyright ©2001-2009 Web Wiz

This page was generated in 0.092 seconds.